Skip to content

ECS overview

insomni-ecs is a standalone Entity-Component-System for building simulations and data-driven scenes on top of the insomni renderer. It is independent of insomni-plot — plot compiles a declarative grammar straight into renderer layers and does not use ECS. Reach for insomni-ecs when you have many entities with per-frame behavior (agents, particles, physics) rather than a static chart spec.

  • World — owns entities and components, runs registered systems each step.
  • EntityManager — creates and recycles entity ids.
  • Components — typed Structure-of-Arrays storage; describe a component with a ComponentDescriptor and read/write it through dense column storage.
  • Query — iterates the entities that match a set of components, with without / any filters and incrementally-maintained membership.
  • System — a function run against matching entities every world.step(dt).
  • CommandBuffer — defers structural changes (spawn/despawn/attach) so they apply safely at a frame boundary.
  • ResourceMap — singleton, world-scoped state keyed by resourceKey.
  • uploadComponent — one-shot dirty-range upload of a component column into a GPU buffer for instanced draws.
  • Damage-tracked rendering — moving, pulsing, and highlighted entities drive the renderer’s automatic damage: "auto" partial-redraw detection.
  • Boids flocking — Reynolds cohesion / alignment / separation implemented as custom systems over hundreds of agents.