Spielerando

NPC Daily Schedules

A daily schedule puts a character in a different place at different hours: at work in the morning, in the square at noon, at home at night. The character sets off early to arrive on time, stops walking while you talk, hurries if that made it late, and goes straight to the right place if the clock jumps.

Also called: Character routines, Daily routines, Timetables for characters, Villager schedules.

A plump fox baker with a tray of loaves steps out of his bakery and sets off along a dotted path to a market stall, while a goose and a hedgehog walk their own paths past a clock tower in a hillside town.
Tickwhistle Terrace, an invented village life game. Invented game, image generated with AI.

Paste this to your AI

Copy it into Claude, Cursor or ChatGPT. It already has good values and the usual mistakes in it.

Add "NPC Daily Schedules" to my game.

What it should do: Characters with a routine make a world feel lived in, and they give the player a reason to plan: find the baker before noon, wait for the guard to leave, catch someone at the tavern.

Build it exactly as this state machine. First check that it fits my game, then build it like this:

```mermaid
stateDiagram-v2
  [*] --> working
  working: At a place
  walking: Walking
  hurrying: Hurrying
  talking: Talking
  working --> working: stays, or clock jumps
  working --> walking: time to set off
  working --> hurrying: already behind
  working --> talking: player talks
  walking --> walking: keeps walking
  walking --> working: arrives or clock jumps
  walking --> talking: player talks
  hurrying --> hurrying: keeps hurrying
  hurrying --> working: arrives or clock jumps
  hurrying --> talking: player talks
  talking --> talking: still talking
  talking --> working: talk ends, stays
  talking --> walking: talk ends, on time
  talking --> hurrying: talk ends, behind
```

Use these starting values:
- travelHours: 0.25 h
- hurryFactor: 2
- skipHours: 2 h

Watch out for these common mistakes:
- Nobody before the first entry: Tell your AI: before the first entry of the day, the last entry of the day before still holds.
- Midnight breaks the clock: Tell your AI: work out the time that went by with the day wrapped round, so 23.9 to 0.1 is a fifth of an hour.
- The character walks through the whole night: Tell your AI: if the clock jumps by more than a set amount, in either direction, put the character at the place the timetable gives and skip the walking.
- The character pops in at the start time: Tell your AI: set off early by the walking time, so the character arrives when the entry starts.
- Stopped by a talk, then lost: Tell your AI: freeze the walk during the talk. Afterwards, if the character is behind the clock, let it walk faster until it arrives.
- Two entries closer than the walk: Tell your AI: let a started walk finish before the next one begins, and keep the entries in the timetable further apart than the walk.

Do not change anything else in the game. Do not claim anything without proof: model what it takes, and show me what your solution rests on and how I can see that it works. If you cannot show something, say you do not know. When you are done, tell me in plain words how to try it.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP

What it does

Characters with a routine make a world feel lived in, and they give the player a reason to plan: find the baker before noon, wait for the guard to leave, catch someone at the tavern.

How it runs, as a diagram

Everything it can be in, and what moves it on. Your AI builds from exactly this.

stays, or clock jumpstime to set offalready behindplayer talkskeeps walkingarrives or clock jumpsplayer talkskeeps hurryingarrives or clock jumpsplayer talksstill talkingtalk ends, staystalk ends, on timetalk ends, behindAt a placeWalkingHurryingTalking
How it runs, as a diagram
  • At a place → At a place: stays, or clock jumps
  • At a place → Walking: time to set off
  • At a place → Hurrying: already behind
  • At a place → Talking: player talks
  • Walking → Walking: keeps walking
  • Walking → At a place: arrives or clock jumps
  • Walking → Talking: player talks
  • Hurrying → Hurrying: keeps hurrying
  • Hurrying → At a place: arrives or clock jumps
  • Hurrying → Talking: player talks
  • Talking → Talking: still talking
  • Talking → At a place: talk ends, stays
  • Talking → Walking: talk ends, on time
  • Talking → Hurrying: talk ends, behind

Good starting values

ValueStart withWhat it changes
travelHours0.25 hHow many game hours a walk between two places takes. The character sets off this long before an entry starts, to arrive when it starts. Zero makes the character appear at once. Keep entries further apart than this.
hurryFactor2How many times faster a late character walks. Two catches up with a short delay and is still easy to read as hurrying.
skipHours2 hA jump of the clock bigger than this counts as sleeping or skipping time, and the character goes straight to where the timetable says. Set it above the biggest step of your normal clock.

What usually goes wrong

Nobody before the first entry

The first entry starts at six. At three in the morning no entry has started yet, so the code finds nothing and the character vanishes or stands in the wall.

Fix: Tell your AI: before the first entry of the day, the last entry of the day before still holds.

Midnight breaks the clock

The clock goes from 23.9 to 0.1. Subtracting gives a jump of minus 23.8 hours, and the code either skips a whole day or walks the character backward.

Fix: Tell your AI: work out the time that went by with the day wrapped round, so 23.9 to 0.1 is a fifth of an hour.

The character walks through the whole night

The player sleeps until morning and the clock jumps eight hours. The character walks from stop to stop in one blink, or is seen halfway between places.

Fix: Tell your AI: if the clock jumps by more than a set amount, in either direction, put the character at the place the timetable gives and skip the walking.

The character pops in at the start time

The entry says the character is at the square at noon. At noon it appears there, with no walk, and the player who watches it sees it flicker into place.

Fix: Tell your AI: set off early by the walking time, so the character arrives when the entry starts.

Stopped by a talk, then lost

The player talks to a character on the way to work. Afterwards the character either keeps walking as if no time passed and arrives an hour late, or jumps to the place.

Fix: Tell your AI: freeze the walk during the talk. Afterwards, if the character is behind the clock, let it walk faster until it arrives.

Two entries closer than the walk

The entries are ten minutes apart but the walk takes fifteen. The character is told to be in two places, and turns around halfway or never arrives anywhere.

Fix: Tell your AI: let a started walk finish before the next one begins, and keep the entries in the timetable further apart than the walk.

How to check it works

Works well with

Common questions

how do npc daily schedules work in games

Each character has a list of hours and places. The character is at the place of the last hour that has started, and walks to the next place just before its hour, so it arrives on time.

what happens to a schedule when the player sleeps or skips time

Do not walk the character through the missed hours. If the clock jumps by more than about two hours, put the character at the place the timetable gives for the new hour.

what should a character do when the player talks to it

Stop walking for the whole talk. When it ends, if the character is behind, let it walk about twice as fast until it arrives, so the day catches up without a jump.

what do i tell my ai to add character routines

Paste this: Give each character a timetable of hours and places. Before the first entry of the day, the last one from the night before holds. Characters set off a quarter hour early to arrive on time, stop while the player talks, hurry twice as fast if late, and if the clock jumps by more than two hours they go straight to the right place.

Where it comes from

We could not find a reliable origin for this one yet.

Where this mechanic comes from has not been researched yet.

Games are named only as references. Names and marks belong to their owners, and nothing here is endorsed by them.

What was checked

This is what separates the blueprint from a catalogue entry: the values on this page come from code that runs.

Your AI gets the code

Tested example code comes through the Spielerando connection, so your AI can use it right away. How to connect it