itch.io is community of indie game creators and players

Devlogs

Scripts and Quests

Drivers & Dragons
A browser game made in HTML5

Quest engine

this is part of a technical writeup, for the initial concept, see Jam Entry

Scripting and Quests is a core mechanic in this game. 

Each turn, the player can 'visit' a location. The boardgame implantation would be drawing a 'visit' card from a deck, and doing the instructions listed in a atlas of gameplay.

In a computer, we can automate this.

To do this, I wrote a custom scripting engine that could process quests. Scripts are just arrays of text, with some special annotations:

  • label - This has no rendering but just indicates the start of an area in a script
  • text - The text is displayed on-screen
  • if - Checks if the player has unlocked a certain keyword, if so, jumps to the label indicated
  • pause - Waits for the person to click 'continue', used to break up large chunks of text
  • choice - Shows a list of options, use clicks one and then you jump to that label
  • action - Can grant an arbitrary number of stat changes, keywords, or drawing cards
  • skill_check - Shows a skill check (dice roll) and jump to a label based on if the player passes or fails the check
  • jump -  automatically jumps to a given label. e.g. if you want to skip to the end. In the tutorial, this is also used to jump back up to the start so players can review options again

A common flow of a script would be to show some text the first time a player arrives, and check for a keyword. Then the next visit, that keyword can make them jump to a different part of the script.

This can make some fairly complex scenarios. It reminds me a lot of writing code using 'goto'. Thankfully, the lack of variables other than keywords stops this scripting language being a full-blown programming language, and keeps the complexity down a little.

Below is a script from the game, see if you can guess what it does?

---