This is a question that I have and would like someone who has experiences with scene graphs and entity component systems to answer.For context, I am currently implementing a game engine and currently I am debating on our current design.Our current design is we have a singular game component class that every component inherits from. Where we have components like SpriteRendererComponent, Mehs Component, etc. They inherit from this GameComponent class. The point of this is being able to have O(1) access to the scene to being able to modify components to attach more components with the idea of accessing those components to specific scene objects in a scene.Now, my question is what kinds of caveauts can this cause in terms of cache coherence? I am well aware that yes its O(1) and that is great but cache coherence is going to be really bad, but would like to know more explicit details and real-life examples such as write in RAM examples on how this is bad. A follow-up question that is part of the same question is, if we want to access components of specific scene objects. Lets say in a scene graph, what are different approaches can be thought of to get components from specific scene objects within the scene graph, and is iterating typically what you do to get to those objects? Meaning is that operation not as bad as it sounds?
This is a question that I have and would like someone who has experiences with scene graphs and entity component systems to answer.
For context, I am currently implementing a game engine and currently I am debating on our current design.
Our current design is we have a singular game component class that every component inherits from. Where we have components like SpriteRendererComponent, Mehs Component, etc. They inherit from this GameComponent class. The point of this is being able to have O(1) access to the scene to being able to modify components to attach more components with the idea of accessing those components to specific scene objects in a scene.
Now, my question is what kinds of caveauts can this cause in terms of cache coherence? I am well aware that yes its O(1) and that is great but cache coherence is going to be really bad, but would like to know more explicit details and real-life examples such as write in RAM examples on how this is bad.
A follow-up question that is part of the same question is, if we want to access components of specific scene objects. Lets say in a scene graph, what are different approaches can be thought of to get components from specific scene objects within the scene graph, and is iterating typically what you do to get to those objects? Meaning is that operation not as bad as it sounds?
Step by step
Solved in 2 steps