Hacker News new | ask | show | jobs
by ah- 2678 days ago
Sadly the article doesn't mention how ECS typically solve the "holes" problem, where your arrays might be quite sparse which leads to inefficiency.

Do you happen to know how that's usually done?

2 comments

Yeah, I'm the author of EnTT C++ ECS (https://github.com/skypjack/entt) and I can guarantee you there are no holes there. :-) The next post (part 2 of the series) will be more or less all about this point. I hope to publish it as soon as possible. The idea is exactly to guide the reader through different models, from the easiest to implement to the ones that are probably hardest to develop but have no holes, perfect matches, higher performance and so on. Stay tuned.
In my ECS I do this by storing the actual data in a dense array, alongside a hash that maps entity IDs to array indexes.

If you want to see the (javascript) innards: https://github.com/andyhall/ent-comp