Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
bevy-parity runs headless: the Bevy examples open no window
shinyobjectzc1acc96d8de7
diff --git a/bench/bevy-parity/build.rs b/bench/bevy-parity/build.rsindex b45de48c..13498f55 100644--- a/bench/bevy-parity/build.rs+++ b/bench/bevy-parity/build.rs@@ -42,6 +42,8 @@ fn main() {// the example is a module of the host, so its crate root is that module.replace("use crate::", "use self::").replace("App::new()", "crate::parity_app()")+ // DefaultPlugins without a window when headless (crate::plugins)+ .replace("DefaultPlugins", "crate::plugins(DefaultPlugins)").replace("\nfn main()", "\npub fn main()");// an example drawing from an unseeded rng draws differently every run (two runs of many_lights: SSIM 0.58), so// its draws are made a fixed sequence its port computes the same way: the n-th light's hue the golden anglediff --git a/bench/bevy-parity/src/main.rs b/bench/bevy-parity/src/main.rsindex c97321c7..2541f05d 100644--- a/bench/bevy-parity/src/main.rs+++ b/bench/bevy-parity/src/main.rs@@ -12,9 +12,19 @@ pub fn parity_app() -> App {let fps = std::env::var("RAEA_PARITY_FPS").ok().and_then(|f| f.parse().ok()).unwrap_or(60.0);raea_sys_parity::fixed_clock(&mut app, fps);raea_sys_parity::install(&mut app);+ if raea_sys_parity::headless() {+ app.set_runner(raea_sys_parity::run);+ }app}+/// The example's DefaultPlugins, without WinitPlugin when it runs headless (raea_sys_parity::headless): no window+/// opens, and the window's cameras draw into the probe's offscreen image as they do with one.+pub fn plugins(g: impl PluginGroup) -> bevy::app::PluginGroupBuilder {+ let g = g.build();+ if raea_sys_parity::headless() { g.disable::<bevy::winit::WinitPlugin>().add_after::<bevy::winit::WinitPlugin>(raea_sys_parity::Reserve) } else { g }+}+fn main() {let ex = std::env::var("RAEA_PARITY_EXAMPLE").unwrap_or_default();if !run(&ex) {diff --git a/systems/parity/src/lib.rs b/systems/parity/src/lib.rsindex 399c9372..0ca29b10 100644--- a/systems/parity/src/lib.rs+++ b/systems/parity/src/lib.rs@@ -9,6 +9,7 @@//! RAEA_PARITY_TYPES=A,B also each listed Bevy type's value on every entity that has it, reflected as Bevy//! serializes it, one line a probed frame in FILE.world.jsonl (FC0c's defaults test)//! RAEA_PARITY_INPUT=FILE scripted input, the script `raea play --input-script` takes (input.rs)+//! RAEA_PARITY_WINDOW=1 with RAEA_PARITY_PNG, open the example's window to watch it (headless otherwise: `headless`)//!//! A line holds what decides a frame's cost, read from the main World://! entities every entity@@ -280,3 +281,57 @@ fn dump(world: &mut World) {let _ = writeln!(file, "{}", serde_json::json!({"frame": f, "world": by_type}));}}++/// Whether the example runs with no window (the host's DefaultPlugins without WinitPlugin, `run` its loop): whenever+/// its pictures are taken (RAEA_PARITY_PNG), unless RAEA_PARITY_WINDOW=1 asks to watch it. They come from the+/// offscreen image either way; a window per example took over the Mac while a suite ran (2026-11-08).+pub fn headless() -> bool {+ std::env::var("RAEA_PARITY_PNG").is_ok() && !std::env::var("RAEA_PARITY_WINDOW").is_ok_and(|v| v == "1")+}++/// The headless App's loop, as Bevy's ScheduleRunnerPlugin runs one with no wait: updates until it exits.+pub fn run(mut app: App) -> AppExit {+ if app.plugins_state() != bevy::app::PluginsState::Cleaned {+ while app.plugins_state() == bevy::app::PluginsState::Adding {+ bevy::tasks::tick_global_task_pools_on_main_thread();+ }+ app.finish();+ app.cleanup();+ }+ loop {+ app.update();+ if let Some(exit) = app.should_exit() {+ return exit;+ }+ }+}++/// How many entities WinitPlugin's window makes before an example's Startup: its observers and the like, and a+/// Monitor for this Mac's display. 462 against 451 at frame 10 in scrollbars, image_node_resizing and split_screen.+const WINIT_ENTITIES: usize = 11;++/// In place of WinitPlugin when headless, as many empty entities as it makes, so the example's own entities get the+/// indices they get with a window. A port matches some by index (UI debug outlines' colours), and an index decides+/// ties in UI draw order (scrollbars' thumbs drew under the track without them). It also sends what winit says as+/// it makes the window (`created`).+pub struct Reserve;++impl Plugin for Reserve {+ fn build(&self, app: &mut App) {+ for _ in 0..WINIT_ENTITIES {+ app.world_mut().spawn_empty();+ }+ app.add_systems(First, created);+ }+}++/// What winit says of the primary window as it makes it, once, before the example's first Update reads it:+/// WindowCreated, then WindowResized to its logical size (split_screen lays its four viewports out on that resize).+fn created(mut done: Local<bool>, windows: Query<(Entity, &Window), With<bevy::window::PrimaryWindow>>, mut made: MessageWriter<bevy::window::WindowCreated>, mut resized: MessageWriter<bevy::window::WindowResized>) {+ let Ok((e, w)) = windows.single() else { return };+ if std::mem::replace(&mut *done, true) {+ return;+ }+ made.write(bevy::window::WindowCreated { window: e });+ resized.write(bevy::window::WindowResized { window: e, width: w.width(), height: w.height() });+}