Week 21: Tracking music beats along navigation paths and automatic camera pan and zoom

An animated GIF of a Squirrel Away recording showing the new music beat indicators, and camera pan and zoom!
Music beat indicators, and camera pan and zoom!


tl;dr: I added logic for tracking music beats and annotating them along navigation paths, and automatic camera pan and zoom when dragging near the screen edges.


What happened last week?

Highlights

  • Add automatic camera pan+zoom when the user is dragging near the edges of the screen during navigation preselection.
    • This makes it a lot easier to see things and navigate in the level!
  • Add music beat tracking and draw hash marks along navigation paths to show where the player will be on the beats.
    • I've toyed with the idea of some sort of rhythm or timing based gameplay a lot before, and I think it should be pretty easy to use my Surfacer tool for this.
    • This feature I've added now just shows future player positions relative to the music beats, but I can use very similar logic to track the timing of other significant events. 
    • It should even be easy for me to modify the timing of the player's trajectory in order to coincide with other significant events.

Laundry list

  • Finish implementing camera pan and zoom during navigation preselection.
    • This involves auto-zooming and panning the camera out when the user is dragging close to the edge of the game region.
    • Implement the main logic for calculating pan and zoom amounts per frame depending on the drag position.
    • Fix an issue with my camera bounds calculations.
    • Fix camera pan/zoom to use set_interval instead of throttle, so the camera continues to move even when the pointer hasn't moved.
    • Adjust camera pan/zoom control parameters.
    • Fix a bug affecting the duration of the camera pan/zoom control. The new tween applied at each interval was starting from the current value and should have been starting from the previous target value.
  • Fix a bug relating to selection-nearby-positions-along-surfaces sometimes being too close to concave neighbor surfaces, which could lead to very broken paths into walls.
  • Add sound effects for slow-motion start/end and navigation selection success/fail.
  • Add a utility function for prepending a second array onto the front of a first array.
  • Add logic for encoding the tempo and meter of each piece of music.
  • Add logic for playing a sort of tick-tock background track during slow-motion mode, and align the tick-tocks to the beat of the background music that has been slowed.
  • Add logic for rendering hash marks along navigation path annotations during slow-motion-mode, and align the hash marks with where the player would be on the beats of the background music.
    • Add logic to track the current music beat state during each frame.
    • Add logic to draw hash marks along navigator trajectories to indicate where the player will be during the beats of the music.
  • Rename "Handler" classes to "Controller" and "Listener".
  • Update the player-recent-movement-annotator to show where beats occur during player movement.
  • Offset beat hashes in annotations by the path start time.

What's next?

  • Smooth-out some remaining kinks with my new beat annotations.
    • It looks like my beat predictions are offset very slightly from where they should be.
    • I need to update the path trajectory beats to account for any extra time scaling that is in effect.
  • Smooth-out some other small issues with navigation start/end state possibly being off by a frame from what is expected.


🎉 Cheers!


This is a simple icon representing my sabbatical.

Comments