nmarshall commited on
Commit
bbf9a55
·
1 Parent(s): d376de0

qvm: walking speed policy

Browse files
docs/ASSET_PIPELINE_TODO.md CHANGED
@@ -364,3 +364,6 @@ Research progress: RE-555 [report](research/QVM_SWIM_MODE.md); remaining native/
364
 
365
 
366
  Research progress: RE-556 [report](research/QVM_WALK_WISH.md); remaining native/content/runtime/platform scope stays open.
 
 
 
 
364
 
365
 
366
  Research progress: RE-556 [report](research/QVM_WALK_WISH.md); remaining native/content/runtime/platform scope stays open.
367
+
368
+
369
+ Research progress: RE-557 [report](research/QVM_WALK_POLICY.md); remaining native/content/runtime/platform scope stays open.
docs/FINDINGS.md CHANGED
@@ -722,3 +722,6 @@ Bounded qagame paths recover bomb-plant/inactivity correction requests, direct f
722
 
723
 
724
  **RE-556 — Recover ordinary walking direction and slope wish producer:** Walking friction and copied-command scaling precede actual40679, flattening and clipping each live basis vector against the ground normal, normalizing them and building a three-axis slope-aligned wish. [Evidence](research/QVM_WALK_WISH.md).
 
 
 
 
722
 
723
 
724
  **RE-556 — Recover ordinary walking direction and slope wish producer:** Walking friction and copied-command scaling precede actual40679, flattening and clipping each live basis vector against the ground normal, normalizing them and building a three-axis slope-aligned wish. [Evidence](research/QVM_WALK_WISH.md).
725
+
726
+
727
+ **RE-557 — Recover walking speed policy acceleration projection and resource:** Walking applies flag/state/resource/water caps then a timed state128 override, selects acceleration from surface/flags/speed, performs two normalized plane projections and passes saved pre-projection speed into39595. [Evidence](research/QVM_WALK_POLICY.md).
docs/PROVISIONAL_TODO.md CHANGED
@@ -676,3 +676,6 @@ Research progress: RE-555 [report](research/QVM_SWIM_MODE.md); remaining native/
676
 
677
 
678
  Research progress: RE-556 [report](research/QVM_WALK_WISH.md); remaining native/content/runtime/platform scope stays open.
 
 
 
 
676
 
677
 
678
  Research progress: RE-556 [report](research/QVM_WALK_WISH.md); remaining native/content/runtime/platform scope stays open.
679
+
680
+
681
+ Research progress: RE-557 [report](research/QVM_WALK_POLICY.md); remaining native/content/runtime/platform scope stays open.
docs/RESEARCH_LEDGER.md CHANGED
@@ -482,3 +482,8 @@ Ordinary swimming uses idle Z−60 or scaled three-axis wish, caps speed by PS52
482
  ## 2026-10-19 — RE-556 Recover ordinary walking direction and slope wish producer (separate task commit)
483
 
484
  Walking friction and copied-command scaling precede actual40679, flattening and clipping each live basis vector against the ground normal, normalizing them and building a three-axis slope-aligned wish. 16 command/normal/prior-direction fixtures and four independent tests validate exact clip/normalize arithmetic, raw wish/root, classifier temporal order and copied pointer. Full suite: 751 tests pass. Report regenerates byte-identically (116042 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.
 
 
 
 
 
 
482
  ## 2026-10-19 — RE-556 Recover ordinary walking direction and slope wish producer (separate task commit)
483
 
484
  Walking friction and copied-command scaling precede actual40679, flattening and clipping each live basis vector against the ground normal, normalizing them and building a three-axis slope-aligned wish. 16 command/normal/prior-direction fixtures and four independent tests validate exact clip/normalize arithmetic, raw wish/root, classifier temporal order and copied pointer. Full suite: 751 tests pass. Report regenerates byte-identically (116042 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.
485
+
486
+
487
+ ## 2026-10-19 — RE-557 Recover walking speed policy acceleration projection and resource (separate task commit)
488
+
489
+ Walking applies flag/state/resource/water caps then a timed state128 override, selects acceleration from surface/flags/speed, performs two normalized plane projections and passes saved pre-projection speed into39595. 30 command/policy profiles and four independent tests reproduce exact speed/cap/coefficient rounding, acceleration, both projections, timed250 boundary and resource outputs. Full suite: 755 tests pass. Report regenerates byte-identically (416388 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.
docs/REVERSE_ENGINEERING_TODO.md CHANGED
@@ -713,3 +713,6 @@ Purpose: turn the supplied installation into an evidence-backed specification of
713
 
714
 
715
  - [x] RE-556 Recover ordinary walking direction and slope wish producer ([report](research/QVM_WALK_WISH.md)).
 
 
 
 
713
 
714
 
715
  - [x] RE-556 Recover ordinary walking direction and slope wish producer ([report](research/QVM_WALK_WISH.md)).
716
+
717
+
718
+ - [x] RE-557 Recover walking speed policy acceleration projection and resource ([report](research/QVM_WALK_POLICY.md)).
docs/research/QVM_WALK_POLICY.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Recover walking speed policy acceleration projection and resource
2
+
3
+ RE-557. Reproduce with `python3 scripts/analyze_qvm_walk_policy.py`; check with `python3 scripts/test_qvm_walk_policy.py`. The [machine report](qvm-walk-policy.json) retains source identity and bounded fixtures.
4
+
5
+ The44110..45142 source evaluates flag1 speed override, state128 cap, resource interpolation below7500 with a source220-based floor, level-dependent cap and the state128 timestamp modulo500<250 override. The timed override occurs after earlier caps. Surface2 or flag64 selects the low coefficient and subtracts gravity before saving speed; above-max wish speed selects the special4.05 coefficient. Velocity is clipped, may be zeroed when old/new dot falls below−0.5, normalized/rescaled, then clipped and normalized/rescaled again. The resource helper receives the saved speed from before these projections, unlike the flagged mode's post-slide measurement. Wrapper and horizontal-zero routing remain for task10; native roots/configuration and legal runtime inputs are still supplied.
6
+
7
+ No original executable/full QVM/native collision/physics/rendering executes. Native responses and legal input domains are supplied or unverified where stated; full runtime/macOS/Linux Rust/Bevy/Solari gameplay remains open.
docs/research/README.md CHANGED
@@ -277,3 +277,6 @@ The extension collector adds five focused tests for native tail calls, command-r
277
 
278
 
279
  [RE-556: Recover ordinary walking direction and slope wish producer](QVM_WALK_WISH.md). Reproduce with `python3 scripts/analyze_qvm_walk_wish.py`; check with `python3 scripts/test_qvm_walk_wish.py`.
 
 
 
 
277
 
278
 
279
  [RE-556: Recover ordinary walking direction and slope wish producer](QVM_WALK_WISH.md). Reproduce with `python3 scripts/analyze_qvm_walk_wish.py`; check with `python3 scripts/test_qvm_walk_wish.py`.
280
+
281
+
282
+ [RE-557: Recover walking speed policy acceleration projection and resource](QVM_WALK_POLICY.md). Reproduce with `python3 scripts/analyze_qvm_walk_policy.py`; check with `python3 scripts/test_qvm_walk_policy.py`.
docs/research/qvm-walk-policy.json ADDED
The diff for this file is too large to render. See raw diff
 
scripts/analyze_qvm_walk_policy.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Walking speed gates, actual acceleration, double projection and retained-speed resource."""
3
+ import itertools
4
+ from pathlib import Path
5
+ from qvm_research_support import source,memory,constants,execute
6
+ from analyze_qvm_walk_wish import wish,LOCAL
7
+ from analyze_qvm_active_mode import accelerate
8
+ from analyze_qvm_resource import resource_probe
9
+ from analyze_qvm_acceleration import PS,FRAME,number
10
+ from analyze_qvm_jump_entry import snapshot
11
+ from analyze_qvm import write_json
12
+
13
+ CONFIG=[21164,21168,21172,21184,21188,21192,21208]
14
+ PROFILES=[(0,0,0,0,0,0),(0,0,7499,0,0,0),(0,0,7500,0,0,0),(1,0,10000,0,0,0),(0,128,10000,0,0,249),(0,128,10000,0,0,250),(0,128,10000,0,0,500),(0,0,10000,2,0,0),(0,0,10000,0,2,0),(64,0,10000,0,0,0)]
15
+
16
+
17
+ def policy(ins,m,cmd):
18
+ fields={'flags':m[PS+12],'state':m[PS+220],'meter':m[PS+184],'level':m[FRAME+212],'surface':m[35023988],'time':m[FRAME+4],'max_speed':m[PS+52],'dt':m[35023928]&0xffffffff,'gravity':m[PS+48]};m,p=wish(ins,m,cmd);ap=None;resource=None
19
+ def acc(i,m,a,c):
20
+ nonlocal ap
21
+ m,ap=accelerate(i,m,a);return m,c,0,{}
22
+ def update(i,m,a,c):
23
+ nonlocal resource
24
+ m,resource=resource_probe(i,speed=number(a[8]),forward=c[0],right=c[1],initial_memory=m,return_memory=True);return m,c,0,{}
25
+ m,cmd,r=execute(ins,44110,45143,m,cmd,LOCAL,{40275:acc,39595:update})
26
+ return m,{'inputs':fields,'wish':p,'acceleration':ap,'resource':resource,'saved_speed':m[LOCAL+60]&0xffffffff,'execution':r,'final':snapshot(m)}
27
+
28
+
29
+ def main():
30
+ q,raw,h,ins=source();cfg=constants(raw,h,CONFIG);rows=[]
31
+ for cmd,profile in itertools.product([(0,0,0),(127,0,0),(-128,127,0)],PROFILES):
32
+ fl,state,meter,level,surface,time=profile;m=memory(raw,h,cmd,flags=fl);m.update(cfg);m.update({PS+220:state,PS+184:meter,FRAME+212:level,35023988:surface,FRAME+4:time});rows.append(policy(ins,m,cmd)[1])
33
+ write_json(Path('docs/research/qvm-walk-policy.json'),{'source':q['source'],'sha256':q['sha256'],'constants':{str(a):v for a,v in cfg.items()},'probes':rows,'limits':'Actual normal-walking prefix and44110..45142 speed/acceleration/projection/resource. Wrapper45143 onward omitted. Roots/initial state supplied; no original executable/full QVM/native physics/rendering executes. Native and full runtime domains remain open.'})
34
+
35
+
36
+ if __name__=='__main__':main()
scripts/test_qvm_walk_policy.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json,unittest
2
+ from pathlib import Path
3
+ from test_qvm_ground import f,n,word
4
+ from test_qvm_walk_wish import check as check_wish,length
5
+ from test_qvm_acceleration import accel_oracle
6
+ from test_qvm_slide_planes import clip,dot
7
+ from test_qvm_resource import resource_oracle
8
+
9
+
10
+ def speed(p,c):
11
+ a=p['inputs'];w=p['wish'];v=f(n(w['root'])*n(w['scale']['result_scale_float_word']));mx=f(a['max_speed'])
12
+ if a['flags']&1:v=f(mx*c[21164])
13
+ if a['state']&128:v=min(v,f(mx*c[21168]))
14
+ if a['meter']<7500:
15
+ low=f(v*c[21184]);candidate=f(f(f(f(a['meter'])*n(957075301))*f(v-low))+low);candidate=max(candidate,f(c[21184]*220));v=min(v,candidate)
16
+ if a['level']:
17
+ factor=f(1-f(f(1-c[21172])*f(f(a['level'])*n(1051372203))));v=min(v,f(mx*factor))
18
+ if a['state']&128 and a['time']%500<250:v=f(mx*n(1058642330))
19
+ coeff=c[21192] if a['surface']&2 or a['flags']&64 else c[21188]
20
+ if v>mx:coeff=f(c[21208]+n(1028443341))
21
+ return word(v),word(coeff)
22
+
23
+
24
+ def check(test,p,c):
25
+ check_wish(test,p['wish']);a=p['acceleration'];size=n(p['wish']['root']);direction=[word(f(n(v)*f(1/size))) for v in p['wish']['wish']] if size else p['wish']['wish'];s,co=speed(p,c);test.assertEqual([a['direction_float_words'],a['wish_speed_float_word'],a['acceleration_float_word']],[direction,s,co]);velocity=p['wish']['friction']['result_velocity_float_words'];test.assertEqual(a['initial_velocity_float_words'],velocity);test.assertEqual([a['projection_float_word'],a['gap_float_word'],a['amount_float_word'],a['result_velocity_float_words']],list(accel_oracle(a,velocity)));v=list(map(n,a['result_velocity_float_words']));normal=list(map(n,p['wish']['normal']))
26
+ if p['inputs']['surface']&2 or p['inputs']['flags']&64:v[2]=f(v[2]-f(f(p['inputs']['gravity'])*n(p['inputs']['dt'])))
27
+ saved=length(v);original=v[:];v=list(map(n,clip(v,normal)))
28
+ if dot(original,v)<-.5:v=[0,0,0]
29
+ for k in range(2):
30
+ size=length(v);v=[f(f(x*f(1/size))*saved) if size else f(x*saved) for x in v]
31
+ if k==0:v=list(map(n,clip(v,normal)))
32
+ test.assertEqual(p['final']['velocity'],list(map(word,v)));test.assertEqual(p['saved_speed'],word(saved));r=p['resource'];test.assertEqual(r['speed_float_word'],word(saved));test.assertEqual([r['path'],r['result_meter_word'],r['result_counter_word'],r['delta_float_word'],r['result_argument_float_word']],list(resource_oracle(r)));test.assertEqual(p['final']['meter'],r['result_meter_word']);test.assertEqual(p['final']['counter'],r['result_counter_word'])
33
+
34
+
35
+ class WalkPolicyTests(unittest.TestCase):
36
+ @classmethod
37
+ def setUpClass(cls):cls.r=json.loads(Path('docs/research/qvm-walk-policy.json').read_text());cls.c={int(a):n(v) for a,v in cls.r['constants'].items()}
38
+ def test_all30_policy_projection_and_resource_outputs(self):
39
+ self.assertEqual(len(self.r['probes']),30)
40
+ for p in self.r['probes']:check(self,p,self.c)
41
+ def test_timed_override_strict250_boundary(self):
42
+ for p in self.r['probes']:
43
+ if p['inputs']['state']&128 and p['inputs']['time']%500<250:self.assertEqual(p['acceleration']['wish_speed_float_word'],word(f(320*n(1058642330))))
44
+ def test_resource_uses_saved_pre_projection_speed(self):
45
+ for p in self.r['probes']:self.assertEqual(p['resource']['speed_float_word'],p['saved_speed']);self.assertEqual(p['resource']['result_inventory_words'],p['resource']['inventory_words'])
46
+ def test_surface_or_flag_selects_gravity_and_low_accel(self):
47
+ rows=[p for p in self.r['probes'] if p['inputs']['surface']&2 or p['inputs']['flags']&64];self.assertEqual(len(rows),6)
48
+ for p in rows:self.assertEqual(p['acceleration']['acceleration_float_word'],speed(p,self.c)[1])