News for hackers. Stuff that matters.
Re:EnTT: Gaming meets modern C++ 3.9 (ECS library and much m... by ncake on Tuesday December 21, 2021 @05:46PM (#29643030)
I'll try to explain what I mean. Suppose you want an in game character to change the displayed weapon in their inventory.

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.

Re:EnTT: Gaming meets modern C++ 3.9 (ECS library and much m... by chmod775 on Wednesday December 22, 2021 @01:56AM (#29646286)
I don't think the terminology you're looking for is not stateful/stateless, it's single source of truth vs multiple.

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.

Re:EnTT: Gaming meets modern C++ 3.9 (ECS library and much m... by jazzfool on Tuesday December 21, 2021 @11:39PM (#29645648)
The "stateful" way you present is not at all how you would approach that problem in an ECS. I think you misunderstand what ECS refers to.
Re:EnTT: Gaming meets modern C++ 3.9 (ECS library and much m... by ShrigmaMale on Wednesday December 22, 2021 @12:27AM (#29645883)
Maybe for ECS newbie, please say more on how you would approach this problem?
Re:EnTT: Gaming meets modern C++ 3.9 (ECS library and much m... by jayd16 on Wednesday December 22, 2021 @02:14AM (#29646375)
ECS is closer to the second way that was described. Data is represented as arrays of structs (referred to as components), similar to what was described. Systems can mutate or read these structs.

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.