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.
1. Put the route in a data table
Section titled “1. Put the route in a data table”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.
-
Save a new file as
the-trail.blend. -
In Blender’s Text Editor, press New and rename the text to
data/trail.json. Every text whose name starts withdata/and ends in.jsonships in the cartridge. -
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.
-
Add a second text,
data/paces.json, with one row per pace:steady14,strenuous18 andgrueling22 miles a day, in a field namedmpd.
| 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.
2. Draw the look
Section titled “2. Draw the look”The pictures are Grease Pencil drawings turned into sprite sheets: one PNG strip with the frames side by side.
-
Draw the wagon (two frames, the wheels turning), the oxen (two frames, walking), three backdrop bands (mountains, hills and prairie) and a signpost.
-
Render each drawing’s frames on a transparent background and lay them side by side in one PNG strip.
-
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 withsprites/ships in the cartridge. -
Keep the drawings themselves out of the published scene: give each one the custom property
sim.source=1(Object Properties ▸ Custom Properties). The.blendkeeps them; the world never receives them. -
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”-
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.atplaces each one:top,upper,middle,lower,centerorbottom. -
Add an Empty with Add Component ▸ HUD & Menus ▸ HUD Choice Menu for the stops. Set
hud.whentoatStopandhud.menuto the line below. Each option is an action name, an equals sign and its label. -
Add a second menu for rivers, shown while
atRiver, with the optionsford,caulkandferry. -
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 forford,caulkandferry.
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.
4. Write the rules
Section titled “4. Write the rules”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.
-
Read the route. A Data Table node with
srcset todata/trail.jsonandfieldset tomile, with the currentstopin 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. -
A day. On Tick with
interval0.35 is the game clock. Whilemoving, 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. -
Arrival. When
milesreaches the next stop’s mile, snap to it, stop the wagon and read the stop’snote,endandriver.endmeans the game is won;rivershows the river menu; otherwise the stop menu. -
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.
-
The end. The fewest days to the last stop is kept in
bestDays.
5. Build and play
Section titled “5. Build and play”-
Press Play on the toolbar to try it from Blender; the tables and sprite sheets travel with the live scene.
-
Press Build Cartridge. The data tables and packed sprite sheets go into the cartridge with the scene.
-
Publish it (Publish and share), open it and press 1: the wheels turn, the oxen walk, and the mountains drift slower than the grass.
What you learned
Section titled “What you learned”- 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.