Game logic without code
For creatorsAdd-on 2.2.2+
A Simulacrum game holds no code. You build its behaviour in Blender from two kinds of pieces. Components are ready-made behaviours you add to an object or a scene, such as a bouncing ball or a line of score text. Graphs are node trees in Blender’s node editor. They hear events, check conditions and change things. This page explains both, the main nodes, and the Inspector you use to watch and debug a running game. The arcade tutorials build complete games with them.
Components
Section titled “Components”A component is a set of tags on an object that the viewer knows how to run. You don’t type the tags yourself.
- Select the object.
- Open Properties ▸ Object ▸ Simulacrum.
- Press Add Component in the panel’s header, choose a group, such as Arcade or HUD & Menus, and pick the component. Hover one to read what it does.
The component appears under Components as a box with its fields, filled with defaults: a checkbox for an on-or-off setting, a number field for a number, a drop-down for a choice. A field it doesn’t have yet shows as + and its name: click it to add it. The × on the box removes the component and every tag it added.
Components for games
Section titled “Components for games”| Component (group) | What it does | Main tags |
|---|---|---|
| Arcade Mover (Arcade) | Moves every frame by its velocity, or by a player action. Bounces, falls, jumps, wraps round the screen. A ball, a paddle, a ship | arcade.body = mover, arcade.velocity, arcade.drive, arcade.bounce, arcade.speed, arcade.gravity, arcade.jump |
| Arcade Solid (Arcade) | Never moves. Blocks and reflects movers. A disabled solid is gone, like a broken brick | arcade.body = solid, arcade.english, arcade.oneway |
| Arcade Sensor (Arcade) | Never blocks. A mover entering it fires On Contact on both. A goal, a pickup, a pit | arcade.body = sensor |
| Arcade Line Wall (Arcade) | A barrier along a line of points, any angle, any length. A road’s edge, or a finish line that only reports | arcade.body = wall, arcade.wall, arcade.wallClosed, arcade.wallSensor |
| HUD Text (HUD & Menus) | A line of screen text. Each {name} in it shows a graph variable, live |
hud = 1, hud.text, hud.at, hud.when |
| HUD Choice Menu (HUD & Menus) | Buttons on the screen. Each one presses a player action | hud = menu, hud.menu, hud.layout, hud.when |
| Sprite (Arcade) | A flat 2D drawing from a sprite sheet, with frames that play while a variable says so | sprite = 1, sprite.sheet, sprite.frames, sprite.play, sprite.when |
| Grid View (Arcade) | Draws a grid variable as blocks or as tiles from a tile set | grid = 1, grid.var, grid.tiles |
| Glide (Arcade) | An actor that moves smoothly from cell to cell while the rules change its cell | glide = 1, glide.cell, glide.grid |
| Look (Arcade) | A variable picks which child model shows | look = 1, look.var, and look.value on each child |
| Pressable Button (Smart Objects) | A button. Pressing it fires the graph’s On Interact | interact.graph = 1 |
The tags reference lists every tag and value.
Components for the whole scene
Section titled “Components for the whole scene”Some components belong to the scene, not to one object. They live in Properties ▸ World ▸ Simulacrum:
- Input is the scene’s input map. Press Add Action to name a player action and its keys, mouse buttons or touches. Graphs hear actions, never raw keys, so the same game plays on a keyboard and on a phone. See controls for your scene.
- Player gives the scene a first-person player or a third-person hero, with its body, start, health and jump. See the player hero.
- Camera holds a fixed or following camera for a board or arcade game:
camera.mode = fixed, withcamera.at,camera.targetandcamera.fov. The panel’s Add Setting adds one for you: pick its name, type its value. × removes one. Settings you add as custom properties of the scene (Properties ▸ Scene ▸ Custom Properties) show here too. Look & Time and Spawning work the same way. - Rules names the scene’s rules graph (below).
An input map entry looks like this. keys:ArrowLeft/KeyA,ArrowRight/KeyD is an axis (left keys, then right keys) and touch:x
lets a finger drag it:
input.move = keys:ArrowLeft/KeyA,ArrowRight/KeyD ; touch:xinput.serve = keys:Space/Enter ; touch:tapGraphs
Section titled “Graphs”A graph is a node tree of the type Simulacrum Behaviour. To make one, open a Node Editor, switch its type to Simulacrum Behaviour and press New. From add-on 2.2.0 there is a quicker way: press New beside Graph in Properties ▸ Object ▸ Simulacrum ▸ Behaviour, or beside Rules in Properties ▸ World ▸ Simulacrum. The graph is made, attached and opened in the node editor in one step. Add nodes with Shift A ▸ Simulacrum, where they are grouped in submenus: Events, Flow, Data, Actions, State, Simulation, Network and Agent.
A graph runs in one of two places:
- A behaviour graph is attached to an object, in Properties ▸ Object ▸ Simulacrum ▸ Behaviour ▸ Graph. It travels with the object, and its Self node is that object. Many objects can share one graph: 24 bricks can run one brick graph, each as itself.
- The scene’s rules graph holds the game’s rules: score, lives, winning and losing. Attach it in Properties ▸ World ▸ Simulacrum ▸ Rules.
The Open button beside either field opens the graph in the node editor. There, the first panel of the sidebar’s Simulacrum tab (N), Graph, says what the open graph is, such as Scene Rules or Behaviour of Ball.
Events start everything
Section titled “Events start everything”Every chain of nodes starts at an event. The white exec wire carries “do this next” from node to node.
| Event | Fires when |
|---|---|
| On Load | the scene or the object finishes loading |
| On Tick | every interval seconds (default 1) |
| On Input | a player action changes. pressed says down or up; value carries an axis from −1 to 1 |
| On Contact | a body touches another. Blank target means this object; with hears only one collision layer |
| On Interact | a player clicks, taps, grabs or gazes at the object |
| On Proximity | someone enters or leaves a radius around the object |
| On Message | a message arrives on a channel |
| On Destroy | the object is about to be removed |
Flow, state and data
Section titled “Flow, state and data”- Flow steers the exec wire: Branch (true or false), Sequence, Switch (up to four cases), Gate, Do Once, Flip Flop, For Loop, For Each, While and Delay.
- State reads and writes variables: Get Variable, Set Variable, Set by Expression, Set List Element and Set Cell.
- Data makes values: Constant, Math, Compare, Logic, Random Range, Text (a template such as
Depth {a}), Expression, Data Table, Self, Find By Name, Get Property, plus vector and grid nodes. - Actions change the world: Set Enabled hides or shows an object, Destroy removes it, Spawn makes a new one, Set Property writes a tag, Translate, Rotate, Tween, Play Media and Call Component.
To read what a node does, hover it in the palette of the Blueprint pane.
Variables
Section titled “Variables”A graph’s variables are its memory. Declare them in the node editor’s sidebar, under Variables in the Simulacrum ▸ Graph panel, with + and −. The Blueprint pane edits them the same way. Each variable has:
| Field | What it holds |
|---|---|
| Name | the name formulas and HUD lines use, such as score |
| Type | number, bool, string, or json for lists and grids |
| Scope | Asset (travels with the asset), Scene (belongs to this scene) or Persistent (kept after the page closes) |
| Save | for a persistent variable: Default (Player), Player or World (named Shard before add-on 2.2.0) |
| Initial | the starting value, written as JSON: 0, true, "text", [1,0,0] |
Player saves are each player’s own, and the viewer keeps them in that player’s browser, one save per scene. A best score that survives a reload is a persistent number with Save: Player. World is one value for the whole world, the same for everyone in it.
HUD text reads variables by name. Score {score} Lives {lives} Best {best} shows all three, live.
Messages between graphs
Section titled “Messages between graphs”Graphs talk with messages. The node that sends one is Send Message (in the Network submenu): give it a channel and,
if you like, a payload. Any On Message node listening on the same channel fires. The channel’s prefix sets who hears it:
| Prefix | Who hears it |
|---|---|
world: |
every graph in this world, the sender’s own included |
graph: |
this graph only |
A brick’s graph shows the pattern: On Contact ▸ Set Enabled (target Self, enabled off) ▸ Send Message on
world:brick.broken. The rules graph hears world:brick.broken and adds one to the score.
Calling a component
Section titled “Calling a component”Call Component runs a named method on an object’s component: set method, wire the object into target (an object’s
name works), and pass an optional arg. An Arcade Mover answers these:
| Method | What it does |
|---|---|
serve |
starts a mover that waits at rest (a ball on the paddle) |
reset |
sends it home and stops it. An arg of x,y,z moves home there first, like a checkpoint |
stop |
stops it where it is |
setVelocity |
sets its velocity to x,y,z |
jump |
jumps, if it stands on the ground |
control |
0 locks the player’s controls, 1 frees them (a start countdown) |
position · speed · heading · grounded |
report where it is, how fast it goes, its heading and whether it stands on something |
Formulas
Section titled “Formulas”The Expression node computes a formula typed as text. The inputs a, b, c and d are its pins. Any other name is one of
the graph’s variables, so score + 10 needs no Get Variable node.
| You write | It means |
|---|---|
+ - * / % |
arithmetic |
< > <= >= == != |
comparisons, 1 or 0 |
&& || ! |
and, or, not |
cond ? x : y |
x when cond holds, else y |
abs min max floor ceil round sqrt sign clamp mod |
functions |
gm[a] |
element a of the list variable gm |
map[px, py] |
the cell at (px, py) of the grid variable map, or −1 outside it |
Set by Expression does variable = formula in one node: score + 1, lives - 1. Set List Element and Set Cell
change one element of a list or one cell of a grid. A formula that doesn’t parse, or that names a variable the graph doesn’t
declare, is an error before the game runs.
Functions
Section titled “Functions”A function is a group of nodes saved once and used anywhere in its graph.
-
Open the graph, then press + beside Functions in the node editor’s sidebar (Simulacrum ▸ Graph). Give its Function ID in the dialog. It opens with a Function Input and a Function Output node.
-
In the sidebar’s This function box, type its signature: the inputs and outputs it takes, each an
idand atype. Anexecpin makes it an action that runs in the chain; without one it is a calculation.{"inputs": [{"id": "exec", "type": "exec"}, {"id": "v", "type": "number"}], "outputs": [{"id": "exec", "type": "exec"}, {"id": "yes", "type": "number"}]} -
Press Apply Signature. The input and output nodes, and every call to the function, get the new pins. Wires on pins that still exist are kept.
-
Back in the graph, add Call Function and type the function’s id in its Function field.
A function reads and sets its graph’s variables. A function can call another function, but not itself. A Random Range inside a function rolls its own numbers at each place it is called, so two calls don’t land on the same cell.
Graph files
Section titled “Graph files”A graph can be saved as a .graph.json file and opened again, in this .blend or another. In the node editor’s sidebar
(Simulacrum ▸ Graph):
- Import (Import Graph) opens a graph file as a new graph you can edit. A file that isn’t a graph is refused with the reason, and nothing is left behind. Nodes the add-on can’t show are left out, and the status bar names them.
- Export (Export Graph) saves the open graph to a file, named after the graph to start with. If the save fails, the file you chose stays as it was.
Both work from add-on 2.2.0.
The Blueprint pane
Section titled “The Blueprint pane”The Blueprint pane is a column beside the node editor with everything about the open graph. In the node editor’s sidebar, open Simulacrum ▸ Blueprint Pane and press Set Up Blueprint Pane: it turns the screen’s File Browser (or, if there is none, a Properties editor) into the pane. Its panels:
- Blueprint: the scene’s rules and every object’s graph. A click opens one.
- Variables and Functions: the same editor as the node editor’s Graph panel. Add, remove and edit variables; the selected one lists the nodes that read or write it, each a click away. Each function opens in the node editor, and + makes a new one.
- Events: every event node in the graph. A click jumps to it.
- Palette: every node type by group, with a search box. A click adds the node in the middle of the node editor.
The Inspector
Section titled “The Inspector”The Inspector is in the node editor’s sidebar, under Simulacrum, below Graph. It shows values and references; you edit variables in the Graph panel. It has three parts:
- Node: the selected node’s settings, which you can edit, and the variables it reads and writes, including every name inside a formula. A name the graph doesn’t declare shows NOT DECLARED.
- Variables: every variable of the graph with its type, scope and value, and how many nodes read (r) and write (w) it. The selected variable lists those nodes: click one to jump to it, even inside a function.
- Object: what the selected object is, its tags, and its own behaviour graph’s values.
Watch and debug a running game
Section titled “Watch and debug a running game”Press Play in the 3D viewport’s header to run the scene in the viewer with Blender linked to it (see preview your scene). While it runs, the Inspector’s top line reads Live and every variable shows its value now, refreshed about four times a second.
- Pause, Continue and Step (one tick, 1/20 s) control the running game from the Inspector’s debug bar.
- Set Breakpoint on the selected node. The node gets a red dot. When it runs, the game pauses at the end of that tick and the node is outlined in yellow.
- Trace (the eye button) outlines in green the nodes that just ran. Nothing is written into your file.
- The pencil beside a variable opens Set Live Value: type a value such as
12345,trueor[1,0,0,0]and the running game takes it at once. - Send Graph to Viewer, at the foot of the Graph panel, sends the open graph to the running viewer.
Without Play, Pause, Continue, Step, Set Live Value and Send Graph to Viewer say “Not live — press Play first”.
Breakpoints are saved with the graph but never published.
Limits
Section titled “Limits”- A breakpoint pauses at the end of the tick in which its node ran, never halfway through a chain.
- A function’s signature is typed as text, not drawn pin by pin.
- Switch has four cases. For more, chain a second Switch off Default.
- While stops after
maxIterations(1000 by default) and reports an error, so a loop can’t freeze the game. - Delay waits in real time, so it is not repeatable from run to run the way the rest of a graph is.
- A World save lasts only for the session unless the scene is part of a shared world. A player’s own save in a private browser window lasts until the window closes.
Worked examples
Section titled “Worked examples”- Brick breaker: arcade bodies, the input map, HUD text, a brick graph and the rules graph.
- The trail: choice menus, sprites and data tables.
- Functions: a large graph rebuilt with functions and formulas.
- Blueprints and the Inspector: formulas that read variables, and live debugging.