How a tick runs in parallel
mcrs runs work in parallel according to the data it reads and writes. This page explains how systems share the tick, how the entity motion pass uses a frozen body grid, and which guarantees the tests check today.
Systems that touch different data run together
Section titled “Systems that touch different data run together”mcrs is built on Bevy ECS, short for entity component system. In an ECS, behaviour is a set of functions called systems, and each system is one transformation over every entity that has the data it names. Bevy runs two systems at the same time when their data access does not overlap, so you write no lock for this. The Bevy scheduler finds the conflicts when it builds the schedule graph. The compiler does not check them.
System sets, which are named groups of systems, fix the order between the groups. The project also checks the schedule for ambiguity, as section 13 of the sharding design note describes. The tick is split into a few phases with few sync points.1
Entities read a frozen grid and write their own components
Section titled “Entities read a frozen grid and write their own components”One system can still have many entities to process. The motion pass splits its Bevy query into parallel batches:
- Before the pass, one owner system updates
BodyGrid, the spatial lookup of bodies grouped by tile. It applies the changes from the previous pass and edits made outside it. MotionStepusespar_iter_mutto step mobs, items and falling blocks. Each entity reads the grid and the blocks without changing them, and writes its own motion components.- The pass collects movers, grid edits, crowd damage candidates and expiries. Later systems consume these results; damage produced by this pass applies after it.
No entity reads another entity’s new motion state during the pass. The design note calls this Jacobi: all entities read the same frozen grid while computing their own next state. Tiles group spatial data and replication interest; they do not hold authoritative mob rows.
Players are Bevy entities too. The AI builds a player table from their components, and the player publisher queries those components to produce tile events. Such tables and body rows are projections for a consumer, not another player entity or another health model. Player movement uses a separate path from MotionStep.
Hits have two apply points
Section titled “Hits have two apply points”Packet and command hits apply before simulation so knockback can affect the same tick’s motion; hits produced by motion apply afterward. Each batch has its own ordering policy, filter and report sets, described in Handle damage, death and respawn.23
The result is the same on any thread count
Section titled “The result is the same on any thread count”The checks below compare runs of the same scene with different thread counts; they do not prove that every subsystem is identical across architectures.
The project sorts determinism into three tiers:4
| Tier | Guarantee | Where it applies |
|---|---|---|
| Exact | The result equals the reference | World generation, the arithmetic of player movement, anything rolled from a seed stored in the save |
| Independent of the scheduler | The same inputs give the same tick regardless of thread order | Everything else |
| Free | Any order is allowed | Entities and systems that share no written data |
Two checks hold this today. The first is the test tick_determinism.rs. It ticks a world of two cells for 46 ticks, or for 60 ticks in the full test profile, once with every world inline on one thread and once with threads. It hashes selected section, column, light, block-entity and player-position state after every tick and fails at the first tick where the hashes differ.
fn assert_threads_do_not_change_the_world(ticks: usize) { let inline = run(Placement::Inline, ticks); let threads = run(Placement::Thread, ticks); assert_eq!( first_divergence(&inline, &threads), None, "the threads diverge from Inline at the tick shown (the last entry holds the blocks)" );}crates/mcrs_minecraft_server/tests/it/tick_determinism.rs:254-262
Run the hash check yourself
Section titled “Run the hash check yourself”The second check is an example in the physics crate. It builds a benchmark scene of 50 000 walkers and 50 000 items on 32 x 32 tiles and prints a hash of the scene after N ticks:
cargo run --release -p mcrs_minecraft_engine_physics --example state_hash -- <threads> <ticks>Run it with 1 thread and then with 8 threads, and the hash at the end of the line is the same. The example also prints the architecture, so you can compare two machines. The code is short:
fn main() { let mut arguments = std::env::args().skip(1); let threads: usize = arguments.next().unwrap().parse().unwrap(); let ticks: u32 = arguments.next().unwrap().parse().unwrap(); ComputeTaskPool::get_or_init(|| TaskPoolBuilder::new().num_threads(threads).build()); let mut scene = TestScene::new(16, 50_000, 50_000, 11); for _ in 0..ticks { scene.step(); }crates/mcrs_minecraft_engine_physics/examples/state_hash.rs:15-23
The example checks the design and makes no claim about speed. It needs a nightly toolchain and is not part of the install guide, which is WIP.
What is parallel today and what is a goal
Section titled “What is parallel today and what is a goal”| Area | State |
|---|---|
| Parallel motion query with a frozen body grid, hash equal across thread counts | in the code, covered by the example above |
| Cells of one world ticking at the same time with halo exchange | in the code, covered by tick_determinism.rs |
| Lighting and world generation on threads of their own, applied at a tick boundary | in the code |
| Block simulation: scheduled ticks, block updates, shards | partly: kernels exist, shards that merge and split are WIP#160 |
| Redstone | not started: WIP#190 |
| One dimension on many machines | goal: WIP#181 |
The ECS lint driver’s checks and limits are described in Repository checks.
Rest skips the full physics step
Section titled “Rest skips the full physics step”The project’s direction is work proportional to change.6 The motion query still visits its entities, but rest can skip the full physics step until motion or nearby blocks change. A hit or an attribute edit can wake a resting mob. Mob AI uses waits for decisions, and damage counters have an explicit work set. These skips reduce work; they do not make every resting entity free.
Two costs are not measured yet: an idle server tick and the memory per section.78
Next: Cells and the road to many nodes.
Footnotes
Section titled “Footnotes”-
Works#364 The decision that the tick runs in phases with few sync points. ↩
-
Works#1078 Adds the sorted damage step, mob defence and health replication for resting mobs. ↩
-
Works#1106 Adds pre-motion packet damage. ↩
-
Works#367 The decision that defines the three tiers of determinism. ↩
-
WIP#190 Tracks redstone circuits that behave as in vanilla. ↩
-
Works#365 The decision that work is proportional to change. ↩
-
WIP#324 Tracks fixed component sizes and a count of section memory. ↩
Sources and verification
Verified: 26.4-snapshot-7, 1cf84286c, 2026-11-30
- docs/physics-architecture.md
- docs/minecraft-bevy-sharding-architecture.md
- crates/mcrs_minecraft_server/tests/it/tick_determinism.rs
- crates/mcrs_minecraft_engine_physics/examples/state_hash.rs
- crates/mcrs_minecraft_engine_entity_motion/src/lib.rs
- crates/mcrs_minecraft_engine_entity_motion/src/motion_step.rs
- crates/mcrs_minecraft_engine_entity_motion/src/body_grid_owner.rs
- crates/mcrs_minecraft_engine_physics/src/entity_motion_plugin.rs
- crates/mcrs_minecraft_engine_physics/src/test_scene.rs
- crates/mcrs_minecraft_engine_damage/src/damage_plugin.rs
- crates/mcrs_minecraft_engine_damage/src/apply_hits.rs
- crates/mcrs_minecraft_engine_damage/src/tick_vitals.rs
- crates/mcrs_minecraft_engine_brain/src/player_table.rs
- crates/mcrs_minecraft_engine_brain/src/mob_brain_plugin.rs
- crates/mcrs_minecraft_engine_player/src/publish_player_tiles.rs
- crates/mcrs_minecraft_engine_host/src/dim_tick.rs
- crates/mcrs_minecraft_engine_mob_attributes/src/mob_defence.rs
- crates/mcrs_minecraft_engine_mob_attributes/src/project_motion.rs
- crates/mcrs_minecraft_damage/src/hurt.rs
- crates/mcrs_minecraft_engine_entity_motion_replication/src/mob_news.rs
- PR #1078
- PR #1106
- docs/lag-compensation.md
- crates/mcrs_minecraft_network/src/play_pings.rs
- crates/mcrs_minecraft_server/tests/it/player_attack.rs
- crates/mcrs_minecraft_engine_shared/src/bus.rs
- crates/mcrs_minecraft_engine_edge/src/dim_inputs.rs
- issue #367
- issue #364
- issue #181
- issue #190
- issue #160
- issue #365
- issue #320
- issue #324
- crates/mcrs_minecraft_command_engine/src/plugin.rs
- crates/mcrs_minecraft_command_engine/src/executor.rs
- crates/mcrs_minecraft_command_vanilla/src/mob_hit.rs
Related open issues:
- #153 WIP Shards own the block simulation queues: scheduled ticks, block events and the insertion sequence
- #160 WIP Shards form, merge and split from causally connected work and run in parallel
- #181 WIP Direction: one dimension on many nodes for thousands of players
- #190 WIP Redstone circuits behave as in vanilla
- #1110 WIP refactor(engine): versioned global state and one edit path for dimension sub-apps; one player list type
- #1180 WIP Tick systems read the wall clock through column streams and the bridge