Nick Urko's Portfolio

The Dark Mansion

Production Time:

The Dark Mansion
Custom C#
5 weeks (10 hrs / week)
5-15 minutes


Download Project Code



The Dark Mansion is a text adventure game inspired by Zork. The main character (you!) finds a mysterious mansion deep in the woods. Explore the mansion, collect treasure, fight monsters, and find a way home.  The Dark Mansion is written in C#.



Room Structure



Rooms in The Dark Mansion are defined as a struct with many potential parameters. 

"name" and "description" are strings of text used to describe the room to the player.

"idNum" is used by the game as a means of identifying rooms, by assigning each one a unique number.

"north" and all directional parameters assigned the appropriate "idNum" if there is an adjoining room in that particular direction.  A directional parameter of 0 means the player can not travel in that direction.

"northLocked" and all movement modifier parameters are used in special cases to restrict player movement until certain tasks have been completed (such as finding a key.)

"coat" and all item parameters are used to keep track of any items in a particular room.  Items were implemented in this way to allow players to "drop" items in any particular room.

"wolf" and associated npcs and monsters are parameters that keep track of the state of each npc or monster.  While most only have one or two states (alive or dead), it was set up in this way so additional states could be added easily.


This code shows how my rooms are initialized, and how they appear when encountered in game.


Inventory System


Items are stored as an array of booleans.  Each element is initialized to false at the beginning of the game.  As the player collects items, the corresponding element in the array is set to true.  Collecting items has a variety of effects, from unlocking new areas, increasing the player's stats, adding to the player's treasure value, or even allowing new combat options.


Combat System

The player can fight the monsters found throughout the mansion.  In a standard combat encounter, the player makes an attack on the monster, and then the monster makes a counterattack on the player (if it is still alive).  The amount of damage dealt is determined by the  player's "Attack" and "Defense" values.

This code sample shows all available actions that the player can perform on the goblin.


The Dark Mansion has an Alchemy system.  The player must find a recipe, as well as individual components, and an appropriate setting, in order to brew potions.

This code sample shows brewing a strength potion, one of the potions available in The Dark Mansion.

Additional Code Samples