//! Background worker infrastructure (#843 Part C). //! //! Generic thread pool for off-tick computation. Workers run on dedicated //! threads, separate from the Bevy tick loop. The tick loop pushes requests //! (non-blocking) and polls for results (non-blocking). //! //! Each worker type is a Bevy `Resource` wrapping a typed `BackgroundWorkerPool`. //! Systems in `TickPhase::PreInput` poll results; systems in `TickPhase::PostSnapshot` //! push new requests. //! //! ## Determinism (D-010) //! //! Workers preserve determinism through request-at-tick, deliver-complete: //! - Inputs come from the deterministic tick loop (same seed → same requests) //! - Outputs are deterministic per input (seeded RNG, no external state) //! - The tick loop never incorporates partial results //! - The only non-deterministic part is latency (when results arrive) //! //! ## Delivery strategies //! //! Each request declares how the tick loop handles a not-yet-ready result: //! - `Fallback`: use default/cached value, player never waits //! - `GracefulDegrade`: area loads partially, elements pop in when ready //! - `ModalLock`: tick loop pauses until result arrives (rare, diegetic UI) pub mod pool; pub mod stubs; pub mod systems;