Scott Purcival

Game Programmer

The Dark

By on 10 March, 2018

The Dark

A bit of a late post for me, so I will make it a postmortem, i suppose.

I started working on The Dark as my first assignment while studying at AIE. It was to be a text adventure showcasing all of the skills we had mastered over the 6 month duration of the subject, and it was to use our own custom string data type class.

The concept of the game is that you are stranded in a dark labyrinth, and must find your way out before you starve.
The labyrinth offers only the occasional morsel of food, rare torch batteries, and other throwable objects.
You may use your torch to see what is around you, or throw objects that you find in a direction you choose to listen for openings.

Looking back, I would admit that I programmed this game quite conservatively, using only the minimum required data types and facets of the C++ language.
I was still at this time in a frame of mind where I looked down upon using any code that was not my own, as if it were some form of ‘cheating’. I have of course come to realise that the STL is no more or less someone elses code, than the entire C language and compiler are. However, I am still wary of adopting outside code unless absolutely necessary, as I feel this opens the door to potential bugs and inefficiencies. (as you can see, I am using Unity heavily now. I see the benefits of that engine to my development time outweigh any shortcomings.)

The most difficult aspect was the random level generator by far. I ran multiple concepts of possible generation styles with pen and paper before settling on the idea of a single winding path with rooms leading out from it.
The general algorithm went as follows;

  1. Create a random winding path from room 0,0 until there are no more possible exits
  2. Scan through the map top to bottom, left to right and find an empty room
    1. Create a winding path until there are no more possible exits
    2. Break through to nearest room
  3. Repeat 2, until no empty rooms left
  4. Randomly place start room, and exit room

I then created a handful of random room descriptions and Items to place in the rooms, and the game begins!

I would like to invite you to give it a try, it’s a simple game but quite challenging.
Let me know what you think! 😀

Download Here (Windows)



Leave a Reply

Your email address will not be published. Required fields are marked *