urt-rs / docs /research /QVM_MOVEMENT_LOOP.md
nmarshall's picture
qvm: step state
3bae649
|
Raw History Blame Contribute Delete
7.09 kB
# Game-QVM movement scheduler and output gates
RE-417–419 / F-172–174. [qvm-movement-loop.json](qvm-movement-loop.json) retains the complete linear partition of helper54475 and the entry prefix of child53418 from shipped qagame. Reproduce with `python3 scripts/analyze_qvm_movement_loop.py`; verify with `python3 scripts/test_qvm_movement_loop.py`.
This follows [movement-frame assembly](QVM_MOVEMENT_FRAME.md). All results use bounded synthetic QVM memory. No original executable, native callee, full QVM, collision callback or physics runs. Scheduler requests to child53418 use an explicitly supplied effect: advance player-state time to the requested command time, with no other child effects. Child-prefix and post-loop slices are evaluated separately; helper29913 requests are recorded with omitted effects. Actual child clock behavior and complete composition remain open.
## LOOP-001 — Time gate, cap and substeps (RE-417)
Helper54475 receives the frame pointer. It loads final command time at frame+4 and current time through frame[+0]. Using signed comparisons, a final time below current time exits before the counter/reset stores. If final time exceeds signed32(current+1000), it sets current time to signed32(final-1000).
Accepted paths increment player-state+456 and mask the result with63. They clear frame words +48/+252/+256/+260/+264, even when final time equals current time and no child step is requested.
Until current time equals the captured final time, each iteration computes signed32(final-current), then caps the step at8 when frame+220 is nonzero, or66 when it is zero. It sets frame+4 to signed32(current+step), records child53418(frame), and inspects player-state+12 afterward. Bit8192 forces the frame's signed movement byte at +27 to20 before the next iteration. Child clock progress is supplied by the model, not recovered by executing physics.
Ninety-six fixtures use current time1000 and finals999/1000/1001/1008/1066/1067/2000/2001, fixed flags0/1, counters0/63/0xffffffff and bit8192 off/on. Independent arithmetic checks every substep request/time, cap, counter, reset and later up-byte input. In the supplied-clock model, the 1000-unit capped gap requires at most125 eight-unit steps. Zero delta still increments/reset; backward time retains those fields.
This establishes a bounded scheduler contract under the supplied child effect. It does not establish wraparound legality, behavior when the child fails to advance time, real game-clock units, physics integration or callback side effects. Signed overflow domains and runtime loop termination remain open.
## LOOP-002 — Single-step entry input cleanup (RE-418)
The retained child53418 prefix (53419–53593) stores the incoming frame pointer in global35024032, increments global21232 and clears frame+52/+208/+212. This global counter does not use the outer player-state counter's observed mask63 in the prefix.
It sign-extends forward/right bytes at frame+25/+26 and obtains their absolute values. If either exceeds64, it clears button-word bit16 at frame+20. Absolute64 is retained; absolute65 is not. Byte128 becomes signed-128 and absolute128, so it reaches the large-input path.
Then button bit2 controls a separate branch. When set, the prefix ORs bit524288 into player-state+104, replaces the complete button word with2 and clears all three movement bytes at frame+25/+26/+27. Otherwise it clears player-state flag bit524288 and retains the movement bytes. WALK/TALK-like interpretations are candidates; producer/consumer and configuration evidence is required before assigning semantic names.
324 probes cover all forward/right combinations of bytes0/1/64/65/127/128/191/192/255 with button words0/16/17/18. Independent signed-byte and bit-mask oracles check threshold boundaries, bit2 precedence, exact final buttons/movement, counter/global pointer and reset words. Evaluation stops before subsequent weapon/action/physics branches.
## LOOP-003 — Post-loop flags and event requests (RE-419)
The separate suffix (54637–54979) copies frame+20 to player-state+212, clears player-state+240, then ORs the following observed bits only when player-state+208 >0. It reads the command through global35024032; the fixture explicitly sets that global to the supplied frame.
| Source predicate | Bit ORed into player-state+240 |
| --- | --- |
| Buttons bit16 | 64 |
| Buttons bit256 | 32 |
| Signed up byte negative | 128 |
| Player-state+12 bit8192 | 1 |
| Signed forward byte positive / negative | 2 / 4 |
| Signed right byte negative / positive | 8 / 16 |
Other sampled health-like words leave +240 zero. Flag meanings and their animation/gameplay consumers are not recovered here.
The suffix records helper29913 requests `(event, parameter, player-state pointer)` in this order:
- Nonzero frame+48: event93, parameter frame+48.
- Nonzero frame+252: event21, parameter frame+256.
- Nonzero frame+260: event31, parameter frame+264.
Before the third request it reads `player-state +312 +4*player-state[+144]`, extracts low byte and next byte into locals32/36, and does not pass these two locals as that request's visible arguments. No index bounds check appears in this retained path. This connects the [earlier packed-state lookup evidence](CHAT_ITEMS_TIME.md) to another consumer without declaring valid selector ranges or event semantics.
334 suffix fixtures cover health-like/button/signed-direction combinations and independent event combinations with selectors0/7. Tests predict every output flag, cached button word, event request/ordering and sampled packed-byte result. No event helper effects are applied; these suffix probes are separate from the scheduler's supplied child-clock model.
## Verification and next tasks
Eight independent tests verify backward/equal/capped scheduling, every step/request, resets/counters/up-byte edits, entry threshold/button precedence, post-loop flag arithmetic/cache, event requests/packed lookup, source/boundaries, explicit resume behavior and supplied-child scope. The evaluator adds an optional resume address within the declared bounded slice, retaining synthetic locals across stopped-call continuations. Invalid resume addresses fail; default behavior for existing scripts is unchanged.
RE-416 remains open for full consumers/physics/runtime work. RE-420 must trace the child53418 clock update and remaining state/weapon/physics branches, real callback/frame mutations and nonprogressing/overflow scheduling domains; confirm input/flag/event meanings and packed selector bounds; recover helper29913 effects; compose actual frame-to-step-to-output behavior and validate gameplay/macOS/Linux before Rust/Bevy/Solari compatibility claims. Native packet and entity/player/snapshot/rendering milestones also remain open.
Follow-up: [child clock and dispatch](QVM_STEP_STATE.md) composes the decoded child clock prefix into selected scheduler fixtures and recovers nearby flag/early-dispatch gates. The original report retains its explicitly supplied-clock default; full child physics and runtime effects remain open.