Game Core
Gameplay Mode
Main script that controls gameplay and evaluates win conditions. Part of the GameplayMode
is the processing of player kill/death and writing to player’s statistics.
Deathmatch
Most basic gameplay mode with standard deathmatch functionality.
Elimination
Players have a limited number of lives. The last player standing wins. This gameplay mode features a Shrinking Area that reduces the available map space over time.
Battle Royale
Players start in the airplane that circles around the shrinking area. After the drop starts, the plane enters the active map area, and players can drop and land with their jetpacks. Players have only one life, the last man standing wins.
While in the airplane, the player's input is processed by the AirplaneAgent
.
Shrinking Area
Shrinking Area is a circular area that shrinks over time and damages players outside of this area. Shrinking happens in multiple steps. Before every step a warning and a remaining time is displayed in the UI. The time between shrinking steps is based on active players - the less alive players, the faster the area shrinks.
Shrinking Area is enabled in the Battle Royale and Elimination modes.
Announcer
The Announcer
system is a simple system that informs players about in-game events such as multi-kills, remaining time, remaining players, and more. Every gameplay mode can define a different set of announcements that are being evaluated and presented to the player.
An Announcement
is a scriptable object defining an in-game event. Every announcement object has custom evaluation logic and contains what message or audio clip should be presented to the player once triggered. Announcements can have different priorities and can be played in specific channels. When two announcements in the same channel are triggered at once, only the one with higher priority is presented. This ensures that for example only the Triple Kill announcement is shown even though both Double Kill and Triple Kill announcements were activated.
Level Generation
Since creating meaningful levels for 200 players is time-consuming, we opted for generating levels semi-procedurally by code.
Every level is generated based on runtime specified parameters when the server loads the scene. Some randomness is involved in the generation process, so every run is different.
Scenes GenArea2
- GenArea 7
differ only in the parameter setup located on the Gameplay/NetworkGame
gameobject.
The level generation specifics are out of this documentation's scope, but in a nutshell, the level is divided into areas (colored sections). Every area is constructed from blocks (premade prefabs), and blocks are connected with connectors (premade prefabs - ramps, a pile of boxes). The center of each area is defined by a special tower block. The values controlling the generation can be found in the LevelGenerator
script.
Every block can define possible player spawn positions and positions of the item boxes. Item boxes are spawned into the level as part of the generation process.
NetworkGame
NetworkGame handles joining and leaving of connected players and spawns a Player
prefab for each client. Disconnected players are saved, so their data can be recovered in case of a reconnect. NetworkGame
spawns GameplayMode
during the initialization process.
Scene & SceneContext
Scene
handles scene-specific functionality and services (SceneService
) such as UI, camera, music, minimap, and others. Scene services are updated manually from the Scene
, so that they can be initialized, activated, deactivated, and updated at any time.
SceneContext
provides safe access to common services or other information that is needed across the codebase without using statics. Scene context is automatically passed to scene services and assigned to networked objects in Gameplay
and NetworkObjectPool
. Inheritance from ContextBehaviour
and ContextSimulationBehaviour
instead of NetworkBehaviour
and SimulationBehaviour
is needed for access to the SceneContext
.
Game Core
The following image illustrates the application loop:
The following diagram shows the lifespan of core game scripts:
Back to top