You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is my (hypothetical, not actually implemented) simplified use case: in my game, when you click a button, all my physical entities explode, which results in their positions being modified.
To achieve this, I create an entity whenever I receive the event of the click of the button, with a component that marks that all entities should explode.
I have a system that reacts to this entity. When it's present, it creates an ExplosionSystem which is responsible for updating the physical entities' positions. If it's not present, and the system is known by ECS, it removes it.
This approach has a few shortcomings:
the eligibility of components to the ExplosionSystem is lost when you remove it, which is bad for performance
the ExplosionSystem is not reusable, and is needlessly recreated
the ExplosionSystem can only be added after all the other systems
This is my example, but it can be generalized to any case where an event results into the update of multiple different components.
It seems to me that if you were able to do mySystem.disable() and mySystem.enable(), all those problems would disappear. It would just be a matter of setting a flag on the disabled systems and checking that it's not present when updating the systems.
It's my first time using ECS, so maybe there is a better approach. I heard about it in this video about Entitas.
The text was updated successfully, but these errors were encountered:
Here is my (hypothetical, not actually implemented) simplified use case: in my game, when you click a button, all my physical entities explode, which results in their positions being modified.
To achieve this, I create an entity whenever I receive the event of the click of the button, with a component that marks that all entities should explode.
I have a system that reacts to this entity. When it's present, it creates an
ExplosionSystem
which is responsible for updating the physical entities' positions. If it's not present, and the system is known by ECS, it removes it.This approach has a few shortcomings:
ExplosionSystem
is lost when you remove it, which is bad for performanceExplosionSystem
is not reusable, and is needlessly recreatedExplosionSystem
can only be added after all the other systemsThis is my example, but it can be generalized to any case where an event results into the update of multiple different components.
It seems to me that if you were able to do
mySystem.disable()
andmySystem.enable()
, all those problems would disappear. It would just be a matter of setting a flag on the disabled systems and checking that it's not present when updating the systems.It's my first time using ECS, so maybe there is a better approach. I heard about it in this video about Entitas.
The text was updated successfully, but these errors were encountered: