alecthomas / entityx

EntityX - A fast, type-safe C++ Entity-Component system
MIT License
2.21k stars 295 forks source link

compile_time branch increases dependencies #209

Closed cmaughan closed 6 years ago

cmaughan commented 6 years ago

I like the single-header version in the compile_time branch, but it has one issue; adding new components or modifying them requires more recompilation because EntityManager changes, and because EntityManager::Entity is now changed. This essentially means that changing any component does a rebuild of everything using Entities. It would be nice to achieve better decoupling here, but I'm not sure how! I guess I can pass around an 'Id' for entity, but anywhere that is using EntityManager will have to recompile.

alecthomas commented 6 years ago

It's a definite problem, but it's inherent in the approach so I don't think there's much that can be done unfortunately 🙁

cmaughan commented 6 years ago

I wondered if the template parameters of each component were necessary in the EntityManager, but I can see they are. I think this might make the compile_time branch hard to use on a bigger project; you'll be switching recompile of a file or 2 for potentially recompiling most of your app for every change. The example.cc isn't a very realistic sample, since everything is in one file. It would be interesting to port the Azteroids sample, or some other to this branch and see how the compile time is affected.

alecthomas commented 6 years ago

I'm going to close this, as this is a very typical problem with templates.