Match Setup and Game Mode Management
While it is not the flashiest part of the game, setting up the match and operating the game mode are key parts to making Super Nova Stadium actually playable. Without some objective or limits on how the game is played, the game becomes more of a testing environment for ricocheting projectiles than an actual multiplayer game. Game modes and match setup is the backbone of the core gameplay loop.
Managing the match setup is closely tied to how the online multiplayer connections are handled and with controlling the player’s spawning. It starts with the multiplayer lobby where players can connect and adjust the game mode settings. These menus have values that can be changed that will be used to set the game mode for the match.
The online multiplayer menu with the variable game mode and player settings.
Some of the code that handles setting the values for the player data and the game mode taken from the multiplayer menu.
While this process alone would be easy to accomplish, there are complications with ensuring that every player is connected to the lobby properly and that these game mode and player setting changes are reflected across all clients and not just the host. Making sure that everything is synced up is incredibly important. Our team encounter problems with synchronizing each client’s match timer and score counter. By ensuring that all settings are synced up correctly, we can focus on operating the actual match.
The execution of the match is done by checking to see if the game is paused and reducing the match time if it is not. The team scores get updated according to the execution function of the game mode and finally a check to see if the match should end occurs.
The operation of the game mode can be done in a single function so that the operation of the match does not need to have different code for different game modes. For our team-based elimination mode, we simply check the number of eliminations a player has and sets the individual score to match.
We handle the operation of our game modes in single functions; these functions are called “function delegates.” By using function delegates, we can pass in a game mode to run without having to change any of the code on how the match operates. This prevents us from writing new code for every game mode, but rather swap out the code that controls the game mode for different code. In addition to this advantage, it becomes much easier to create more game modes for the future because we do not need to tailor the match operation code to the game mode. The new game mode can be created independently of the match operation and still work. And while the behind-the-scenes operation of the game needs some polish here and there, we have created a solid framework for building the game.
Comments