In the Amethyst Pong tutorial, The Entity/Component/System (ECS) architecture is explained in a way that makes me think that systems are something added to the game in the main
function, and cannot be added or removed at runtime.
In the same book, I was following this part to add a Producer
system and a Receiver
system, both associated to a customized EventChannel
.
Since Receiver
and Producer
are systems, following the tutorial I only learnt how to add them in the main
function and in no other place, while in the code example the Receiver
’s new
method is called upon an instance of the World
struct
. I do not have any instance of World
when in the main
function, as it seems too early in the creation process to have one of those.
How can it be done in a proper ECS-compliant way? Is there a way to retrieve a system from a state during the game loop, and subscribe it there? Would it be correct?