I'm integrating artemis entity system in my IOS engine. Everything is working nicely but there are some tasks that I'm finding difficult to achieve.
Artemis works around components and systems. Components are just data holders with no logic and systems are the ones that apply logic to components (they process components data and create new results).
In my game, the world is splitted in layers, and when an entity is added to the world the RenderSystem needs to know what layer it belongs to add its avatar to the visible world. First time the object is added to the world this is easy to accompllish: I can have a Layer property in the graphic component and when the entity containing this component is added to the world the RenderSystem (that owns the scene) adds it to the correct layer.
The problem comes when I want to move the object to another layer. I have come across 2 "solutions":
1) To have a system that watches for changes in the GraphicComponent layer member and when it changes, it does the layer swap.
2) To have some "dirty flags" in the gameobject to flag things that have changed in the components. Then systems can check this and do swhat they need.
Both of them seem pretty ugly and ineficient.
Summing up, it is difficult in FRP to do a direct call on a component to change it, because you allways need to have a system (that contains the logic) to do everything.
How would you handle this type of things in a system like artemis following the FRP paradigm?
Thanks in advance.