nmarshall commited on
Commit
d61efed
·
1 Parent(s): 51dd462

gameplay: compose camera world and require nix python

Browse files
.githooks/pre-commit CHANGED
@@ -1,3 +1,8 @@
1
  #!/bin/sh
2
  set -eu
3
- exec python3 scripts/storage_policy.py check --require-setup
 
 
 
 
 
 
1
  #!/bin/sh
2
  set -eu
3
+ : "${PYTHON:?Run Git inside nix develop to use the flake Python dependency}"
4
+ case "$PYTHON" in
5
+ /nix/store/*/bin/python3) ;;
6
+ *) echo "PYTHON must be the flake's Nix-store Python executable" >&2; exit 1 ;;
7
+ esac
8
+ exec "$PYTHON" scripts/storage_policy.py check --require-setup
.githooks/pre-push CHANGED
@@ -1,8 +1,13 @@
1
  #!/bin/sh
2
  set -eu
 
 
 
 
 
3
  updates=$(mktemp)
4
  trap 'rm -f "$updates"' EXIT HUP INT TERM
5
  cat > "$updates"
6
- python3 scripts/storage_policy.py check --require-setup
7
- python3 scripts/storage_policy.py push --require-setup < "$updates"
8
  git lfs pre-push "$@" < "$updates"
 
1
  #!/bin/sh
2
  set -eu
3
+ : "${PYTHON:?Run Git inside nix develop to use the flake Python dependency}"
4
+ case "$PYTHON" in
5
+ /nix/store/*/bin/python3) ;;
6
+ *) echo "PYTHON must be the flake's Nix-store Python executable" >&2; exit 1 ;;
7
+ esac
8
  updates=$(mktemp)
9
  trap 'rm -f "$updates"' EXIT HUP INT TERM
10
  cat > "$updates"
11
+ "$PYTHON" scripts/storage_policy.py check --require-setup
12
+ "$PYTHON" scripts/storage_policy.py push --require-setup < "$updates"
13
  git lfs pre-push "$@" < "$updates"
crates/urt-gameplay/src/bin/urt-camera-world.rs CHANGED
@@ -149,6 +149,131 @@ fn run() -> Result<String, String> {
149
  array(&host)
150
  ))
151
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  _ => Err("unknown command".into()),
153
  }
154
  }
@@ -211,3 +336,14 @@ fn math_calls(w: &[u32], p: &mut usize) -> Result<ReplayMath, String> {
211
  *p += 4 * n;
212
  Ok(ReplayMath::new(calls))
213
  }
 
 
 
 
 
 
 
 
 
 
 
 
149
  array(&host)
150
  ))
151
  }
152
+ "camera" => {
153
+ if w.len() < 9 || w[1] > 1 || w[2] > 1024 {
154
+ return Err("invalid camera header".into());
155
+ }
156
+ let mut state = w[0];
157
+ let slot = w[1] as usize;
158
+ let n = w[2] as usize;
159
+ let fallback = urt_gameplay::transition::View {
160
+ origin: w[3..6].try_into().unwrap(),
161
+ angles: w[6..9].try_into().unwrap(),
162
+ };
163
+ let mut p = 9;
164
+ let mut world = vec![];
165
+ for _ in 0..n {
166
+ let v = w.get(p..p + 9).ok_or("missing world record")?;
167
+ p += 9;
168
+ let class = HashEntity {
169
+ in_use: v[0] as i32,
170
+ class_present: v[1] != 0,
171
+ class_hash: v[2],
172
+ };
173
+ let origin = v[3..6].try_into().unwrap();
174
+ let angles = v[6..9].try_into().unwrap();
175
+ let aim = blob(&w, &mut p)?;
176
+ let label = blob(&w, &mut p)?;
177
+ world.push(WorldEntity {
178
+ class,
179
+ origin,
180
+ angles,
181
+ aim,
182
+ label,
183
+ });
184
+ }
185
+ let mut math = math_calls(&w, &mut p)?;
186
+ if p != w.len() {
187
+ return Err("trailing camera words".into());
188
+ }
189
+ let mut entity = urt_gameplay::transition::CameraEntity {
190
+ origin: [0x12345678; 3],
191
+ clear: [0x12345678; 6],
192
+ };
193
+ let blank = urt_gameplay::transition::CameraPlayer {
194
+ movement: 0xaabbccdd,
195
+ origin: [0xaabbccdd; 3],
196
+ velocity: [0xaabbccdd; 3],
197
+ field104: 0xaabbccdd,
198
+ angles: [0xaabbccdd; 3],
199
+ mode3108: 0xaabbccdd,
200
+ field4324: 0xaabbccdd,
201
+ };
202
+ let mut clients = [blank.clone(), blank];
203
+ let out = configure_camera(
204
+ &world,
205
+ &mut state,
206
+ fallback,
207
+ &mut math,
208
+ &mut entity,
209
+ &mut clients[slot],
210
+ )
211
+ .map_err(|e| format!("{e:?}"))?;
212
+ math.finish().map_err(|e| format!("{e:?}"))?;
213
+ let e = word_object(
214
+ &[4, 8, 92, 96, 100, 156, 160, 180, 460],
215
+ &[
216
+ entity.clear[0],
217
+ entity.clear[1],
218
+ entity.origin[0],
219
+ entity.origin[1],
220
+ entity.origin[2],
221
+ entity.clear[2],
222
+ entity.clear[3],
223
+ entity.clear[4],
224
+ entity.clear[5],
225
+ ],
226
+ );
227
+ let clients = clients
228
+ .iter()
229
+ .map(|p| {
230
+ word_object(
231
+ &[4, 20, 24, 28, 32, 36, 40, 104, 152, 156, 160, 3108, 4324],
232
+ &[
233
+ p.movement,
234
+ p.origin[0],
235
+ p.origin[1],
236
+ p.origin[2],
237
+ p.velocity[0],
238
+ p.velocity[1],
239
+ p.velocity[2],
240
+ p.field104,
241
+ p.angles[0],
242
+ p.angles[1],
243
+ p.angles[2],
244
+ p.mode3108,
245
+ p.field4324,
246
+ ],
247
+ )
248
+ })
249
+ .collect::<Vec<_>>()
250
+ .join(",");
251
+ let effects = out
252
+ .effects
253
+ .iter()
254
+ .map(|e| match e {
255
+ CameraEffect::FindClass => 276433,
256
+ CameraEffect::Fallback => 168114,
257
+ CameraEffect::PickTarget => 276586,
258
+ CameraEffect::Angles => 62944,
259
+ })
260
+ .collect::<Vec<_>>();
261
+ let matches = out.matches.iter().map(|j| *j as u32).collect::<Vec<_>>();
262
+ let diagnostic = match out.diagnostic {
263
+ None => "null",
264
+ Some(TargetDiagnostic::Null) => "\"null\"",
265
+ Some(TargetDiagnostic::Missing) => "\"missing\"",
266
+ };
267
+ Ok(format!(
268
+ "{{\"class_index\":{},\"target_index\":{},\"rng_state\":{state},\"matches\":{},\"diagnostic\":{diagnostic},\"effects\":{},\"view\":{{\"origin\":{},\"angles\":{}}},\"entity\":{e},\"clients\":[{clients}]}}",
269
+ out.class_index.map(|j| j as i32).unwrap_or(-1),
270
+ out.target_index.map(|j| j as i32).unwrap_or(-1),
271
+ array(&matches),
272
+ array(&effects),
273
+ array(&out.view.origin),
274
+ array(&out.view.angles)
275
+ ))
276
+ }
277
  _ => Err("unknown command".into()),
278
  }
279
  }
 
336
  *p += 4 * n;
337
  Ok(ReplayMath::new(calls))
338
  }
339
+
340
+ fn word_object(k: &[u32], v: &[u32]) -> String {
341
+ format!(
342
+ "{{{}}}",
343
+ k.iter()
344
+ .zip(v)
345
+ .map(|(k, v)| format!("\"{k}\":{v}"))
346
+ .collect::<Vec<_>>()
347
+ .join(",")
348
+ )
349
+ }
crates/urt-gameplay/src/camera_world.rs CHANGED
@@ -394,3 +394,187 @@ mod angle_tests {
394
  assert_eq!(m.finish(), Err(Error::MathTranscript));
395
  }
396
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
394
  assert_eq!(m.finish(), Err(Error::MathTranscript));
395
  }
396
  }
397
+
398
+ #[derive(Clone, Debug, PartialEq, Eq)]
399
+ pub struct WorldEntity {
400
+ pub class: HashEntity,
401
+ pub origin: [u32; 3],
402
+ pub angles: [u32; 3],
403
+ pub aim: Option<Vec<u8>>,
404
+ pub label: Option<Vec<u8>>,
405
+ }
406
+ #[derive(Clone, Copy, Debug, PartialEq, Eq)]
407
+ pub enum CameraEffect {
408
+ FindClass,
409
+ Fallback,
410
+ PickTarget,
411
+ Angles,
412
+ }
413
+ #[derive(Clone, Debug, PartialEq, Eq)]
414
+ pub struct CameraResolution {
415
+ pub class_index: Option<usize>,
416
+ pub target_index: Option<usize>,
417
+ pub matches: Vec<usize>,
418
+ pub diagnostic: Option<TargetDiagnostic>,
419
+ pub effects: Vec<CameraEffect>,
420
+ pub view: crate::transition::View,
421
+ }
422
+ pub fn resolve_camera<M: AngleMath>(
423
+ world: &[WorldEntity],
424
+ state: &mut u32,
425
+ fallback: crate::transition::View,
426
+ math: &mut M,
427
+ ) -> Result<CameraResolution, Error> {
428
+ let classes = world.iter().map(|e| e.class).collect::<Vec<_>>();
429
+ let selected = find_class(&classes, world.len(), None, (-2104846030i32) as u32)?;
430
+ let mut out = CameraResolution {
431
+ class_index: selected,
432
+ target_index: None,
433
+ matches: vec![],
434
+ diagnostic: None,
435
+ effects: vec![CameraEffect::FindClass],
436
+ view: fallback,
437
+ };
438
+ let Some(index) = selected else {
439
+ out.effects.push(CameraEffect::Fallback);
440
+ return Ok(out);
441
+ };
442
+ let e = &world[index];
443
+ out.view = crate::transition::View {
444
+ origin: e.origin,
445
+ angles: e.angles,
446
+ };
447
+ if let Some(aim) = &e.aim {
448
+ out.effects.push(CameraEffect::PickTarget);
449
+ let fields = world
450
+ .iter()
451
+ .map(|e| FieldEntity {
452
+ in_use: e.class.in_use,
453
+ value: e.label.clone(),
454
+ })
455
+ .collect::<Vec<_>>();
456
+ let mut staged = *state;
457
+ let pick = pick_target(&fields, world.len(), Some(aim), &mut staged)?;
458
+ out.target_index = pick.index;
459
+ out.matches = pick.matches;
460
+ out.diagnostic = pick.diagnostic;
461
+ if let Some(j) = pick.index {
462
+ let mut delta = [0; 3];
463
+ for (k, v) in delta.iter_mut().enumerate() {
464
+ let x = f32::from_bits(world[j].origin[k]);
465
+ let y = f32::from_bits(e.origin[k]);
466
+ let d = x - y;
467
+ if !x.is_finite() || !y.is_finite() || !d.is_finite() {
468
+ return Err(Error::FloatDomain);
469
+ }
470
+ *v = d.to_bits();
471
+ }
472
+ out.view.angles = vector_angles(delta, math)?;
473
+ out.effects.push(CameraEffect::Angles);
474
+ }
475
+ *state = staged;
476
+ }
477
+ Ok(out)
478
+ }
479
+ pub fn configure_camera<M: AngleMath>(
480
+ world: &[WorldEntity],
481
+ state: &mut u32,
482
+ fallback: crate::transition::View,
483
+ math: &mut M,
484
+ entity: &mut crate::transition::CameraEntity,
485
+ player: &mut crate::transition::CameraPlayer,
486
+ ) -> Result<CameraResolution, Error> {
487
+ let out = resolve_camera(world, state, fallback, math)?;
488
+ crate::transition::place_camera(entity, player, out.view.origin, out.view.angles);
489
+ Ok(out)
490
+ }
491
+ #[cfg(test)]
492
+ mod world_tests {
493
+ use super::*;
494
+ use crate::transition::{CameraEntity, CameraPlayer, View};
495
+ fn player() -> CameraPlayer {
496
+ CameraPlayer {
497
+ movement: 7,
498
+ origin: [7; 3],
499
+ velocity: [7; 3],
500
+ field104: 7,
501
+ angles: [7; 3],
502
+ mode3108: 2,
503
+ field4324: 3,
504
+ }
505
+ }
506
+ #[test]
507
+ fn fallback_places_view_without_rng() {
508
+ let fallback = View {
509
+ origin: [1, 2, 3],
510
+ angles: [4, 5, 6],
511
+ };
512
+ let mut state = 9;
513
+ let mut entity = CameraEntity {
514
+ origin: [7; 3],
515
+ clear: [7; 6],
516
+ };
517
+ let mut player = player();
518
+ let out = configure_camera(
519
+ &[],
520
+ &mut state,
521
+ fallback,
522
+ &mut HostMath,
523
+ &mut entity,
524
+ &mut player,
525
+ )
526
+ .unwrap();
527
+ assert_eq!(
528
+ out.effects,
529
+ vec![CameraEffect::FindClass, CameraEffect::Fallback]
530
+ );
531
+ assert_eq!(state, 9);
532
+ assert_eq!(
533
+ (entity.origin, player.angles, player.velocity),
534
+ (fallback.origin, fallback.angles, [0; 3])
535
+ );
536
+ }
537
+ #[test]
538
+ fn self_target_and_invalid_math_ownership() {
539
+ let mut e = WorldEntity {
540
+ class: HashEntity {
541
+ in_use: 1,
542
+ class_present: true,
543
+ class_hash: (-2104846030i32) as u32,
544
+ },
545
+ origin: [0; 3],
546
+ angles: [7; 3],
547
+ aim: Some(b"node".to_vec()),
548
+ label: Some(b"NODE".to_vec()),
549
+ };
550
+ let mut state = 1;
551
+ let fallback = View {
552
+ origin: [0; 3],
553
+ angles: [0; 3],
554
+ };
555
+ let out = resolve_camera(&[e.clone()], &mut state, fallback, &mut HostMath).unwrap();
556
+ assert_eq!(out.target_index, Some(0));
557
+ assert_eq!(out.view.angles, [(-270.0f32).to_bits(), 0, 0]);
558
+ e.origin[0] = f32::NAN.to_bits();
559
+ let before = state;
560
+ let mut entity = CameraEntity {
561
+ origin: [7; 3],
562
+ clear: [7; 6],
563
+ };
564
+ let old = entity.clone();
565
+ let mut player = player();
566
+ assert_eq!(
567
+ configure_camera(
568
+ &[e],
569
+ &mut state,
570
+ fallback,
571
+ &mut HostMath,
572
+ &mut entity,
573
+ &mut player
574
+ ),
575
+ Err(Error::FloatDomain)
576
+ );
577
+ assert_eq!(state, before);
578
+ assert_eq!(entity, old);
579
+ }
580
+ }
docs/FINDINGS.md CHANGED
@@ -1586,3 +1586,6 @@ RE-813–822 replaces the scoreboard decimal assumption with actual37914 executi
1586
 
1587
 
1588
  **RE-862:** 96 continuous setup→placement cases now execute class-hash, field/string, capped random target, RNG and angle bodies on shared coherent world state, including collision/fallback/missing/self/capped target and client-indirection cases. Only fallback168114 and finite math responses remain supplied. Runtime/respawn integration and native math parity remain open. [Evidence](research/QVM_CAMERA_WORLD.md).
 
 
 
 
1586
 
1587
 
1588
  **RE-862:** 96 continuous setup→placement cases now execute class-hash, field/string, capped random target, RNG and angle bodies on shared coherent world state, including collision/fallback/missing/self/capped target and client-indirection cases. Only fallback168114 and finite math responses remain supplied. Runtime/respawn integration and native math parity remain open. [Evidence](research/QVM_CAMERA_WORLD.md).
1589
+
1590
+
1591
+ **RE-863:** Rust matches all96 composed source setup/placement fixtures across searches, actual RNG state transitions, checked angle-math transcripts and resolved player indirection. Fallible resolution stages RNG before committing it and performs placement only after success. Fallback selection and native math parity remain explicit boundaries; intermission/respawn/runtime integration is still open. [Evidence](research/RUST_CAMERA_WORLD.md).
docs/PROVISIONAL_TODO.md CHANGED
@@ -1580,7 +1580,7 @@ RE-852: 144 original 277695/278138 cases recover tempEntity metadata, wrapped ev
1580
  RE-853: Rust matches 144 original temporary-event cases, including exact snap words, event-kind wrapping, metadata and preservation of allocator/caller fields. Five invalid source domains reject atomically in Rust. Allocation and native linking remain caller-owned; source class tokens require runtime metadata resolution. Full runtime completion remains open. [Evidence](research/RUST_EVENT_CONSTRUCT.md).
1581
 
1582
 
1583
- - [ ] RE-854: Compose recovered camera/map/event policies into intermission flows; recover searches, angles, commands, allocation, respawn and publication; validate actual macOS/Linux runtime traces. [Scope](research/QVM_CAMERA_MAP_EVENT_BATCH.md).
1584
 
1585
 
1586
  RE-854: 80 original 276433 cases recover nonzero active/class-pointer filtering, first match after cursor, scan limits and raw hash equality. Class text is never compared, so collisions return the first eligible hash match. Read-only world behavior is verified; unsafe pointers and native/runtime behavior remain open. Full runtime completion remains open. [Evidence](research/QVM_ENTITY_HASH.md).
@@ -1608,3 +1608,9 @@ RE-861: Rust matches 96 corrected source angle cases exactly through checked mat
1608
 
1609
 
1610
  RE-862: 96 continuous setup→placement cases now execute class-hash, field/string, capped random target, RNG and angle bodies on shared coherent world state, including collision/fallback/missing/self/capped target and client-indirection cases. Only fallback168114 and finite math responses remain supplied. Runtime/respawn integration and native math parity remain open. Full runtime completion remains open. [Evidence](research/QVM_CAMERA_WORLD.md).
 
 
 
 
 
 
 
1580
  RE-853: Rust matches 144 original temporary-event cases, including exact snap words, event-kind wrapping, metadata and preservation of allocator/caller fields. Five invalid source domains reject atomically in Rust. Allocation and native linking remain caller-owned; source class tokens require runtime metadata resolution. Full runtime completion remains open. [Evidence](research/RUST_EVENT_CONSTRUCT.md).
1581
 
1582
 
1583
+ - [x] RE-854–863: Recover entity searches, target RNG, corrected angles and composed camera placement. Native/runtime integration continues under RE-864. [Evidence](research/QVM_CAMERA_WORLD_BATCH.md).
1584
 
1585
 
1586
  RE-854: 80 original 276433 cases recover nonzero active/class-pointer filtering, first match after cursor, scan limits and raw hash equality. Class text is never compared, so collisions return the first eligible hash match. Read-only world behavior is verified; unsafe pointers and native/runtime behavior remain open. Full runtime completion remains open. [Evidence](research/QVM_ENTITY_HASH.md).
 
1608
 
1609
 
1610
  RE-862: 96 continuous setup→placement cases now execute class-hash, field/string, capped random target, RNG and angle bodies on shared coherent world state, including collision/fallback/missing/self/capped target and client-indirection cases. Only fallback168114 and finite math responses remain supplied. Runtime/respawn integration and native math parity remain open. Full runtime completion remains open. [Evidence](research/QVM_CAMERA_WORLD.md).
1611
+
1612
+
1613
+ RE-863: Rust matches all96 composed source setup/placement fixtures across searches, actual RNG state transitions, checked angle-math transcripts and resolved player indirection. Fallible resolution stages RNG before committing it and performs placement only after success. Fallback selection and native math parity remain explicit boundaries; intermission/respawn/runtime integration is still open. Full runtime completion remains open. [Evidence](research/RUST_CAMERA_WORLD.md).
1614
+
1615
+
1616
+ - [ ] RE-864: Recover fallback/native math, compose camera into respawn/intermission, resolve map/allocation/publication effects and validate actual macOS/Linux game traces. [Scope](research/QVM_CAMERA_WORLD_BATCH.md).
docs/RESEARCH_LEDGER.md CHANGED
@@ -1983,7 +1983,7 @@ Rust matches 168 original target selections and five six-step RNG sequences. It
1983
 
1984
  96 actual 62944 cases use corrected repeated child reentry and coherent full/partial alias memory, preserving staged f32 arithmetic and exact output words. All24 older fixtures are compared explicitly. atan2/sqrt remain supplied finite f32 math models; original native library bit parity is not established. Focused `cargo xtask test-group camera-angles` passes (5 Python tests); selected reports regenerate twice deterministically, with storage, documentation links and whitespace guards. Full suite deferred to task ten. Original assets unchanged; source fixtures do not establish complete native/runtime parity.
1985
 
1986
- RE-860 environment correction: added flake.nix/flake.lock because this repository had no flake; pin uses the existing sibling project's nixpkgs revision. All subsequent Python runs use the declared Nix Python3.13.15 dependency and the absolute `PYTHON` variable, with no macOS Command Line Tools Python. The pending focused camera-angle validation is repeated through that shell.
1987
 
1988
  RE-860 flake validation: the repeated focused group passes all5 Python tests with the explicit Nix-store Python executable, identical deterministic source reports and all guards. Flake evaluation exposes both macOS and both Linux architectures.
1989
 
@@ -1996,3 +1996,14 @@ Rust matches 96 corrected source angle cases exactly through checked math transc
1996
  ## 2026-10-27 — RE-862 Original camera world composition with recovered searches and angles
1997
 
1998
  96 continuous setup→placement cases now execute class-hash, field/string, capped random target, RNG and angle bodies on shared coherent world state, including collision/fallback/missing/self/capped target and client-indirection cases. Only fallback168114 and finite math responses remain supplied. Runtime/respawn integration and native math parity remain open. Focused `cargo xtask test-group camera-world` passes (5 Python tests); selected reports regenerate twice deterministically, with storage, documentation links and whitespace guards. Full suite deferred to task ten. Original assets unchanged; source fixtures do not establish complete native/runtime parity.
 
 
 
 
 
 
 
 
 
 
 
 
1983
 
1984
  96 actual 62944 cases use corrected repeated child reentry and coherent full/partial alias memory, preserving staged f32 arithmetic and exact output words. All24 older fixtures are compared explicitly. atan2/sqrt remain supplied finite f32 math models; original native library bit parity is not established. Focused `cargo xtask test-group camera-angles` passes (5 Python tests); selected reports regenerate twice deterministically, with storage, documentation links and whitespace guards. Full suite deferred to task ten. Original assets unchanged; source fixtures do not establish complete native/runtime parity.
1985
 
1986
+ RE-860 environment correction: added flake.nix/flake.lock because this repository had no flake; pin uses the existing sibling project's nixpkgs revision. Analysis/xtask commands now use the declared Nix Python3.13.15 dependency and absolute `PYTHON`. A remaining bare-python Git-hook entry point was later identified and closed in RE-863. The pending focused camera-angle validation is repeated through that shell.
1987
 
1988
  RE-860 flake validation: the repeated focused group passes all5 Python tests with the explicit Nix-store Python executable, identical deterministic source reports and all guards. Flake evaluation exposes both macOS and both Linux architectures.
1989
 
 
1996
  ## 2026-10-27 — RE-862 Original camera world composition with recovered searches and angles
1997
 
1998
  96 continuous setup→placement cases now execute class-hash, field/string, capped random target, RNG and angle bodies on shared coherent world state, including collision/fallback/missing/self/capped target and client-indirection cases. Only fallback168114 and finite math responses remain supplied. Runtime/respawn integration and native math parity remain open. Focused `cargo xtask test-group camera-world` passes (5 Python tests); selected reports regenerate twice deterministically, with storage, documentation links and whitespace guards. Full suite deferred to task ten. Original assets unchanged; source fixtures do not establish complete native/runtime parity.
1999
+
2000
+
2001
+ ## 2026-10-27 — RE-863 Rust composed camera world selection and placement
2002
+
2003
+ Rust matches all96 composed source setup/placement fixtures across searches, actual RNG state transitions, checked angle-math transcripts and resolved player indirection. Fallible resolution stages RNG before committing it and performs placement only after success. Fallback selection and native math parity remain explicit boundaries; intermission/respawn/runtime integration is still open. Focused `cargo xtask test-group rust-camera-world` passes (9 Python tests); selected reports regenerate twice deterministically, with storage, documentation links and whitespace guards. Full suite deferred to task ten. Original assets unchanged; source fixtures do not establish complete native/runtime parity.
2004
+
2005
+ RE-863 hook correction: pre-commit/pre-push now require a Nix-store `PYTHON`, preventing implicit system-Python fallback. Final checks and remaining Git commit/push operations use the project flake shell.
2006
+
2007
+ RE-863 final review: targeted xtask dependency-registry test passes, including all five new source→Rust edges and shared transition composition. Both hooks pass shell syntax checks and reject missing PYTHON before invoking any interpreter.
2008
+
2009
+ Batch RE-854–863 boundary: the single `cargo xtask test-full --since cedc6d02` run passed after commit ten through the flake shell and its declared Nix Python3.13.15: 1,688 Python tests, 157 Rust tests (assets 10, gameplay 119, xtask 28), 51 deterministic producers, storage policy, 425 documentation files and whitespace checks. No generated report drift; notes amended into task ten. Original assets unchanged. Remaining commit/push hooks use the explicit Nix-store interpreter.
docs/REVERSE_ENGINEERING_TODO.md CHANGED
@@ -1617,7 +1617,7 @@ Purpose: turn the supplied installation into an evidence-backed specification of
1617
  - [x] RE-853 Rust temporary event construction and ownership boundaries ([evidence](research/RUST_EVENT_CONSTRUCT.md)).
1618
 
1619
 
1620
- - [ ] RE-854: Compose recovered camera/map/event policies into intermission flows; recover searches, angles, commands, allocation, respawn and publication; validate actual macOS/Linux runtime traces. [Scope](research/QVM_CAMERA_MAP_EVENT_BATCH.md).
1621
 
1622
 
1623
  - [x] RE-854 Original entity class-hash search and cursor semantics ([evidence](research/QVM_ENTITY_HASH.md)).
@@ -1645,3 +1645,9 @@ Purpose: turn the supplied installation into an evidence-backed specification of
1645
 
1646
 
1647
  - [x] RE-862 Original camera world composition with recovered searches and angles ([evidence](research/QVM_CAMERA_WORLD.md)).
 
 
 
 
 
 
 
1617
  - [x] RE-853 Rust temporary event construction and ownership boundaries ([evidence](research/RUST_EVENT_CONSTRUCT.md)).
1618
 
1619
 
1620
+ - [x] RE-854–863: Recover entity searches, target RNG, corrected angles and composed camera placement. Native/runtime integration continues under RE-864. [Evidence](research/QVM_CAMERA_WORLD_BATCH.md).
1621
 
1622
 
1623
  - [x] RE-854 Original entity class-hash search and cursor semantics ([evidence](research/QVM_ENTITY_HASH.md)).
 
1645
 
1646
 
1647
  - [x] RE-862 Original camera world composition with recovered searches and angles ([evidence](research/QVM_CAMERA_WORLD.md)).
1648
+
1649
+
1650
+ - [x] RE-863 Rust composed camera world selection and placement ([evidence](research/RUST_CAMERA_WORLD.md)).
1651
+
1652
+
1653
+ - [ ] RE-864: Recover fallback/native math, compose camera into respawn/intermission, resolve map/allocation/publication effects and validate actual macOS/Linux game traces. [Scope](research/QVM_CAMERA_WORLD_BATCH.md).
docs/TESTING.md CHANGED
@@ -1,8 +1,8 @@
1
- # Development toolchain
2
 
3
- Run analysis and validation inside `nix develop`. The pinned flake declares Python as a development dependency and sets `PYTHON` to its absolute Nix-store executable, which `cargo xtask` uses. Do not use Python from macOS Command Line Tools. For a one-shot run, use `nix develop --command cargo xtask test-group <name>`; the same environment supplies Python for direct analysis scripts and their subprocesses. The shell also supplies Rust, Cargo, Git and pkg-config on macOS and Linux.
4
 
5
- # Dependency-aware validation
6
 
7
  The Rust `xtask` workspace package selects and runs the existing Python research tests and Rust crate tests. It has no third-party Rust dependencies. Python remains necessary for the existing analyzers/tests and a syntax-only AST reader; selection, Git inspection, scheduling, determinism checks and command execution live in Rust.
8
 
@@ -147,3 +147,8 @@ Focused source/Rust pairs: `exit-predicate`/`rust-exit-predicate`, `intermission
147
  ## Camera, map and event groups
148
 
149
  Focused source/Rust pairs: `camera-place`/`rust-camera-place`, `camera-select`/`rust-camera-select`, `nextmap-series`/`rust-nextmap-series`, `nextmap-reset`/`rust-nextmap-reset`, and `event-construct`/`rust-event-construct`. Invoke `cargo xtask test-group <name>` before each task commit. The scoped transition adapter covers each word-level contract; Rust groups also run scoped gameplay tests and refresh their test-count metadata. The registry regression verifies source-report edges, transition module consumers and the shared mode-classifier dependency. Continue one full suite after ten commits. [Batch contracts and boundaries](research/QVM_CAMERA_MAP_EVENT_BATCH.md).
 
 
 
 
 
 
1
+ # Dependency-aware validation
2
 
3
+ ## Development toolchain
4
 
5
+ Run analysis and validation inside `nix develop`. The pinned flake declares Python as a development dependency and sets `PYTHON` to its absolute Nix-store executable, which `cargo xtask` uses. Do not use Python from macOS Command Line Tools. For a one-shot run, use `nix develop --command cargo xtask test-group <name>`; the same environment supplies Python for direct analysis scripts and their subprocesses. The shell also supplies Rust, Cargo, Git and pkg-config on macOS and Linux.
6
 
7
  The Rust `xtask` workspace package selects and runs the existing Python research tests and Rust crate tests. It has no third-party Rust dependencies. Python remains necessary for the existing analyzers/tests and a syntax-only AST reader; selection, Git inspection, scheduling, determinism checks and command execution live in Rust.
8
 
 
147
  ## Camera, map and event groups
148
 
149
  Focused source/Rust pairs: `camera-place`/`rust-camera-place`, `camera-select`/`rust-camera-select`, `nextmap-series`/`rust-nextmap-series`, `nextmap-reset`/`rust-nextmap-reset`, and `event-construct`/`rust-event-construct`. Invoke `cargo xtask test-group <name>` before each task commit. The scoped transition adapter covers each word-level contract; Rust groups also run scoped gameplay tests and refresh their test-count metadata. The registry regression verifies source-report edges, transition module consumers and the shared mode-classifier dependency. Continue one full suite after ten commits. [Batch contracts and boundaries](research/QVM_CAMERA_MAP_EVENT_BATCH.md).
150
+
151
+
152
+ ## Entity search and composed world camera groups
153
+
154
+ Use the source/Rust pairs `entity-hash`/`rust-entity-hash`, `entity-field`/`rust-entity-field`, `target-pick`/`rust-target-pick`, `camera-angles`/`rust-camera-angles` and `camera-world`/`rust-camera-world`. Run them inside the flake shell. Registry regression checks report, module and shared transition dependencies; Rust groups refresh scoped gameplay test counts. Git hooks require the flake's absolute Nix-store `PYTHON` and refuse to fall back to system Python. Run `storage` after hook changes and one full suite after ten commits. [Batch evidence and limits](research/QVM_CAMERA_WORLD_BATCH.md).
docs/research/QVM_CAMERA_WORLD_BATCH.md ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Entity search and camera composition: RE-854–863
2
+
3
+ This batch replaces camera search and angle stand-ins with original instruction execution and matching Rust policies. The final composition executes setup and placement across shared world state. Native fallback selection, math-library parity and game/runtime integration remain open.
4
+
5
+ | Task | Evidence |
6
+ | --- | --- |
7
+ | RE-854 | [276433 class-hash search](QVM_ENTITY_HASH.md) |
8
+ | RE-855 | [Rust class-hash search](RUST_ENTITY_HASH.md) |
9
+ | RE-856 | [276505 field search with actual 69386 comparator](QVM_ENTITY_FIELD.md) |
10
+ | RE-857 | [Rust field search and signed-byte comparison](RUST_ENTITY_FIELD.md) |
11
+ | RE-858 | [276586 target selection and actual 36717 random generator](QVM_TARGET_PICK.md) |
12
+ | RE-859 | [Rust capped target selection and RNG](RUST_TARGET_PICK.md) |
13
+ | RE-860 | [Corrected coherent 62944 angle execution and legacy audit](QVM_CAMERA_ANGLES.md) |
14
+ | RE-861 | [Rust angles with checked math responses](RUST_CAMERA_ANGLES.md) |
15
+ | RE-862 | [Actual camera setup→placement composition](QVM_CAMERA_WORLD.md) |
16
+ | RE-863 | [Rust composed world camera API](RUST_CAMERA_WORLD.md) |
17
+
18
+ ## Findings and boundaries
19
+
20
+ The class-hash helper has 80 fixtures. It scans from the first entity or immediately after a supplied cursor, checks nonzero in-use and class pointer values, then compares the stored hash. It never compares class text, so collisions select the first eligible hash match. Rust keeps this behavior with bounded slices and cursor validation.
21
+
22
+ Field search has 150 fixtures and 256 standalone comparator cases. Original 69386 executes rather than a string stand-in. It folds ASCII lowercase to uppercase and compares signed bytes, honors embedded NUL and nullable pointer ordering, and applies the count gate after reading characters. Rust uses logical byte strings with implicit terminators; it does not reproduce unsafe memory reads for zero count or invalid pointers. The field search passes 99999 to the comparator.
23
+
24
+ Target selection has 168 fixtures plus five six-step RNG sequences. It collects the first 32 eligible field matches, advances the xorshift state exactly once when a match exists, and selects by the low 15-bit result modulo match count. Null/missing paths preserve random state and request diagnostic 2294. Initialization, rendered diagnostics and native world ownership remain open.
25
+
26
+ The corrected angle probe has 96 fixtures with full/partial output aliases, signed zeros and subnormal intermediates. All 24 older angle fixtures agree. Both source and Rust preserve each f32 arithmetic stage. Source atan2/sqrt responses are finite Python math results rounded to f32; Rust exact parity uses transcripts checked against operation and argument bits. A separate host-math path is checked within four f32 ULPs on this host. Neither establishes original executable/native-library bit parity.
27
+
28
+ The final 96 world fixtures execute 6717→6575 with actual 276433/276586/276505/69386/36717/62944, covering absent/colliding classes, missing/multiple/capped/self targets, random-state sharing and two entity-to-player pointers. Independent policy tests verify final world/client state and mutation scope. Rust composes the recovered policies and applies placement to an already-resolved mutable player. Fallback 168114 view writes are supplied; raw pointer legality, respawn and runtime behavior remain outside these finite layouts.
29
+
30
+ ## Toolchain and validation
31
+
32
+ The repository had no flake. RE-860 adds pinned Python/Rust/Cargo development dependencies for macOS/Linux and sets an absolute Nix-store `PYTHON`. After the user's toolchain instruction, research and xtask commands use the flake-provided Python 3.13.15. The Git hooks were subsequently audited in RE-863 and changed from bare python3 to requiring the Nix `PYTHON`; they fail with guidance when it is missing or points outside the Nix store. Remaining commit/push operations run inside that shell.
33
+
34
+ The shell was evaluated from an identical temporary copy of flake.nix/flake.lock to avoid copying asset/cache payloads into the Nix store. Four platform shell outputs evaluate; actual runtime validation here is on the host. Use `nix develop --command cargo xtask test-group <name>` or enter `nix develop` first. New focused groups are `entity-hash`, `rust-entity-hash`, `entity-field`, `rust-entity-field`, `target-pick`, `rust-target-pick`, `camera-angles`, `rust-camera-angles`, `camera-world` and `rust-camera-world`. Use `storage` for hook/storage checks.
35
+
36
+ Each task passed focused xtask checks before its own commit. Registry regression verifies all five source-report parity dependencies, camera_world module selection and transition-module composition dependency. The single full-suite run after commit ten, `cargo xtask test-full --since cedc6d02`, passed inside the flake shell: 1,688 Python tests and 157 Rust tests (assets 10, gameplay 119, xtask 28). All 51 affected report producers regenerated twice deterministically with the explicit Nix-store Python3.13.15. Storage policy, 425 documentation files and whitespace checks passed. No generated reports changed. Validation notes were amended into task ten.
37
+
38
+ ## Next work: RE-864
39
+
40
+ - [ ] Recover 168114 fallback spawn/view selection and compare actual native atan2/sqrt libraries and edge domains.
41
+ - [ ] Compose camera world setup into begin-intermission with actual 175123 respawn and 156523 slow setup; broaden alias/entity ownership fixtures.
42
+ - [ ] Recover next-map command children 122230/7188/249007 and 256248/256651, then execute complete 6939 from readiness.
43
+ - [ ] Recover 277165 allocation/initialization and integrate event construction with caller-owned fields, native linking and lifetime.
44
+ - [ ] Execute publication 6328, formatting/configstring/network work, and integrate ranking→intermission→camera/map/event→scoreboard state.
45
+ - [ ] Continue legacy tracer audits and validate actual macOS/Linux Bevy/Solari gameplay/rendering. Full-game completion remains open.
docs/research/README.md CHANGED
@@ -1182,3 +1182,8 @@ The extension collector adds five focused tests for native tail calls, command-r
1182
 
1183
 
1184
  [RE-862: Original camera world composition with recovered searches and angles](QVM_CAMERA_WORLD.md).
 
 
 
 
 
 
1182
 
1183
 
1184
  [RE-862: Original camera world composition with recovered searches and angles](QVM_CAMERA_WORLD.md).
1185
+
1186
+
1187
+ [RE-863: Rust composed camera world selection and placement](RUST_CAMERA_WORLD.md).
1188
+
1189
+ - [RE-854–863 entity search and composed world camera batch](QVM_CAMERA_WORLD_BATCH.md).
docs/research/RUST_CAMERA_WORLD.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Rust composed camera world selection and placement
2
+
3
+ RE-863. Reproduce with `python3 scripts/analyze_rust_camera_world.py`; focused validation: `cargo xtask test-group rust-camera-world`. [Machine report](rust-camera-world.json).
4
+
5
+ Rust matches all96 composed source setup/placement fixtures across searches, actual RNG state transitions, checked angle-math transcripts and resolved player indirection. Fallible resolution stages RNG before committing it and performs placement only after success. Fallback selection and native math parity remain explicit boundaries; intermission/respawn/runtime integration is still open.
6
+
7
+ Original executable/native runtime and complete Linux/macOS Rust/Bevy/Solari acceptance remain unverified.
docs/research/rust-camera-world.json ADDED
The diff for this file is too large to render. See raw diff
 
docs/research/rust-health-impulse.json CHANGED
@@ -2985,7 +2985,7 @@
2985
  "exit_code": 2
2986
  }
2987
  ],
2988
- "rust_unit_tests": 117,
2989
  "source_report": "docs/research/qvm-health-impulse.json",
2990
  "source_report_sha256": "625fd8064004ea6dbdf398d51d0af844d9c635ff04c0a0790886dddb6ab81e71"
2991
  }
 
2985
  "exit_code": 2
2986
  }
2987
  ],
2988
+ "rust_unit_tests": 119,
2989
  "source_report": "docs/research/qvm-health-impulse.json",
2990
  "source_report_sha256": "625fd8064004ea6dbdf398d51d0af844d9c635ff04c0a0790886dddb6ab81e71"
2991
  }
scripts/analyze_rust_camera_world.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ import hashlib,json
3
+ from pathlib import Path
4
+ from rust_camera_world_support import binary,result,invoke
5
+ from analyze_qvm import write_json
6
+ from analyze_qvm_camera_world import scene
7
+ from rust_camera_world_support import blob
8
+ def encode(s):
9
+ a=s['input'];c,fallback=scene(a['layout'],a['profile']);values=[a['seed'],a['slot'],len(c),*fallback[0],*fallback[1]]
10
+ for e in c:values.extend([e['active'],e['name'],e['hash'],*e['origin'],*e['angles'],*blob(None if e['aim'] is None else e['aim'].hex()),*blob(None if e['label'] is None else e['label'].hex())])
11
+ values.append(len(s['math']))
12
+ for m in s['math']:values.extend([m['target'],m['arguments']['8'],m['arguments'].get('12',0),m['result']])
13
+ return values
14
+ def project(s):return {k:s[k] for k in ['class_index','target_index','rng_state','matches','diagnostic','effects','view','entity','clients']}
15
+
16
+ def main():
17
+ b=binary();p=Path('docs/research/qvm-camera-world.json');data=p.read_bytes();rows=[]
18
+ for s in json.loads(data)['probes']:rows.append({'source':project(s),'rust':result(b,'camera',encode(s))})
19
+ write_json(Path('docs/research/rust-camera-world.json'),{'source_report':str(p),'source_report_sha256':hashlib.sha256(data).hexdigest(),'probes':rows,'limits':'Rust matches all96 composed source setup/placement fixtures across searches, actual RNG state transitions, checked angle-math transcripts and resolved player indirection. Fallible resolution stages RNG before committing it and performs placement only after success. Fallback selection and native math parity remain explicit boundaries; intermission/respawn/runtime integration is still open.'})
20
+ if __name__=='__main__':main()
scripts/test_rust_camera_world.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import hashlib,json,unittest
2
+ from pathlib import Path
3
+ class PortTests(unittest.TestCase):
4
+ def test_all_original_cases(self):
5
+ r=json.loads(Path('docs/research/rust-camera-world.json').read_text());src=json.loads(Path(r['source_report']).read_text());self.assertEqual(len(r['probes']),len(src['probes']));self.assertGreater(len(r['probes']),20)
6
+ for p in r['probes']:self.assertEqual(p['rust'],p['source'])
7
+ def test_source_identity(self):
8
+ r=json.loads(Path('docs/research/rust-camera-world.json').read_text());self.assertEqual(hashlib.sha256(Path(r['source_report']).read_bytes()).hexdigest(),r['source_report_sha256'])
9
+ if __name__=='__main__':unittest.main()
xtask/checks.tsv CHANGED
@@ -2408,3 +2408,19 @@ report scripts/analyze_qvm_camera_world.py docs/research/qvm-camera-world.json
2408
  edge docs/research/qvm-camera-world.json scripts/test_qvm_camera_world.py
2409
  group camera-world scripts/analyze_qvm_camera_world.py
2410
  edge scripts/analyze_qvm_camera_world.py scripts/analyze_qvm_resumer_audit.py
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2408
  edge docs/research/qvm-camera-world.json scripts/test_qvm_camera_world.py
2409
  group camera-world scripts/analyze_qvm_camera_world.py
2410
  edge scripts/analyze_qvm_camera_world.py scripts/analyze_qvm_resumer_audit.py
2411
+ edge Cargo.toml scripts/analyze_rust_camera_world.py
2412
+ edge Cargo.lock scripts/analyze_rust_camera_world.py
2413
+ edge crates/urt-gameplay/Cargo.toml scripts/analyze_rust_camera_world.py
2414
+ edge crates/urt-gameplay/src/lib.rs scripts/analyze_rust_camera_world.py
2415
+ edge crates/urt-gameplay/src/camera_world.rs scripts/analyze_rust_camera_world.py
2416
+ edge crates/urt-gameplay/src/bin/urt-camera-world.rs scripts/analyze_rust_camera_world.py
2417
+ edge docs/research/qvm-camera-world.json scripts/analyze_rust_camera_world.py
2418
+ group rust-camera-world scripts/analyze_rust_health_impulse.py
2419
+ group gameplay scripts/analyze_rust_camera_world.py
2420
+ edge crates/urt-gameplay/src/transition.rs scripts/analyze_rust_camera_world.py
2421
+ report scripts/analyze_rust_camera_world.py docs/research/rust-camera-world.json
2422
+ edge docs/research/rust-camera-world.json scripts/test_rust_camera_world.py
2423
+ group rust-camera-world scripts/analyze_rust_camera_world.py
2424
+ edge scripts/analyze_rust_camera_world.py scripts/analyze_qvm_resumer_audit.py
2425
+ edge .githooks/pre-commit scripts/test_storage_policy.py
2426
+ edge .githooks/pre-push scripts/test_storage_policy.py
xtask/src/lib.rs CHANGED
@@ -1051,6 +1051,8 @@ mod integration_tests {
1051
  ("intermission", "intermission_flow"),
1052
  ("intermission", "nextmap_series"),
1053
  ("transition", "event_construct"),
 
 
1054
  ("leaderboard", "leaderboard"),
1055
  ("recipient_wire", "recipient_wire"),
1056
  ] {
@@ -1116,6 +1118,11 @@ mod integration_tests {
1116
  ("qvm-nextmap-series", "nextmap_series"),
1117
  ("qvm-nextmap-reset", "nextmap_reset"),
1118
  ("qvm-event-construct", "event_construct"),
 
 
 
 
 
1119
  ] {
1120
  let selected = plan(
1121
  &g,
 
1051
  ("intermission", "intermission_flow"),
1052
  ("intermission", "nextmap_series"),
1053
  ("transition", "event_construct"),
1054
+ ("transition", "camera_world"),
1055
+ ("camera_world", "camera_world"),
1056
  ("leaderboard", "leaderboard"),
1057
  ("recipient_wire", "recipient_wire"),
1058
  ] {
 
1118
  ("qvm-nextmap-series", "nextmap_series"),
1119
  ("qvm-nextmap-reset", "nextmap_reset"),
1120
  ("qvm-event-construct", "event_construct"),
1121
+ ("qvm-entity-hash", "entity_hash"),
1122
+ ("qvm-entity-field", "entity_field"),
1123
+ ("qvm-target-pick", "target_pick"),
1124
+ ("qvm-camera-angles", "camera_angles"),
1125
+ ("qvm-camera-world", "camera_world"),
1126
  ] {
1127
  let selected = plan(
1128
  &g,