Hi guys. In the last few weeks, I read a lot about ECS. Also, I started to use artemis-odb in my engine which was previously used a Unity-like game loop, where every GameObject might have onUpdate, onFrameStart, etc.
The confusion is this. Let’s say, if I have 3-4 entities, all have a MeshRenderer component, which contains the material and the mesh. In a MeshRendererSystem, I process those entities, add/update all of them into a batch and when all are processed, I do the render passes using the batches. That’s pretty mutch clear, I have entities with one component, and one system process them, then a separated logic uses the systems outcome.
But in other cases, I’m not sure, what to do. Eg.:
I have
- a CursorEntity
- a CursorScreenPositionComponent
- a CursorPositionSystem
The component is attached to the entity, the system updates the component’s data, which is the cursor position on the screen. But where should I update the cursor (an image) position itself? So after a frame, I have an entity with an up2date component (thanks to the system), but what to do next?
Currently, I solve this that ECS systems run first in the gameloop, and after that, I run updater components that uses the updated entities.
I might miss something very basic stuff, so if you can recommend a great article or explain what did I miss, I would be so happy