Replies: 1 comment
-
Well, if I expected such a wholesome comment! Thank you very much for your words, it actually means a lot 😄 I'm glad my focus on intuitivity and ease of use is worth it! Regarding the ECS, you're absolutely right, there's definitely room for improvement; I made this years ago and went down the easiest path (or well, one of the easiest). I wanted, again, something easy to use, with an intuitive syntax (e.g., being able to add components directly to entities, instead of the "an entity is a simple integer" design), and the current implementation was good enough for me at that time. Components are not stored as-is either though. Each one is located at a specific index assigned by CRTP incremented for each new type, meaning that there can be null pointers between them when stored into entites. That allows direct access to a specific component without having to loop over the whole list, and/or use some kind of RTTI. Clearly this is not ideal regarding memory fragmentation (as you say, they shouldn't be held by entities in the first place anyway), and I've read many articles about this kind of stuff, though never really thoroughly. I didn't know much better at that time (and frankly I believe I still don't). This is not exactly one of my main points of interest, and if I weren't crazy I'd simply use an ECS library; but if I am to keep a custom one it would indeed need work in the long run. |
Beta Was this translation helpful? Give feedback.
-
The best example project I have ever found for game dev novices, systematic and elegant(compared to CDDA horrible intricate code structure), if possible, I will recommend it to every new game developer I meet.
However, the ECS system seems a little problematic. According to Unity official docs, the core insight of ECS is storing components of the same type from different entities in a contiguous memory block for better caching and accessing, and in the repo's implementation, I did not find any trace of memory layout desgin to support ECS, only a std::vector for storing pointers of components. Maybe this should be a point for future improvement?
Beta Was this translation helpful? Give feedback.
All reactions