Skip to content

The trail

For creatorsAdd-on 2.2.2+

In this tutorial you build a journey game. A wagon leaves Independence, Missouri, and heads for Oregon City, 2,169 miles west. Each day it covers miles and eats food. At landmarks the player chooses what to do, and at rivers the choice carries real risk. The game is two data tables, six drawings, a set of HUD lines and menus, and one rules graph. This builds on tutorial 2, Asteroid-Blaster.

▶ Play the finished game: press 1 2 3 to choose, or click a choice. On a phone, every choice is a button you tap.

A data table is a JSON file in the cartridge, { "rows": [ … ] }, that graphs read with the Data Table node. You keep it inside the .blend as a text block, so the file is the whole source.

  1. Save a new file as the-trail.blend.

  2. In Blender’s Text Editor, press New and rename the text to data/trail.json. Every text whose name starts with data/ and ends in .json ships in the cartridge.

  3. Write one row per stop, from the start (mile 0) to the end. Each row holds the fields the rules read, as in the table below.

  4. Add a second text, data/paces.json, with one row per pace: steady 14, strenuous 18 and grueling 22 miles a day, in a field named mpd.

Field Holds
name The stop’s name, shown on the HUD
kind What it is: the start, a fort, a river, a landmark, the end
note A short, careful historical note, shown when you arrive
mile Miles from the start
river 1 when the stop is a river crossing
end 1 for the last stop
qid The stop’s Wikidata id, so every row can be cited and corrected

Every number cites its source. The finished game takes each landmark’s coordinates from Wikidata, measures the great-circle distance between neighbours, and scales the chain to the trail’s recorded length of 2,169 miles, because the real route winds. Its paces are marked as game figures, not history. Any route works: a pilgrimage or a trade road is a different list of rows, and the rules do not change.

The pictures are Grease Pencil drawings turned into sprite sheets: one PNG strip with the frames side by side.

  1. Draw the wagon (two frames, the wheels turning), the oxen (two frames, walking), three backdrop bands (mountains, hills and prairie) and a signpost.

  2. Render each drawing’s frames on a transparent background and lay them side by side in one PNG strip.

  3. Open each strip in Blender’s Image Editor, rename the image to sprites/wagon.png (and so on), and choose Image ▸ Pack. Every packed image whose name starts with sprites/ ships in the cartridge.

  4. Keep the drawings themselves out of the published scene: give each one the custom property sim.source = 1 (Object Properties ▸ Custom Properties). The .blend keeps them; the world never receives them.

  5. For each picture, add an Empty with Add Component ▸ Arcade ▸ Sprite (or drag Sprite from the Simulacrum asset library) and set its tags from the table.

Sprite Tags
Wagon sprite.sheet = sprites/wagon.png, sprite.size = 2.86,1.89, sprite.frames = 2, sprite.fps = 6, sprite.play = moving (the wheels turn only while moving is true)
Oxen sprite.sheet = sprites/oxen.png, sprite.frames = 2, sprite.fps = 5, sprite.play = moving
Mountains, hills, prairie sprite.scroll = speed, with sprite.scrollFactor of 0.08, 0.3 and 1.0. One variable scrolls all three at different rates, which gives depth
Signpost sprite.when = stopped: shown only while the wagon is stopped

The side view. In Properties ▸ Scene ▸ Custom Properties, add camera.mode = fixed, camera.at = 0,0.4,10, camera.target = 0,0.4,0, camera.projection = ortho, camera.orthoHeight = 2.4 and camera.orthoMinWidth = 7. The last one keeps the whole wagon in view on a phone held upright.

3. Build the screen from HUD lines and menus

Section titled “3. Build the screen from HUD lines and menus”
  1. Add HUD text lines (Add Component ▸ HUD & Menus ▸ HUD Text) for the status, the trip, the place and its note, the last event, and the win and loss banners. hud.at places each one: top, upper, middle, lower, center or bottom.

  2. Add an Empty with Add Component ▸ HUD & Menus ▸ HUD Choice Menu for the stops. Set hud.when to atStop and hud.menu to the line below. Each option is an action name, an equals sign and its label.

  3. Add a second menu for rivers, shown while atRiver, with the options ford, caulk and ferry.

  4. In World ▸ Simulacrum ▸ Input, bind each action to a number key with Add Action: continue = keys:Digit1/Numpad1, rest = keys:Digit2/Numpad2, pace = keys:Digit3/Numpad3, and the same three keys for ford, caulk and ferry.

continue=Continue on the trail|rest=Rest for a day|pace=Change the pace (now {paceName})
Line hud.text hud.at · hud.when
Status Day {day} · {miles} of {total} mi · Food {food} lb · Health {health} · ${money} top
Trip Next: {nextName} in {toNext} mi · pace: {paceName} bottom · moving
Place {placeName} upper · atStop
Note {placeNote} middle · atStop
Last event {lastEvent} lower · lastEvent

A click or a tap on a menu option presses its action exactly as the bound key does. The buttons are large enough for a thumb, so a phone plays the whole game.

Make a Scene-scope graph named trail.rules and set it as World ▸ Simulacrum ▸ Rules. Its variables start at day 1, food 1600, health 100 and money 400, with flags such as moving, stopped, atStop, atRiver, won and lost. bestDays is Persistent, saved for the Player.

  1. Read the route. A Data Table node with src set to data/trail.json and field set to mile, with the current stop in its row pin, gives that stop’s mile. Its Rows output says how many stops there are. The viewer loads every table a graph names before the game starts, so reads are instant.

  2. A day. On Tick with interval 0.35 is the game clock. While moving, each tick adds a day, adds miles by the pace and eats 10 lb of food. With no food left, health falls by 8 a day; otherwise it heals by 1. A 3% daily roll brings illness (−15). At 0 health the game is lost.

  3. Arrival. When miles reaches the next stop’s mile, snap to it, stop the wagon and read the stop’s note, end and river. end means the game is won; river shows the river menu; otherwise the stop menu.

  4. A river. Roll a Random Range with a fixed seed. Ford: a 35% chance of losing 150 lb of food and 20 health. Caulk: a 20% chance of losing 80 lb and 5 health. Ferry: $50, no risk.

  5. The end. The fewest days to the last stop is kept in bestDays.

  1. Press Play on the toolbar to try it from Blender; the tables and sprite sheets travel with the live scene.

  2. Press Build Cartridge. The data tables and packed sprite sheets go into the cartridge with the scene.

  3. Publish it (Publish and share), open it and press 1: the wheels turn, the oxen walk, and the mountains drift slower than the grass.

  • A game’s facts live in data tables kept in the .blend, read by the Data Table node (Data tables).
  • Sprites show drawings from packed sprite sheets; one variable can animate or scroll them.
  • HUD choice menus turn choices into actions, so a click, a tap and a key are the same input.

Next: Falling blocks keeps a whole board in one variable.