LastOliveGames / becsy

A multithreaded Entity Component System (ECS) for TypeScript and JavaScript, inspired by ECSY and bitecs.
MIT License
196 stars 17 forks source link

why use sparse set rather than archetype? #26

Closed yafacex closed 9 months ago

yafacex commented 9 months ago

I'm new to ecs.Why use sparse set rather than archetype?I dont know the benefit of sparse set.

pkaminski commented 9 months ago

I think you can find plenty of articles on the trade-offs between the two architectures. For Becsy in particular, I wanted all the data structures to be compatible with a lockless multithreading strategy and saw a clear way forward with sparse sets so just went with that. That's not to say that you couldn't do it with archetypes too but I just didn't see how.