XSharp

X2 ceiling contact after a lateral wall kick

The continuous Gap Jumps.bk2 comparison matches X/Y/VX/VY through frame 162 after the ceiling correction. parity/gap-jumps-ceiling.json records a 500-input run and a successful 20-update save-state replay from ceiling-contact frame 159. Ladder acquisition is the next divergence, at frame 163. The entire movie is not yet equivalent.

Original evidence

The same unmodified X2 USA ROM, movie and BizHawk 2.11/BSNESv115+ core used for the preceding milestones were traced on frames 158–164. parity/gap-first-ceiling-writes.csv records player/contact writes; its accompanying source JSON identifies the movie, reference and instruction bytes.

On frame 159 the original first integrates both axes. Y becomes 015A.B1 and VX/VY retain the wall-kick speeds -0375/0513 (original VY is positive up). The new horizontal position places the head under a ledge. $08:D0DE..D0EC computes an eight-pixel downward integer correction, producing Y 0162.B1 without modifying its fractional byte. $08:D036 records ceiling bit 08. The controller still remains in wall kick $10/04 for that completed frame.

On 160 the controller changes to falling $08/00, without displacement or changes to stored speed. On 161 it initializes falling, clears VX and applies downward gravity 0040, producing Y 0162.F1. Resolving the ceiling during the vertical sweep at the old X misses this corner penetration; clearing wall-kick speeds during the collision callback also skips the original controller transition.

Engine policy

DeferWorldCeilingContact is enabled only in the X2 preset. After ordinary axis sweeps, the player checks for remaining world-block penetration along its head and applies a bounded integer pushout, preserving the new fraction. Ladder tops and slopes are excluded from this ceiling correction. Sprite’s existing serialized ceiling latch records actual resolution; adjacency alone does not acquire contact. The next controller update preserves stored speed while switching to falling, and the following update initializes the fall.

The persistent phase uses the existing contact latch and player state. The transition-motion flag is consumed within the same tick, with no added serialized fields. The device-free regression reproduces the source wall kick and checks every X/Y/VX/VY observation through frame 161. The native save replay checks the pending-contact state and 20 following production-engine updates. Legacy/X1/X3 retain their previous ceiling policy.

This does not certify slope, actor-platform or every ceiling configuration. Further geometry and ladder regressions must accompany subsequent changes. See wall-slide timing for the preceding prefix and original capture provenance.

Inclusive boundary at the later ceiling

A read-only instruction capture at movie frame 2002 confirms $08:CB6F samples the integer head coordinate and stores (sampleY & 15) + 1; $08:D0DE computes 17 - that value. For the last solid pixel, the correction is exactly one pixel. Y changes from 00E1.1D to 00E2.1D, preserving VX/VY; frame 2003 changes to falling without moving, and 2004 initializes downward gravity.

The terrain query now converts the native head sample using WORLD_OFFSET before computing pushout. The distance from this converted sample already includes the boundary pixel, so no extra pixel is added afterward. This also preserves the earlier eight-pixel corner pushout at frame 159. The new device-free regression first reproduced the frame-2002 failure, then passed all 21 recorded states; all 99 ladder/collision regressions pass together. Full replay validation remains separate.

parity/gap-late-ceiling-writes.csv and its source metadata retain the independent original-game evidence.