Navigation and AI
Make one small level, a keep at night, to the last navigation control: guards on their rounds, a map of the floor with its prices, obstacles and shortcuts, and a cat that finds its own way, then guards who see the thief, chase her, search for her on a timer and ring the alarm, a map that changes while it runs, reinforcements from the barracks, the watch exported, and a gallery of six small cases.

On this page
The Night Watch
Navigation and AI makes one small level, The Night Watch: a keep at night, seen from above, with a hall, a kitchen and a store room, a carpeted corridor, a cellar, a gallery and a muddy courtyard. A thief sneaks through it past two guards who walk their rounds, notice her, chase her by the shortest way round, search where they last saw her, ring the alarm, and give up and go back to their posts. A cat wanders the keep, a lever shuts a door, the mud slows a walker down, and there is a hole to drop through and a ladder to climb.
You start from a starter with the keep built and the thief walking, and nothing else moving. By the end the guards walk their rounds on paths and then by themselves, over a map of the floor with prices on the carpet and the mud, obstacles round the tables and shortcuts through the hole and up the ladder. They see her, think in modes, search on a timer, ring the bell, and call a third guard out of the barracks, and the whole watch runs in an exported game. A last chapter builds six small cases of their own, each a recipe to take into your own game.
The tutorial is for learning every navigation control to the end. Every field of the nine components that move a game’s characters by themselves (the Nav Region, the Nav Obstacle, the Nav Link, the Nav Cost, the Nav Agent, the Path, the Path Follow, the Timer and the Screen Notifier) is defined with what it does, its unit and the value the keep gives it, and every builtin a guard’s script calls to walk, look and listen is printed in a script that runs.
Each part ends on a keep that works at its level:
What you need
- Rengy, installed, on Windows or Linux. Getting started installs it and shows you round the editor.
- The starter, navigation-and-ai.zip: the keep with its walls, floors, carpet and mud, the thief who walks, the two guards at their posts, the cat by the hearth, and the pictures the later chapters use. Unzip it somewhere outside your other projects; in the editor’s launcher, choose Open project… and pick the
navigation-and-aifolder. - Nothing to download. The one pack the keep is drawn from is already in the starter.
- Nothing else. Part 1 is all clicks. From chapter 6 the orders the cat and the guards follow are short Rengy Script files, which the editor runs as they are, with nothing to install.
| Download | By | What the game takes from it | Needed from | Licence |
|---|---|---|---|---|
| Tiny Dungeon | Kenney | The keep’s walls and floors, the thief, the guards, the tables, the doors, the ladder and the barrels, and the gallery’s rat, ghost, villager and fence | The starter (already in it) | CC0 |
Tiny Dungeon is in the public domain (CC0), and its sheet is already in the starter. The cat, its bowl, the hearth, the bell, the key, the pans, the carpet, the mud, the hole and the hatch, the guards’ three poses, their cone of sight, the lever, the cart, the sheep and the turret were drawn for this tutorial, the guards’ poses from the pack’s own pixels, and they are in the starter too.
Three parts
You can stop after any of them: each leaves you a keep that works. The chapters below are listed by part.
- Basic, chapters 1 to 5: a keep where everything walks with no script. Rounds on paths, a map of the floor, prices and obstacles, shortcuts, and a cat that finds its own way to its bowl.
- Simple, chapters 6 to 9: a playable level. Orders from scripts, eyes that see the thief, a guard’s mind that chases and searches, and timers that end the search and ring the alarm.
- Pro, chapters 10 to 13: the whole watch. A map that changes while it runs, reinforcements and guards who sleep off screen, the level finished and exported, and a gallery of six small cases.
How each chapter teaches
- Every control is defined. A list of terms in each chapter says what a field does, its unit, the range that suits the keep and the value the keep gives it.
- Routes are shown. Where a chapter says a walker goes some way, a picture shows its route drawn over the map of the floor, from a run, at a step the caption names.
- Who moves it. A node can be moved by a Path Follow, a Nav Agent, a script or the keys. Two of them on one node is the mistake most readers make, so every chapter says which one moves each node now.
- Each thing you build ends in a table of its values, so you can build it again in your own game.
- Every picture is a capture of the editor or the game, never a mock-up.
How long it takes
The thirteen chapters take about 6 hours at the keyboard: most take between a quarter of an hour and half an hour, and the gallery more than an hour, a case at a sitting. Every chapter ends at a place you can stop, with a Check it works box that says what you should see.
The chapters
Part 1 · Basic
A keep where everything walks with no script: rounds on paths, a map of the floor, prices and obstacles, shortcuts, and a cat that finds its own way to its bowl.
- 1 Rounds The guards walk their rounds and the cat circles the hearth, each on a path it follows. 20 min
- 2 A map of the floor Lay a map of the floor over the keep, baked from its walls, that every walker plans its way over. 15 min
- 3 Prices and obstacles Carpet a guard prefers, mud he avoids and tables in the way. 15 min
- 4 Shortcuts The cellar hole, the ladder and the shut hatch: shortcuts across the map. 15 min
- 5 Walking it The cat walks to its bowl by itself, with no script, and you see its route in Play. 15 min
Part 2 · Simple
A playable level: orders from scripts, eyes that see the thief, a guard’s mind that chases and searches, and timers that end the search and ring the alarm.
- 6 Orders The cat wanders where it likes, and a guard is sent to a noise. 25 min
- 7 Eyes A guard notices the thief in his cone, unless a wall is between them. 20 min
- 8 A brain A guard’s mind as a script: he patrols, grows suspicious, chases, searches and goes back to his round. 30 min
- 9 Timers The search lasts six seconds, and the alarm counts down. 20 min
Part 3 · Pro
The whole watch: a map that changes while it runs, reinforcements and guards who sleep off screen, the level finished and exported, and a gallery of six small cases.
- 10 A changing map A lever shuts a door, and the guards go the long way round. 30 min
- 11 Reinforcements The alarm wakes the barracks, and the round guards sleep while they are off screen. 35 min
- 12 The watch, finished The level played from start to end, a guard debugged in Play, and the watch exported. 30 min
- 13 A gallery of navigation and AI Six small cases — a rat that flees, a companion, a turret, a ghost, a sheep pen and a delivery cart — each a recipe to take into your own game. 80 min