Posted April 03, 2024 by Sidequest cafe
#developement
IN-DEPTH LOOK: the round management system
Hello people, gab here! Today I’m going to explain in more detail how the game handles rounds and some other inner workings of the game system. This system was quite difficult to implement at first since I had to change a number of other systems that I implemented in the first iteration of the game.
the system is composed of 4 main parts:
I will now start to describe in detail these parts and how they interact with the “Player” object
-------PLAYER MANAGER-------
Truly the most complex of the four parts and the one that is being constantly updated and fixed in some way. This is the brain of the round system, counting the rounds, keeping track of who is winning, sending messages to the ui and the players themselves and overall dealing with the multiplayer aspect of the game.
The player manager is composed of the player input manager that is provided by unity and three custom scripts: RoundManager, Preround and Uimanager.
Due to the fact that the player manager has mostly public variables and functions, there is a number of other game objects that “checks” specific variables like the score, the number of rounds etc. For example one of these is the random material script in each object of map, which changes some values depending on how many rounds have passed since the beginning of the game.
--------MAP SPAWNER--------
The map spawner is the object in charge of spawning maps between rounds, it is quite a simple script that has some interesting functions behind it. On the first round, a random map is selected as the “current” map and another one will be selected as the “next”, on the next rounds the map that was considered “current” will then become the “last” , the “next” then becomes the “current” and a new “next” map is chosen randomly but excluding both the “last” and the new “current”. Although this seems intricated for no reason it’s actually useful for not having too many repeats of the same map over and over.
The map spawner also has a usefull feature where you can decide which map is going to spawn for testing purposes.
-------PLAYER SPAWN MANAGER------
The player spawn manager is the most simple out of all of the round system objects, it’s simply a game object that holds four other object which are the “spawnpoints” for the players, whenever a player needs to spawn in (usually at the start of a round) it checks the position of the spawnpoint of the same value as them (player 1, spawnpoint 1) and teleports there. A small interesting thing about the player spawn manager is a small script called Findfloor: Findlfoor is used each time a new map is spawned in and it teleports the player spawn manager up by 10 units, create a raycast downwards to find the position of the new floor and then teleports downwards to the new height. The reason I’ve decided to create findfloor is to fix a small problem where the player would start the round high in the air every time which would make the start of the round hectic with the cars not being equipped to handle verticality.
-------CAMERAS-------
Since in the project we use cinemachine, cameras are incredibly easy to set up. This helped us a lot in terms of time and coding issues that could have been raised if we used the basic cameras provided by unity. There are four main cameras that are used in the game: