To clarify, by overlapping I do not mean overlapping between said components, but rather, let's say I have:
- My entity contains components, and a parent-children system. Call it a mandatory
Hierarchycomponent if you may.
Transformcomponent that has
Drawablecomponent family that is drawn by a
RenderingSystem, it uses position information from
- Script components that can read and manipulate position of objects.
Now, what I want to add is a
Box2DPhysics component family(shape(s), body) and a
Box2DPhysicsSystem that internally just updates the physics world, but the problem is: The
Transform component is not compatible with that. Box2D has its own internal position, rotation, velocity information, that here can only be accessed via getter and setter methods. Now, it's not impossible for me to wrap the Transform component's fields and methods to use said getters/setters, but then I'm implementing half of the functionality in the
Now, what should I do? Some options that come to my mind would be:
Make the physics component override the
Transformcomponent, somehow. Either by writing its position info into
Transformevery frame, or something like that
Allow some components to be two or more subcomponent, such as
Box2DPhysicsbeing both a
Physicscomponent and a
Not use Box2D whatsoever, write my own verlet-based physics engine, likely significantly slower, but functional and fully interoperational with the rest of the code.
"Freeze" some of the components and functionality, effectively making it 100% built-in - prohibit the user from replacing or implementing few basic most important components, and handle things like this interally.
I feel like personally I'm leaning towards #2, but honestly, I just don't know. It's probably my anxiety/indecisiveness that is at fault, but I feel like I simply cannot proceed without getting someone's opinion.