Jazz2::Multiplayer namespace

Multiplayer-related classes, compiled only if WITH_MULTIPLAYER.

See Multiplayer for how to run, configure and join a server.

Namespaces

namespace GameModes
Rules and HUD of the particular multiplayer game modes, compiled only if WITH_MULTIPLAYER.

Classes

struct AllPeersT
All connected peers tag type.
struct AntiCheatState
Server-side anti-cheat state of a peer.
struct ConnectionResult
Describes a connection result of INetworkHandler::OnPeerConnected().
class INetworkHandler
Interface to handle incomming network requests.
class IServerObserver
Interface to observe publicly-listed running servers.
class IServerStatusProvider
Interface to provide current status of the server.
struct LocalPeerT
Local peer tag type.
class MpLevelHandler
Level handler of a multiplayer game session (online or local splitscreen).
struct MpPlayerState
Network-agnostic per-player game-mode state for a single round.
struct MultiplayerSpawnPoint
Spawn point in a multiplayer level.
class NetworkManager
Manages game-specific network connections.
class NetworkManagerBase
Allows to create generic network clients and servers.
struct Peer
Remote peer as opaque handle.
struct PeerDescriptor
Peer descriptor.
struct PlaylistEntry
Playlist entry in ServerConfiguration.
struct RaceCheckpoint
Checkpoint on the track through a level.
struct ServerConfiguration
Server configuration.
struct ServerDescription
Server description.
class ServerDiscovery
Allows to monitor publicly-listed running servers for server listing.
struct ServerInitialization
Server initialization parameters.
struct ServerMessage
Message of the server with its arguments, see ServerMessageType.
struct ServerMessageArg
Argument of ServerMessage.
struct ServerMessageTeam
Team index passed to ServerMessage.
class WebhookClient
Posts selected server events to a configured webhook.

Enums

enum class MpGameMode { Unknown = 0, Battle, TeamBattle, Race, TeamRace, TreasureHunt, TeamTreasureHunt, CaptureTheFlag, Cooperation, RoastTag, LastRabbitStanding, ExtendedLastRabbitStanding, Pestilence, TeamLastRabbitStanding, Jailbreak, DeathCaptureTheFlag, FlagRun, Domination, HeadHunters }
Multiplayer game mode.
enum class NetworkChannel : std::uint8_t { Main, UnreliableUpdates, Count }
Network packet channel.
enum class NetworkState { None, Listening, Connecting, Connected, Local }
State of network connection.
enum class BroadcastPacketType { Null, DiscoveryRequest, DiscoveryResponse }
Packet type broadcasted on the local network.
enum class ClientPacketType { Null, Ping, Reserved, Rpc, Auth = 10, LevelReady, ChatMessage, ValidateAssetsResponse, ForceResyncActors = 20, PlayerReady = 30, PlayerUpdate, PlayerKeyPress, PlayerChangeWeaponRequest, PlayerSpectateRequest, PlayerAckWarped, PlayerChangeCharacter, PlayerChangeTeamRequest, ScriptPacket = 50 }
Packet type going from client to server.
enum class ServerPacketType { Null, Pong, Reserved, Rpc, AuthResponse = 70, PeerSetProperty, ValidateAssets, StreamAsset, LoadLevel = 80, LevelSetProperty, LevelResetProperties, ShowInGameLobby, FadeOut, PlaySfx, PlayCommonSfx, Reserved2, ChatMessage, SyncTileMap, SetTrigger, AdvanceTileAnimation, RevertTileAnimation, CreateDebris, StopSfx, ServerMessage, ScriptPacket, CreateControllablePlayer = 110, CreateRemoteActor, CreateMirroredActor, DestroyRemoteActor, UpdateAllActors, ChangeRemoteActorMetadata, MarkRemoteActorAsPlayer, UpdatePositionsInRound, SyncMinimapTrack, SyncTeamScores, SyncScoreboard, SyncRoundResults, SyncGameModeObjects, PlayerSetProperty = 130, PlayerResetProperties, PlayerRespawn, PlayerMoveInstantly, PlayerAckWarped, PlayerActivateForce, PlayerEmitWeaponFlare, PlayerChangeWeapon, PlayerTakeDamage, PlayerPush, PlayerActivateSpring, PlayerWarpIn }
Packet type going from server to client.
enum class PeerPropertyType { Unknown, Connected, Disconnected, Roasted, ClientID, Count }
Peer property type from ServerPacketType::PeerSetProperty.
enum class LevelPropertyType { Unknown, State = 1, GameMode, LevelText = 10, Music, BossHealth, Weather, Overtime, Countdown, Count }
Level property type from ServerPacketType::LevelSetProperty.
enum class PlayerPropertyType { Unknown, PlayerType = 1, Lives, Health, Controllable, Invulnerable, Modifier, Dizzy, Freeze, Shield, LimitCameraView, OverrideCameraView, ShakeCameraView, Spectate, Team, BeingStoodOn, SugarRush, AmbientLight, FlyCheat, ModeState, GravityFlipped, WeaponAmmo = 30, WeaponUpgrades, Coins = 60, Gems, Score, Points = 90, PositionInRound, Deaths, Kills, Laps, TreasureCollected, Count }
Player property type from ServerPacketType::PlayerSetProperty.
enum class PeerLevelState { Unknown, ValidatingAssets, StreamingMissingAssets, LevelLoaded, LevelSynchronized, Spectating, PlayerReady, PlayerSpawned }
Peer state in a level.
enum class SpectateMode : std::uint8_t { None, Forced, Requested, FreeCamera = 0x10, Mask = 0x0F }
Spectate mode flags.
enum class TrackRouteType { Lap, LevelExit }
Shape of the route traced by GenerateRaceRouteFromGeometry().
enum class TrackCharacterMoves : std::uint8_t { None = 0x00, DoubleJump = 0x01, Glide = 0x02, All = 0x03 }
Moves of only some characters the route tracer takes into account, supports a bitwise combination of its member values.
enum class Reason : std::uint32_t { Unknown, Disconnected, InvalidParameter, IncompatibleVersion, ProtocolViolation, SecurityPolicyViolation, AuthFailed, InvalidPassword, InvalidPlayerName, NotInWhitelist, Requires3rdPartyAuthProvider, ServerIsFull, ServerNotReady, ServerStopped, ServerStoppedForMaintenance, ServerStoppedForReconfiguration, ServerStoppedForUpdate, ConnectionLost, ConnectionTimedOut, Kicked, Banned, CheatingDetected, AssetStreamingNotAllowed, Idle }
Client disconnect reason.
enum class WebhookEventType : std::uint32_t { None = 0, ServerLifecycle = 0x01, PlayerConnected = 0x02, PlayerDisconnected = 0x04, PlayerKicked = 0x08, LevelChanged = 0x10, RoundStarted = 0x20, RoundEnded = 0x40, ChampionshipEnded = 0x80, ChatMessages = 0x100, PlayerRoasted = 0x200, PlayerLapFinished = 0x400, FlagCaptured = 0x800, Default = ServerLifecycle | PlayerConnected | PlayerDisconnected | PlayerKicked | LevelChanged | RoundEnded | ChampionshipEnded, All = ServerLifecycle | PlayerConnected | PlayerDisconnected | PlayerKicked | LevelChanged | RoundStarted | RoundEnded | ChampionshipEnded | ChatMessages | PlayerRoasted | PlayerLapFinished | FlagCaptured }
Server events that can be broadcast to a webhook.
enum class ServerMessageType : std::uint16_t { Unknown, Text, GameWillBeginShortly, ChampionshipWon, FirstToReachPointsWins, TeamsRebalanced, CtfFlagTaken, CtfFlagReturned, CtfFlagCaptured, CtfFlagDropped, RaceFinishedFirst, RaceFinished, WinnerIs, TeamWins, Overtime, RoundEndedInDraw, ControlPointCaptured, ControlPointCapturedUnnamed, FlagRunTookFlag, FlagRunOutOfTime, FlagRunPassedFlag, FlagRunScored, FlagRunStoleFlag, HeadHuntersDelivered, PlayerIsOut, PlayerPosition, PestilenceRandomZombie, PestilenceLastSurvivor, PestilenceBecameZombie, JailbreakPrisonersReleased, JailbreakTeamScored, RoastTagLostRingIdle, RoastTagHasRing, IdleSpectate, IdleSpectateHelp, RaceAlreadyFinished, CannotJoinNow, CheatsNotAllowed, TeamJoined, CannotChangeTeam, TeamUsage, TeamsOnlyInTeamModes, TeamsRebalancedReply, SetTeamUsage, PlayerMovedToTeam, PlayerNotFound, TeamCountOutOfRange, PollStartedRestart, PollStartedResetPoints, PollStartedSkip, PollAlreadyActive, PollUnsupportedType, PollCancelled, PollVoted, PollAlreadyVoted, PollNotActive, PollAccepted, PollNotEnoughVotes, Count }
Message sent by the server, which the client formats in its own language.
enum class ServerMessageDisplay : std::uint8_t { Console, Alert }
Where a ServerMessage is shown.
enum class ServerMessageArgType : std::uint8_t { Text, Number, Team }
Type of ServerMessageArg.

Functions

void GenerateRaceRouteFromGeometry(Tiles::TileMap* tileMap, Events::EventMap* eventMap, TrackRouteType routeType, float waterLevel, const SmallVector<MultiplayerSpawnPoint, 0>& spawnPoints, const SmallVector<Vector2i, 0>& startMarkers, SmallVector<RaceCheckpoint, 0>& orderedCheckpoints, Vector2i& outBoundsMin, Vector2i& outBoundsMax, bool& outCheckpointsOrdered, SmallVectorImpl<std::int32_t>* outDistances = nullptr, TrackCharacterMoves moves = TrackCharacterMoves::All)
Auto-places minimap track checkpoints for levels without authored waypoints.
auto ComputeReachableTiles(Tiles::TileMap* tileMap, Events::EventMap* eventMap, float waterLevel, Vector2f startPos, SmallVectorImpl<std::int32_t>& distances, TrackCharacterMoves moves = TrackCharacterMoves::All) -> bool
Finds every tile the player can get to from a position, with the movement model of GenerateRaceRouteFromGeometry().
auto IsTeamGameMode(MpGameMode mode) -> bool
Returns true if the specified game mode splits players into teams.
auto UsesCtfFlags(MpGameMode mode) -> bool
Returns true if the specified game mode uses the team flags and bases of Capture The Flag.
auto GetTeamColor(std::uint8_t team) -> nCine::Colorf
Returns the display color of the specified team (Blue, Red, Green, Yellow).
auto GetTeamName(std::uint8_t team) -> Death::Containers::StringView
Returns the display name of the specified team.
auto ApplyTeamFurColor(std::uint32_t furColor, std::uint8_t team) -> std::uint32_t
Recolors a packed fur color so the primary character color section matches the team color.

Variables

AllPeersT AllPeers constexpr
All connected peers tag.
LocalPeerT LocalPeer constexpr
Local peer tag.
static std::uint8_t MaxTeamCount constexpr
Maximum number of teams supported.
static std::uint8_t NoPreferredTeam constexpr
Sentinel team value meaning "no preference, let the server decide".

Enum documentation

enum class Jazz2::Multiplayer::MpGameMode

Multiplayer game mode.

Selects the win condition and team rules of a multiplayer round, from free-for-all and team variants of Battle, Race and Treasure Hunt to Capture The Flag, Jailbreak, Domination and Cooperation. The value is sent over the network, so new modes are only appended.

Enumerators
Unknown

Unspecified

Battle

Battle

TeamBattle

Team Battle

Race

Race

TeamRace

Team Race

TreasureHunt

Treasure Hunt

TeamTreasureHunt

Team Treasure Hunt

CaptureTheFlag

Capture The Flag

Cooperation

Cooperation

RoastTag

Roast Tag

LastRabbitStanding

Last Rabbit Standing

ExtendedLastRabbitStanding

Extended Last Rabbit Standing

Pestilence

Pestilence

TeamLastRabbitStanding

Team Last Rabbit Standing

Jailbreak

Jailbreak

DeathCaptureTheFlag

Death Capture The Flag

FlagRun

Flag Run

Domination

Domination

HeadHunters

Head Hunters

enum class Jazz2::Multiplayer::NetworkChannel : std::uint8_t

Network packet channel.

Selects which transport channel a packet is sent on, separating reliable, ordered traffic on the main channel from frequent unreliable state updates.

Enumerators
Main

Main

UnreliableUpdates

Unreliable updates

Count

Count of supported channels

enum class Jazz2::Multiplayer::NetworkState

State of network connection.

Describes the current role and connection status of a NetworkManagerBase: idle, listening as a server, or connecting to and connected with a remote server as a client.

Enumerators
None

Disconnected

Listening

Listening as server

Connecting

Connecting to server as client

Connected

Connected to server as client

Local

Local session with no socket (local splitscreen multiplayer)

enum class Jazz2::Multiplayer::BroadcastPacketType

Packet type broadcasted on the local network.

Identifies a connectionless packet exchanged over the LAN discovery channel, used by clients to locate running servers and by servers to announce themselves in response.

Enumerators
Null

Empty packet

DiscoveryRequest

Request to discover servers on the local network

DiscoveryResponse

Response of a server to a discovery request

enum class Jazz2::Multiplayer::ClientPacketType

Packet type going from client to server.

Identifies the kind of message sent in the client-to-server direction, covering connection setup (ping, authentication), level and chat handshakes, and periodic player state and input updates.

Enumerators
Null

Empty packet

Ping

Ping request to measure round trip time

Reserved

Reserved

Rpc

Remote procedure call forwarded to a scripted actor

Auth

Authentication request

LevelReady

Notifies the server that the level finished loading

ChatMessage

Chat message sent to the server

ValidateAssetsResponse

Response to a server request to validate required assets

ForceResyncActors

Requests the server to resynchronize all actors

PlayerReady

Notifies the server that the player is ready to spawn

PlayerUpdate

Periodic update of the local player state

PlayerKeyPress

Player input state

PlayerChangeWeaponRequest

Requests a weapon change

PlayerSpectateRequest

Requests to enable or disable spectate mode

PlayerAckWarped

Acknowledges that the player has been warped

PlayerChangeCharacter

Requests to change the player character

PlayerChangeTeamRequest

Requests to change the player team

ScriptPacket

Data a level script sends to the server (jjSendPacket())

enum class Jazz2::Multiplayer::ServerPacketType

Packet type going from server to client.

Identifies the kind of message sent in the server-to-client direction, covering authentication and asset handshakes, level loading and synchronization, actor creation and updates, and player state changes pushed by the server.

Enumerators
Null

Empty packet

Pong

Response to a ping request

Reserved

Reserved

Rpc

Remote procedure call forwarded to a scripted actor

AuthResponse

Response to an authentication request

PeerSetProperty

Sets a property of a peer

ValidateAssets

Requests the client to validate its required assets

StreamAsset

Streams a missing asset to the client

LoadLevel

Requests the client to load a level

LevelSetProperty

Sets a property of the current level

LevelResetProperties

ShowInGameLobby

Requests the client to show the in-game lobby

FadeOut

Requests the client to fade out the screen

PlaySfx

Plays a sound effect attached to an actor

PlayCommonSfx

Plays a common sound effect at a position

Reserved2

Unused, kept so the following values don't change

ChatMessage

Chat message of a player or of the server console, see ServerMessage for the rest

SyncTileMap

Synchronizes the state of the tile map

SetTrigger

Sets the state of a trigger

AdvanceTileAnimation

Advances a destructible tile animation

RevertTileAnimation

CreateDebris

Creates particle or sprite debris

StopSfx

Stops a sound effect attached to an actor, started with SfxFlags::Exclusive

ServerMessage

Alert or console line of the server, formatted by the client in its own language, see ServerMessageType

ScriptPacket

Data the level script of the server sends to the client (jjSendPacket())

CreateControllablePlayer

Creates a player controllable by the client

CreateRemoteActor

Creates a remote actor on the client

CreateMirroredActor

Creates a mirrored actor on the client

DestroyRemoteActor

Destroys a remote actor on the client

UpdateAllActors

Periodic update of the remote actors relevant to the peer

ChangeRemoteActorMetadata

Changes metadata of a remote actor

MarkRemoteActorAsPlayer

Marks a remote actor as another player

UpdatePositionsInRound

Updates player positions in the current round

SyncMinimapTrack

Sends the ordered track checkpoint polyline and start markers for the minimap

SyncTeamScores

Sends the per-team aggregate scores for the HUD

SyncScoreboard

Sends per-player scoreboard rows (name, kills, deaths, points, ping)

SyncRoundResults

Sends the final round standings shown while the round is ending

SyncGameModeObjects

Sends the objects of the game mode (control points, jails, heads, ...)

PlayerSetProperty

Sets a property of a player

PlayerResetProperties

Resets all properties of a player

PlayerRespawn

Respawns a player

PlayerMoveInstantly

Moves a player instantly to a position

PlayerAckWarped

PlayerActivateForce

PlayerEmitWeaponFlare

Emits a weapon flare from a player

PlayerChangeWeapon

Changes the current weapon of a player

PlayerTakeDamage

Applies damage to a player

PlayerPush

Pushes a player

PlayerActivateSpring

Activates a spring under a player

PlayerWarpIn

Warps a player into the level

enum class Jazz2::Multiplayer::PeerPropertyType

Peer property type from ServerPacketType::PeerSetProperty.

Identifies which per-peer session property the server is announcing to clients, such as a peer connecting, disconnecting or being roasted.

Enumerators
Unknown

Unknown

Connected

Peer connected

Disconnected

Peer disconnected

Roasted

Peer was roasted (killed)

ClientID

Number the server gave the receiving peer (see PeerDescriptor::ClientID) and whether it's an admin

Count

Count of supported property types

enum class Jazz2::Multiplayer::LevelPropertyType

Level property type from ServerPacketType::LevelSetProperty.

Identifies which property of the current level the server is updating on clients, such as the level state, the active game mode or the currently playing music.

Enumerators
Unknown

Unknown

State

Level state

GameMode

Game mode

LevelText

Overridden level text

Music

Currently playing music

BossHealth

Health of the currently active boss, drives the boss health bar on clients

Weather

Current weather type and intensity

Overtime

Time the remaining players have left to finish a race after the first one did

Countdown

Step of the big countdown in the middle of the screen, shown by a game mode

Count

Count of supported property types

enum class Jazz2::Multiplayer::PlayerPropertyType

Player property type from ServerPacketType::PlayerSetProperty.

Identifies which property of a player the server is updating on clients, covering character and health state, weapon ammo and upgrades, collected currency, and per-round statistics.

Enumerators
Unknown

Unknown

PlayerType

Player type (character)

Lives

Remaining lives

Health

Current health

Controllable

Whether the player is controllable

Invulnerable

Invulnerability state

Modifier

Active modifier (e.g., copter, frog)

Dizzy

Dizziness state

Freeze

Freeze state

Shield

Active shield

LimitCameraView

Camera view limit

OverrideCameraView

Camera view override

ShakeCameraView

Camera shake

Spectate

Spectate mode state

Team

Team the player belongs to

BeingStoodOn

Whether another player is standing on this one (cosmetic lift animation)

SugarRush

Remaining sugar rush time

AmbientLight

Ambient light intensity to apply and/or to remember for the checkpoint

FlyCheat

Whether fly-cheat behavior is active (unlimited copter flight)

ModeState

Role, score, carried amount and lives defined by the game mode

GravityFlipped

Whether gravity pulls the player up

WeaponAmmo

Ammo of a weapon

WeaponUpgrades

Upgrades of a weapon

Coins

Collected coins

Gems

Collected gems

Score

Current score

Points

Earned points in the session

PositionInRound

Deaths

Deaths in the current round

Kills

Kills in the current round

Laps

Completed laps in the current round

TreasureCollected

Treasure collected in the current round

Count

Count of supported property types

enum class Jazz2::Multiplayer::PeerLevelState

Peer state in a level.

Tracks how far a peer has progressed through joining the current level, from validating and streaming required assets through loading and synchronization to spectating or having a spawned player. The server advances this state as the join handshake completes.

Enumerators
Unknown

Unknown

ValidatingAssets

Peer received list of required assets, the server is waiting for response

StreamingMissingAssets

Missing assets are being streamed to peer

LevelLoaded

Peer finished loading of the level

LevelSynchronized

Peer finished synchronized entities in the level

Spectating

Peer is spectating

PlayerReady

Player is ready to spawn

PlayerSpawned

Player is spawned

enum class Jazz2::Multiplayer::SpectateMode : std::uint8_t

Spectate mode flags.

Describes whether and how a player is spectating instead of playing. The low bits hold the base mode (not spectating, forced by the server, or requested by the client), while the SpectateMode::FreeCamera flag selects a free-roaming camera over a player-following one.

Enumerators
None

Not spectating

Forced

Spectate mode is forced by the server, the client cannot disable it

Requested

Spectate mode is requested by the client, the server can accept or reject it

FreeCamera

Spectate with free camera, otherwise spectate with player camera

Mask

Mask for spectate mode flags

enum class Jazz2::Multiplayer::TrackRouteType

Shape of the route traced by GenerateRaceRouteFromGeometry().

Enumerators
Lap

Race track: from the spawn around the loop and back to the "Set Lap" warp (or a level exit if there is none)

LevelExit

Straight from the spawn to the level exit, e.g. through a story level in Cooperation

enum class Jazz2::Multiplayer::TrackCharacterMoves : std::uint8_t

Moves of only some characters the route tracer takes into account, supports a bitwise combination of its member values.

Enumerators
None

None of them

DoubleJump

The double jump of Spaz

Glide

The copter ears of Jazz and Lori

All

All of them, as a cooperation player can pick any character

enum class Jazz2::Multiplayer::Reason : std::uint32_t

Client disconnect reason.

Describes why a connection was refused or terminated, ranging from user-initiated disconnects and protocol or version mismatches to authentication failures, moderation actions and various server shutdown states. It is reported on disconnect and when kicking a peer.

Enumerators
Unknown

Unspecified

Disconnected

Client disconnected by user

InvalidParameter

Invalid parameter specified

IncompatibleVersion

Incompatible client version

ProtocolViolation

Protocol violation (e.g., received malformed packet)

SecurityPolicyViolation

Security policy violation (e.g., "ws://" from "https://")

AuthFailed

Authentication failed

InvalidPassword

Invalid password specified

InvalidPlayerName

Invalid player name specified

NotInWhitelist

Client is not in server whitelist

Requires3rdPartyAuthProvider

Server requires 3rd party authentication provider (e.g., Discord)

ServerIsFull

Server is full or busy

ServerNotReady

Server is not ready yet

ServerStopped

Server is stopped for unknown reason

ServerStoppedForMaintenance

Server is stopped for maintenance

ServerStoppedForReconfiguration

Server is stopped for reconfiguration

ServerStoppedForUpdate

Server is stopped for update

ConnectionLost

Connection lost

ConnectionTimedOut

Connection timed out

Kicked

Kicked by server

Banned

Banned by server

CheatingDetected

Cheating detected

AssetStreamingNotAllowed

Downloading of assets is not allowed, but some assets are missing

Idle

Inactivity

enum class Jazz2::Multiplayer::WebhookEventType : std::uint32_t

Server events that can be broadcast to a webhook.

Selects which events are posted to the webhook configured in ServerConfiguration::WebhookUrl. Supports a bitwise combination of its member values.

Enumerators
None

None

ServerLifecycle

Server has been started or stopped

PlayerConnected

Player joined the server

PlayerDisconnected

Player left the server

PlayerKicked

Player was kicked or banned (moderation, idle, cheating)

LevelChanged

Level has been loaded (also on playlist advance)

RoundStarted

Round countdown finished and the round is running

RoundEnded

Round ended with a winner, winning team or draw

ChampionshipEnded

A player won the championship (reached the points target)

ChatMessages

In-game chat messages

PlayerRoasted

Player was roasted (killed by another player or the environment)

PlayerLapFinished

Player finished a lap (Race)

FlagCaptured

Team captured a flag (Capture The Flag)

Default

Default set of events used if.

"WebhookEvents" is not specified in the configuration

All

All events.

enum class Jazz2::Multiplayer::ServerMessageType : std::uint16_t

Message sent by the server, which the client formats in its own language.

The server sends only the type and the arguments, so every player sees the text in the language of their own client, not of the server. Never renumber the existing values, append new ones before Count.

Enumerators
Unknown

Unknown

Text

Text shown as it is (e.g., from the server console or an admin command)

GameWillBeginShortly

Pre-game phase of a round started

ChampionshipWon

Player name

FirstToReachPointsWins

Score that wins the overtime

TeamsRebalanced

Players were moved between teams

CtfFlagTaken

Player name, team of the flag

CtfFlagReturned

Team of the flag

CtfFlagCaptured

Team of the carrier, team of the flag

CtfFlagDropped

Team of the flag

RaceFinishedFirst

Player name, seconds left for the others

RaceFinished

Player name, finishing position

WinnerIs

Player name

TeamWins

Team

Overtime

Overtime started

RoundEndedInDraw

Round ended without a winner

ControlPointCaptured

Team, name of the control point

ControlPointCapturedUnnamed

Team, number of the control point

FlagRunTookFlag

Player name

FlagRunOutOfTime

Player name

FlagRunPassedFlag

Name of the carrier, name of the teammate

FlagRunScored

Player name, points

FlagRunStoleFlag

Player name

HeadHuntersDelivered

Player name, gems, points

PlayerIsOut

Player name

PlayerPosition

Player name, tile X, tile Y

PestilenceRandomZombie

No zombie roasted anybody for too long

PestilenceLastSurvivor

Player name

PestilenceBecameZombie

Player name

JailbreakPrisonersReleased

Jails opened

JailbreakTeamScored

Team

RoastTagLostRingIdle

Player name

RoastTagHasRing

Player name

IdleSpectate

The player was moved to spectate mode for inactivity (alert)

IdleSpectateHelp

The player was moved to spectate mode for inactivity (console)

RaceAlreadyFinished

The player can't rejoin the race

CannotJoinNow

The player can't join the game right now

CheatsNotAllowed

Cheats are not allowed

TeamJoined

Team

CannotChangeTeam

The player can't change team right now

TeamUsage

Help for the /team command

TeamsOnlyInTeamModes

Teams are not used in the current game mode

TeamsRebalancedReply

Reply to the /balance command

SetTeamUsage

Help for the /setteam command

PlayerMovedToTeam

Player number, team

PlayerNotFound

No player with the specified number

TeamCountOutOfRange

Maximum number of teams

PollStartedRestart

Poll to restart the playlist started

PollStartedResetPoints

Poll to reset the points started

PollStartedSkip

Poll to skip the current level started

PollAlreadyActive

Seconds left of the active poll

PollUnsupportedType

Requested poll type

PollCancelled

Active poll was cancelled

PollVoted

Vote was counted

PollAlreadyVoted

The player already voted

PollNotActive

No poll is active

PollAccepted

Poll passed

PollNotEnoughVotes

Poll didn't pass

Count

Count of supported message types

enum class Jazz2::Multiplayer::ServerMessageDisplay : std::uint8_t

Where a ServerMessage is shown.

Enumerators
Console

Line in the console

Alert

Big text in the middle of the screen

enum class Jazz2::Multiplayer::ServerMessageArgType : std::uint8_t

Type of ServerMessageArg.

Enumerators
Text

Text shown as it is (e.g., player name)

Number

Integer number

Team

Team index, the client shows its name

Function documentation

void Jazz2::Multiplayer::GenerateRaceRouteFromGeometry(Tiles::TileMap* tileMap, Events::EventMap* eventMap, TrackRouteType routeType, float waterLevel, const SmallVector<MultiplayerSpawnPoint, 0>& spawnPoints, const SmallVector<Vector2i, 0>& startMarkers, SmallVector<RaceCheckpoint, 0>& orderedCheckpoints, Vector2i& outBoundsMin, Vector2i& outBoundsMax, bool& outCheckpointsOrdered, SmallVectorImpl<std::int32_t>* outDistances = nullptr, TrackCharacterMoves moves = TrackCharacterMoves::All)

Auto-places minimap track checkpoints for levels without authored waypoints.

Heuristic route tracer for levels that don't carry JJ2+ waypoint Text events. It traces the actual walkable route the player would take and samples checkpoints evenly along it, so the minimap (and in race modes also the progress-based position ranking) reflects the real level geometry. TrackRouteType::Lap goes from the spawn to the farthest reachable point and back to the "Set Lap" warp, TrackRouteType::LevelExit straight from the spawn to the level exit.

The player's movement is traced against the tile masks at sub-tile precision, and jumps, springs, poles and tube rides are simulated with the original game's physics, including the moves only some characters have (a cooperation player can pick any). The player swims under waterLevel (in pixels, FLT_MAX if the level has no water), flies with an airboard or a copter, and uses trigger tiles in either state. A TrackRouteType::LevelExit route leads to the boss in a level without an exit, and out to the far end in a level with neither.

On success, fills orderedCheckpoints, outBoundsMin / outBoundsMax (minimap extent in tiles) and sets outCheckpointsOrdered to true. On failure, the outputs are left unchanged (except an emptied orderedCheckpoints when a traced route turns out to be degenerate).

With outDistances, nothing is traced, it only gets how far each tile is from the start along the way the player goes, row by row, -1 where the player can't get, see ComputeReachableTiles(). moves are the moves of only some characters taken into account.

bool Jazz2::Multiplayer::ComputeReachableTiles(Tiles::TileMap* tileMap, Events::EventMap* eventMap, float waterLevel, Vector2f startPos, SmallVectorImpl<std::int32_t>& distances, TrackCharacterMoves moves = TrackCharacterMoves::All)

Finds every tile the player can get to from a position, with the movement model of GenerateRaceRouteFromGeometry().

distances gets how far each tile is from the start, row by row, in the cost units of the search (a walk over a tile is 10), -1 where the player can't get. Returns false if the start isn't anywhere the player can be. moves are the moves of only some characters the player has, all of them by default.

bool Jazz2::Multiplayer::IsTeamGameMode(MpGameMode mode)

Returns true if the specified game mode splits players into teams.

bool Jazz2::Multiplayer::UsesCtfFlags(MpGameMode mode)

Returns true if the specified game mode uses the team flags and bases of Capture The Flag.

nCine::Colorf Jazz2::Multiplayer::GetTeamColor(std::uint8_t team)

Returns the display color of the specified team (Blue, Red, Green, Yellow).

Death::Containers::StringView Jazz2::Multiplayer::GetTeamName(std::uint8_t team)

Returns the display name of the specified team.

std::uint32_t Jazz2::Multiplayer::ApplyTeamFurColor(std::uint32_t furColor, std::uint8_t team)

Recolors a packed fur color so the primary character color section matches the team color.

Forces the low byte (the first of the four packed fur sections, i.e. the primary fur color) of furColor to the team's signature sprite-palette gradient start, keeping the player's own choice for the remaining sections. The gradient bytes match the in-game character color options (Jazz2::ContentResolver::FurHueShiftFlag = 0x80 marks a hue-shifted variant): Red = 0x18, Blue = 0x20, Yellow = 0x28, Green = 0x58 | 0x80 (the last hue-shifted variant). Unknown/neutral teams are left unchanged.

Variable documentation

AllPeersT Jazz2::Multiplayer::AllPeers constexpr

All connected peers tag.

Use in NetworkManagerBase::SendTo() to send to all connected peers or the remote server peer.

LocalPeerT Jazz2::Multiplayer::LocalPeer constexpr

Local peer tag.

static std::uint8_t Jazz2::Multiplayer::MaxTeamCount constexpr

Maximum number of teams supported.

static std::uint8_t Jazz2::Multiplayer::NoPreferredTeam constexpr

Sentinel team value meaning "no preference, let the server decide".