Fog of War

Fog of War is a Unity-based project that merges 2D platforming with card batting. I worked with a team of four people and was responsible for doing the engine work and programming, while they handled art, story and testing. This game was inspired by Slay The Spire. I was able to borrow systems from rogue-like card games, while adding some my own spin on it.

Prototype – Intro

The prototype covers the first level, which the player must complete without dying, defeating the boss at the end. The player can move (left and right), jump and attack. Throughout the level, there are arrows being fired at the player from pill boxes, which they must avoid. There are also enemies. Battling these enemies is done in a card-style battler.

Menus

This was my first attempt at creating functional menus in Unity. I wanted a level of customisation over the game to allow graphical and volume control. The settings menu is a separate object that is enabled when the setting button is clicked. Every setting has an appropriate UI element assigned to it. Resolution and target frame-rate use drop-downs to select common options. V-sync is a tick box, and the volume of the three music tracks in the game is controlled using sliders.

The Platformer

During the platforming section, there were two functioning elements: the pillboxes and enemy knights. The pill boxes work off a timer which fires an arrow every 4 seconds. The arrow keeps travelling until the next arrow is fired, then it is destroyed. Instead of creating new arrows every time it’s fired, every 4 seconds the arrow is moved back to its start position to give the impression that a new arrow is being fired and destroyed.

The knights are simple spires with collision boxes. When the player attacks them, it triggers the transition between a 2D platformer and the card battler. Some of the knights move between two set points, allowing them to patrol a specified area. Moving knights have their own attack box that allows them to initiate the card battle. If players are caught in front of the knight, they have the incentive to attack first.

The Card-Battler

The card battler is where most of the functionality of the game lies. The game has a wide variety of cards. Each can be played by clicking and dragging. Attack cards deal damage to the opponent and defend cards give the player armour, reducing damage of an incoming attack.

Each turn, the enemy knight can attack, defend, or choose to pass and do both next turn. This is decided by a random number generator which goes from 1 to 3, so it is independent of the player’s choices. The knight’s intentions are displayed above them during the player’s turn, so the player can make decisions based on their opponent’s next move.

The player’s cards are transported them between the deck, hand and discard pile. This was achieved using three empty game objects, which I could transport the card prefabs between. The hand used a horizontal layout group component to display them in a line. The discard and deck game objects were placed outside of the canvas, so that once the cards are moved there they do not show up on the screen but are stored and can be moved to the hand to display them.

The Transition

To make the transitions between the two gameplay loops smooth, I made the entire project in one scene in unity, this allowed me to switch between menus, platforming level and the card level instantly, without needing to load a new scene each time. This was a tricky yet rewarding programming challenge, as I had to manage a number of game objects, while also writing scripts to communicate between the three states.

As the player can access to the main menu by pressing escape, I had to ensure that the game paused in the background and resumed where they left off.

Reflection

This was a complex project, dealing with a large number of scripts which needed to share information between them. My process for debugging improved, especially when testing multiple scripts communication wit each other. I was able to break code down and analyse each step to find and fix all the bugs I encountered. I also creatively use Unity game objects to achieve the effects I wanted, for example switching the cards between game objects to store them in virtual containers.

Comments are closed.