Skip to content

Brick breaker

For creatorsAdd-on 2.2.2+

In this tutorial you build a complete paddle-and-ball game in Blender: a paddle, a ball, 24 bricks, three lives, a score and a best score that survives a reload. You write no code. Each object gets a component from the add-on, and two small graphs hold the rules.

▶ Play the finished game: ← → or A D move the paddle, Space serves. On a phone, drag to move and tap to serve.

You need Blender with the Simulacrum add-on (Install the add-on). This tutorial uses three places in Blender:

Where What you do there
Properties ▸ Object ▸ Simulacrum Give the selected object a component (Add Component), set its tags, attach its behaviour graph
Properties ▸ World ▸ Simulacrum The game as a whole: its Rules graph, Input, Camera and Cartridge
A Node Editor set to Simulacrum Behaviour Build graphs. Its sidebar’s Simulacrum tab opens on the Graph panel, which holds the graph’s variables

The add-on at a glance tours them all.

  1. Start a new file and save it as brick-breaker.blend. The cartridge takes its name from the file. Rename the scene to Brick Breaker; that becomes the game’s title.

  2. Model three walls (left, right and top) as boxes. Select each one and choose Add Component ▸ Arcade ▸ Arcade Solid in Object ▸ Simulacrum. A solid never moves; it blocks and reflects what hits it.

  3. Model a flat paddle near the bottom. Choose Add Component ▸ Arcade ▸ Arcade Mover. In the component’s box, set the tags from the table below. A tag that is not set yet shows as a + button; click it to add it.

  4. The paddle also needs arcade.english, which bends the ball by where it hits: centre straight, edges steep. Open the Tags panel under Object ▸ Simulacrum, press Add Tag, and add the tag arcade.english with the value 0.9.

  5. Model a small sphere for the ball, name it Ball, and give it Arcade Mover with the ball’s tags from the table. It waits on the paddle until a graph serves it.

  6. Model a thin box behind the paddle, name it KillZone, and give it Add Component ▸ Arcade ▸ Arcade Sensor. A sensor never blocks; it reports what enters it.

  7. Model one brick and give it Arcade Solid. You will give it a graph in the next section, then copy it into a wall of 24.

  8. Add four Empties for the on-screen text and give each Add Component ▸ HUD & Menus ▸ HUD Text (or drag HUD Text in from the Simulacrum asset library in Blender’s Asset Browser). Set their text from the table.

Object Component Tags
Three walls Arcade Solid arcade.body = solid
Paddle Arcade Mover arcade.drive = move (the player action that drives it), arcade.driveSpeed = 9, arcade.driveAxis = x, arcade.min = -3.7,-10,-100 and arcade.max = 3.7,10,100 (it stops between the walls), arcade.english = 0.9
Ball Arcade Mover arcade.idle = 1 (waits for a serve), arcade.bounce = 1, arcade.velocity = 2.4,0,-7 (its serve), arcade.speed = 7.5 (kept after every bounce), arcade.minAxis = z (it never crawls sideways)
KillZone Arcade Sensor arcade.body = sensor
Each brick Arcade Solid arcade.body = solid, and the behaviour graph brick.hit
Score line HUD Text hud.text = Score {score} Lives {lives} Best {best}, hud.at = top
Serve hint HUD Text hud.text = Press Space or tap to serve, hud.at = bottom, hud.when = waiting
Win banner HUD Text hud.text = YOU WIN, hud.at = center, hud.when = won
Loss banner HUD Text hud.text = GAME OVER, hud.at = center, hud.when = lost

A HUD line shows a graph variable wherever you write its name in braces, and hud.when shows the line only while that variable is true.

Graphs never see a key. They hear actions, such as move and serve, and the scene’s input map decides which keys, touches or buttons make each action. The same game plays on a keyboard and a phone because the phone’s bindings are just more data.

  1. In World ▸ Simulacrum ▸ Input, press Add Action. Leave the preset on Custom, type the action move and the bindings keys:ArrowLeft/KeyA,ArrowRight/KeyD ; touch:x.

  2. Press Add Action again: action serve, bindings keys:Space/Enter ; touch:tap.

  3. Fix the camera over the board. In World ▸ Simulacrum ▸ Camera, press Add Setting once for each of these, pick its name and type its value: mode = fixed, at = 0,15,3.2, target = 0,0,-6.4, fov = 50. They are the scene’s camera.mode, camera.at, camera.target and camera.fov.

Binding Means
keys:ArrowLeft/KeyA,ArrowRight/KeyD An axis: the keys before the comma push it to −1, the keys after it to +1. A slash lists alternatives
keys:Space/Enter A button: any of these keys presses it
touch:x On a touch screen, the finger’s left-right position drives the axis
touch:tap A tap presses the button

Separate one kind of binding from the next with a semicolon, as in keys:Space/Enter ; touch:tap. Controls for your scene lists every kind.

  1. Open a Node Editor, switch its type to Simulacrum Behaviour, and press New. Name the graph brick.hit. In the sidebar’s Simulacrum tab, set the Graph panel’s Scope to Asset: the graph travels with the object.

  2. From Add ▸ Simulacrum, add On Contact (under Events), Set Enabled (Actions), Self (Data) and Send Message (Network).

  3. Leave On Contact’s target empty: it then listens to the object the graph is on. Wire its exec to Set Enabled, plug Self into Set Enabled’s Target, and leave enabled unticked.

  4. Wire Set Enabled to Send Message and set its Channel to world:brick.broken.

  5. Select the brick. In Object ▸ Simulacrum ▸ Behaviour, set Graph to brick.hit.

  6. Copy the brick into a wall of 24 (Shift D). Each copy keeps its component and its graph.

A disabled solid is gone: the ball passes through where it stood. A channel that starts with world: reaches every graph in the scene; one that starts with graph: stays inside its own graph.

The rules are one graph that belongs to the scene.

  1. Make a new Simulacrum Behaviour graph named breaker.rules and set its Scope to Scene. In World ▸ Simulacrum, set Rules to breaker.rules.

  2. In the sidebar’s Graph panel, press + beside Variables for each variable in the table below and fill in its Name, Type, Scope and Initial. Save shows once the scope is Persistent.

  3. A brick broke. Add On Message with the channel world:brick.broken. Add 1 to score with Get Variable, Math (add) and Set Variable. Then a Compare (≥) of score against total into a Branch. On True: set won to true, add a Call Component whose method is stop with a Constant (string Ball) in its Component pin, and finish with Send Message on world:game.over.

  4. The ball fell. Add On Contact with target set to KillZone. Take 1 from lives, call reset on Ball, and set waiting to true. Then Branch on lives ≤ 0: on True, set lost to true and waiting to false, and emit world:game.over.

  5. Serve. Add On Input with the action serve. Combine its Pressed output and waiting in a Logic node (and) and Branch on it. On True, set waiting to false and call serve on Ball.

  6. The best score. Add On Message on world:game.over. Branch on score > best, and on True set best to score.

Name Type Scope Initial
score number Scene 0
lives number Scene 3
total number Scene 24
won bool Scene false
lost bool Scene false
waiting bool Scene true
best number Persistent, Save: Player 0

Two things to notice:

  • serve, reset and stop are methods every Arcade Mover offers. Any graph calls them with Call Component and the object’s name.
  • Each step re-reads its inputs when it runs, so a Compare placed after a Set Variable sees the new score.

best is persistent and saved for the player: in the browser for a guest, and with their account for a player who is signed in to MegaCity.

  1. Press Play on the toolbar at the top of the 3D Viewport to try the game in the viewer straight from Blender. Preview your scene explains the live link.

  2. Open World ▸ Simulacrum ▸ Cartridge. It shows the folder, web path, title and version the build will use.

  3. Press Build Cartridge (or Build on the toolbar). It saves the file, writes the cartridge folder and packs a .cartridge file beside it. The cartridge is not signed yet; the viewer still plays it and says so.

  4. Publish the cartridge (Publish and share) and open it. Press Space: the ball leaves the paddle, and the bricks fall away as it hits them.

  • Components make objects do things: arcade solids, movers and sensors, and HUD text.
  • The input map turns keys and touches into actions, so one graph plays on every device.
  • Graphs answer events (a contact, a message, an input) and keep the game’s state in variables, including a saved best score. Game logic covers graphs in full.

Next: Asteroid-Blaster adds things that appear and disappear while the game runs.