Replies: 1 comment 3 replies
-
|
I’m on board with this proposal. A generalized event system will help us decouple subsystems and make future features easier to plug in. Let’s proceed. How about if we also include:
enum EventResult {
case handled
case `continue`
case forward(to: EntityID)
case bubbleUp
}Thoughts? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I propose the creation of a generalized event system for the engine. While this work was initially motivated by the need to redesign the
InputSystemto better support binding OS input events (keyboard, mouse, etc.) to engine logic (e.g.,moveForward), further exploration suggests that a dedicatedEventSystemandEventManagerwould provide a more powerful and extensible foundation for the entire engine.This system would allow any component—
InputSystem,AnimationSystem,PhysicsSystem,RenderSystem, etc.—to communicate through a unified event mechanism, improving decoupling, extensibility, and clarity.Motivation
The current design limits event handling primarily to input-related actions. This creates friction when attempting to extend the engine to support more complex interactions such as:
dismountEventto its passengers).By introducing a generalized event framework, we can:
Proposal Details
1. Core Components
EventSystem: A high-level manager responsible for lifecycle, subscriptions, and system-wide dispatch.EventManager: Manages the queue of events, dispatch timing, and delivery semantics.2. Event Structure
Core event type contains:
type: integer identifier (extensible, allows new event types).args: core argument values (standardized).Extensions:
3. Event Flow
Events can be:
EventManagerfor deferred processing.Entities and objects may:
4. Input System Integration
The redesigned
InputSystemwill:EventManagerto enqueue events.moveForward).This ensures input handling is no longer a special case—it is simply one producer of events.
Example Use Case
Imagine a car object with a player entity inside:
dismountEventis triggered.This shows the flexibility of a system where objects don’t need to “understand” all events—they can simply route them until the right handler acts.
Benefits
Next Steps
EventManagerwith queue and dispatch logic.InputSystemto integrate with the new system.👉 Note: Work on the
InputSystemredesign will be on hold until this event system is implemented.@untoldengine What do you think?
Beta Was this translation helpful? Give feedback.
All reactions