nmarshall commited on
Commit
b8a7968
·
1 Parent(s): d8571fe

qvm: aim trigonometric offsets

Browse files
docs/ASSET_PIPELINE_TODO.md CHANGED
@@ -523,3 +523,6 @@ The [RE-604–613 allocation/spread batch](research/QVM_ALLOCATION_SPREAD_BATCH.
523
 
524
 
525
  Research progress: RE-613 [report](research/QVM_SHARED_SHOT_BASIS.md); remaining native/content/runtime/platform scope stays open.
 
 
 
 
523
 
524
 
525
  Research progress: RE-613 [report](research/QVM_SHARED_SHOT_BASIS.md); remaining native/content/runtime/platform scope stays open.
526
+
527
+
528
+ Research progress: RE-615 [report](research/QVM_AIM_TRIG.md); remaining native/content/runtime/platform scope stays open.
docs/FINDINGS.md CHANGED
@@ -878,3 +878,6 @@ Bounded qagame paths recover bomb-plant/inactivity correction requests, direct f
878
 
879
 
880
  **RE-613 — Shared shot handler basis muzzle and pending aim handoff:** 293732 resolves entity weaponID in16 slots, creates local forward/up and global right, computes the alternate muzzle and stops before290493 aim. [Evidence](research/QVM_SHARED_SHOT_BASIS.md).
 
 
 
 
878
 
879
 
880
  **RE-613 — Shared shot handler basis muzzle and pending aim handoff:** 293732 resolves entity weaponID in16 slots, creates local forward/up and global right, computes the alternate muzzle and stops before290493 aim. [Evidence](research/QVM_SHARED_SHOT_BASIS.md).
881
+
882
+
883
+ **RE-615 — Aim airborne adjustment and trigonometric offsets:** The airborne44 multiplier precedes sampling; three sin/cos pairs create horizontal and vertical offsets, then future field6304 can clear flag84. [Evidence](research/QVM_AIM_TRIG.md).
docs/PROVISIONAL_TODO.md CHANGED
@@ -843,3 +843,6 @@ The [RE-604–613 allocation/spread batch](research/QVM_ALLOCATION_SPREAD_BATCH.
843
 
844
 
845
  Research progress: RE-613 [report](research/QVM_SHARED_SHOT_BASIS.md); remaining native/content/runtime/platform scope stays open.
 
 
 
 
843
 
844
 
845
  Research progress: RE-613 [report](research/QVM_SHARED_SHOT_BASIS.md); remaining native/content/runtime/platform scope stays open.
846
+
847
+
848
+ Research progress: RE-615 [report](research/QVM_AIM_TRIG.md); remaining native/content/runtime/platform scope stays open.
docs/RESEARCH_LEDGER.md CHANGED
@@ -752,3 +752,8 @@ Each spread candidate consumes four actual36717 draws; acceptance requires radiu
752
  ## 2026-10-20 — RE-613 Shared shot handler basis muzzle and pending aim handoff (separate task commit)
753
 
754
  293732 resolves entity weaponID in16 slots, creates local forward/up and global right, computes the alternate muzzle and stops before290493 aim. 32 angle/slot/ID/mode fixtures independently check complete state, basis/muzzle, call order, pending ABI, canaries and full static child inventory. Full suite: 952 tests pass. Report regenerates byte-identically (488656 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.
 
 
 
 
 
 
752
  ## 2026-10-20 — RE-613 Shared shot handler basis muzzle and pending aim handoff (separate task commit)
753
 
754
  293732 resolves entity weaponID in16 slots, creates local forward/up and global right, computes the alternate muzzle and stops before290493 aim. 32 angle/slot/ID/mode fixtures independently check complete state, basis/muzzle, call order, pending ABI, canaries and full static child inventory. Full suite: 952 tests pass. Report regenerates byte-identically (488656 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.
755
+
756
+
757
+ ## 2026-10-20 — RE-615 Aim airborne adjustment and trigonometric offsets (separate task commit)
758
+
759
+ The airborne44 multiplier precedes sampling; three sin/cos pairs create horizontal and vertical offsets, then future field6304 can clear flag84. 37 fixtures check independent f32 offsets, trig arguments/order and explicit zero-seed exhaustion. Existing default sampler output stays identical. Full suite: 955 tests pass. Report regenerates byte-identically (437425 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
@@ -886,3 +886,6 @@ Purpose: turn the supplied installation into an evidence-backed specification of
886
 
887
 
888
  - [x] RE-613 Shared shot handler basis muzzle and pending aim handoff ([report](research/QVM_SHARED_SHOT_BASIS.md)).
 
 
 
 
886
 
887
 
888
  - [x] RE-613 Shared shot handler basis muzzle and pending aim handoff ([report](research/QVM_SHARED_SHOT_BASIS.md)).
889
+
890
+
891
+ - [x] RE-615 Aim airborne adjustment and trigonometric offsets ([report](research/QVM_AIM_TRIG.md)).
docs/research/QVM_AIM_TRIG.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Aim airborne adjustment and trigonometric offsets
2
+
3
+ RE-615. Reproduce with `python3 scripts/analyze_qvm_aim_trig.py`; check with `python3 scripts/test_qvm_aim_trig.py`. The [machine report](qvm-aim-trig.json) retains source identity and bounded fixtures.
4
+
5
+ Actual290969–290994 triples local44 only for IDs14/23 with ground1023. The sampler accepts a prepared speed context so this source write survives instead of being recomputed away. Actual291081–291314 sets flag84 from PS4048 bits8192/16384, forms source-order spread angles, issues three native sine/cosine pairs, and writes offsets76/52 scaled by16384. For IDs14/23, time<PS6304 clears the flag after those calculations. Finite supplied libm→f32 responses model native trig; original-library parity remains unverified. Thirty-six ordinary fixtures cover IDs2/14/23, both ground states, both relevant flags and two counter values; a zero-seed fixture stops before trig at the bounded rejection budget. Extra random offsets, endpoint and trace remain pending.
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
@@ -444,3 +444,6 @@ The extension collector adds five focused tests for native tail calls, command-r
444
 
445
 
446
  [RE-613: Shared shot handler basis muzzle and pending aim handoff](QVM_SHARED_SHOT_BASIS.md). Reproduce with `python3 scripts/analyze_qvm_shared_shot_basis.py`; check with `python3 scripts/test_qvm_shared_shot_basis.py`.
 
 
 
 
444
 
445
 
446
  [RE-613: Shared shot handler basis muzzle and pending aim handoff](QVM_SHARED_SHOT_BASIS.md). Reproduce with `python3 scripts/analyze_qvm_shared_shot_basis.py`; check with `python3 scripts/test_qvm_shared_shot_basis.py`.
447
+
448
+
449
+ [RE-615: Aim airborne adjustment and trigonometric offsets](QVM_AIM_TRIG.md). Reproduce with `python3 scripts/analyze_qvm_aim_trig.py`; check with `python3 scripts/test_qvm_aim_trig.py`.
docs/research/qvm-aim-trig.json ADDED
The diff for this file is too large to render. See raw diff
 
scripts/analyze_qvm_aim_trig.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Actual airborne adjustment, rejection sampler and aim trig before extra offsets."""
3
+ import itertools
4
+ from pathlib import Path
5
+ from qvm_research_support import source,execute
6
+ from qvm_server_fire_support import seed
7
+ from qvm_shot_math_support import TRIG
8
+ from analyze_qvm_spread_speed import speed
9
+ from analyze_qvm_spread_sampling import sample
10
+ from analyze_qvm_spread_parameters import LOCAL
11
+ from analyze_qvm_acceleration import PS
12
+ from analyze_qvm import write_json
13
+
14
+ def aim_trig(ins,m,attempt_limit=32):
15
+ fields={str(o):m[PS+o]&0xffffffff for o in [4048,6304,4404]};now=m[34992532];m,p=speed(ins,m);m,_,adjust=execute(ins,290969,291079,m,(0,0,0),LOCAL);half=m[LOCAL+44]&0xffffffff;m,s=sample(ins,m,attempt_limit,prepared=p)
16
+ r={'speed':p,'fields':fields,'time':now,'airborne_adjustment':adjust,'adjusted44':half,'sampling':s,'status':s['status'],'execution':None}
17
+ if s['status']!='accepted':return m,r
18
+ m,_,e=execute(ins,291081,291315,m,(0,0,0),LOCAL,TRIG);r.update({'execution':e,'offsets':{str(o):m[LOCAL+o]&0xffffffff for o in [76,52]},'flag84':m[LOCAL+84],'status':'extra-offsets-pending'})
19
+ return m,r
20
+
21
+ def main():
22
+ q,raw,h,ins=source();rows=[]
23
+ for ident,flags,ground,counter in itertools.product([2,14,23],[0,8192,16384],[0,1023],[0,10]):
24
+ m=seed(raw,h,ident);m[PS+144]=0;m[PS+312]=ident;m[PS+4048]=flags;m[PS+68]=ground;m[PS+216]=counter;m[21044]=1;rows.append(aim_trig(ins,m)[1])
25
+ m=seed(raw,h);m[21044]=0;rows.append(aim_trig(ins,m)[1])
26
+ write_json(Path('docs/research/qvm-aim-trig.json'),{'source':q['source'],'sha256':q['sha256'],'probes':rows,'limits':'Actual parameters, speed, airborne44 adjustment, bounded actual rejection and291081–291314. Sin/cos/sqrt use finite supplied models. Zero seed returns harness budget status; no endpoint or trace.'})
27
+ if __name__=='__main__':main()
scripts/analyze_qvm_spread_sampling.py CHANGED
@@ -10,9 +10,9 @@ from analyze_qvm_server_shot_setup import random_word
10
  from analyze_qvm_acceleration import PS
11
  from analyze_qvm import write_json
12
 
13
- def sample(ins,m,attempt_limit=32):
14
  if not 1<=attempt_limit<=64:raise ValueError('Attempt limit outside1..64')
15
- m,p=speed(ins,m);before=m[21044]&0xffffffff;attempts=[]
16
  def rng(i,m,a,c):m,r=random_word(i,m);return m,c,r['result'],r
17
  for _ in range(attempt_limit):
18
  m,_,r=execute(ins,290995,291081,m,(0,0,0),LOCAL,{36717:rng},boundaries=[291079]);accepted=r['stop']==291081
 
10
  from analyze_qvm_acceleration import PS
11
  from analyze_qvm import write_json
12
 
13
+ def sample(ins,m,attempt_limit=32,prepared=None):
14
  if not 1<=attempt_limit<=64:raise ValueError('Attempt limit outside1..64')
15
+ m,p=speed(ins,m) if prepared is None else (dict(m),prepared);before=m[21044]&0xffffffff;attempts=[]
16
  def rng(i,m,a,c):m,r=random_word(i,m);return m,c,r['result'],r
17
  for _ in range(attempt_limit):
18
  m,_,r=execute(ins,290995,291081,m,(0,0,0),LOCAL,{36717:rng},boundaries=[291079]);accepted=r['stop']==291081
scripts/qvm_shot_math_support.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Explicit finite native trig models; original library bit parity is unverified."""
2
+ import math
3
+ from analyze_qvm_acceleration import word,number
4
+
5
+ def trig(kind):
6
+ def apply(ins,m,args,cmd):
7
+ value=word((math.sin if kind=='sin' else math.cos)(number(args[8])))
8
+ return m,cmd,value,{'model':kind,'argument':args[8]&0xffffffff,'result':value}
9
+ return apply
10
+
11
+ TRIG={-104:trig('sin'),-105:trig('cos')}
scripts/test_qvm_aim_trig.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json,math,unittest
2
+ from pathlib import Path
3
+ from test_qvm_ground import word,n,f
4
+
5
+ def expected(p):
6
+ a=p['speed']['parameters']['initial'];s={int(k):n(v) for k,v in p['speed']['parameters']['locals'].items() if int(k) not in [36,64]};half=n(p['speed']['locals']['44']);half=f(half*3) if a['id'] in [14,23] and a['ground']==1023 else half
7
+ move=f(n(p['speed']['locals']['24'])*half);angle=f(f(f(s[56]+f(s[68]*s[40]))+move)+f(move*2));last=p['sampling']['attempts'][-1];args=[f(angle*n(last[k])) for k in ['x','y']];args.append(f(s[80]*s[88]));tan=lambda x:f(f(math.sin(x))/f(math.cos(x)));x=f(tan(args[0])*16384);y=f(f(tan(args[1])+tan(args[2]))*16384);flag=int(bool(p['fields']['4048']&24576))
8
+ if a['id'] in [14,23] and p['time']<p['fields']['6304']:flag=0
9
+ return word(half),{'76':word(x),'52':word(y)},flag,[word(v) for v in args for _ in range(2)]
10
+ class AimTrigTests(unittest.TestCase):
11
+ @classmethod
12
+ def setUpClass(cls):cls.r=json.loads(Path('docs/research/qvm-aim-trig.json').read_text())
13
+ def test_independent_f32_offsets_and_native_arguments(self):
14
+ self.assertEqual(len(self.r['probes']),37)
15
+ for p in self.r['probes'][:-1]:
16
+ half,offsets,flag,args=expected(p);self.assertEqual(p['adjusted44'],half);self.assertEqual(p['offsets'],offsets);self.assertEqual(p['flag84'],flag);self.assertEqual([c['args']['8']&0xffffffff for c in p['execution']['calls']],args)
17
+ def test_exact_trig_order_and_sampling_preparation(self):
18
+ for p in self.r['probes'][:-1]:self.assertEqual([c['target'] for c in p['execution']['calls']],[-104,-105]*3);self.assertEqual(p['sampling']['speed'],p['speed']);self.assertEqual(p['airborne_adjustment']['calls'],[])
19
+ def test_zero_seed_stops_before_trig(self):
20
+ p=self.r['probes'][-1];self.assertEqual(p['status'],'attempt-budget-exhausted');self.assertIsNone(p['execution']);self.assertNotIn('offsets',p)
21
+ if __name__=='__main__':unittest.main()