Files
Neutron/docs/analysis/air-steering.md
T

102 lines
5.9 KiB
Markdown

# Corrected airborne keyboard input
User testing exposed an error in the earlier reconstruction: Jimmy could rise
with the jet pack but could not begin moving/turning in the air. This report
supersedes the no-air-steering claim in the original movement checkpoint.
Read-only Neutron.exe addresses are VAs; text file offsets are VA-0x400000.
## Dispatch error and recovered handler
The signed mode at interface+704 (complete+7C4) selects jump table438BA4:
mode0->438B31, mode1->438B60, mode2->438B6D, mode3->438B82. Mode1 logs at
438B60, removes its printf argument at438B6A, then **falls through** to438B6D.
438B76 calls complete-object virtual128, whose Jimmy vtable4A3BDC entry is439900.
It does not return after logging. The earlier report incorrectly read that
control flow and a regression test encoded the error. Both have been corrected.
Normal jump/jetpack movement uses mode1 and the following keyboard subset of
439900. Special movement mode2 (distinct from gadget selection) shares the input
handler but has extra turn/pose/camera behavior; that full mode is not implemented.
| Input/rule | Source | Implemented arithmetic |
| --- | --- | --- |
| Left before Right |439943/439966|Left precedence; adjust turn rate by+100*dt or-100*dt|
| Release keyboard turn |439989..439A19|Move prior turn rate toward0 by100*dt, clamp crossing|
| Normal air turn limit |439D81..439DB7|Clamp rate to[-30,+30] degrees/sec|
| Up |439AE6..439B69|Add source30 speed per call, cap600|
| Coast |439B69..439BA2|If speed>600*0.909090936, subtract35*.5; otherwise retain|
| Down with positive speed |439C1D..439C78|Subtract35*.5, clamp at0|
| Down with negative speed |439C7A..439CB2|Add35 toward0, clamp crossing|
Forward acceleration precedes braking when Up/Down are both held. Turn alone
does not use ground acceleration. At normal maximum600, release coasts down
600->582.5->565->547.5->530 and retains530 until another input/ground phase.
Down brakes, rather than starting reverse air movement. These are source rules,
not a replacement walking controller enabled wholesale in the air.
## Velocity and integration
Air apply437F90 preserves vertical velocity, adds turnRate*dt to current yaw
at438011..43802B, and calculates lateral velocity at43803B..438062 as:
```
sideSpeed = turnRate * (1-friction) * speed * float(1/55)
velocityXZ = forward(yaw)*speed + right(yaw)*sideSpeed
```
Source friction is0.8. Air sideSpeed lacks the additional ground dt factor;
ground437CDx uses (turnRate*(1-friction)*speed/45+keyboardSide)*dt instead.
Correction:437B9E..437BAC clears the shared turn field on grounded/released
input. Its receiver is the game interface, so interface+614 is complete+6D4.
The port now clears it at this boundary and on scene reset. Air input's destination yaw is current yaw (439E2B), so the ground
keyboard target offset does not override its direct yaw update.
AirSteering.cs translates this keyboard subset. LabSimulation calls it while
airborne, including before burst activation and after release. The
existing jetpack vertical state/effect/energy behavior remains a separate phase.
Full original input/update/rotation phase order, mouse/analog, pitch/roll/lean,
special flight mode2, collision response and camera are still incomplete. Current
integration is yaw-only at fixed60Hz with the provisional collision capsule.
## Verification
-2 Python source tests guard all four dispatch-table entries, mode1 fall-through,
vtable128 and decisive keyboard/constants/air-lateral instruction sites.
-16 movement groups pass, replacing the invalid no-air-steering fixture with
ordinary-jump response, exact keyboard arithmetic, powered takeoff-from-rest
steering/braking, left/right paths and60/120/144Hz equivalent replay.
-14 vertical jetpack groups remain passing. Input-only lab navigation still
reachesSCENE60, score150, owned jet pack and the original outside LOAD.
-The upgraded VR04 smoke starts vertically, presses Up/Left/Down during active
flight, releases the burst and lands. Headless llvmpipe renders300 frames:
powered horizontal travel403.88, one burst/landing, maximum rise418.98,
zero Vulkan validation errors. It requires actual powered horizontal travel
and nonzero turn rate, so the previous frozen-air implementation fails it.
-Window mode injects all four Up/Left/Down/Shift keys through SDL, runs300 frames
and resizes800x600. Package/runtime results are recorded in compatibility.md.
These are static and port runtime regressions; original gameplay comparison and
native Windows verification remain distinct. Original assets remain unchanged.
Final package checks: Linux self-contained GTX1070 and Windows self-contained
under isolated Wine64 both receive the full SDL input sequence, resize and finish
with identical403.88 powered travel and grounded position. Linux reports zero
validation errors; Wine validation is disabled. Logs: artifacts/package-jetpack-steering.log
and artifacts/windows-jetpack-steering-package/wine.log. Native Windows remains
unverified by the agent. All539 original hashes still match.
## Ground-turn cancellation correction
User feedback after the first air-input fix identified intermittent slow turning
with all jump buttons. The previous integration incorrectly retained TurnRate
on the ground: an air turn of-30 could cancel most of the opposing+37deg/sec
walking turn. The original outer reset437B9E..437BAC clears jump state, mode and
interface+614 (complete+6D4). The port now performs that grounded/released-jump
reset before ground steering. A17th movement group reproduces opposing air turns
landing into left/right ground input and requires the full source turn rate.
A third source-byte regression guards all20 reset bytes and pointer displacement.
All five SDL bindings (left/right Shift, Insert, keypad0, right mouse) also pass
identical300-frame powered steering replays, each403.88 travel. No button-specific
turn multiplier is introduced. Original global update phase order remains open.