Write Your Own Text Adventure in Rust
This is a super simple text adventure that I built in Rust while trying to wrap my head around the language.
I've called it a "Write Your Own" adventure as it's easy to drop in your own "chapters" to the project directory and extend or recreate the adventure.
How it works
The program reads Markdown files and extracts a couple of lines from the top of the file that lets it know where each choice leads. For example:
[a] Stay where I am : stayandwait.md
[b] Run left into the forest : runleft.md
The left hand side of the colon is the option shown to the player in the console. The right hand side is the text file that is loaded as a consequence of the player selecting the option.
If the player selects "a" when prompted, the next chapter loaded will be "stayandwait.md".
Some chapters are a 'dead-end' for a player. In these cases, simply write
[GAME OVER] as the first line of the file. This will give the player the chance to either end the game or start again from the beginning.
You'll need Rust installed on your machine in order to run this program. Read how to install Rust here.
Installing and running the Text Adventure Game
Either clone this repository or click the Download Zip button to add this program to your computer.
Chapters are found in
start.md is the starting point of the adventure. You can edit the contents of this file but you should not rename or delete it.
Feel free to add, edit or delete any other file in the chapters directory. Whatever you end up doing, you obviously have to make sure everything links up properly (as explained above).
To start the adventure
cd to the project directory and then enter the
cargo run command.