feat(stress): add a deterministic particle demo with sequenced music

Move Storm Eagle playback and source assets to Stress Console and keep Dummy Boy silent. Exercise VM math, seeded Random and persistent typed particles with a projected tunnel, bounded 512-sprite heavy workload, reproducible replays and measured costs.
This commit is contained in:
2026-11-20 22:15:47 +00:00
parent 8510c5b00d
commit c2bf8d055c
42 changed files with 20688 additions and 232 deletions
@@ -0,0 +1,82 @@
use pbxgen_stress::{Preset, DEFAULT_SEED};
use prometeu_host_headless::{AdvanceFrameOutcome, HeadlessHost};
use std::path::PathBuf;
struct Cart(PathBuf);
impl Cart {
fn new(seed: i64) -> Self {
let unique =
std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_nanos();
let path =
std::env::temp_dir().join(format!("prometeu-demo-{}-{unique}", std::process::id()));
pbxgen_stress::generate_with(Preset::Normal, seed, Some(path.clone())).unwrap();
Self(path)
}
fn boot(&self) -> HeadlessHost {
let mut h = HeadlessHost::new();
h.boot(self.0.to_string_lossy()).unwrap();
h
}
}
impl Drop for Cart {
fn drop(&mut self) {
let _ = std::fs::remove_dir_all(&self.0);
}
}
fn advance(h: &mut HeadlessHost) -> Vec<u32> {
assert!(matches!(h.advance_frame().unwrap(), AdvanceFrameOutcome::FrameCompleted { .. }));
assert!(h.get_fault().is_none());
h.capture_frame().unwrap().frame.pixels
}
fn hash(v: &[u32]) -> u64 {
v.iter().fold(14695981039346656037, |h, &p| (h ^ u64::from(p)).wrapping_mul(1099511628211))
}
#[test]
fn native_visual_replay_seed_and_pause_resume() {
let cart = Cart::new(DEFAULT_SEED);
let other = Cart::new(DEFAULT_SEED + 1);
let mut a = cart.boot();
let mut b = cart.boot();
let mut changed = other.boot();
let mut last = vec![];
let mut hashes = vec![];
for frame in 0..6 {
let actual = advance(&mut a);
let expected = advance(&mut b);
assert_eq!(actual, expected);
assert_ne!(actual, last);
hashes.push(hash(&actual));
if frame == 0 {
assert_ne!(actual, advance(&mut changed));
}
// Explicit pause freezes audio and does not alter the displayed guest state.
a.resume().unwrap();
a.pause().unwrap();
let before = a.audio_diagnostics().frames;
let mut silence = [1.0; 1600];
a.render_audio(&mut silence);
assert_eq!(silence, [0.0; 1600]);
assert_eq!(a.audio_diagnostics().frames, before);
assert_eq!(a.capture_frame().unwrap().frame.pixels, actual);
a.resume().unwrap();
b.resume().unwrap();
let mut left = [0.0; 1600];
let mut right = [0.0; 1600];
a.render_audio(&mut left);
b.render_audio(&mut right);
assert_eq!(left, right);
last = actual;
}
assert!(a.audio_diagnostics().maximum_voices > 0);
println!("visual_hashes={hashes:?}");
assert_eq!(
hashes,
[
509059057377717011,
11639740206223880472,
10144685766373560685,
12298401095609708800,
8400916329250932746,
12687665705214954737
]
);
}