File size: 7,986 Bytes
42b012c 7704420 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | # Game-QVM resource update, caller arguments and consumer bridges
RE-453–455 / F-199–201. [qvm-resource.json](qvm-resource.json) retains complete shipped qagame helper39595, two selected caller slices,856 resource probes,14 caller probes and16 scalar consumer bridges. Reproduce with `python3 scripts/analyze_qvm_resource.py`; verify with `python3 scripts/test_qvm_resource.py`.
This follows [command scaling](QVM_ACCELERATION.md) and [posture](QVM_POSTURE.md), both of which consume player-state+184. The numeric update policy is recovered through bounded synthetic instruction evaluation. No original executable, complete QVM, native sqrt, collision, physics or renderer executes. Configuration, command bytes, PS fields, array words and time are supplied. Resource/health/item/type/flag names and legal domains remain provisional. Caller and consumer bridges do not establish complete shared-state simulation or real movement ordering.
## RESOURCE-001 — Reset, bypass and drain policy (RE-453)
Helper39595 receives one binary32 argument, called `s` below. It uses global35024032 to reach the movement frame and PS pointer. Global34065924 is a signed configuration word; global35023932 is a supplied integer timestep `dt`.
Priority starts with:
1. If configuration >=2, write resource PS+184 = PS+208 ×300 with QVM integer arithmetic, then return. The counter at PS+224 and other resource paths are skipped.
2. Otherwise clamp a negative starting resource to zero.
3. If frame+244 is nonzero, return after that initial clamp; leave the counter unchanged.
Normal processing defines an input gate: frame button word+20 includes256, signed right byte+26 equals0, and signed forward byte+25 is strictly greater than80. The drain branch requires that gate, no PS+12 bits in mask3, and `s` strictly greater than221.
On drain, the helper caps its **local argument copy** to340, then subtracts220. Each subsequent float operation rounds to binary32:
`drop = (((min(s,340) - 220) * C1) * 7.5) * float(dt)`
Here `C1` is the exact word1008095194 (approximately0.00917431153). It scans16 words starting at PS+376, comparing each low byte against17. A match multiplies drop by the binary32 word1063675494 (approximately0.9); otherwise it multiplies by0.5. The scan short-circuits at a match. A17 in slot16, just beyond those16 words, is ignored in the fixtures; nonzero high bytes do not prevent a low-byte match.
It converts the current resource integer to binary32, subtracts drop, truncates toward zero to signed integer, then clamps a negative result to zero. This branch has **no health-derived upper cap**: an initially oversized40000 resource can remain above30000 after drain. This is a branch policy observation, not a claim that the runtime admits oversized resource values. The local `s` rewrite does not mutate the caller's by-value argument.
Probes cover exact220/221, just above221,300/340/400; flag masks; item matches in slots0/15 versus excluded16; zero/nonzero timestep; signed command bytes; and reset/bypass ordering. Full source instructions and exact constant words are retained in the JSON.
## RESOURCE-002 — Recovery, replacement debit and counter (RE-454)
If drain conditions fail, the default signed change is:
`change = ((1 - s * C2) * 6) * float(dt)`
`C2` is exact word997735952 (approximately0.00378787890). Operations round individually to binary32. If the input gate holds, `s >105`, and PS+12 has no bits in mask12, the helper **replaces** that change with:
`change = (float(dt) * 0.125) * C3`
`C3` is exact word3255128556 (approximately-33.3300018). It adds change to the float-converted resource and truncates to integer, then applies an upper cap of PS+208 ×300. Unlike drain, this branch does not apply a final zero floor. With suitable supplied flags/input/speed and initially zero resource, it can store a negative value. The next ordinary invocation would perform the initial negative clamp before further processing; this report does not compose consecutive full frames. Even default recovery can be a debit at sufficiently high supplied `s`.
After either normal branch, zero local `s` clears counter PS+224. Nonzero local `s` adds integer `dt` to that counter and caps values strictly above1700 to1700. Early reset/bypass paths skip this work. Drain's locally capped/subtracted argument is the value tested here. These finite fixtures use small nonnegative timesteps and bounded counters; overflow/negative/exceptional domains and live timestep/configuration producers remain unresolved.
The856 probes include threshold105/just above105,80/81 forward, signed negative movement bytes, masks2/3/8/12, resource below zero/zero/near cap/above cap, and counter0/1699/1700/1800. Independent binary32 formulas verify every resulting resource, local argument/change word, counter, path, unchanged array and canary.
## RESOURCE-003 — Caller arguments and resource consumers (RE-455)
Two caller boundaries are evaluated separately:
| Caller slice | Argument passed to39595 | Explicit omitted inputs/effects |
| --- | --- | --- |
| Helper55465 tail56161–56211 | Supplied sqrt return for rounded VX²+VY²+VZ² | Earlier mode helpers/collision/velocity setup; native sqrt |
| Helper43626 slice45083–45142 | Retained local+60 scalar, after multiplying each supplied starting velocity component by that scalar | Producer of retained local scalar, preceding normalization and other mode work |
Five measured probes include zero, horizontal220, vertical-only300,180/240 and1/2/2 vectors. They establish that this tail requests a full3D norm, rather than the horizontal norm used by posture. Nine retained-scalar probes combine three supplied vectors with scalar0/220/340, checking exact rounded rescaling and unchanged scalar handoff. Each recorded argument is passed to the recovered resource helper in a separate synthetic frame with explicitly supplied remaining resource inputs. Those fixtures do not claim that a complete mode's state has been preserved.
Sixteen additional bridges transfer evaluated resource into the earlier command-scale helper and posture helper, then transfer posture's resource output into command scaling again. They use speed0/220/300/340, flags0/1, resource0/11 and matching supplied forward81/right0/button256. Independent prior posture/scale oracles check every transferred value and result. This connects the new producer to the earlier strict resource>10 speed policy and potential3000 crouch-entry charge, but does not establish that those operations occur in this order during a real step. Full frame/state/collision composition is still open.
## Validation and next tasks
Eight tests independently check all856 resource results and immutable words, reset/bypass priority, strict drain thresholds/cap/low-byte inventory scan, recovery negative values and upper-cap asymmetry, zero/1700 counter policy,14 caller arguments/velocity updates,16 resource/posture/scale bridges, source/constants/partitions and explicit scope. Direct posture/acceleration dependencies regenerate unchanged; the new report reproduces twice byte-identically. Full-suite/storage/link/whitespace outcomes are recorded in the research ledger.
RE-444/448/452 retain native collision, animation/contact and broad state work. RE-456 tracks semantic/configuration/health/resource/array/counter/timestep producers and legal domains; retained-scalar producer, actual native sqrt and complete caller effects; consecutive-frame resource behavior, exceptional/overflow/alias cases, real movement ordering/full state composition and gameplay/macOS/Linux/Rust/Bevy/Solari compatibility. Packet/entity/player/snapshot/rendering milestones remain open.
Follow-up: [flagged55465 movement](QVM_FLAGGED_MODE.md) evaluates the relevant40966 entry impulse/command-byte effects, bit16 bypass, ordinary wish/inline clip/slide and measured resource at the actual main branch. Other bodies/native/combined/full runtime scope remains open.
|