Hacker News new | ask | show | jobs
by knappador 3883 days ago
I've heard a lot of enthusiastic talk of entity-component architecture from those interested in game-dev. The way of modelling seems very appropriate and well-suited to C++. Things like holding each entity in a component class's static member array and calling the static method to, for instance, update the health component of every health-having entity is just too elegant not to appreciate. Immediately the problem is mapping each component across threads and just trivial to make parallel/concurrent.

To start though you need multiple inheritance likely to get this to work idiomatically. C would also do fine, as would Java, except the Java would look like C because of the lack of multiple inheritance/mix-in, while the C code could result in some type insanity -- although components can be implemented as simple structs in structs for entities, except the whole construction/destruction phase of life.

As an outsider looking in, C++ seems filthily well-suited to game development.