Posted on January 30, 2022


NotPong is a small lockdown project game. It started as a simple local multiplayer Pong game just to get some more experience with Unity, but has has grown into a 1 versus 1 online multiplayer game that uses a client-server model.

The objective is to get the bomb to explode in the other player’s part of the ‘field’ or their ‘goal’.

It uses Mirror for networking and a self-hosted Node.js backend API that automatically spawns and manages game servers.


Creating a lobby

There are two ways to play the game: create a game/lobby, or join an existing one. One player creates a lobby and gets a 5 character lobby code to give to the opponent so they can join the game.

On the backend, game server instances are managed by a NodeJS API. When a player creates a game, they make an API call which spins up a new game server instance on one of the available ports within the preconfigured port range and is assigned a unique lobby code.

Joining a lobby

When a user enters a lobby code to join the lobby, the game performs an API request passing the lobby code which (assuming the code is valid and the lobby is still running) returns the game information (primarily the game server port number). The game client then connects to the server and the game begins.

Game server management

The game server is configured to shut down when an opponent has not connected to the game after a period of time and after the game is finished. Upon receiving the ‘close’ event, the matchmaking API kills the game server PID and removes the lobby code from the ‘running’ games list.

Single player game mode

Time challenge is a single player mode where the player has to keep deflecting the bomb for as long as they can, while it speeds up over time.