Online / 5 & 6 February 2022


Polymorph: a compile time approach to entity-component-systems in Nim

Queryless ECS: removing runtime overhead by orienting around systems

The entity-component-system pattern (ECS) is popular in game development for its ability to model complex dynamic simulations with mechanical sympathy, in an environment where microseconds matter.

The pattern is focused on run time composition. Entities are mutable sets of component data types, and systems run for entities with specific sets of components. Many ECS frameworks are oriented around components or entities, and systems use run time queries or filters to match their component data requirements against the live state.

In this talk, a system oriented ECS is presented which removes all run time work for systems by storing execution state in the systems themselves. Changing an entity's components leverages Nim's static typing and powerful AST macros to precalculate affected systems and generate pared down system state changes.

The result is statically defined and intrinsically optimised to the user's system/component design, allowing efficient embedded event loops through to complex interactive simulations.


Ryan Lipscombe