Skip to content

Intent System

Alan Jefferson edited this page Jan 21, 2020 · 2 revisions

Use "intents" to facilitate communication between systems.


Prelude

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?


Intent System

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.