Big Game Project – Post 5 – Final Post

In the final days before GGC I made/worked on the following:

  • Pause Menu
  • Results Screen
  • Loading Screen
  • Assisted Driving (derived from AI)
  • Scene Transitions

Pause Menu

The pause menu is accessed by any player pressing the start button on their controller (if four controllers are connected but only two of them are racing, only the two active controllers can be used to pause).
Pausing the game triggers a global bool that stops every script from running. It originally set the TimeScale of Unity to 0, but then it stopped taking input for the pause menu so I had to solve it using the global bool.

The pause menu itself is a canvas that (de)activates and overlays the game screen, with buttons copied from the main menu that another programmer created earlier in the production.
The code for input I wrote to take every active controller into account with an internal cooldown for each controllers input so it doesn’t spam through the buttons.

Every button has properties like if they should have a confirmation window before triggering along with choosing the text displayed in it.

Fixes:

There is a cooldown for the A button that triggers when the confirmation window opens since it autotriggered when it wasn’t there (Confirm is done by pressing A, and entering the confirmation window uses the same button).

When switching scenes in Unity the global bools didn’t reset, so the return to main menu autotriggered when re-entering the Game state, fixed by having every static variable resetting in the OnEnable method of Unity.

 

Results Screen

Basically the same solution as the pause screen, only this was made on the final day so it was rushed together.
The Canvas activates when the game is done, it goes through every child the canvas has in order, with every object having a script containing a bool done that triggers the canvas to deactivate and activate the next object until it has gone through all of them and the game goes back to the main menu.

Some objects are triggered by themselves (like a fade to black that starts the results part of the game) and some by pressing A on any controller active (same procedure as pause menu, only the controllers currently in the race can press).

I made an input system for the high scores, every player chooses three letters by using the D-pad (up & down for switching through letters and left & right to switch between which of the three letters to be changed).
The letters was made using a generated image of a font using a program that our programming teacher Tommi Lipponen provided during an earlier course. The image was divided into individual letters by  Unitys built in sprite editor.
If I remember correctly I made an array of letters in a script, adding every individual image of a letter manually.
Then it was just switching the image by switching the the next/previous image in the array and the letter was retrieved by the same way, which position in the array they are (A is 0, B is 1 etc.).

We never designed the rest of the visual area of the highscore inputting, leading to that part of the results being only a black screen with each players’ three letters shown. We decided to not use the highscore input for the GGC build and only have the results shown (The data, things like best lap time and total time was saved by a trigger in the waypointhandler and timers created by the other programmers).

 

Loading Screen/Screen transitions

The loading screen in our game is fake, it doesn’t take more than 0.5 seconds to load the game but we used it to show our control scheme before the race, and we didn’t want the game to freeze for 0.5 seconds when pressing start so we added screen transitions that fades the screen to black (and back again in the next scene).
The only things in the loading screen is an image of the control schemes and starting circles that indicate the start/goal of the racetracks as a “now loading” indication.

 

Assisted Driving

The playtesters said that the game was too hard, so I added some assistance to the drivers that helps them turn.

What it does is cast a ray down to each side and if it doesn’t hit the track it adds a predetermined value to the steering of the vehicle.
The same idea is used for the AI so I just copied my code from there to the players.
This assistance some said was annoying since it leads them into the center when close to the edge so I added a way to shut it down by pressing the space bar on a keyboard.

 

That is basically every major artifact I made/worked on during this project, thank you for reading through my journey in the making of our game and I’ll start posting again next year when school starts again