News for hackers. Stuff that matters.
Re:Flecs – A fast entity component system for C and C++ by throwaway894345 on Tuesday April 04, 2023 @09:25AM (#35439202)
I don’t have any intention of writing a game, but my lay understanding of ECS is that it sort of treats your world as an in-memory columnar database for better cache locality: if you’re updating the positions of a collection of entities, you only need to loop over a collection of contiguous `position` structs—you can get a lot more of these in a cache line than you would if the entire entity was a struct containing a position field among many other fields which are irrelevant to the updatePosition operation. How far off am I?
Re:Flecs – A fast entity component system for C and C++ by ajmmertens on Tuesday April 04, 2023 @10:46AM (#35440492)
Pretty close, but there's a bit more to it. This post goes over one way an ECS can store data: https://ajmmertens.medium.com/building-an-ecs-2-archetypes-a...