-
Notifications
You must be signed in to change notification settings - Fork 0
Intent System
Use "intents" to facilitate communication between systems.
Software is about transforming data in one form to another, typically in response to user input. In your typical object-oriented application, data transformations happen in direct response to input.
void mouse_press_event(const MouseEvent& event) {
if (event.button() == MouseEvent::LeftButton) {
handle_mouse_press();
}
}
In an ECS, systems do data transformations, but they are typically not called in response to input. Rather, they are called iteratively, in a loop.
void draw_event() {
InputSystem();
AnimationSystem();
RenderSystem();
}
Furthermore, systems are rarely aware of each other, and can technically be toggled on/off independently without breaking the application or affecting other systems. But this begs the question, how do systems communicate? How does the RenderSystem
take into account updated animation? How does the AnimationSystem
respond to user input?
Wip, ping me if you want it right now.
- Cover handling intents with more than one system, using an
.accepted
boolean to determine whether a system should be the last to handle it, or whether it should permit subsequent systems from responding too.
EnTT - Fast and Reliable ECS (Entity Component System)
Table of contents
Examples
Blog
- RAII
- Polymorphism
- Shared Components
- Intent System
- Input Handling
- Undo
- Operator Stack
- State
- Resources
- Interpolation
Resources
Extras