I prefer not to have any state in systems. I either store some state in specific components that live during the game lifetime in a single exemplar, then I have ability to reset them at once if I want to restart the game. Either have special structures that calculated at the beginning of the frame before systems run (and immutable for the systems). Like time (delta time, gameplay time) and raw input (what was pressed and released since the last frame).
What about renderer? How do you implement it in conjunction with the ECS?
I have a 2D game with a very primitive render pipeline so I don't do anything interesting there, I have a system that iterates over all renderable components and their positions and request render for them (animations are being processed in a separate system).
Обсуждают сегодня