top of page

Zork

ROLE

Personal Project

DESCRIPTION

This is a work in progress recreating the game Zork within Visual Studio playing in the command line. I have also created an interface for the code to work and be played within Unity.

Developed in Visual Studio and Unity 2d

YEAR

2021

GENRE

Exploration

PLATFORM

Windows

Contribution

This was an independent student project where I recreated part of the 1980 text-based game Zork. It was created in Visual Studio with a command line executable and then an interface was made so that the code already written could be used in Unity where a user interface similar to the original Zork game could be made. This was a semester-long project with other smaller projects in the class.

 

The objective of the project was to learn how to start small with a project and slowly add new code and refactor code to do the same things more efficiently and dynamically.

 

First simple inputs and outputs were made to ensure the program properly saved and had access to the input from the player. Then a map designed with a 2d array was implemented to design how the navigation of the player would work using enumerations for player command inputs such as Look, Quit, North, South, East, and West without being dependent on how the player inputs the command. For example, a player could go north by typing North, n, or nORth regardless of how many spaces were before or after the command word. These commands were then made into a command class so that new command scripts could be added without having to add new enumerations. The code was then refactored so that a world map did not have to be hard coded using a 2d array but simply read from a json file to get all the information of the rooms and their relationship to each other saved into a library. From here, item objects were implemented into the json file and commands take and drop were designed. An inventory and score mechanic was then also implemented.

An interface was then designed so that the code could be used in Unity. The original code was refactored so that any interface can use it. A UI was designed in Unity to resemble the original Zork UI. Players can always see what room they are in, current moves and score at the top. Player still inputs commands like a command line.

As the code works now, the player can navigate a world, pick up and drop items in different rooms, and check inventory, current moves and score.

 

From this project I developed a better understanding of how to make scripts interact with each other and make sure scripts do one task and one task only. I also developed a better understanding of how to serialize and deserialize files to be used in a game.

bottom of page