Skip to main content

SimulationService

Struct SimulationService 

Source
pub struct SimulationService {
Show 38 fields pub scene: GameObjectScene, pub kernel: Option<CausalComputeKernel>, pub encoder: Option<CausalEngineEncoder>, pub bridge: Option<QuantumBridge>, pub last_bridge_packet: Option<BridgePacket>, pub decoherence: Option<Decoherence>, pub oracle: Option<Oracle>, pub decoherence_fields: Vec<DecoherenceField>, pub last_result: Option<KernelResult>, pub last_descriptor: Option<SuperBodyFrameDescriptor>, pub player_object_id: u64, pub particle_offsets: Vec<[f32; 3]>, pub observer: SuperpositionObserver, pub journal: Vec<SimulationJournalEntry>, pub console: Vec<String>, pub mode: SimulationMode, pub readiness: RuntimeReadiness, pub frame: u64, pub tick: u64, pub quantum_cull_radius: f32, pub elapsed_time: f32, pub gate: Option<DreamGate>, pub limiter: Option<LoomLimiter>, pub budgeter: Option<LoomBudgeter>, pub ledger_rx: Option<LedgerLaneReceiver>, pub causal_observer_rx: Option<CausalObserverLaneReceiver>, pub causal_observer_tx: Option<CausalObserverLaneSender>, pub active_zone_index: usize, pub metaphor_profile: MetaphorProfile, pub active_particle_count: f32, pub coherence_target: f32, pub coherence_current: f32, pub gather_active: bool, pub emit_strength: f32, pub universe_snapshot_rx: Option<Receiver<FieldSnapshot>>, pub universe_update_tx: Option<Sender<ClientUpdate>>, pub universe_client_id: u64, pub universe_connected: bool,
}
Expand description

SimulationService — the DreamRealityContainer.

Fields§

§scene: GameObjectScene

Active scene objects.

§kernel: Option<CausalComputeKernel>

CausalComputeKernel — synced from encoder for collision/POI checks.

§encoder: Option<CausalEngineEncoder>

CausalEngineEncoder — authoritative encode boundary (wraps SuperBodyController → Kernel).

§bridge: Option<QuantumBridge>

QuantumBridge — formal CPU→GPU transfer with DreamMemory + SacredSeal.

§last_bridge_packet: Option<BridgePacket>

Last bridge packet for decoder path (app.rs consumes this).

§decoherence: Option<Decoherence>

SDK Decoherence facade (input → Weave → Oracle).

§oracle: Option<Oracle>

Oracle — SacredPath validation + BLAKE3 attestation router.

§decoherence_fields: Vec<DecoherenceField>

Spatial decoherence zones from scene tags.

§last_result: Option<KernelResult>

Last kernel tick result for rendering.

§last_descriptor: Option<SuperBodyFrameDescriptor>

Last SuperBody frame descriptor for GPU upload (backward compat).

§player_object_id: u64

Player entity ID (CanonicalObserverObject).

§particle_offsets: Vec<[f32; 3]>

Pre-computed sphere offsets for particle particles.

§observer: SuperpositionObserver

Observer context for quantum culling.

§journal: Vec<SimulationJournalEntry>

Session journal.

§console: Vec<String>

Console messages (for UI display).

§mode: SimulationMode

Simulation mode.

§readiness: RuntimeReadiness

Readiness signal — input is gated on this.

§frame: u64

Current frame index.

§tick: u64

Total ticks processed.

§quantum_cull_radius: f32

Quantum cull radius in meters.

§elapsed_time: f32

Accumulated elapsed time in seconds.

§gate: Option<DreamGate>

DreamGate — high-throughput Weave validation and dispatch.

§limiter: Option<LoomLimiter>

LoomLimiter — per-frame mutation rate limiting.

§budgeter: Option<LoomBudgeter>

LoomBudgeter — hardware-derived resource budgets.

§ledger_rx: Option<LedgerLaneReceiver>

LedgerLane receiver for cold-path draining.

§causal_observer_rx: Option<CausalObserverLaneReceiver>

CausalObserverLane receiver for GPU frame cold-path draining.

§causal_observer_tx: Option<CausalObserverLaneSender>

CausalObserverLane sender (stored here for wiring to renderer).

§active_zone_index: usize

Active topology layer index (0-9).

§metaphor_profile: MetaphorProfile

Metaphor profile for the bridge evaluator.

§active_particle_count: f32

Active particle count (decremented by POI siphon, regenerated over time).

§coherence_target: f32

Form coherence target: 1.0=Cohere (fibonacci), 0.0=Wave (sinusoidal). TAB cycles.

§coherence_current: f32

Current coherence — smooth-lerped toward target (0.5s transition).

§gather_active: bool

Gather mode active (Ctrl held).

§emit_strength: f32

Primary action emit strength [0,1].

§universe_snapshot_rx: Option<Receiver<FieldSnapshot>>

Universe connection: snapshot receiver (from QuantumServer).

§universe_update_tx: Option<Sender<ClientUpdate>>

Universe connection: update sender (to QuantumServer).

§universe_client_id: u64

Universe client ID.

§universe_connected: bool

Whether universe is connected.

Implementations§

Source§

impl SimulationService

Source

pub const DEFAULT_QUANTUM_CULL_RADIUS: f32 = 9.14

Default quantum cull radius: 9.14m (30ft).

Source

pub fn new(scene_name: &str, mode: SimulationMode) -> Self

Create a new simulation service.

Source

pub fn input_enabled(&self) -> bool

Whether input is enabled. Requires encoder (authoritative pipeline).

Source

pub fn connect_universe(&mut self) -> Sender<()>

Connect to a universe server (spawns background kernel thread). Returns the shutdown sender so the caller can stop the universe.

Source

pub fn set_coherence_target(&mut self, t: f32)

Set form coherence target. 1.0=Cohere, 0.0=Wave.

Source

pub fn set_gather(&mut self, active: bool)

Set gather mode.

Source

pub fn set_emit_strength(&mut self, s: f32)

Set primary action emit strength.

Source

pub fn initialize( &mut self, scene: GameObjectScene, spawn_pos: [f32; 3], particle_count: u32, ) -> Result<(), String>

Initialize the simulation from a scene and spawn position. Runs the 7-step initialization sequence with CausalComputeKernel + SDK Decoherence.

Returns Ok(()) if all steps pass, Err with failure description.

Source

pub fn tick(&mut self, packet: &InputPacket) -> Option<KernelResult>

Process one simulation tick via single-encoder authority pipeline.

Round trip (THE_BRAIDED_PATH): (1) Build Input Weave → submit to DreamGate (2) Encoder tick (single authority: Encoder → SuperBody → Kernel → AttentionSolver) (3) Build Observation + Locomotion Weaves → submit to DreamGate (4) Gate dispatch: spindle → SacredPath → scene (5) Bridge: encode → GPU-ready BridgePacket (DreamMemory + SacredSeal)

Returns the KernelResult, or None if input is not enabled.

Source

pub fn check_collisions(&self, threshold: f32) -> Vec<(u64, f32)>

Check for collisions with isWall/isCollider objects within threshold.

Source

pub fn check_poi_proximity(&self, radius: f32) -> Vec<(u64, f32)>

Check POI proximity. Returns Vec of (object_id, distance).

Source

pub fn tick_poi_interactions(&mut self)

Check POI proximity and dispatch interaction weaves for nearby POIs.

Source

pub fn tick_collisions(&mut self)

Apply collision pushback from wall/collider objects.

Source

pub fn set_metaphor_profile(&mut self, profile: MetaphorProfile)

Set the active metaphor profile and propagate to the bridge evaluator.

Source

pub fn cycle_metaphor(&mut self) -> &'static str

Cycle to the next metaphor profile (Wave → Fibonacci → Stream → Wave). Returns the name of the newly active profile.

Source

pub fn end_session(&mut self)

End the simulation session.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WasmNotSend for T
where T: Send,