NSSTC / sim-ecs

Batteries included TypeScript ECS
https://nsstc.github.io/sim-ecs/
Mozilla Public License 2.0
84 stars 12 forks source link

Improve archetypes #11

Closed minecrawler closed 1 year ago

minecrawler commented 4 years ago

Instead of assigning entities to a system, they can be grouped by tag. Grouped entities should have similar components. Systems should then be assigned tags which they can iterate over.

This idea is taken from Legion, which chunks entities that way. Using tags will have the benefit that doing loose queries is way faster (as they query is compared against tags instead of iterating over all entities). In addition, systems might share tags, so that adding/removing components results in fewer query-comarisons.

The iteration-overhead will be slightly increased for systems, but I'd say that's minimal.

minecrawler commented 4 years ago

This already is kinda implemented, now that I implemented a clearer way systems work and interact with the world.

I would however improve the usage, so that at some point we have something like SPECS' dispatcher, which does not allow the addition of new systems, so that we could use the systems defined directly as archetypes, or move archetype storages to this "closed world", so that multiple systems with the same archetype only need to be sorted once and take up less memory for information management.

minecrawler commented 1 year ago

scratched, but separated the world and now have a cleaner architecture.