How would you implement ECS, a system for tracking the state of game entities, in a stateless manner? Can you expand on that?
How would you implement ECS, a system for tracking the state of game entities, in a stateless manner? Can you expand on that?
Stateful way: your Inventory Manager component iterates through its private array of item entities to mark their model components as shown or hidden, then calls the dependency injected character's avatar component to update its animation state.
Stateless way: you flip an integer in character's struct, and the rendering function does something different.
A physics system might change the position components while a decoupled rendering system might read that position components and the rendering details components to add draw commands.
The latter is an anti-pattern, and you can do either with ECS.
With ECS nothing prevents you from just having the "physical" game state as the single source of truth, and having the render function for the player inventories look at it.