Week 48: Variable friction, dynamic max-speed, and collinear neighbor surfaces

A recording from Squirrel Away showing new tile-properties (variable friction and max-speed) and collinear surfaces.
Variable friction, max-speed, and grabbability!


tl;dr: I added support for configurable frictions, dynamic max speeds, and collinear neighbor surfaces.


What happened last week?

Highlights

  • Surface properties configured per-tile.
  • Configurable frictions
  • Dynamic max speeds
  • Collinear neighbor surfaces

Laundry list

  • Create a new concept of surface properties:
    • What?
      • These are parameters like friction, max-speed, grabbability, fall-through-ability.
      • These can be configured on a given tile in a tile-set.
    • Update surface-parsing to record surface properties.
    • Refactor how tile-set properties are configured.
  • Configurable frictions:
    • Refactor how surface friction values are stored.
    • Create a tile-set with separate tiles for different surface frictions.
    • Start refactoring how friction is calculated.
      • My old approach didn’t support making it difficult to get up-to-speed when the floor is slippery.
      • It previously only added a force against the direction of motion, which is what causes the character to slow down when not pressing sideways controls.
    • Update stopping-distance calculations to account for new friction logic.
    • Update intra-surface edge and calculator to include counter-acceleration friction.
  • Dynamic max speeds:
    • Fix how intra_surface_edge_speed_multiplier is used.
      • I originally added this very quickly during my last game jam.
      • My original implementation was consequently pretty broken.
      • Now it scales the intra-surface acceleration/velocity (walk, climb, crawl) as well as the max-horizontal-velocity while attached to surfaces.
    • Fix default velocity-cap to account for intra_surface_edge_speed_multiplier.
    • Add a separate max-speed multiplier for in-air.
    • Add more utilities for accessing the current on-surface and in-air max-horizontal-speed values.
    • Start adding support for a speed_multiplier in individual surface properties.
    • Update walk_acceleration to use speed_multiplier.
    • Include surface speed_multiplier in velocity, acceleration, and max-speed calculations.
    • Replace clamp_horizontal_velocity_to_max_default with more specific logic using new distinct-surface and multiplier logic.
    • Fix some bugs from the recent speed-multiplier logic.
  • Collinear neighbor surfaces:
    • Add support for not merging collinear neighbor surfaces.
    • Update WaypointUtils to account for collinear neighbor surfaces.
    • Update climb-to-adjacent-surface edge and calculator logic for collinear neighbors.
    • Add a separate edge weight for collinear neighbor surfaces.
    • Fix a bug with PositionAlongSurface instances referencing a collinear neighbor.
    • Fix surface-annotation drawing for collinear neighbors.
    • Update navigation-state-update logic to account for collinear-neighbor surfaces.
    • Add logic to nudge a contact point along an axially-aligned segment toward the shape center.
      • This is important because Godot will determine that the contact-point is the corner of the character’s collision boundary.
      • This is technically correct (since two collinear and overlapping segments have infinitely many points of intersection), but a centered contact-point is more intuitive and useful.
      • Before fixing this, I was seeing problems with collisions being detected on the wrong collinear neighbor surface.
    • Similarly, add logic to correct which axially-aligned collinear-neighbor surface is used when Godot collision detection returns contact points based on collider corners rather than mid-segment.
      • That is, this corrects which surface is used, and before we were just correcting the point that was used.
    • Update SurfaceParser to remove any single-vertex collinear-neighbor surfaces.
    • Fix an issue with move-to-adjacent-collinear-surface-edges never colliding with the end surface.
  • Miscellaneous:
    • Update intra-surface-edge start-velocities to match previous-edge end-velocities.
    • Fix a bug with check_just_landed_on_expected_surface.
    • Fix a coordinate-typo bug in nudge_point_along_axially_aligned_segment_toward_shape_center.
    • Create a surface_enablement editor icon.
    • Update SurfaceStore filtering to omit surfaces with `can_grab=false` in their properties.
    • Add some new tiles for testing other surface properties.
    • Finish adding support for slow, fast, and disabled tiles.

What's next?

  • A very short week!
  • If I have time, I'll try adding support for referring to categories of characters, rather than individual characters, throughout my frameworks.


🎉 Cheers!


This is a simple icon representing my sabbatical.

Comments