A story engineSmall. A weekend.
Code Like a Dungeon Master ends with a dungeon written into the code. Take the next step: an engine that plays any adventure written in a JSON file, so that making a new game needs no Python at all.
It is done when it has all of these:
- The whole story is in a JSON file: the rooms, their descriptions, the exits, the items, and what opens what
- The engine has no room names or story text in its code. A different file gives a different game
- Commands: go, look, take, drop, use, inventory and help, with short forms such as n, s, e, w and i
- At least one way that stays locked until the player has the right item, and one item that changes a room when it is used
- A command it does not know gets a helpful answer, never a crash
- Before the game starts, the engine checks the story file and names any mistake, such as an exit to a room that does not exist
- A game can be saved and picked up again later
- Two story files: a short one for the tests, which play it from start to finish, and a real one with at least eight rooms
- It is on GitHub, with a README that says what it does and how to run it, with a sample run copied from your terminal
- Your portfolio links to it
Want more?
- A map command that draws the rooms visited so far
- Things that happen after a number of moves
- The same engine behind a web page
Lessons that help