Expand description
Murk: a world simulation engine for reinforcement learning and real-time applications.
This is the top-level facade crate that re-exports the public API from all
Murk sub-crates. For most users, adding murk as a single dependency is
sufficient.
§Quick start
use murk::prelude::*;
use murk::space::Square4;
// A minimal propagator that fills a field with zeros.
struct ZeroFill;
impl Propagator for ZeroFill {
fn name(&self) -> &str { "zero_fill" }
fn reads(&self) -> murk::types::FieldSet { murk::types::FieldSet::empty() }
fn writes(&self) -> Vec<(FieldId, WriteMode)> {
vec![(FieldId(0), WriteMode::Full)]
}
fn step(&self, ctx: &mut StepContext<'_>) -> Result<(), PropagatorError> {
ctx.writes().write(FieldId(0)).unwrap().fill(0.0);
Ok(())
}
}
// Build a 16×16 grid world.
let space = Square4::new(16, 16, EdgeBehavior::Absorb).unwrap();
let fields = vec![FieldDef {
name: "heat".into(),
field_type: FieldType::Scalar,
mutability: FieldMutability::PerTick,
units: None,
bounds: None,
boundary_behavior: BoundaryBehavior::Clamp,
}];
let config = WorldConfig {
space: Box::new(space),
fields,
propagators: vec![Box::new(ZeroFill)],
dt: 0.1,
seed: 42,
ring_buffer_size: 8,
max_ingress_queue: 64,
tick_rate_hz: None,
backoff: Default::default(),
};
let mut world = LockstepWorld::new(config).unwrap();
let result = world.step_sync(vec![]).unwrap();
assert_eq!(result.snapshot.tick_id(), murk::types::TickId(1));§Modules
Each module corresponds to a sub-crate. Use them for types not in the prelude:
| Module | Sub-crate | Contents |
|---|---|---|
types | murk-core | IDs, field definitions, commands, core traits |
space | murk-space | Spatial backends and region planning |
propagator | murk-propagator | Propagator trait and pipeline validation |
propagators | murk-propagators | Reference propagators (diffusion, agents, reward) |
obs | murk-obs | Observation specification and tensor extraction |
engine | murk-engine | Simulation engines (lockstep and realtime-async) |
replay | murk-replay | Deterministic replay recording and verification |
Re-exports§
pub use murk_core as types;pub use murk_space as space;pub use murk_propagator as propagator;pub use murk_propagators as propagators;pub use murk_obs as obs;pub use murk_engine as engine;pub use murk_replay as replay;
Modules§
- prelude
- Common imports for typical Murk usage.