For the Love of Reading

For this week, I’d like to take a detour from the usual tech-centered posts and talk about storytelling in another form: books. Much of my free time away from working on my team’s project has been spent reading books. In fact, according to my Storygraph stats (a great website for tracking reading habits), I have read 14 books in the past two months. I would like to share and discuss one of my favorite books in particular I have been reading from one of my favorite authors and content creators. I write this in the hopes that someone reading this will pick up the book and let it change their perspective on the world like it has changed mine.

The Anthropocene Reviewed by John Green

Quickly becoming one of my favorite works of non fiction, The Anthropocene Reviewed is a collection of essays reviewing various aspects of the Anthropocene, a term that describes the current geological age. At the end of each review, a rating is given out of 5 stars – and these reviews are about anything from scratch-and-sniff stickers to title pages to the internet. It is both a comical and thoughtful approach to many of the topics in todays world, and I have often found myself laughing from the silliness of it all and tearing up at how amazing the world really is.

One of the reasons I have gravitated towards this book is the way in which it has helped me appreciate various aspects of human existence I seldom think about – and, perhaps even more importantly, it has helped me appreciate the world. I have learned a lot of history about various things such as Claude glasses, how scratch-and-sniff stickers work, the invention of antibiotics, and the population growth of Canadian geese. I think it is very easy in this day and age to lose faith in the world and humanity as a whole, and I was in that boat – but this book has helped me realize just how amazing the Anthropocene is despite its flaws.

I would like to end this with one of my favorite quotes from the book’s introduction:

“To fall in love with the world isn’t to ignore or overlook suffering, both human and otherwise. For me anyway, to fall in love with the world is to look up at the night sky and feel your mind swim before the beauty and distance of the stars. … I want to look away from feeling. I want to deflect with irony, or anything else that will keep me from feeling directly. We all know how loving ends. But I want to fall in love with the world anyway, to let it crack me open. I want to feel what there is to feel while I am here.”

The Anthropocene Reviewed by John Green

Designing a Room in a Text-Based Adventure Game

We have come to the part in our project where our main focus is shifting to the story. This is what makes any work of interactive fiction a game – without the story, there is no game. Storytelling in a text-based adventure is largely done through environmental storytelling; there are no visuals (other than ASCII art on occasion), no narrator to guide the player, and few (if any) other characters to interact with. This makes the design of the rooms and the objects within them crucial to the experience; designing such rooms, the basic building block in any text-based adventure game, will be my main focus going forward.

Deciding what types of rooms make sense for the environment is one of the first steps alongside creating a map to aid in development. It is important to remember that users will not have a map in-game, and so the order of the rooms must be logical without being too complicated. I started to lay out the beginnings of a map in the past week for our game:

A map of the layout of the rooms in our game. The courtyard to the west leads to a flooded chamber, an underground passage, and then an armory. To the east, it leads to an astronomy room, both a study and a room of doors, and a mushroom forest.
First map iteration for our text-based adventure game.

I added an underground passage coming from the flooded chamber since it seems to me that the flooded chamber would already be partially underground. West of that, there is an armory due to it having easy access to the outdoors via the passage (I imagined in its prime, this castle would use that as a secret passage). To the east of the courtyard, the astronomy room leads to some curious places – I thought of this as the research wing, and so I added a wizard’s study, a room of doors (a curious room that appears as a void with doors in all directions), and a mushroom forest (a callback to the glowing mushrooms in the courtyard seen earlier).

As for the tower, that is also a callback: when the user first enters the game, they appear in the courtyard where a large tower looms in the distance looking strangely untouched compared to the rest of the castle. What is it doing there? Why is it not partially in ruins like the rest of the castle? Due to this oddity, it seemed like it could be the location of the logical endpoint to the game.

There is much more to come for this game’s story – and I will avoid giving too many more spoilers from now on! In the meantime, I hope this glimpse into our story-building process was interesting and inspires creativity for those who are working on their own stories too.

Reaching the Midpoint and Our Demo

This week marked the midway point for my team’s text-based adventure game project. The prior week passed by in a blur as we worked hard to get it ready for a demo – after getting the needed functionalities done or close to done, it was time to put all of the pieces together! And I am happy to report that the process was surprisingly seamless. As the writer of the script that runs the game, I was the first who got to actually run the game, and the excitement I felt at seeing it all work so well together was palpable. There is almost nothing so satisfying as seeing a well thought-out plan come together, especially after so much work!

To celebrate our success (and live up to my word), I would like to present a short playthrough video of our demo to show off most of our game’s current features. Enjoy!

A playthrough of our demo showcasing most features.

In the coming weeks, we will be adding the final touches to the game such as adding many more rooms, bringing the story together, and fully implementing save/load functionality. I am excited to dive in to the final stretch after taking a much deserved day off.

Room Objects and JSON Files

As mentioned in previous posts, my team for our capstone project is creating a text-based adventure game using Python. It has been a lot of fun diving into the code and designing this project – and next week we will showcase our first demo! Because of this, our team has been spending a lot of time getting some of the final basic functionalities in place. One of those functionalities is loading data for the rooms in the adventure from external JSON files. And since I have been working on this functionality for the majority of the week, I wanted to share a bit of my process as well as a cool package I plan on using for validating the file structures.

To give context, the foundation of our project rests on game object classes we have created – the Game, Rooms, Doors, and Items. And so, the basic steps for loading up the game from external files are:

  1. Find all of the JSON room files in the rooms folder.
  2. For each file, validate that it is structured correctly (more on this later).
  3. If it is structured correctly, use the data to create a dictionary of Door objects and a dictionary of Item objects.
  4. Use these dictionaries along with the rest of the data to create a new Room object.
  5. Add that Room to the rooms dictionary (which is what is returned).

Luckily, loading the external files and creating the objects was not too difficult of a task once we decided on how we wanted the JSON files to be structured. Because of this, the code for the actual load_rooms function itself was fast to write. What took the most time by far was writing the tests for the function once it was complete. I knew that ideally, I wanted a couple of test JSON files to be created automatically for the testing, and then removed after the tests were done running. This led me down a rabbit hole re-learning how to use unittest’s tearDownClass() class method, and the file creation/deletion took a while due in part to having to remind myself how os.path.abspath(path) works. (Hint: it returns a string of the path to the argument relative to the current working directory; and your cwd changes when you are running tests in another folder versus when you are running the main script files.) Once I remembered this, it was mostly smooth sailing getting the rest of the tests written (even if it did take a while).

So far, everything that I have mentioned is something I have done before, and so I was never completely lost. However, there is something new I will be trying for this part of the project that is uncharted territory for me: validating the JSON data for the correct structure.

While finishing up the load_rooms function, I realized it would be important for us to be able to easily verify that each of the Room files we add were using the correct structure. One way to verify the structure would be to manually go through and check for every key – and sure, this would be doable – but there must be a better way, right?

Enter JSON Schema and Python’s jsonschema library.

“When you’re talking about a data format, you want to have metadata about what keys mean, including the valid inputs for those keys. JSON Schema is a proposed IETF standard how to answer those questions for data.”

From the JSON Schema website – Getting Started Step-By-Step

JSON Schema can be used to validate that a data set adheres to a given schema – and the jsonschema Python library is an implementation of this standard. By using this, it will make it much easier for my team and I to ensure that we are not making any major mistakes when adding new rooms to our game. Trying something new like this is always a bit exciting and I am eager to get started on the actual code for it.

Overall, this week has had its fill of triumphs and trials, and while some of the hurdles took a while to get over, I am satisfied with what I learned and accomplished. By this time next week, I hope to have a demo worthy of showcasing on my blog!

My Top Tips for Interview Anxiety

This week, I had my first phone interview for a job this year. I believe it went well and it was great practice – I am glad I went through with it! It made me think of how far I have come when it comes to my ability to communicate, especially during something as high-pressure as an interview. “What if I say something wrong? What if they ask me a question and I blank out?” While questions like these still are in the back of my mind, I have developed many strategies to help me prepare that have made it marginally less of a stressful experience. This inspired me to want to give a few tips to those (like me) who find the prospect of interviews nerve-wracking:

First tip: Write out your answers to commonly asked questions.

One of my top tips for making it through any kind of interview is by preparing your answers in advance. By planning out your answers to some commonly asked interview questions (search engines are your friend here), it is incredibly helpful in the event that you get nervous and cannot come up with any good answers during the actual interview. Anything you can do to reduce the amount of thinking you need to do in the interview itself is key!

Second tip: Research the company in advance (and take notes).

This is similar to the first answer: you are likely going to get questions about why you chose to apply at [company name] and what you know about [company name]. Putting in the effort ahead of time to research the company and write down important points will not only ensure you remember the important details during the interview, but it will also show that you are genuinely interested in the company.

Third tip: Don’t dwell on it before and afterwards.

The worst part of any stressful event for me, especially a social one, is the anticipation beforehand and the analysis of how it went afterwards. The more you concentrate on how nervous you are or how you did, the worse you will feel about it. Once you do all of the above, go and watch an episode of your favorite show and trust that you prepared well. And remember that if you feel like you made any mistakes afterwards, it’s okay – you’re only human (and so is the interviewer).

I hope this is helpful, especially to anyone who is going into an interview soon. Good luck and happy job hunting!

I Used All My Brainpower Writing Descriptions For Testing Room Objects

When I sat down to write this blog post, trusting that my brain is usually good at coming up with words, I was confronted with utter silence. Absolute nothingness. Why is this, you may ask? Well, during my time working on our capstone project yesterday – a text-based adventure game – I spent a significant amount of time implementing the Room class to be used for representing rooms and their contents in our game. And, since Rooms require a short description and a long description, when writing the tests for the Room class, I had to come up with these descriptions. A lot of descriptions. And I may have had too much fun. I would like to share a few of my favorites:

Room Name: “Kitchen”
Short Description: “The floor and the walls are full of potatoes. How this happened is a mystery.”
Long Description: “With the sparkling clean appliances and empty shelves, one would almost believe that this kitchen had never been touched…if it were not for the potatoes. The entire floor is covered in potatoes. And, if one looks closely enough, a hole in the wall reveals that the walls, too, are full of potatoes. How this could have happened is a mystery.”

Room Name: “Chair Hell”
Short Description: “The chairs are staring at you. You feel a sense of dread.”
Long Description: “You are not entirely certain what you did to deserve this – perhaps you were a bit too critical of your office chairs in life – but in this afterlife, you seem to be surrounded by chairs. And not just any chairs – sentient, angry chairs. They look at you with clear malice in their eyes. You wonder if it’s too late to repent.”

Room Name: “Sewing Room”
Short Description: “Fabric is spilling out of the shelves while a mouse is hard at work sewing a button on a sleeve.”
Long Description: “The way the mouse on a nearby table scrutinizes your outfit makes you feel underdressed. Other than the overflowing fabric in the nearby shelves, most of the floor space is taken up by mannequins of various shapes and sizes. About a dozen mice are hard at work doing various repairs, from missing buttons to rips in seams. You wonder who these clothes are for.”

Writing the descriptions was a fun exercise in creative writing – and who knows, perhaps we will use one of these in our final game? And the tests served their purpose as well, all verifications of the currently implemented methods passing on the first try (always satisfying). I even got to use unittest’s Mock class to mock the unfinished Item and Door classes – something I learned about in CS 362 (Software Engineering II) but never had the chance to try. Overall, it was a gratifying exercise, even if my mind is currently out of creativity.

For now, I will make myself a cup of tea and allow my mind some rest until I tackle our project’s Item class – and come up with all of the names and descriptions for those. (Sure, I could use some classic lorem ipsum, but where is the fun in that?)

New Discoveries and Old Adventures

Over the course of the past week, I and a few others in my capstone course were chosen to create a text-based adventure game as our final project! As this was my number one pick, I am very excited and have already started exploring the wide variety of ways we could go about planning and creating our project. This exploration led me a few different places and I learned about some technologies and libraries I was unaware of in the process. To share a couple:

  1. I discovered a cool JavaScript library called jQuery Terminal Emulator for emulating a terminal-like UI in the browser with custom commands.
  2. I learned about creating JSON-RPC services and multiple ways not to integrate one with a Python/Flask application.

And to get some inspiration, I played through a few of my older works of interactive fiction. One game in particular I played through is a demo that I wrote some time ago for a game called The Marble Mansion – and it is the perfect candidate to recreate using the jQuery Terminal Emulator plugin.

The Marble Mansion Demo is the first act for a game I originally made using Inform7, an application for creating interactive fiction. The player wakes up in a decrepit mansion with no memory of how they got there, and the only way to find out (and escape) is to explore the mansion. The game is interacted with by typing commands such as “examine item” or “look at room”. It is a fun game even if it is just a demo (feel free to play it) and the current version works fine, but I would love to recreate it from scratch in order to truly customize the experience (and challenge myself). And after my discoveries, I think I will choose to use JavaScript with the terminal plugin I found in order to rebuild the game in my free time.

Overall, exploring these technologies and my old games was a great exercise in order to get in the correct mindset for planning our capstone project. I already have a lot of ideas for the structure we could follow as well as a few ideas for what the story could be – and I cannot wait to get started!

From Computer Class to Annie’s Dollhouse

My first ever game was a simple 2D side-scroller about a princess who saves a prince. It was made in a middle school computer class alongside my best friend in a program similar to Stencyl, a game creation software that uses a drag-and-drop style of coding and cute pixelated assets. Our game only ended up with two functionalities – walking around and picking up potions – but it was at that point that the seed was sewn: I wanted to create stories that people could play.

Fast-forward through high school and my first ever Computer Science course, and I started to pursue my first Bachelor’s degree in Digital Technology and Culture where I specialized in digital storytelling and game development. It was in a web development course where I made my first from-scratch game: Annie’s Dollhouse.

A doll's face with text over it that says "now we can play together".
A screenshot of Annie’s Dollhouse.

Annie’s Dollhouse is a riddle-horror game written using JavaScript where users have to choose the correct answers to the riddles…or face the consequences (though, one could argue there is no “good” ending). It is a game that I was (and am still) proud of coming up with, and it ended up being featured in the CMDC Nouspace Student Research Gallery, Exhibit 26, for mixing the two genres. I still display it on my portfolio website for these reasons (it is a fun little game – feel free to play through it!), but that definitely does not mean there is no room for improvement after all these years.

The code as it was originally written was, while functional, not well organized or efficient. It was over 1000 lines of code broken up into three different functions, all of which was made up of nested function calls and a lot of repeat code. The current version (which was last updated in 2019) is broken up in a more logical way…but it still suffers from not following the DRY principal (Don’t Repeat Yourself) as well as hardcoded strings that make it difficult to update without breaking the game. (This is a prime example of why you should always write code that is easy to maintain and change later – something I had not thought much about until pursing a degree in Computer Science.) Someday I would like to go back and overhaul the code, but even as it is, I still love this little game. It’s short and sweet (and a little scary) and it’s a great example of the kind of storytelling I want to continue doing in the future.

After all of this time and now that I have been pursuing a degree in Computer Science, I still love making games. Writing code and creating stories are two of my favorite pastimes – and now that I have more knowledge at my disposal, I finally have the power to make more of my visions a reality! And I am hopeful that, as I go into my final project before graduation, I will come away with yet another great game I can be proud of.