Hacker News new | ask | show | jobs
by ratww 1587 days ago
ECS is sort of an in-memory database. The rock is not a class in the code: it's just an entity in the game that has X, Y and Z components "attached" to it, dynamically. Components are just structs. And finally Systems are just functions that runs once-per-frame doing something on entities that have a certain components on them. Normally, entities/components are serialised into some format so it's not static in the code.

The advantage of this is that this requires less code, permits very good separation of concerns and is very transferrable even between engines. Unity, for example, uses something similar where components and systems are in the same class together. For self-coded games, there's several libraries too.