Creative Technology - Final Project
Build upon a Design Challenge (or create something entirely new) to develop a socially useful, beneficial, or positive tool, application, or artwork.
I decided to build my final project using Unity. Of the programs we used throughout the semester, Unity was the one I had the least exposure to beforehand. I had never used the Unity IDE, and I had never programmed in C# before, so I decided to challenge myself.
In our Unity specific design challenge, I made a simple game where the player controls a snowman, and the only goal is to collect snowballs. I decided to expand on that concept and make it educational. The plan was to have the player control a snowman who was fighting against climate change. They would have to collect the materials to build environmentally friendly technology, such as wind turbines and solar panels. In this way, the person playing the game can be educated about some of the dangers of climate change and be introduced to some alternative energy sources. I felt that this was a good way to make a “socially useful, beneficial, or positive” application.
I decided to use a grid system in order to lay out the levels. I was able to import a free asset pack from the Unity Asset Store which included winter themed environment tiles. With a Tilemap Collider attached to my grid system, I was able to use these tiles as platforms for the player character to stand on.
Rather than just leaving empty gaps for the player to have to jump over, I utilized another group of tiles from the imported asset pack to make water hazards. This makes it obvious that the player should avoid falling into the gaps. Combining fourteen different versions of the water tile, I was able to create an animation so that there appear to be waves rippling through the water. I felt that this background animation was important to fully realize the environment.
With the basics of my level design in place, I had to focus on the character that the player would control. In Adobe Illustrator, I drew the body parts I would need to assemble my snowman avatar and exported them all into the scene. With all the pieces available, I arranged a head, a body, arms, legs, eyes, a nose, and three buttons into a recognizable snowman shape. I saved this grouping as a “prefab” so I would be able to use the avatar in any situation I needed it.
At that point, I decided that I wanted to use skeletal animation rather than sprite animation for the player character. This meant that I would attach each relevant body part to a “bone”. I could then create any character animations I wanted by moving these bones, meaning I did not have to redraw the snowman multiple times to create each animation.
The next element I wanted to create, was a prefab of the snowballs that the player would collect throughout the game. To simplify this, I took the body element that I created for the snowman, and I scaled it down to 40% of its original size. I left one variant in its original off-white color and I created one in a dark blue. In this way, I planned to create collectibles of different point values that the player could easily distinguish.
With these key elements in place, I began to work on the C# code that would make it a playable game. Given my limited amount of time, I started with a Character Controller script that I found from a YouTube Unity tutorial channel called Brackeys (https://www.youtube.com/user/Brackeys). This handled a lot of the background controls such as jump velocity, flipping the character when the player changed directions, and gave me the option of adding crouch functionality. Working in tandem with this script, I created a Player Movement script which was able to read user inputs to trigger the routines in the Character Controller Script.
With the player now able to move, I needed to have the camera follow those movements, otherwise the size of the level would be severely limited. To accomplish this, I created a Camera Controller script. Initially, I had the camera follow the player exactly, but I was not satisfied with the result. First, I decided to have the camera only follow the player’s movements in the X direction. That was certainly an improvement, but this had the player centered on the screen, which made it slightly difficult to see what was coming up ahead of them. To solve this, I added an offset to the position of the camera. With this, came the issue that it was disorienting to change directions because the camera would jump to have the offset to the correct side of the screen. The final element this script needed, was to add smoothing to the camera movements.
Now it was possible for the player to advance far enough into the level to possibly fall into one of the water hazards. My next task, therefore, was to create a way for the player to respawn back at the beginning of the level. I added two elements to the scene. The first was a fall detector, which was simply a long box collider that sat below the level and followed the players movements. The second was an empty game object that I simply called a Level Manager. I attached a new Level Manager script to this element, which I would use to control a lot of the miscellaneous events that happen in a video game. In the Character Controller script, I added a routine that would detect when the player collided with the fall detector. That routine would trigger the respawn routine that I built in the new Level Manager script.
As we know though, very few games allow the player to have infinite chances. With that in mind, my next task was to keep track of how many times the player has died. I created a UI element that would display the life count to the player. Attached to this life count, I generated a Life Manager script, which would keep track of the number of deaths. When the player runs out of lives, it activates a UI element that tells the player they have lost.
The next UI element I implemented was a score tracker. As I stated, each snowball prefab was worth a different amount of points. I attached a Player Collect script to each prefab. When the player collided with the snowball, the point value is added to the player’s score and the snowball is removed from the screen.
The final UI element I wanted to create was essentially a timer. To play on the climate change theme, I made the timer a thermometer that is displaying the increasing temperature. This thermometer is made of a slider. The slider illustrates the temperature, which is increasing at one degree per second. Based on feedback I received in class, I decided to tie the snowball collectables to this thermometer. So, for each snowball the player collects, the temperature decreases by the same amount that the score increases by. Of course, when the thermometer reaches its maximum temperature, the game over screen is displayed, regardless of how many lives the player has left. After receiving feedback from the class, I added two elements to coincide with this temperature display. I added code to the Time Manager script to cause the sky in the background to slowly transition from a light blue to a reddish-orange color as the temperature increases. This makes it clearer to the player that they are running out of time. I also created a melting animation, which plays in the event of the player running out of time to make it more obvious why the player lost.
As I was play testing, it became very frustrating to fall into the water and have to completely restart the level. I decided to implement checkpoints throughout the level that the player would respawn at. I decided to add a slightly whimsical element to the game and represented these checkpoints as candy canes that I was able to import from another asset pack. Each checkpoint has a Checkpoint Controller script attached to it. When the player reaches one of these candy canes, it gains a green stripe to indicate that it has been activated. The script then tells the Level Manager script that if the player dies, they should respawn at this checkpoint.
The last element I added to the level was enemies. I drew elements of a Pollution Monster in Adobe Illustrator and imported them into my scene. I assembled these elements and saved them as a prefab, to which I attached an Enemy manager script. This script moves the enemies backwards and forwards across a platform, flipping it as it changes directions. If the player touches the monster, they immediately die and are forced to respawn at the last checkpoint.
To end the level, I decided that the player would open a chest containing the prize for that level. The chest I used came from the same asset pack as the tiles. I attached a Chest Manager script to the chest. When the player reaches the chest, the level is marked as complete, which starts a routine in the Level Manager script. This makes the level fade out, then a cut scene fades in which starts a predetermined animation. The chest opens, and the prize, which in this case is a wind turbine comes out of it. Once that animation completes, the cut scene fades out. If there were a second level it would then fade in, but this project only includes the first level for now.
Finally, to make this feel like a more complete game, I created a main menu. This menu displays the title of the game, and provides Play, Controls, and Quit buttons. There is a Main Menu script attached to this scene. Pressing the Quit button runs a routine that closes out of the game. Pressing the Controls button changes the display to show how the player can control the character. The controls screen includes a Back button that brings the player back to the main menu. Lastly, the Play button brings the player to a screen that explains the premise of the game. From this screen the player can press a Back button to return to the main menu, or they can press Start. The Start button causes the level to fade into view and allows the player to begin the game.
Through completing this project, I learned a lot about developing in Unity. It was a very intimidating program when I first got started, but by the end of the project I found that I was actually enjoying myself. Given the opportunity, I would like to complete my development of this game, possibly allowing the player to explore different environments and collect even more alternative energy sources. I am satisfied with what I have been able to produce, and I think it works very well as a game demo.