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
Events should do more than just execute a function associated with them. Events also should inform relevant parts of the game engine of what just occurred.
The event system should simply post events out for the rest of the engine to pick up.
Example: The Render2dSystem would subscribe to ComponentAdded and ComponentRemoved events for SpriteComponents and TextComponents to know how to manage the actual creation and deletion of these Components.
The text was updated successfully, but these errors were encountered:
Suggestion: We could have some virtual methods in the base entity class that gets called when components are added, modified, or removed. Elsewhere, layers would receive and handle these events.
Suggestion: We could have some virtual methods in the base entity class that gets called when components are added, modified, or removed. Elsewhere, layers would receive and handle these events.
Depends on how we want to treat the entity class. In ECS, generally you want the entity to be as minimal as possible. Literally in most cases, an entity is strictly an ID. No other data or logic associated with it.
We could go down this route of giving the entity class some logic. I did this in Komodo, and I was able to manage the object lifetimes safely and easily. If we have the EventDispatcher calling these virtual methods on the proper entity, then that could totally work!
We may not need specifically a "subscription" event model then if we go all in on defining events and letting the dispatch handle them.
Events should do more than just execute a function associated with them. Events also should inform relevant parts of the game engine of what just occurred.
The event system should simply post events out for the rest of the engine to pick up.
Example: The Render2dSystem would subscribe to ComponentAdded and ComponentRemoved events for SpriteComponents and TextComponents to know how to manage the actual creation and deletion of these Components.
The text was updated successfully, but these errors were encountered: