Week 35: Bug fixes and polish for behaviors and surface-state updates

An animated GIF of a recording from Squirrel Away showing various different character behaviors: climb-adjacent-surfaces, move-back-and-forth, and wander.
Some different character behaviors:
move-back-and-forth, climb-adjacent-surafces, wander (with bounciness)

tl;dr: I fixed a lot of bugs and added a lot of polish for behaviors, surface-state updates, character annotations, and character logs.

What happened last week?


  • Finishing touches for surface-state updates and climbing adjacent surfaces.
  • Finishing touches for character-behavior features.
  • Improvements to make character logs more useful.
  • Improvements to make character annotations more useful.

Laundry list

  • Surface state and climbing adjacent surfaces:
    • Remove SurfaceNavigator.actions_might_be_dirty flag.
      • This was originally added in order to update surface-state and current input actions mid frame.
      • The supposed benefit of this would be that later logic in the frame could make more up-to-date decisions.
      • However, this definitely causes a lot of bugs, and doesn't seem to really improve things much.
    • Add support for not implicitly ending instruction-playback when the last input is expected to be done.
      • I was seeing some intra-surface edges ending early, before a collision with the next surface had been triggered.
    • Fix a bug with ClimbToNeighborSurfaceEdge playback being detected as complete before it actually was.
    • Fix an issue with rounding-corner actions failing when executing on the frame that the character is finishing the rounding-corner movement.
    • Update surface-default action handlers to force the player position to maintain cling distance.
    • Fix a bug with character action-event-tracking not detecting action releases.
    • Fix a bug with surface-state grabs being released during the frame just after transitioning over to the next surface when rounding a corner.
    • Fix a small run-time trajectory bug with the action-handlers for movement around corners.
    • Fix support for climbing around with just the grab button.
    • Remove SurfaceState.release_(wall|ceiling), which were causing problems with surface updates mid-frame.
    • Encode the correct velocity start/end values in ClimbToNeighborSurfaceEdges.
      • This fixes a bug with surface-contact transitions not triggering correctly.
    • Rename "neighbor" surface to "adjacent" surface.
    • Account for max horizontal speed in climb-to-adjacent-surface calculations.
    • Fix a surface-state bug with inconsistent touch and grab state.
  • Behaviors:
    • Finish ClimbAdjacentSurfacesBehavior.
    • Add support in get_intersection_of_segment_and_circle for accessing the second intersection point.
      • This is useful for detecting where the maximum distance away from a given point aligns with a given surface.
      • Behaviors use this in order to limit the character movement to a given radius.
    • Update behaviors to not pause between movement, if the delay is configured as zero.
    • Update Behavior._move() to return an enum rather than a bool to represent the result type.
    • Update Behavior to support a standard move_target reference, and to check for when it is destroyed.
    • Support excluding surfaces that are too far from a basis point that is separate from the target point in SurfaceParser.get_closest_surfaces.
      • This is useful for Behaviors, because a Behavior can be configured to keep the character within a given radius from their start position.
      • So we then need to be able to navigate the character to a position near some given target, but also not too far from the given start position.
    • Add support for anticipates_target_path, anticipates_target_edge, and recomputes_nav_on_target_edge_change in CollideBehavior and RunAwayBehavior.
    • Add support for leaving the starting surface in MoveBackAndForthBehavior.
    • Distinguish between Behavior start-positions from the latest move call vs the latest activate call.
    • Fix a bug with the max-distance threshold in the move-back-and-forth behavior.
    • Add support for optionally projecting Behavior overrides into a character's SpawnPosition node.
    • Update Behaviors to abort when navigation fails.
  • Logs:
    • Update various character log events to not be considered low-level, so it's easier to enable them to actually print.
    • Refactor character event logging.
      • Make it easier to quickly configure log types for debugging.
      • Make log formats more standard and easier to scan quickly.
  • Annotations:
    • Fix bug with opacity and the circular-buffer index in the recent-movement annotator.
    • Update character annotators to use character-specific colors.
    • Update CharacterSurfaceAnnotator surfaces to not be drawn my SurfacesAnnotator.
    • Hide character prediction when character-sprite-annotator is disabled.
    • Tweak character surface annotator colors.
    • Fix ruler annotator opacity and label positions.
  • Miscellaneous:
    • Fix bug with initial-surface attachment for non-floor surfaces.
    • Fix a path NPE.
    • Fix a bug with bouncify_path leaving gaps when a jump-edge can't be calculated for a given sub-region.
    • Fix a rare bug with horizontal motion calculations.
    • Fix beat tracking.
    • Update Momma Duck for latest framework changes.
    • Fix a bug with trying to add jumps to non-floor start/end surfaces.

What's next?

  • Update navigator-calculate-land-position logic to be able to preserve slow-rise gravity (by still "holding the jump button").
    • The character-navigator system supports recalculating a new navigation while in the middle of executing a previous navigation.
    • However, if the character is in the ascent-part of a jump, with the jump-button-press emulation still active, then the navigator-system currently doesn't preserve this jump-button state—that is, it tries to calculate a new land trajectory that uses only fast-fall gravity, with no remaining slow-rise gravity.
      • While holding the jump button and ascending, a smaller gravity value is applied, and the character moves more slowly.
      • Then after releasing the jump button or starting descent, a larger gravity value is applied, and the character moves more quickly.
      • This makes jumps feel a lot more satisfying for the player.
    • This is critical for fixing a handful of navigation failure/interruption issues.
  • Add support for fall-through floors and walk-through walls.
    • These are the kinds of surfaces that you can either stop on or pass through, depending on what buttons you're pressing.
    • A lot of platformers have thin platforms like this.
    • You can usually always jump from below.
  • More assorted bug fixes and polish work from my current backlog.

🎉 Cheers!

This is a simple icon representing my sabbatical.