Week 20: Navigation to in-air destinations

An animated GIF of a recording from Squirrel Away, showing a bug where the cat would jump up to an in-air destination, then fall back down and repeat, endlessly, because I didn't have logic to detect the edge-end condition for in-air destinations.
I added support for in-air destinations!
This shows a brief fun bug I had, before I'd added logic to detect when the player had actually reached the destination for an in-air target.


tl;dr: I added support for navigating to in-air destinations when the click point is too far from a surface, and I added some small improvements to navigation preselection annotations.


What happened last week?

Highlights

  • I added support for navigating to in-air destinations when the click point is too far from a surface.
  • I added some small improvements to navigation preselection annotations.
    • I make the player position/animation-frame prediction more faint when it is further in the future and less likely to be accurate.
    • I make the player position/animation-frame prediction face the correct left/right direction more accurately.
    • I show an exclamation mark over the player's head when starting a new navigation.

Laundry list

  • Fix some small issues with edge trajectory and duration calculations.
  • Fix some issues with checkbox scaling.
  • Create a new data structure for storing the selection position as well as its nearby surface position and navigation destination.
  • Remove some obsolete edge types, in preparation for supporting in-air destinations.
  • Fix some small bugs relating to edge trajectory calculations.
  • Start debugging an issue relating to an empty jump trajectory from a false-positive collision result.
  • Add support for considering alternate possible collision state when colliding with an unexpected (highly oblique) surface normal.
  • Compared performance with and without my new logic to consider alternate collision points.
    • I actually saw a few less valid edges being returned when this new check is enabled, which is definitely not what should be the case.
    • I should debug that later...
  • Add special handling for edge calculations that end with a valid collision much earlier than anticipated.
    • Require a min number of frames. If less than min, reject the edge.
  • Update duration when edge calculation ends with collision with expected surface.
  • Add support for in-air destinations.
    • New annotations.
    • New edge calculations.
    • New navigation logic.
  • Re-name edges and calculators to no-longer imply they must end along a surface.
  • Update navigator to re-use selection-nearby-position-along-surface info in addition to the standard destination target point.
  • Update size and cone-count of in-air destination indicator.
  • Move path calculation and storage to PointerSelectionPosition.
  • Calculate alternate jump-off points for in-air destinations, using nearby surfaces of a different side type, when the initial nearest-surface-attempt fails.
    • The reason this was useful is because I have a scenario where I want to jump to an in-air position that is near the ceiling. I want to jump from a floor that is beneath this position. But, the closest position-along-a-surface is along a nearby wall, and jumping from that wall would cause the player to bonk their head on the ceiling, and then fall-short of the in-air target.
    • However, this ended up not working out, since it can be the case that, even though I know I want to jump from a floor instead of a wall, the closest floor could actually be near-the-ceiling-and-to-the-side-of the target, or it could even be above the target, and either of these jump-off positions would be invalid.
    • So I found another heuristic to use instead...
  • Calculate the top-n closest jump-off points for in-air destinations, so that we can just use the closest that yields a valid surface-to-air edge.
  • Add support for detecting edge-complete with in-air destinations.
  • Fix Navigator to update paths for stale selections.
  • Add path-optimization for in-air destinations, which could eliminate whole edges from the path.
  • Add a flag for also optimizing paths during preselection.
  • Fix bug with level-select screen still responding to keyboard events when closed.
  • Show an exclamation mark when a player starts a new navigation.
  • Render the player prediction ghost as faint and yellow when there is less confidence.
  • Update player predictions to base player-facing-direction off of the actual edge instructions rather than just velocity.
  • Fix issue with climb-down-wall-to-floor-edges cancelling navigation early when reaching the floor.
  • Start adding support for auto-zooming and panning the camera out when the user is trying to navigate close to the edge of the game region (and back in if not).

What's next?

  • Finish adding support for auto-zooming and panning the camera out when the user is trying to navigate close to the edge of the game region (and back in if not).


🎉 Cheers!


This is a simple icon representing my sabbatical.

Comments