Hacker News new | ask | show | jobs
by gravypod 1639 days ago
ECS is less about access patterns (relationships and queries) and more about efficient storage. Games care about page faults still so making your tight loop execute quickly on many smaller pieces of data and "do the right thing" is a win. Also, from an architectural perspective it's easier to write abstract code like `Health.value -= 10` instead of PlayerHealth.value -= 10`. By coding against a single components interface you can get consistent behavior across all entities with that component. You could also do this with inheritance but that becomes complex and (the real killer) very slow. jblow has some rants about this in the witness.
1 comments

Some compilers also use the ECS "pattern" quite heavily.

Case in point: rustc:

https://www.youtube.com/watch?v=N6b44kMS6OM&t=1263s