2D Top-Down Game:

This was part of my English Midterm project, so it contains a lot of symbolism from the books we read in class.

From a technical standpoint, it is a top down game that I implemented in C++ using SDL2. The entire rendering engine, game logic and enemy AI was written by me from scratch. The video below is a screen recording of me completing the game fully, followed by the development process.

1. GEtting Started

I knew I wanted to make a top-down 2D game because it would give the player a better sense of the layout of the level and it is also generally easier to code these kinds of games because they can run on basic hardware, there are more images online and no complex 3D rendering engine has to be designed.

I had a limited amount of time to complete the game, so I used images which I found online for all of the game art. I did modify the images to change some minor aspects and arrange objects around the level, but I didn’t draw everything from scratch.

Here are some examples of the sprite sheets I found which contained frames of the animations for each of the characters and furniture:

Once I had these bare essentials, I started getting the images on the screen, processing keyboard and mouse input and displaying the images in a specific sequence to create the walking and fighting animations. Once I could move the character in all 8 directions, I started work on the layout of the level.

2. Level Design

To make the level more interesting and dynamic, I implemented a random arrangement of obstacles which would change randomly. This was done by making a blank background image of the walls and floor and randomly choosing 300 pairs of coordinates within the boundaries for random pieces of furniture.

3. Enemy AI

In order to make the Minotaur into a worthwhile adversary, I had to give it some kind of intelligence to follow the player and attempt to attack them. Since the furniture was designed to be an obstacle only to the player, I allowed the Minotaur to walk through it. However, if the Minotaur’s path finding consisted of only following the player’s current location, it would not make for a very interesting level, since its movements could be easily predicted and avoided, and it would not make sense because the Minotaur would walk through walls to reach its destination. Thus I implemented a complex waypoint-based path finding algorithm which I designed myself.

Each of the highlighted squares in the image is a waypoint (target location for the Minotaur to walk to). In order to track the player, the Minotaur calculates the shortest path along the waypoints in order to reach the point closest to the player. Once it gets close enough to the player after following this path, it initiates a charge, plays an animation and runs towards the player at a much faster rate. If the player manages to escape, it pauses for a moment before returning to the closest waypoint, but otherwise, it slashes the player, dealing significant damage. The Minotaur also randomly pauses to stomp its feet and change the layout of the room. This makes the combat more exciting and unpredictable. I spent a lot of time debugging this algorithm and making sure the Minotaur knew exactly what it was supposed to do based on the nearest waypoint and distance to the player.

4. Hunger, Health and Sanity

In order to add some sort of time incentive to the player, I implemented mechanisms to drain hunger as the player runs around the level, and reduce their sanity passively as well. With increased hunger, the player’s movement slows, and they eventually begin to starve. With lower sanity, their health also drops and their attacks against the minotaur become weaker. However, there is also a way to stave off these effects. Every few seconds, the player can eat a cheeseburger or recite a prayer to temporarily boost their hunger or sanity levels. (These are important partreferences to the books we read)

tomb.png

5. ENDGAME

Finally, with a low enough hunger level, the player can access the “tomb” in the center, which is otherwise locked and shrouded in fog. (This is another reference to the books)

 
fight.png

This provides the player with the opportunity to fight back against the Minotaur but also forces them to endure some of the Minotaur’s attacks and sanity/hunger effects since they are defenseless in the beginning. By touching the scroll in the middle, the player gains the ability to fight back.

 

6. Advice

The last element I added was a system for the player to get “advice”. This functioned as kind of a tutorial by providing hints.

Annotation 2020-07-19 121506.png