7#include <boost/serialization/string.hpp>
73 std::string
to_string(
unsigned int tab_offset);
92 std::vector<boost::optional<LobbyPlayer>>
players;
109 this->players.push_back(boost::none);
124 const boost::optional<LobbyPlayer>&
getPlayer(
int playerIndex)
const;
158 std::string
to_string(
unsigned int tab_offset)
const;
168 std::unordered_map<EntityID, boost::optional<SharedObject>>
objects;
187 this->phase = GamePhase::TITLE_SCREEN;
190 this->matchPhase = MatchPhase::MazeExploration;
191 this->relay_finish_time = 0;
192 this->playerVictory =
false;
193 this->numPlayerDeaths = 0;
199 this->phase = start_phase;
203 this->matchPhase = MatchPhase::MazeExploration;
204 this->relay_finish_time = 0;
205 this->playerVictory =
false;
206 this->numPlayerDeaths = 0;
Representation of the Object class used by ServerGameState, containing exactly the subset of Object d...
Definition: sharedobject.hpp:302
PlayerRole
Definition: event.hpp:82
GLuint id
Definition: glad.h:1776
GLuint const GLchar * name
Definition: glad.h:1846
Definition: serialize.hpp:45
#define MAX_PLAYERS
Definition: constants.hpp:6
#define FIRST_TIMESTEP
Definition: constants.hpp:4
GamePhase
Definition: sharedgamestate.hpp:20
MatchPhase
Definition: sharedgamestate.hpp:28
Definition: config.hpp:12
int max_players
max number of players this server allows
Definition: config.hpp:51
std::string lobby_name
Name of the server's lobby.
Definition: config.hpp:47
struct GameConfig::@2 server
Config settings for the server.
Information about a player that has connected to the current lobby.
Definition: sharedgamestate.hpp:37
PlayerRole desired_role
This is the player's desired role (though they may not actually play as this role - the server must s...
Definition: sharedgamestate.hpp:50
bool ready
Whether the player is in the Ready state on the lobby screen.
Definition: sharedgamestate.hpp:56
LobbyPlayer(EntityID id, PlayerRole desired_role, bool ready)
Definition: sharedgamestate.hpp:60
LobbyPlayer()
Definition: sharedgamestate.hpp:58
EntityID id
Player's EntityID (this is the EntityID of their Player or DungeonMaster object in the game state)
Definition: sharedgamestate.hpp:42
DEF_SERIALIZE(Archive &ar, unsigned int version)
Definition: sharedgamestate.hpp:63
std::string to_string()
Definition: sharedgamestate.hpp:74
Information about the current lobby of players.
Definition: sharedgamestate.hpp:80
std::string name
name of the lobby as set by the server
Definition: sharedgamestate.hpp:84
std::string to_string() const
Definition: sharedgamestate.hpp:159
std::vector< boost::optional< LobbyPlayer > > players
A vector of length max_players that maps a player's index (technically, index - 1 as player indices a...
Definition: sharedgamestate.hpp:92
Lobby(int max_players)
Definition: sharedgamestate.hpp:104
Lobby()
Default Lobby constructor supports exactly 4 players.
Definition: sharedgamestate.hpp:102
int max_players
The maximum number of players that this game instance can support.
Definition: sharedgamestate.hpp:97
DEF_SERIALIZE(Archive &ar, unsigned int version)
Definition: sharedgamestate.hpp:145
const boost::optional< LobbyPlayer > & getPlayer(int playerIndex) const
Given a player's 1-indexed player index, this method returns a reference to the boost::optional<Lobby...
Definition: sharedgamestate.cpp:21
int numPlayersInLobby() const
Returns the number of players in the lobby Note: use this method and note players....
Definition: sharedgamestate.cpp:34
Lobby(const std::string &name, int max_players)
Definition: sharedgamestate.hpp:106
The SharedGameState is a representation of the ServerGameState instance maintained by the server and ...
Definition: sharedgamestate.hpp:167
SharedGameState(GamePhase start_phase, const GameConfig &config)
Definition: sharedgamestate.hpp:196
unsigned int numPlayerDeaths
Definition: sharedgamestate.hpp:182
SharedGameState()
Definition: sharedgamestate.hpp:184
Lobby lobby
Definition: sharedgamestate.hpp:172
void update(const SharedGameState &update)
Definition: sharedgamestate.cpp:4
MatchPhase matchPhase
Definition: sharedgamestate.hpp:176
GamePhase phase
Definition: sharedgamestate.hpp:174
bool playerVictory
Definition: sharedgamestate.hpp:180
unsigned int timestep
Definition: sharedgamestate.hpp:170
time_t relay_finish_time
Definition: sharedgamestate.hpp:178
DEF_SERIALIZE(Archive &ar, const unsigned int version)
Definition: sharedgamestate.hpp:209
std::unordered_map< EntityID, boost::optional< SharedObject > > objects
Definition: sharedgamestate.hpp:168
uint32_t EntityID
Global Object ID (when the server or client references an object with a particular EntityID,...
Definition: typedefs.hpp:9