Skip to content
Systems & Schedules
step 1/5

Reading — step 1 of 5

Read

~1 min readEntity-Component System

Systems & Schedules

Systems are functions operating on entities with specific components. Run each frame.

python

Game loop:

python

System order matters:

  • Physics before render: render the new positions.
  • Input before physics: act on this frame's input.
  • AI before physics: AI sets velocities, physics moves.

Schedules:

  • Group systems by phase (Input, Update, PostUpdate, Render).
  • Bevy: stages, schedules, system sets.
  • Unity: Update, FixedUpdate, LateUpdate.

Parallelism:

  • Systems can run in parallel if they access different components.
  • Conflict: two systems writing same component → must serialize.
  • Bevy/ECS frameworks compute the dependency graph + parallelize.

Events:

  • Systems communicate via events (mailbox).
  • Producer system writes to event queue.
  • Consumer system reads queue next frame.
python

Common events:

  • Collision: a hit b.
  • Damage: entity took N damage.
  • Spawn: create new entity.
  • Death: entity destroyed.

Decoupling: damage system doesn't care WHO damaged; just processes events.

Resources (singletons):

  • Time, input, asset registry.
  • Not per-entity; globally accessible.
python

Systems request resources by type. Framework provides.

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…