20#include <unordered_map>
22#include <boost/container_hash/hash.hpp>
25using EventList = std::vector<std::pair<EntityID, Event>>;
28 size_t operator()(
const std::pair<int, int>& pair)
const {
31 boost::hash_combine(c, pair.first);
32 boost::hash_combine(c, pair.second);
282 std::unordered_set<EntityID> entities_to_delete;
288 std::unordered_set<EntityID> updated_entities;
293 unsigned int timestep;
317 time_t relay_finish_time;
329 unsigned int numPlayerDeaths;
334 std::string maze_file;
339 std::string maps_directory;
352 std::unordered_set<std::pair<Object*, Object*>,
pair_hash> collidedObjects;
357 Trap* currentGhostTrap;
362 std::optional<glm::vec3> dmLightningCutLights;
367 std::optional<glm::vec3> dmActionCutLights;
372 unsigned int lastLightCut;
377 unsigned int lastLightningLightCut;
386 void spawnWall(
GridCell* cell,
int col,
int row,
bool is_internal);
401 void spawnTorch(
GridCell *cell, glm::vec3 orb_pos, glm::vec3 exit_pos);
420 std::unordered_map<EntityID, std::array<std::optional<EntityID>,
MAX_POINT_LIGHTS>> lightSourcesPerPlayer;
CellType
Definition: celltype.hpp:3
Definition: gridcell.hpp:23
Definition: objectmanager.hpp:26
Definition: object.hpp:95
The ServerGameState class contains all abstract game state data and logic for a single game state ins...
Definition: servergamestate.hpp:43
void updateLobbyPlayer(EntityID id, LobbyPlayer player)
Updates the LobbyPlayer with the given EntityID to the given LobbyPlayer struct.
Definition: servergamestate.cpp:1640
void updateEnemies()
Definition: servergamestate.cpp:1137
void tickStatuses()
Definition: servergamestate.cpp:1374
~ServerGameState()
Definition: servergamestate.cpp:112
void update(const EventList &events)
Updates this ServerGameState from the current timestep to the next one.
Definition: servergamestate.cpp:187
MatchPhase getMatchPhase() const
Returns the match phase that this ServerGameState instance is currently in.
Definition: servergamestate.cpp:1581
Grid & getGrid()
Returns a reference to the Grid in use by this ServerGameState.
Definition: servergamestate.cpp:2408
void spawnEnemies()
Definition: servergamestate.cpp:1095
void handleRespawns()
Definition: servergamestate.cpp:1346
ObjectManager objects
ObjectManager instance that manages all objects in this game instance at the current timestep.
Definition: servergamestate.hpp:49
void updatePlayerLightningInvulnerabilityStatus()
Updates player's lightning invulnerability status (sets to false once the player's lightning invulner...
Definition: servergamestate.cpp:1525
void updateItems()
Definition: servergamestate.cpp:1099
void doProjectileTicks()
Definition: servergamestate.cpp:1150
void updateTraps()
Definition: servergamestate.cpp:1196
bool hasObjectCollided(Object *object, glm::vec3 newCornerPosition)
Detects whether a collision occurs with other objects when the given object moves to the given positi...
Definition: servergamestate.cpp:1028
void doTorchlightTicks()
Definition: servergamestate.cpp:1181
std::unique_ptr< Spawner > spawner
Controls the spawns for the enemies.
Definition: servergamestate.hpp:54
void transitionToRelayRace()
Transitions this ServerGameState's match phase to MatchPhase::RelayRace and updates all necessary dat...
Definition: servergamestate.cpp:1585
void handleTickVelocity()
Definition: servergamestate.cpp:1444
void updateDungeonMasterParalysis()
Updates the DungeonMaster's paralysis status (sets to false once the DungeonMaster's paralysis durati...
Definition: servergamestate.cpp:1553
void handleDM()
Definition: servergamestate.cpp:1391
void setPhase(GamePhase phase)
setter for game phase
Definition: servergamestate.cpp:1577
void updateAttacks()
Definition: servergamestate.cpp:1162
void updateMovement()
Definition: servergamestate.cpp:787
GamePhase getPhase() const
Returns the phase that this ServerGameState instance is currently in.
Definition: servergamestate.cpp:1573
SoundTable & soundTable()
Definition: servergamestate.cpp:181
void updateCompass()
Definition: servergamestate.cpp:1398
void setPlayerVictory(bool playerVictory)
Sets the playerVictory boolean.
Definition: servergamestate.cpp:1604
Trap * placeTrapInCell(GridCell *cell, CellType type)
Definition: servergamestate.cpp:1676
void deleteEntities()
Definition: servergamestate.cpp:1364
const Lobby & getLobby() const
Definition: servergamestate.cpp:1672
std::string to_string()
Creates a string representation of this ServerGameState object.
Definition: servergamestate.cpp:2414
unsigned int getTimestep() const
Returns the current timestep of this ServerGameState instance.
Definition: servergamestate.cpp:1569
void markForDeletion(EntityID id)
tell the gamestate to delete this entity at the end of the tick
Definition: servergamestate.cpp:778
void handleDeaths()
Definition: servergamestate.cpp:1257
void addPlayerToLobby(LobbyPlayer player)
Adds a new LobbyPlayer to this ServerGameState's Lobby struct. This method will assign the new player...
Definition: servergamestate.cpp:1608
void markAsUpdated(EntityID id)
mark an entity as updated
Definition: servergamestate.cpp:783
void removePlayerFromLobby(EntityID id)
Definition: servergamestate.cpp:1654
std::vector< SharedGameState > generateSharedGameState(bool send_all)
Generate a SharedGameState object from this ServerGameState instance.
Definition: servergamestate.cpp:115
ServerGameState()
Creates a ServerGameState instance. The intial GamePhase is set to Lobby.
Definition: servergamestate.cpp:42
void loadMaze(const Grid &grid)
Reads from maze file and initializes this ServerGameState's Grid instance, as well as creating all ne...
Definition: servergamestate.cpp:1829
Definition: soundtable.hpp:16
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glad.h:1531
std::vector< std::pair< EntityID, Event > > EventList
Represents a list of events from a certain client with a specified ID.
Definition: servergamestate.hpp:25
#define MAX_POINT_LIGHTS
Definition: constants.hpp:7
GamePhase
Definition: sharedgamestate.hpp:20
MatchPhase
Definition: sharedgamestate.hpp:28
Definition: config.hpp:12
Definition: servergamestate.hpp:27
size_t operator()(const std::pair< int, int > &pair) const
Definition: servergamestate.hpp:28
Information about a player that has connected to the current lobby.
Definition: sharedgamestate.hpp:37
Information about the current lobby of players.
Definition: sharedgamestate.hpp:80
Definition: custom_hash.hpp:6
uint32_t EntityID
Global Object ID (when the server or client references an object with a particular EntityID,...
Definition: typedefs.hpp:9