Comment

Comment by cepacked

In a context where you have thousands of entities, it's very rare that you'll loop all over them from 0 to N. In such context entities are always partitioned in space. You interact with one entity and you update the entities around it. For which you'll query the spatial partition to get list of entities around, and they won't be contigious in memory.

You may have one loop to update all entities but that's it. And will you even update all of them ? What about the ones that are not visible ? Maybe you want to update only the visible ones .. in that case you query the partition to get the ones visible around your camera

So practically you never query the ecs registry to loop over all of them

parent cepacked 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton