Enter the world of interactive fiction, javascript style.
Zork is one of the earliest interactive fiction computer games. Originally written around 1977 it used the MDL Programming Language on a PDP-10 Computer. Since then programming has come a long way.
Zork is currently in beta, but you can play it in your browser here: Beta Zork. There are a few minor bugs, and some rooms have yet to have been connected. But you can still travel around the map.
Alternatively, if you'd like to host your own version of Zork, you can! Get the project by cloning the repo, or grabbing a zip of the latest release. The build is intentionally not using packages to make it easy to drag and drop virtually anywhere that JS is supported.
I am by no means a Javascript developer, nor do I use Javascript on a daily basis. This project is primarily aimed at practicing Javascript, and for fun.
Being a non-compile project the layout is kept relatively simple.
style.css
The stylesheetCLI.js
The DOM CLI interface classGameEngine.js
The GameEngine classItem.js
The Item library classPlayer.js
The Player state classRoom.js
The Room library classCLI -- The CLI is a command interface class for interacting with the DOM. The responsibility is to accept commands from the user, validate them, parse them and pass them back for execution. Additionally the CLI is responsbile for receiving output instructions to print to the DOM CLI.
Player -- The Player class is responsible for managing the players state. When saved the players current class state is stored as a JSON string in local storage. When the app reloads, it checks for the saved game and hydrates the player model if it exists.
Item
-- The Item class is meant as a factory for creating items. Additionally the Item.js
file holds a static list of referencable item objects.
Room
-- The Room class is meant as a factory for creating rooms and their exits using cardinal directions. Additionally the Room.js
file holds a static list of referencable room objects.
GameEngine
-- The GameEngine.js
file holds a single GameEngine
object which is responsible for tying all other components together. A future goal is to abstract as much functionality to each domain as possible to keep the scope of the GameEngine strictly for interlacing other classes.
git checkout -b feature/SomeFeature
)Anyone is free to fork, modify and create PR's. If you're only interested in playing the game, you can help contribute by creating issues for any bugs you find.