Skip to main content

Module flow

Module flow 

Source
Expand description

Flow — the typed interface between Data and Lanes.

A Flow is a per-domain, read-only presenter of the World. It runs every tick during the Substrate Pass (before Lanes execute) in two steps:

  1. select (read-only) — picks the entities relevant for this domain.
  2. project (read-only) — builds a typed View published into the LaneBus. Lanes consume the view; they never query the World directly.

A Flow never mutates the World. Representation adaptation (AGDF memory layout) is the Data layer’s own self-maintenance; semantic / gameplay mutation is developer-authored (an opt-in DataSystem), never automatic here. See .agent/rules.mdadapt the HOW, never the WHAT.

Each domain (Render, UI, Physics, Audio, Shadow, …) defines its own Flow implementation. Adding a new domain costs one registration:

inventory::submit! {
    khora_data::flow::FlowRegistration {
        name: MyFlow::NAME,
        domain: MyFlow::DOMAIN,
        run: my_flow_runner_trampoline,
    }
}

Re-exports§

pub use audio::AudioFlow;
pub use audio::AudioPlaybackUpdate;
pub use audio::AudioPlaybackWriteback;
pub use audio::AudioSourceSnapshot;
pub use audio::AudioView;
pub use physics::PhysicsFlow;
pub use physics::PhysicsStepResult;
pub use physics::PhysicsView;
pub use render::RenderFlow;
pub use shadow::ShadowFlow;
pub use shadow::ShadowMatrices;
pub use shadow::ShadowView;
pub use ui::UiFlow;

Modules§

audio
AudioFlow — projects the ECS audio domain into a per-tick AudioView consumed by SpatialMixingLane.
physics
PhysicsFlow — read-only projection of the physics domain.
render
RenderFlow — projects the ECS World into a RenderWorld for the render lanes to consume from the LaneBus.
shadow
ShadowFlow — derives, per shadow-casting light, the view-projection matrix the shadow pass will use to render its depth slice.
ui
UiFlow — projects UI ECS data + text layout into a per-frame UiScene published into the LaneBus.

Macros§

register_flow
Convenience macro for declaring a Flow registration with the standard trampoline (single static instance, no per-frame allocation).

Structs§

FlowRegistration
Registration entry for a Flow — submitted by each concrete Flow implementation via inventory::submit!.
Selection
A snapshot of entities selected by a Flow for the current tick.

Traits§

Flow
The typed interface between the Data layer and Lanes.

Functions§

combine_cache_key
Folds an ordered sequence of cache-key ingredients (domain epochs, bit-level hashes of runtime state, the World instance id) into a single u64 via the std hasher. Deterministic within a process, which is all a per-process view cache needs.
run_flow_cached
One Substrate-Pass execution of flow, with view-cache support. This is the body of the [register_flow!] trampoline, extracted so the caching behaviour is a single, directly testable code path.