After the beta was completed, work was started on making the game ready for its final release. I received another unity project file from my team leader that had two final levels and all the assets implemented. I had to add this to my existing project and make sure everything worked together. I also replaced my placeholder assets with the final ones.
Video of Final Build
I put together a basic title screen with a screenshot from an edited scene in the Unity editor as the 2D artist unfortunately wasn’t able to make the title screen assets. As seen in the video, the two bugs that were present in the beta haven’t been completely fixed. Methods were put in place to mitigate them but they can still happen. I didn’t have enough time to completely fix them before the deadline for the Team Project. Sound has been added to the game to make the game more enjoyable to play in the form of music and sound effects for the player being hurt and the glass breaking.
Variables Script Changes
New variables were added to the variable script so that the sound effects could be linked to within the scripts when the respective sounds were needed.
Damage Script Changes
The integer contained within the TakeDamage functions in the damage script was changed to be a variable so that I could change the damage value for each object in the editor instead of making a new script for each object. The second line of code in this screenshot shows one of the player damage audio clips being played.
Glass Destruction Script Change
I added this line of code to the glass destruction script so that the sound of glass being broken would play when the broken glass is triggered.
Player 1 Respawn Script 2
A new version of the player respawn script needed to be created for both players as I removed the need for the dummy player to be created when the player walks off the edge to mitigate the double score bug. It is virtually the same as the other respawn script except that the line of code that destroys the object is removed since the players shouldn’t be destroyed within a script since it would cause script issues.
The link goes to the game page which has a playable HTML version as well as a downloadable executable version for Windows. The Windows executable is recommended as the HTML version usually has performance issues.
I was given feedback on some aspects of the game alpha from my team as well as external testers that I used as a basis for changes in the beta. I also aimed to fix issues encountered in the alpha.
Video of the Beta
The video of the Beta above shows the game almost feature complete however there are some bugs visible in this video.
The score system has now been implemented which is the new win condition for the game with the aim being for one of the player to reach a score of 5. There is a bug with the score system as the score sometimes gains 2 instead of 1 when the player falls or is thrown down.
The windows can now be destroyed which allows both players to fall or get thrown down outside of the building which is how the players get score when the other player falls or is thrown from the building. To implement the window destruction I had to create a simple model in Blender and then apply an addon known as cell fracture that I then used on the model. I then exported both versions of the model that I needed for the destruction script that will be shown later in the development log.
A respawn system has been added for the players since the win condition now includes them being defeated multiple times rather than once. The respawn system uses a dummy version of the player that is either created when the player’s health reaches 0 or when the player walks or is thrown off the level.
The movement for the players has also been redone. This is because originally I had to make the players kinematic for them to be able to move around correctly but this stopped the objects from interacting with the player model so I redid the player movement script with more physics-based code.
I revised the control scheme of the game by making E and Right Control the keys to both pick up and throw the objects due to some feedback. This meant the control scheme was simpler and the unnecessary feature of dropping objects was removed.
I fixed the objects being lost by adding invisible colliders in the out of bounds areas around the level so the objects would bounce back in as well as implementing a respawn system for objects since the windows can also break now. There is a bug with the objects where sometimes they don’t trigger damage on the players.
The bugs mentioned are aimed to be fixed in the final build.
Player 1 Score Script
The above image shows the script that controls the Player 1 score UI element. It is very short as all it does is link the score variable to the UI text. The image below shows the script for the Player 2 score UI.
Player 2 Score Script
Variables Script
This new script is used to contain some old variables and some new variables to make them easier to access. This means that I don’t have to link to objects for each time a script is used and instead only have to link once from the object the variable script is linked to. The player respawn and player transform variables are used to set the respawn points of the players and the direction that the object should be thrown. The void Update section of this script is used to determine when one of the players has reached the win condition by using the two new floats that contain the player scores. It then disables both of the players and enables the UI for whichever player won. The UI code was moved from the damage script to here as this script is where the new win condition is determined.
Glass Destruction Script
This script is the one that has the functionality for the glass being destroyed. It is connected to the glass object and has a game object variable that links to the broken glass object. When any object enters the trigger for the glass the broken glass object replaces the glass object by being created as the glass is removed from the level.
Glass Removal Script
This script removes all of the broken glass from the level after 5 seconds of it being active. This is because the broken glass object consist of many different smaller objects so for performance reasons this isn’t kept for long.
Player 1 Respawn Script
The above script is the script that handles the respawn of the player. It does so by destroying the dummy version of the the player and then moving the actual player to the respawn location and reactivating them. The player object is never actually destroyed as it causes some script errors so it is just deactivated in the level and replaced when the player loses health or is falling off the map. Below is the Player 2 version of this script.
Player 2 Respawn Script
Player Health Script Changes
This image shows some changes made to the player health scripts. A new function has been added that is used to reset the player health of both players when they respawn. The void Update section has been changed to no longer contain the win condition of the game and instead now creates the dummy version of the player when the health of the player runs out. The playerisDummy bool is used in this code because without it the player dummies are spawned infinitely which is not intended at all.
Infinite Dummy Player Bug (Fixed)
Player 1 Movement Script Version 2
The image above shows the new version of the player movement script. It has the exact same functionality as the original script but it is done in a different way that works with using the rigidbody of the player for movement rather then the character controller as this allows the objects to affect the player correctly. The character controllers were removed from the players as they were no longer needed. Below is the script for the second player.
Player 2 Movement Script Version 2
Item Pickup Script Changes
The above code is the changes I made to the item pickup script for the control scheme. I had to edit the parameters for the if statements to make sure this fully functioned like it did before but with the same key being used for both picking up and throwing an object.
Object Respawn Script
This script is the one that respawns the throwable objects. When the objects are thrown off the map they are respawn in the level at the point set in the variable. Constraints are set and removed on the rigidbodies of the objects so that the force applied to the object isn’t carried over when they respawn.
After the prototype, I received a unity project file from the team leader who was also the level designer that contained a work in progress version of the levels that are going to be in the game as well as assets from the 2D artists and 3D modellers. This allowed me to start working on the alpha of the game which would contain most of the functionality of the game as well as having a way to ‘finish’ the game even if is wasn’t necessarily the way that it would when it was finished. I moved all of my assets that I needed from my unity project into the new one so that all of my progress from the prototype would be in the new project for the alpha.
Game Alpha Screenshot
The above image shows the alpha of the game that I created. It has some assets implemented such as the chair, desk and health bar. It also has more functionality then the prototype as the damage system is working which affects the health bar and allows one of the players to win.
User Interface
This image shows the UI which is functional as the health bars move when the players are damaged. However, the player score for both players is missing as this has not yet been implemented. Below is an example of the health bar when one of the players is damaged.
Health Bar with Damage
Winning UI
The image above displays the UI that appears when one of the players wins the match. It allows the players to restart the game by pressing the rematch button which reloads the scene. In the future, more buttons will be added to allow the player to switch the level when more levels are added and to be able to quit the game.
Object out of Bounds
Object Lost
The above images show a bug in the alpha that allows the player to throw or drop objects out of bounds which means the object will no longer be useable. This means that there is potential for the players to lose all the objects meaning the level can’t be completed as neither player can damage the other. This will be fixed in the next build of the game.
Player Health Script
This image shows the script that has the functionality of the first player’s health. The Player GameObject variable links to the player while the winUI2 links to the UI that is displayed when Player 1 dies. The two integers are variables that contain the max health of the player and the current health of the player. The healthBar variable links to the script that controls the health bar of the player so that it has the correct values to display on the bar. The void Start section of the code is used to set the player’s current health to the full health of the player as well as setting the health bar value to the max health. The next part of the code is a function called TakeDamage that is created to allow the player to take damage. It takes the damage integer away from the current health and sets the health bar value to the current health so that it goes down. The last section of this script is used to detect when the player’s health is 0 so that the UI to show that Player 2 has won can be shown as well as disabling Player 1 so that they can no longer move since they lost. The below image shows the script for Player 2 which is very similar with minor differences linking to the Player 2 related values and UI.
2nd Player Health Script
Damage Script
This script is the one that handles the functionality for the damage of the objects when they hit the players. It has the same functionality as the script from the prototype as well as actually having the damage system implemented. The damage lines of code link to the respective player health scripts for each player to remove the damage integer in the brackets from the health of the respective player.
Health Bar Script
The above script is a very simple script that connects the health bars in the UI to the health values of the players. This is so when the player is damaged the bar will visibly go down.
The team I was assigned to was called The Lego Munchers. This name was chosen to match our game idea as the characters in the game are based off of Lego bricks. The role I had within the team was game designer and scripter. We decided that our game was to be Lego-based in some way very early on and that the game would have some kind of connection to the word defenestration which is the word that describes someone the action of throwing something or someone out of a window. This is why the title of our game was chosen to be Delegostration.
After we had decided on a title, we had to decide on what type of a game we wanted to make. Eventually, we settled on the idea of a Gang Beasts type fighting game set in an office with two players against each other. The idea was for each player to try and knock the other player out of a window to win the game. The team leader then gave tasks for each of the team members to do and made sure that each person had enough to do.
I made a prototype of the game to test the various game mechanics I would have to implement. The mechanics that were implemented in this prototype were player movement, multiple players and picking up and throwing objects.
Video of the Prototype
This prototype shows the player movement working for both the players as well as both players being able to interact with objects (the blocks) by picking them up, dropping them and throwing them. However, at this stage the winning conditions were not implemented so there is no way for the players to damage or knock each other around. There was a dummy player in this prototype to display how this would function later. The models used in the prototype are placeholders implemented by me which will later be replaced by models made by our 3D modellers.
Player 1 Movement Script
This script is the one that enables the first player character to move around the game environment. The first part of the script is where the variables are set up to enable the script to work. The controller variable links to the character controller of the player and the cam variable links to the camera of the game scene. The speed variable is a float used to set how fast the player moves while the turnSmoothTime and turnSmoothVelocity are floats used to to make the turning of the player character smoother. The first section of code within the void Update section is used to detect the input of movement linked to WASD by using the Horizontal and Vertical input tags and to create a Vector3 linked to these inputs so that the player can be moved using them. The normalized part is at the end of the Vector3 line is used so that the speed of the player doesn’t increase when multiple keys are pressed to get the player to go diagonally. The if section of the code only works if the player is moving because it is looking for the number that represents the input of the player to be higher then 0.1. The first line of the if section is used to make the player turn to the direction they are moving in while the next two are used so that the player doesn’t snap instantly to the direction and instead turns. The last bit of code in the if section is what actually moves the player by determining the direction it needs to move in as well as actually moving the player by using the character controller.
Player 2 Movement Script
This script is virtually the same as the previous script except that it is the one for the second player. The only difference is that the input that the script is looking for is the arrow keys rather then WASD which is linked to by using Alt in front of Horizontal and Vertical.
In Progress Damage Script
The above script is an incomplete script that was used to test some functionality for the damage system that will be later implemented. It detects when the objects are near the player while being thrown by adding a log in the debugging menu that says that damage has been done. It also disables the trigger used to detect the player when the object either hits the player or the environment so that the player wouldn’t get damaged if they walked near the objects on the ground.
Item Pickup Script Variables
The above image shows the first part of the script used for the functionality of the player picking up and throwing or dropping objects. This part of the script starts with the variables needed for this script. The itemOG variable is used to link to the object that this script is attached to in the game. The damageObj variable is used to link to a component of the object that contains the trigger used to detect the player when the object is being thrown. The next variable is a float called throwForce that is used to set the force at which the object is thrown. The objectHeld variables are booleans used to determine if one of the players is holding this object when the other is in the radius of it. The next two variables are floats used to see if the player already has an object when they try to pick up another one. The two transform variables are used to set where the objects will go when they are picked up. The withinRadius and pickedUp booleans are used to detect when the players are in the radius of the object so it can be picked up and if the object has been picked up by the players. The two trigger sections are used to set the withinRadius variables to true or false whenever the players enter or exit the trigger on the object.
Item Pickup Script Player 1 Functionality
The first if section of this part of the code is only active when player 1 is within the radius of the object, the object isn’t held by the first or second player and the amount of objects the player has is below one (since the player should only be able to hold one object). The part inside the if section is an if section that detects when the player presses the E key as this is the key that is used to pick up objects and has the functionality for the object being picked up. The object is made kinematic so that the other objects can’t affect it and is made to not use gravity so it stays where it is moved to. The object is then moved to the destination set in the variables section and added to the player object so that it stays with the player when the player moves. The related variables are also changed so that the script knows that player 1 has picked up this object. The next if section that isn’t contained inside the first if section is only active when the player has picked up an object. It contains two if sections that detect when the R and F keys are pressed respectively. R being the key that drops the object and F the key that throws it. They both reverse all the changes made in the code contained inside the first if section with the only difference being that the F section enables a trigger contained in the object that detects the player for the damage script and throws the object forwards.
Item Pickup Script Player 2 Functionality
This image shows the functionality for Player 2. It is in the most part the same as the part of the script for Player 1 but instead uses Return/Enter as the key for picking up objects as well as Right Shift for dropping the object and Right Control for throwing the object.