Game Engine
The EGOS Game Engine is a powerful visual programming system that executes your game logic in real-time.
Core Concepts
Logic Flows
Flows are the building blocks of game logic. Each flow consists of:
- Trigger - What starts the flow
- Conditions - Optional checks before execution
- Actions - What happens when the flow runs
Node Types
Triggers
| Trigger | Description |
|---|---|
| Component State Changed | Device input detected |
| Variable Changed | Variable value updated |
| Timer Fired | Scheduled event |
| Game Started | Game session begins |
Conditions
| Condition | Description |
|---|---|
| Compare Values | Check if values match |
| Expression | Custom JavaScript expression |
| All/Any | Combine multiple conditions |
Actions
| Action | Description |
|---|---|
| Set Component State | Change device output |
| Set Variable | Update game variable |
| Delay | Wait before continuing |
| Execute Flow | Run another flow |
Visual Editor
The flow editor provides:
┌──────────────────────────────────────────┐ │ Flow: "Button Controls LED" │ ├──────────────────────────────────────────┤ │ │ │ ┌─────────┐ ┌─────────┐ │ │ │ Trigger │────▶│ Action │ │ │ │ Button │ │ Set LED │ │ │ │ Pressed │ │ ON │ │ │ └─────────┘ └─────────┘ │ │ │ └──────────────────────────────────────────┘
Keyboard Shortcuts
Ctrl + Click- Add connectionDelete- Remove selected nodeCtrl + Z- UndoCtrl + S- Save flow
Variables
Variables store game state:
// Example variable usage
{
"puzzlesSolved": 3,
"timeRemaining": 1800,
"hintUsed": false
}
Warning
Variables are reset when a new game session starts unless marked as persistent.
Execution Model
- Event arrives (button press, timer, etc.)
- Triggers evaluated - matching triggers fire
- Conditions checked - must all pass
- Actions executed - in sequence or parallel
Parallel Execution
Multiple flows can execute simultaneously:
Flow A: Button 1 → LED 1 Flow B: Button 2 → LED 2 ↓ Both run in parallel
Best Practices
Pro Tip
Keep flows focused on single responsibilities. Use variables to coordinate between flows.
- Name flows descriptively - "Button 1 Opens Door" not "Flow 1"
- Use variables for state - Don't chain complex conditions
- Test incrementally - Verify each flow works before adding more
- Document complex logic - Add comments to non-obvious flows