During the months of October and November in 2018, I created a text adventure game based on the Haunted House game within the ‘Write Your Own Adventure Programs For Your Microcomputer” book. This was the first of three assignments in the “Low-Level Programming” module in the Games Technology course at UWE.
This assignment was unique as it provided the source code for the text adventure game in the BASIC programming language. Our objective was to create the same game, but in ASGE, a game engine created and provided to us by the UWEGames team.
Week 1 - BASIC
The first task was to write up the BASIC code provided to try out the game. This would allow myself to gain an idea of how the game played as well as gain an idea of how the game worked from a coding standpoint. This would be essential to porting the game over ASGE to make sure no features were missing.
This task was set on October 5th and I spent the week working on writing up the provided code in a Applesoft BASIC, a BASIC emulator. While doing this, it was interesting to see how BASIC did things differently compared to more modern coding languages, mostly in the terminology used. BASIC used a lot more numbers and symbols in its code, whereas modern languages focus on using more English, which is understandable as it has made coding more accessible and easier to read.
When I finished writing up the code, there were some bugs that prevented the game from functioning as intended. Some were due to personal mistakes such as mistyping symbols, such as typing a ; instead of, (and vice versa) while
In the end, it was interesting to work with BASIC, it being a language that intreprets rather than compiles.
Week 2, 3 & 4 - Beginning the ASGE Project & CLion
The second and third weeks after the assignment being set had small, but still important progress.
During my first year of university, the program we used to code was Visual Studio, but for this year, we have moved to CLion. Because of this, I spent time early on during this period getting used to the differences of the program, mostly in terms of the interface and CMake.
One interesting problem I encountered during this period was CLion struggling to work with code from my memory stick, which was a peculiar issue that took me a few days to figure out. Because of how new I was to CLion, I had assumed there was a problem elsewhere within in the program rather than incompatability with my memory stick. Thankfully, getting this problem sorted out early during the assignment period helped avoid a potential headache later.
Afterwards, I started the the development of the Haunted House game in ASGE, titled ‘Basic Reb0rn’. Development was brief and I focused on only setting up the foundations of the game, such as setting up a few classes and adding a simple menu that I could build off of when I next worked on the project.
The last time I had used ASGE was back during the Angry Birds project, which was in April, so I was admittedly a little rusty when it came to the game engine. I used this time as well to look back at previous projects such as Angry Birds and Pong to familiarize myself with elements of ASGE, which helped in deciding what kind of classes to use and how I should structure my code.
Week 5 - Data & Movement
One thing I learned from coding the BASIC version of the game was how much data was needed to be stored and then later retrieved for later use. Hard-coding this was a possibility, but I knew reading from a text file was possible was it touched upon last year and I had also played a game with a level editor that stored all the needed data within text files, so I wanted to do the same in relation to recording the names of all items and locations, as well as other important parts of data such as a player’s current position.
This week was focused on doing that. To compliment this addition as well, I added input from arrow keys that would allow the player to move through the haunted house with locations and available exits cycling appropriately from the text file. This worked mostly well, with the only issue being an oversight in moving up and down, which needed the array to be added or taken away by 8 instead of 1.
Week 6 - Items
While getting items to display in their appropriate location was easy enough, it being structured in the same way locations and exits are displayed, allowing the player to pick them up was a little trickier.
This was mainly as certain locations need to recognise the player of having a item or not. The game must also be able to recognise if the player is trying to use an item, as well as remove that item from its initial location if the player has picked it up.
Using an item requires the player to input a noun followed by the item needed, such as “OPEN DOOR”. Recognising both proved to be more difficult than expected due to being initially unable to find out how to check specific words of a sentence.
Week 7 - Finalizing
This week was the final week of the project before its due date. I began the week by continuing to work on the items, finally sorting out my issue with searching for specific words in a string. The first word was retrieved by finding everything from the first character to the first space whereas the second word was found by finding everything after the first space. This allowed actions on the haunted house to be carried out.
However, while adding these items to the inventory work, removing them from their initial location was something I could not finish in time. For example, picking up the vacuum would display you picked it up, but if you were to move to an adjacent room and then move back, it would still tell you the vacuum was there, despite being
The game also displays special messages upon certain conditions being met, such as “THE DOOR SLAMS SHUT!” which occurs upon entering the house, indicating you can’t leave. Most of these special messages I was unable to add due to the items taking more time than expected.
Due to time constraints, I decided to focus on optimising my current code rather than add in the missing features.
Post-Mortem:
Creating the Haunted House in ASGE was a fun process, though I admittedly wish I had spent more of the early weeks developing the game and getting further ahead.
Because of the game being essentially a port of the BASIC version, I underestimated parts of the development; I had an idea of how to do everything I needed to do because of what I learned from the BASIC version, but when unexpected errors came up that I hadn’t accounted for, whether that be from CLion or my own code, it slowed down development considerably. This was a pretty bad mistake to made and I’ll need to avoid this issue from coming up in the future by not underestimating any part of the development process and getting things done earlier.
I liked how this project taught me more about reading from files though for the future I’d like to optimise that more. Currently, only two words can be read in as an example, but I’d like to tweak that code to allow more to be read in. This would also allow less text files to be used as currently there is a text file for every piece of data needed, such as locations, location exits and locations of items. These three as an example could easily be unified and retrieved by searching for specific parts of a string.