AR Patterns Logo

Event-Condition-Action

Introduction

AR pattern diagrams can be seen as a kind of pseudo code representation for Augmented Reality functionalities. They work as a rough documentation and help to comprehend the triggering, decision control, and execution mechanism of AR behavior.

AR experiences are heavily driven by elements detected in the real world, without having control over their occurrence and timing during the creation process. The reactive behavior and dynamic scenography of AR/MR experiences are therefore modeled as event-driven reactions described as Event-Condition-Action (ECA) rules that perform an action in response to an event, provided that certain conditions are met. In the context of AR patterns, ECA rules build a generic technology-agnostic abstraction of the reactive behavior of AR software systems.

Together with visual illustrations of the scene, AR pattern diagrams help teams stay productive by making it easier to:

  • Navigate AR scenarios without reading source code.
  • Plan out new features before programming.
  • Quickly onboard new team members.
  • Collaborate with technical and non-technical team members.

Rule-Reaction Block

In order to provide a compact visualization of active Event-Condition-Action (ECA) rules we developed a diagram representation consisting of rule-reaction blocks. The first line of a rule-reaction block in such a diagram shows the active rule as an Event-Condition-Action triple. Below the rule a blockquoted line follows which depicts the changed state as reaction.

If no condition is defined, it evaluates to true, and the diagram shows an immediate execution arrow (→).

To illustrate the use of the diagram, consider the following example which presents an active rule triggered by a temporal event (in 20 seconds). If no item is found in the current AR session (the condition), the action will provide a voice feedback (the reaction) using a text-to-speech system.

Several ECA rules may be loaded and installed at the same time. They are shown as sequences of rule-reaction blocks. Be aware that they are installed at the same time but may not be triggered at that time.

An action may dynamically load and run new consecutive rules. These rules are displayed as indented block quotes consisting of one or several sequential rules. All rules in a block are loaded and installed in sequence, yet not (all) executed at loading time, but triggered by their corresponding event.

How to write an ECA Diagram?

  1. List the items that will augment the real world as media assets (e.g., 3D models, parametric geometries, images, audio files, text). These items should then be tagged by ECA rules.
  2. Enumerate potential events that may occur during the AR session and will trigger behavior and interactivity. See typical Events in AR applications.
  3. Arrange the enumerated items and events into Event-Condition-Action rules that will manipulate media items, run-time data, and system settings.
  4. Whenever possible, use the generic action identifiers listed in Actions in AR Applications.
  5. Depict the reaction of the triggered action.
  6. Write down the rule-reaction blocks in Markdown by applying the corresponding styling.
  7. Integrate and render the diagram as embedded documentation, e.g., in README files within GitHub repositories or in web-based technical documentation.

Read more about ECA Diagrams

Read more about ECA Patterns