I need some insight/recommendations on the way my entity component system is implemented. I think I might be doing something wrong because my systems depend on each other (which gives me bad coupling).
In order to describe my implementation, I’ll give an example of how I would create an entity with an asset. First off, I create an entity and I add a ModelComponent to it, which contains the path to the asset (as a String). Then, my ModelSystem takes this entity, gets the component, and loads the asset using the path in the component. I then store the asset that was just loaded inside a map, using the ID of the entity as a key.
Now lets say I need to access the spatial from another system, such as the AnimationSystem, I use ModelSystem.get().getEntityModel(entityID) (because currently each system is a Singleton). This is whats been bugging me about my implementation: how would I share things between my systems that shouldn’t be inside components (such as a spatial) while having minimum coupling.
Whats the best/right way to do it?