Simple Web Game Server
0.1
A C++ library for creating authenticated scalable backends for multiplayer web games.
|
A game server built on the base_server class. More...
#include <game_server.hpp>
Public Member Functions | |
game_server (const jwt::verifier< jwt_clock, json_traits > &v, function< std::string(const combined_id &, const json &)> f, std::chrono::milliseconds t) | |
The constructor for the game_server class. More... | |
game_server (const jwt::verifier< jwt_clock, json_traits > &v, function< std::string(const combined_id &, const json &)> f) | |
Constructs the underlying base_server with a default time-step. | |
void | set_tls_init_handler (function< ssl_context_ptr(connection_hdl)> f) |
Sets the tls_init_handler for the underlying base_server. | |
void | run (uint16_t port, bool unlock_address=false) |
Runs the underlying base_server. | |
void | process_messages () |
Runs the process_messages loop on the underlying base_server. | |
void | reset () |
Stops, clears, and resets the server so it may be run again. | |
void | stop () |
Stops the server and clears all data and connections. | |
std::size_t | get_player_count () |
Returns the number of verified clients connected. | |
bool | is_running () |
void | update_games (std::chrono::milliseconds timestep) |
Loop to run games. More... | |
std::size_t | get_game_count () |
Returns the number of running game sessions. | |
A game server built on the base_server class.
This class wraps base_server that runs game sessions for connected clients.
|
inline |
The constructor for the game_server class.
The parameters are simply used to construct the underlying base_server.
|
inline |
Loop to run games.
Processes player connections and disconnections, executes the game loop for all running games, and sends all associated messages. Should only be called by one thread (but note that the game loops are marked to be run in parallel if possible).