Writing puzzles for Castle Quest

Castle Quest's dungeons, mines, caves, ruined keeps and inn cellars can hold puzzles written by players. A puzzle is one small text file (a .json file) describing a few steps the adventurer must do in order: find something, read a clue, use an item, answer a riddle, pull levers, beat a guardian, or give something to a ghost.

About half the places a player explores for the first time get one of these puzzles. In a dungeon or a mine, solving it also opens the way to the lower floor.

Puzzles are also the building blocks of Mini Adventures: an adventure file ties 2 to 5 puzzles together with a story, and players take them one at a time from a village notice board. See Mini Adventures below.

Open the puzzle checker   Play Castle Quest   Marcal Labs home

How to make one

An example

This four-step puzzle is in the game now. Steps are done in order, from the top.

Loading...

The parts of a puzzle

PartWhat it is
"id"A short name in small letters, numbers and dashes, like "drowned-bell". Every puzzle needs its own.
"title"The puzzle's name, shown in the player's journal (up to 60 letters).
"places"Where it can appear: a list chosen from . Leave it out for dungeons, mines, caves and keeps.
"minLevel"The lowest player level it appears for, from 1 to 20. Leave it out for any level.
"intro"What the player reads when they first walk in.
"things"(Optional) your own words for the things in your puzzle, e.g. "bell": "A great bronze bell..."
"steps"The steps, in the order they must be done: 2 to 8 of them. See below.
"reward"What the player gets at the end: "gold" (0 to 500), "xp" (0 to 300, experience), "magic" (true or false: true gives a magic item), and "text" (what they read when it's solved).

The steps

Every step has a "type" and a "text": what the player reads when that step is done. A player may pick something up early, but can't use it until its turn comes.

Things a step can happen at

Use one of these names for "at". The game draws them; you can describe them in your own words with "things".

Monsters

For a guardian ("fight") or something sitting on an item ("guard"):

The complete list (for puzzle generators)

Every field the game reads is below. For computer programs that write puzzles, the same rules are in the standard JSON Schema format (puzzle-schema.json): give that file to your generator. Fields not listed are ignored. Text fields must not be blank.

The puzzle

FieldNeeded?KindAllowed
idyestext1 to 40 of a-z, 0-9 and -. Unique. Also the file name.
titleyestextup to 60
placesnolist1 or more of: dungeon, mine, cave, keep, cellar. Default: dungeon, mine, cave, keep.
minLevelnowhole number1 to 20. Default 1.
intronotextup to 400
thingsnothing name → textnames from the things list; each text up to 200
stepsyeslist of steps2 to 8, done in order
reward.goldnowhole number0 to 500. Default 0.
reward.xpnowhole number0 to 300. Default 40.
reward.magicnotrue / falsetrue gives a vault prize: a better weapon, a magic item, an elixir or potions. Default false.
reward.textnotextup to 400

Each step

typeNeedsMay haveHow it plays
finditem (up to 40), textguard (monster)An item in a spot of its own. Each find's item must be different. Done when its turn comes, even if picked up early.
readtextat (thing)Without "at": writing on a wall in a spot of its own. With "at": shown when the player walks up to that thing. Done when its turn comes, even if read early.
useitem, at, textThe item must come from an earlier find, and each item can be used or given only once (it is used up). Too early: "Nothing happens... yet".
giveitem, at, textAs use, for handing something to a ghost or a prisoner.
riddleat, question (up to 300), answers (2 to 5, each up to 60), correct (1 = first answer)wrong (up to 300), textOffered only on its turn. A wrong answer costs 6 strength; the player may try again.
leversat, levers (2 to 5 names, each up to 30), order (every name once), textwrong (up to 300)Offered only on its turn. The player sees "Pull the <name> lever". A wrong pull resets them all and costs 4 strength.
fightmonster, textname (up to 40)A guardian in a spot of its own. Done when its turn comes, even if beaten early.

Monsters, weakest to strongest

MonsterStrengthHits forSuits
rat81-3level 1 and up
goblin122-5
wolf152-6
spider183-6
bandit253-8level 2 to 3 and up
scorpion304-10
hag304-9
skeleton304-9
orc354-10
dwarf355-11
bear455-12
werewolf656-12level 5 and up
troll856-14
ogre1108-16level 8 and up
giant17012-22

Will it fit?

Each of these needs a spot of its own: every different thing named in "at", every find, every fight, and every read without "at". Rough room for spots: dungeon about 10, keep about 10, mine about 7, cellar about 6, cave about 5, and a small animal den only 1 or 2. A puzzle too big for a place is simply not used there (in a dungeon or mine the way down is left open instead). Several steps can share one thing (a "use" and a "riddle" both at the bell, say) and that only needs one spot.

Never allowed

Mini Adventures

A Mini Adventure is a small Castle Quest made from puzzles that are already on the website. The player starts in a village; its notice board shows the adventure's story and its puzzles as tasks. They take one task at a time, travel to its place (a dungeon, mine, cave or ruined keep a few squares away, marked on the map, or the inn cellar in the village), solve it, and come back to the board for the next. When every task is done, they get the adventure's reward. Players can work at the inn and buy gear at the smithy along the way.

An adventure is one small .json file, checked and uploaded with the same checker (it goes into the adv folder). Upload its puzzles first: the checker makes sure every puzzle it names is on the website. adventure-schema.json describes the format for puzzle generators.

{
  "id": "trouble-at-the-mill",
  "title": "Trouble at the Mill",
  "story": "Strange things are happening around the village...",
  "minLevel": 1,
  "puzzles": [
    "millers-secret",
    { "puzzle": "miners-ghost", "place": "cellar" },
    "drowned-bell"
  ],
  "reward": { "gold": 100, "xp": 80, "text": "The elders thank you with a purse of gold." }
}
FieldWhat it is
idRequired. A short name in small letters, numbers and dashes. Also the file name: adv/<id>.json.
titleRequired. Up to 60 letters, shown on the list of adventures and the notice board.
storyRequired. Up to 800 letters: what is going on, shown on the list and the notice board. Do not name the village: it is different every time.
minLevelOptional, 1 to 20 (default 1). The level the adventure is meant for; players below it are warned but can still play.
puzzlesRequired. 2 to 5 puzzle ids, each used once, in the order listed on the board (players may do them in any order). To fix where a puzzle happens, write { "puzzle": "its-id", "place": "cellar" }; the place must be one the puzzle allows. Otherwise the game picks one of the puzzle's places, so a puzzle that allows only cellar is always under the inn. Only one puzzle per adventure can be in the cellar.
rewardOptional, for finishing every task: gold (0 to 1000), xp (0 to 600), magic (true for a magic prize), text (up to 400 letters). Each puzzle also gives its own reward when solved.

As with puzzles, the signs < and > may not appear anywhere, and fields the game does not know are rejected.

Writing tips