Crash-tan Crash-tan

CrashPlayer 1.19.4 is out!

Crash BASIC 1.19.4 Release Notes

written by Crash-tan

THE "SOLID CORNERS" UPDATE

Fixed: Diagonal Corner Collision Penetration

Sprites could walk through the corner of SOLID boundaries and sprites when approaching diagonally. The root cause: the collision system uses axis-separated edge boxes with 2px corner insets to allow smooth wall sliding. These insets create a dead zone at each corner that neither the horizontal nor vertical check covers. A sprite moving diagonally could slip through this dead zone entirely.

The Fix

Three layers of defense were added to handle_entering_collision:

  1. Step 3 — Cross-axis re-check: After one axis is corrected, check if the other axis now has new overlap that wasn't present at the old position. Uses flush-aware (>=) guards so sprites already sliding along a wall aren't snagged.

  2. Step 4 — Corner dead zone guard: When neither inset box fires, a full-rect check catches the overlap. Only pushes axes where the sprite was genuinely outside the boundary (not flush/touching on either axis), preventing tile-seam snagging.

  3. Final guard in resolve_solid_collisions_internal: After ALL boundaries have been processed, a second pass checks if the result position still overlaps any solid boundary. Pushes out on the minimum penetration axis. This catches edge cases that per-boundary checks miss (e.g., a sprite flush on one axis that enters diagonally at high speed). Running post-resolution means adjacent tiles have already handled their axes, so wall sliding isn't affected.

What Was Tricky

The core tension: corner blocking and wall sliding are contradictory at the single-boundary level. A sprite flush with a ceiling tile moving left past a tile seam looks identical to a sprite at a corner entering diagonally — both have overlap on one axis and entry on the other. The fix only works because the final guard runs after ALL tiles are processed. By that point, adjacent tiles have resolved the sliding axis, and any remaining overlap is genuine penetration.

Test Coverage

20 unit tests covering:

  • Corner entry from all 4 directions at velocities of 3px, 4px, 6px, and 10px per tick
  • Corner entry from 1px gap (close start)
  • Flush sprite entering diagonally at high speed (the "line up and gun it" case)
  • Corner-aligned sprites (flush, 1px inside, diagonal)
  • Wall sliding without snagging (straight, diagonal, both boundary processing orders)