Week 17: Improved trajectory calculations in Surfacer

A screenshot from Squirrel Away showing a movement trajectory that includes falling off of a floor platform.
Nice round corners around edges!


tl;dr: I improved some trajectory calculations in Surfacer.


What happened last week?

Highlights

  • Finished the Ludum Dare 48 game jam and fixed a couple of its bugs.
  • Resumed work on Surfacer:
    • Updated fall-from-floor and climb-over-wall edges to include rounded trajectories around the corner, which correspond to the player’s collider shape.
    • Added support for moving along edges by updating the player's position to match what is expected from the edge calculations, rather than by executing input instructions (e.g. "move_left", "move_right", "jump") and letting Godot's physics and collision system handle the movement.

Laundry list

  • Ludum Dare:
    • Finished the Ludum Dare 48 game jam on Monday.
    • Fixed some bugs in our game-jam submission on Tuesday.
    • Played through and rated some other Ludum Dare submissions.
      • They use a rating system that gets more eyes on your game as you rate more of other folks' games.
      • Also, it's a lot of fun to see how other people interpreted the theme.
  • Surfacer:
    • Fixed a bug when ctrl+clicking to inspect edge calculations.
    • Moved some logic out into a separate PositionAlongSurfaceFactory class.
    • Added a DebugLevel class for debugging Surfacer platform-graph logic without needing to add a bunch of conditional checks to disable Squirrel Away logic.
    • Fixed annotation and tooltip fonts (size and color).
    • Added support for fall-from-floor edges that don’t include extra distance to account for horizontal movement.
    • Updated fall-from-floor edges to include rounded trajectories that correspond to the player’s collider shape.
      • Previously, I was just calculating sharp corners in these trajectories.
A screenshot from Squirrel Away showing a movement trajectory that includes falling off of a floor platform.
Before fixing corner trajectories:
A sharp displacement from the on-top-of-floor position to the offset-from-the-top-point-of-the-wall position

A screenshot from Squirrel Away showing a movement trajectory that includes falling off of a floor platform.
After fixing corner trajectories:
Considering the offset from a "capsule" (roundish) collider shape.
As the player rounds the corner, they slide downwards slightly until falling off entirely.

A screenshot from Squirrel Away showing a movement trajectory that includes falling off of a floor platform.
After fixing corner trajectories:
Considering the offset from a rectangle collider shape.
As the player rounds the corner, they stay at the same height until falling off entirely.
    • Updated climb-over-wall edges to include rounded trajectories that correspond to the player’s collider shape.
    • Fixed an issue with the PositionAlongSurface target not preserving the perpendicular distance from the surface when calculating positions for fall-from-floor fall-off points.
    • Fixed a bug with the initial portion of FallFromFloorEdges being really slow.
    • Removed a redundant fall-from-floor land position
    • Removed some redundant state from JSON edge encodings.
    • Refactored the logic for forcing player runtime trajectory position/velocity to match that expected from edge calculations to instead query the edge class for these values.
    • Implemented logic to get trajectory state from edges that wouldn’t have precalculated it before (IntraSurfaceEdge, WalkToAscendWallFromFloorEdge, ClimbDownWallToFloorEdge).

What's next?

  • Now that I have support for fully controlling the player's according to pre-calculated trajectory info, I need to actually disable Godot's underlying collision and physics system (which should improve run-time performance slightly).
  • Then I'm going to start working on some fancy features for making it easier to precisely control where the player's moving:
    • Add a slow-down effect when the mouse is down and the trajectory preview is shown.
    • Render the computer players' expected future positions at the time the human player would reach the each of the trajectory preview.


🎉 Cheers!

This is a simple icon representing my sabbatical.

Comments