Simple Web Game Server  0.1
A C++ library for creating authenticated scalable backends for multiplayer web games.
Classes | Public Member Functions | List of all members
simple_web_game_server::game_server< game_instance, jwt_clock, json_traits, server_config, close_reasons > Class Template Reference

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.
 

Detailed Description

template<typename game_instance, typename jwt_clock, typename json_traits, typename server_config, typename close_reasons = default_close_reasons>
class simple_web_game_server::game_server< game_instance, jwt_clock, json_traits, server_config, close_reasons >

A game server built on the base_server class.

This class wraps base_server that runs game sessions for connected clients.

Constructor & Destructor Documentation

◆ game_server()

template<typename game_instance , typename jwt_clock , typename json_traits , typename server_config , typename close_reasons = default_close_reasons>
simple_web_game_server::game_server< game_instance, jwt_clock, json_traits, server_config, close_reasons >::game_server ( const jwt::verifier< jwt_clock, json_traits > &  v,
function< std::string(const combined_id &, const json &)>  f,
std::chrono::milliseconds  t 
)
inline

The constructor for the game_server class.

The parameters are simply used to construct the underlying base_server.

Member Function Documentation

◆ update_games()

template<typename game_instance , typename jwt_clock , typename json_traits , typename server_config , typename close_reasons = default_close_reasons>
void simple_web_game_server::game_server< game_instance, jwt_clock, json_traits, server_config, close_reasons >::update_games ( std::chrono::milliseconds  timestep)
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).


The documentation for this class was generated from the following file: