Skip to content

Instantly share code, notes, and snippets.

@dakom
dakom / ECS notes.md
Last active April 19, 2025 05:00
ECS with sparse array notes (EnTT style)

Intro

The below is a breakdown / bird's eye view of how a sparse-array backed ECS like EnTT or Shipyard works.

Please see the thanks and references at the bottom - without their help I would not have been able to share this breakdown with you... everything here is really just notes and rephrasing of what they've written already :)

Also, these notes do not cover archetype systems (like unity) nor adaptations of archetypes (like in Flecs). Though there's a couple comparative footnotes at the end.

Here we go!

use std::num::Wrapping;
use bincode::{Encode, Decode};
// Time is monotonic time (OS ticks) not clock time. The difference is precision vs accuracy.
// clock time can have huge variances, be different by over 100ms even when queried within a few ms of each other. Accurate but not precise.
// OS ticks are very precise over short intervals. But can drift very quickly over longer periods.
// We consume snapshots in sequence order, possibly skipping missing sequences.
// The interpolation state time represents our progression through the server timeline. Our server timeline is based on received snapshots. We advance through this timeline using local delta time.