Overcharged is a local multiplayer game in which two players attempt to shoot the ball inside their opponent’s hoop. Both players have a set of abilities. Such as dashing, deflecting and a jetpack for jumping, to make the gameplay a bit more interesting. The player that scored the most goals in the given timelimit wins.
Overcharged was a university project in the second quarter of our second year in which we were free to create any indie game we would like to by utilizing any engine we wanted to. Since our team already collected experience in Unity3D, we decided to stick to it this time as well. We were given three weeks of time for development with a team of four designers/artists and two programmers. In this project we took some inspiration from both Overwatch and Rocket League to create an interesting two player versus game.
Since this game concept had too much complexity to let two players play on the same keyboard, we decided to make it networked. Both of us programmers had little experience with networking at this point so we decided to keep everything simple by making the game specifically for a local LAN network to avoid dealing with lag, packet loss and other potential network issues. For our approach we used the Unity build-in top level networking API UNet. We decided to let one player be the hosting and one be the joining client. Since the hosting client also had the server, it caused some issues that prevented the joining client from interacting with the ball as well as the hosting client could. However we optimized our networking a little and minimized this disadvantage for the joining player eventually.
Ball behaviour & interaction
The player has two key interactions with the ball in our game: Pushing the ball away from him by pressing the left mouse button or picking up the ball by holding down the right mouse button as well as shooting the held ball by releasing the right mouse button or as soon as the ball has overcharged. One of the main difficulties was to synchronize the ball position and state realiably and as precise as possible over the network, since only the hosting client simulated the ball movement and sent the position information to the joining client. Additionally the ball switch its own and its trails color as soon as one of the players hit or held the ball in order to show which player recently had control over the ball.
When a game is hosted, the player spawns in the playfield with frozen controls and a “Waiting…” message at the top of the screen. As soon as the a second player joins, he is assiged to the opposing team of the hosting player and a countdown to indicate the match beginning starts. Both players need to try to score goals as well as protecting their own goal from their opponent by utilizing their abilites to dash, fly and push the opponent. Everytime after a goal is scored, the players reset to their starting position and a new round starts. The player that scored the most goals after the time limit has run out, wins. Again, all these gamestates had to be communicated over the network.
UI & Audio implementation
An additional challenge was synching each players UI and audio over the network. While the UI implementation could easily be solved by creating synced variables holding the needed data and properties, audio turned out not to be as easy to synchronize. My solution was to spawn an object on the server which would play the sound and destroy itself afterwards everytime a sound needed to be played. That way both the hosting and the joining client could hear all of the sounds at the same time and from the same position.