40 void beginWarmup(std::span<const ClientId> expectedPlayers);
Shared definitions for match status and state synchronization between server and clients.
MatchPhase
Definition MatchStatus.hpp:8
@ LOBBY
Pre-match lobby phase; players are not yet spawned in-world.
Definition MatchStatus.hpp:9
Shared ECS registry type alias for the game engine.
entt::registry Registry
Shared ECS registry type alias.
Definition Registry.hpp:11
TCP game server that accepts clients and dispatches incoming packets.
Manages match flow: lobby → countdown → in-progress → finished → lobby.
Definition MatchController.hpp:15
void setSkipLobby(bool v)
Enable or disable developer-mode lobby bypass.
Definition MatchController.cpp:82
MatchConfig config
Configuration for current match (e.g. kill threshold to win).
Definition MatchController.hpp:58
void markGameplayReady(ClientId clientId)
Definition MatchController.cpp:203
void broadcastMatchConfig(Server &server)
Definition MatchController.cpp:153
int winnerId
Client ID of the winner (-1 if none).
Definition MatchController.hpp:48
void removeExpectedPlayer(ClientId clientId)
Definition MatchController.cpp:211
bool validateKillsToWin(int killsToWin)
Definition MatchController.cpp:133
float countdownTimer
Seconds remaining in the current timed phase.
Definition MatchController.hpp:47
static constexpr float k_countdownDuration
Seconds for the pre-match countdown.
Definition MatchController.hpp:55
bool setMatchConfig(const MatchConfig &cfg)
Definition MatchController.cpp:158
MatchConfig getMatchConfig() const
Definition MatchController.cpp:186
bool validateMaxPlayers(int maxPlayers)
Definition MatchController.cpp:141
int ticksSinceBroadcast
Definition MatchController.hpp:74
bool setKillsToWin(int killsToWin)
Definition MatchController.cpp:168
MatchPhase lastBroadcastPhase
Definition MatchController.hpp:71
static constexpr float k_finishedDuration
Seconds to show the in-game result banner before post-match.
Definition MatchController.hpp:56
float lastBroadcastCountdown
Definition MatchController.hpp:73
MatchPhase currentPhase
Current phase of the match.
Definition MatchController.hpp:46
void broadcastMatchState(Server &server)
Send the current match phase, countdown, and winner to all clients.
Definition MatchController.cpp:92
static constexpr float k_warmupDuration
Max time to wait for players to load/spawn before starting after host start.
Definition MatchController.hpp:53
void update(float deltaTime, Registry ®istry, Server &server)
Advance the match state machine by one tick.
Definition MatchController.cpp:10
void beginWarmup(std::span< const ClientId > expectedPlayers)
Definition MatchController.cpp:191
bool validatePowerupTiming(float initialSpawnDelaySeconds, float respawnCooldownSeconds)
Definition MatchController.cpp:146
int lastBroadcastWinnerId
Definition MatchController.hpp:72
bool allExpectedPlayersReady() const
Definition MatchController.cpp:216
bool skipLobby
True to auto-promote lobby to countdown.
Definition MatchController.hpp:49
bool setMaxPlayers(int maxPlayers)
Definition MatchController.cpp:177
void hostStartedMatch(std::span< const ClientId > expectedPlayers)
Start the host-authorized countdown if the match is still in the lobby phase.
Definition MatchController.cpp:73
int getWinnerId()
Return the winner's client ID, or -1 if no winner yet.
Definition MatchController.cpp:87
MatchPhase getCurrentPhase()
Return the current match phase.
Definition MatchController.cpp:68
std::unordered_map< ClientId, bool > playerReadyStatus
Tracks each player's ready status in the lobby.
Definition MatchController.hpp:51
TCP stream socket — receives client packets and echoes them back.
Definition Server.hpp:42
Definition LagCompMath.hpp:10
Associates an entity with a connected network client.
Definition ClientId.hpp:10
Definition MatchConfig.hpp:4