group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
LobbyStatus.hpp
Go to the documentation of this file.
1
3
4#pragma once
7
8#include <array>
9#include <cstdint>
10#include <type_traits>
11#include <vector>
12
15{
17 bool ready = false;
18 bool isHost = false;
19 std::array<char, PlayerName::k_maxLen + 1> displayName{};
20};
21
22static_assert(std::is_trivially_copyable_v<LobbyPlayer>,
23 "LobbyPlayer is sent as raw bytes in LOBBY_STATE and must stay trivially copyable.");
24
27{
28 uint32_t count;
29 std::vector<LobbyPlayer> players;
30};
31
34{
44
47 std::array<char, PlayerName::k_maxLen + 1> displayName{};
48};
49
50static_assert(std::is_trivially_copyable_v<LobbyUpdateEvent>,
51 "LobbyUpdateEvent is sent as raw bytes and must stay trivially copyable.");
Network client identifier component for multiplayer entities.
Per-player display name (nickname) — replicated to clients.
Associates an entity with a connected network client.
Definition ClientId.hpp:10
Per-player state entry in the lobby.
Definition LobbyStatus.hpp:15
ClientId id
Network identity of this player.
Definition LobbyStatus.hpp:16
std::array< char, PlayerName::k_maxLen+1 > displayName
NUL-terminated display name.
Definition LobbyStatus.hpp:19
bool isHost
True if this player is the current lobby host.
Definition LobbyStatus.hpp:18
bool ready
True when the player has confirmed they are ready to play.
Definition LobbyStatus.hpp:17
Full lobby snapshot sent to a client upon joining.
Definition LobbyStatus.hpp:27
std::vector< LobbyPlayer > players
Ordered list of all connected players.
Definition LobbyStatus.hpp:29
uint32_t count
Number of players currently in the lobby.
Definition LobbyStatus.hpp:28
Incremental lobby change event broadcast to all connected clients.
Definition LobbyStatus.hpp:34
Type type
Kind of lobby change.
Definition LobbyStatus.hpp:45
std::array< char, PlayerName::k_maxLen+1 > displayName
Display name (only populated for PlayerJoined).
Definition LobbyStatus.hpp:47
ClientId id
Player this event applies to.
Definition LobbyStatus.hpp:46
Type
Discriminator for the type of lobby change.
Definition LobbyStatus.hpp:37
@ PlayerUnready
A player toggled their ready status to not ready.
Definition LobbyStatus.hpp:41
@ PlayerLeft
A player disconnected or left the lobby.
Definition LobbyStatus.hpp:39
@ PlayerNewHost
Host assignment transferred to a different player.
Definition LobbyStatus.hpp:42
@ PlayerReady
A player toggled their ready status to ready.
Definition LobbyStatus.hpp:40
@ PlayerJoined
A new player connected and entered the lobby.
Definition LobbyStatus.hpp:38