std-builder-game
Level: Molecule | Entity: BuilderGame | Persistence: runtime
3 states, 5 events, 5 transitions
Live Preview
schema.orb
{
"name": "BuilderGameOrbital",
"orbitals": [
{
"name": "BuilderGameOrbital",
"entity": {
"name": "BuilderGame",
"persistence": "runtime",
"fields": [
{
"name": "id",
"type": "string"
},
{
"name": "name",
"type": "string"
},
{
"name": "description",
"type": "string"
},
{
"name": "status",
"type": "string",
"default": "active",
"values": [
"active",
"inactive",
"pending"
]
},
{
"name": "createdAt",
"type": "string"
},
{
"name": "score",
"type": "number",
"default": 0
},
{
"name": "level",
"type": "number",
"default": 1
}
],
"instances": [
{
"id": "game-1",
"name": "Builder Session",
"description": "Active game session",
"status": "active",
"score": 0,
"level": 1
}
]
},
"traits": [
{
"name": "BuilderGameBuilderGame",
"linkedEntity": "BuilderGame",
"category": "interaction",
"stateMachine": {
"states": [
{
"name": "menu",
"isInitial": true
},
{
"name": "playing"
},
{
"name": "complete"
}
],
"events": [
{
"key": "INIT",
"name": "Initialize"
},
{
"key": "START",
"name": "Start"
},
{
"key": "COMPLETE",
"name": "Complete"
},
{
"key": "RESTART",
"name": "Restart"
},
{
"key": "NAVIGATE",
"name": "Navigate"
}
],
"transitions": [
{
"from": "menu",
"to": "menu",
"event": "INIT",
"effects": [
[
"fetch",
"BuilderGame"
],
[
"render-ui",
"main",
{
"type": "game-menu",
"title": "Builder Challenge",
"menuItems": [
{
"label": "Start",
"event": "START",
"variant": "primary"
}
]
}
]
]
},
{
"from": "menu",
"to": "playing",
"event": "START",
"effects": [
[
"render-ui",
"main",
{
"type": "stack",
"direction": "vertical",
"gap": "md",
"children": [
{
"type": "game-hud",
"stats": [
{
"label": "Score",
"value": "@entity.score"
},
{
"label": "Level",
"value": "@entity.level"
}
]
},
{
"type": "builder-board",
"entity": "BuilderGame",
"completeEvent": "COMPLETE"
}
]
}
]
]
},
{
"from": "menu",
"to": "menu",
"event": "NAVIGATE",
"effects": []
},
{
"from": "playing",
"to": "complete",
"event": "COMPLETE",
"effects": [
[
"render-ui",
"main",
{
"type": "game-over-screen",
"title": "Well Done!",
"menuItems": [
{
"label": "Play Again",
"event": "RESTART",
"variant": "primary"
}
]
}
]
]
},
{
"from": "complete",
"to": "menu",
"event": "RESTART",
"effects": [
[
"render-ui",
"main",
{
"type": "game-menu",
"title": "Builder Challenge",
"menuItems": [
{
"label": "Start",
"event": "START",
"variant": "primary"
}
]
}
]
]
}
]
}
}
],
"pages": [
{
"name": "BuilderGamePage",
"path": "/buildergames",
"traits": [
{
"ref": "BuilderGameBuilderGame"
}
]
}
]
}
],
"description": "Educational game molecule: menu -> playing -> complete. Uses the `builder-board` pattern for the playing state."
}
Loading preview...
Orbital Visualization
Loading visualization...
Entity Fields
| Field | Type | Default |
|---|---|---|
| id | string | - |
| name | string | - |
| description | string | - |
| status | string | "active" |
| createdAt | string | - |
| score | number | 0 |
| level | number | 1 |
States
| State | Type |
|---|---|
| menu | Initial |
| playing | - |
| complete | - |
Events
| Event | Payload |
|---|---|
| INIT | - |
| START | - |
| COMPLETE | - |
| RESTART | - |
| NAVIGATE | - |
Transitions
| From | Event | To | Effects |
|---|---|---|---|
| menu | INIT | menu | 2 effects |
| menu | START | playing | 1 effect |
| menu | NAVIGATE | menu | - |
| playing | COMPLETE | complete | 1 effect |
| complete | RESTART | menu | 1 effect |