Base class for both client and server lobby. The lobbies are started when a server opens a game, or when a client joins a game. It is used to exchange data about the race settings, like kart selection.
More...
|
enum | : uint8_t {
LE_CONNECTION_REQUESTED = 1
, LE_CONNECTION_REFUSED
, LE_CONNECTION_ACCEPTED
, LE_SERVER_INFO
,
LE_REQUEST_BEGIN
, LE_UPDATE_PLAYER_LIST
, LE_KART_SELECTION
, LE_PLAYER_DISCONNECTED
,
LE_CLIENT_LOADED_WORLD
, LE_LOAD_WORLD
, LE_START_RACE
, LE_START_SELECTION
,
LE_RACE_FINISHED
, LE_RACE_FINISHED_ACK
, LE_BACK_LOBBY
, LE_VOTE
,
LE_CHAT
, LE_SERVER_OWNERSHIP
, LE_KICK_HOST
, LE_CHANGE_TEAM
,
LE_BAD_TEAM
, LE_BAD_CONNECTION
, LE_CONFIG_SERVER
, LE_CHANGE_HANDICAP
,
LE_LIVE_JOIN
, LE_LIVE_JOIN_ACK
, LE_KART_INFO
, LE_CLIENT_BACK_LOBBY
,
LE_REPORT_PLAYER
, LE_ASSETS_UPDATE
, LE_COMMAND
} |
| Lists all lobby events (LE).
|
|
enum | RejectReason : uint8_t {
RR_BUSY = 0
, RR_BANNED = 1
, RR_INCORRECT_PASSWORD = 2
, RR_INCOMPATIBLE_DATA = 3
,
RR_TOO_MANY_PLAYERS = 4
, RR_INVALID_PLAYER = 5
} |
|
enum | BackLobbyReason : uint8_t {
BLR_NONE = 0
, BLR_NO_GAME_FOR_LIVE_JOIN = 1
, BLR_NO_PLACE_FOR_LIVE_JOIN = 2
, BLR_ONE_PLAYER_IN_RANKED_MATCH = 3
,
BLR_SERVER_ONWER_QUITED_THE_GAME = 4
, BLR_SPECTATING_NEXT_GAME = 5
} |
|
|
virtual void | setup ()=0 |
| A previous GameSetup is deleted and a new one is created.
|
|
virtual void | update (int ticks)=0 |
| Called by the protocol listener, synchronously with the main loop.
|
|
virtual void | finishedLoadingWorld ()=0 |
|
virtual void | loadWorld () |
| Starts the sychronization protocol and the RaceEventManager.
|
|
virtual bool | allPlayersReady () const =0 |
|
virtual bool | isRacing () const =0 |
|
void | startVotingPeriod (float max_time) |
| Starts the voting period time with the specified maximum time.
|
|
float | getRemainingVotingTime () |
| Returns the remaining voting time in seconds.
|
|
bool | isVotingOver () |
| Returns if the voting period is over.
|
|
float | getMaxVotingTime () |
| Returns the maximum floating time in seconds.
|
|
GameSetup * | getGameSetup () const |
| Returns the game setup data structure.
|
|
int | getNumberOfVotes () const |
| Returns the number of votes received so far.
|
|
void | addVote (uint32_t host_id, const PeerVote &vote) |
| Adds a vote.
|
|
const PeerVote * | getVote (uint32_t host_id) const |
| Returns the voting data for one host.
|
|
void | resetVotingTime () |
|
const std::map< uint32_t, PeerVote > & | getAllVotes () const |
| Returns all voting data.
|
|
std::pair< uint32_t, uint32_t > | getGameStartedProgress () const |
|
void | setGameStartedProgress (const std::pair< uint32_t, uint32_t > &p) |
|
void | resetGameStartedProgress () |
|
bool | hasLiveJoiningRecently () const |
|
void | storePlayingTrack (const std::string &track_ident) |
|
std::string | getPlayingTrackIdent () const |
|
Track * | getPlayingTrack () const |
|
| Protocol (ProtocolType type) |
| Constructor Sets the basic protocol parameters, as the callback object and the protocol type.
|
|
virtual | ~Protocol () |
| Destructor.
|
|
virtual void | setup ()=0 |
| Called when the protocol is going to start.
|
|
virtual void | update (int ticks)=0 |
| Called by the protocol listener, synchronously with the main loop.
|
|
virtual void | asynchronousUpdate ()=0 |
| Called by the protocol listener as often as possible.
|
|
NetworkString * | getNetworkString (size_t capacity=16) const |
| functions to check incoming data easily
|
|
bool | checkDataSize (Event *event, unsigned int minimum_size) |
| Checks if the message has at least the specified size, and if not prints a warning message including the message content.
|
|
void | sendMessageToPeers (NetworkString *message, bool reliable=true) |
| Sends a message to all validated peers in game, encrypt the message if needed.
|
|
void | sendMessageToPeersInServer (NetworkString *message, bool reliable=true) |
| Sends a message to all validated peers in server, encrypt the message if needed.
|
|
void | sendToServer (NetworkString *message, bool reliable=true) |
| Sends a message from a client to the server.
|
|
virtual void | requestStart () |
| Starts a request in the protocol manager to start this protocol.
|
|
virtual void | requestTerminate () |
| Submits a request to the ProtocolManager to terminate this protocol.
|
|
virtual bool | notifyEvent (Event *event) |
| Notify a protocol matching the Event type of that event.
|
|
virtual bool | notifyEventAsynchronous (Event *event) |
| Notify a protocol matching the Event type of that event.
|
|
ProtocolType | getProtocolType () const |
| Method to get a protocol's type.
|
|
void | setHandleConnections (bool b) |
| Sets if this protocol should receive connection events.
|
|
void | setHandleDisconnections (bool b) |
| Sets if this protocol should receive disconnection events.
|
|
virtual bool | handleConnects () const |
| Return true if this protocol should be informed about connects.
|
|
virtual bool | handleDisconnects () const |
| Return true if this protocol should be informed about disconnects.
|
|
|
const ProcessType | m_process_type |
|
std::map< uint32_t, PeerVote > | m_peers_votes |
| Vote from each peer.
|
|
std::atomic< uint64_t > | m_end_voting_period |
| Timer user for voting periods in both lobbies.
|
|
uint64_t | m_max_voting_time |
| The maximum voting time.
|
|
std::thread | m_start_game_thread |
|
std::atomic< uint32_t > | m_estimated_remaining_time |
| Estimated current started game remaining time, uint32_t max if not available.
|
|
std::atomic< uint32_t > | m_estimated_progress |
| Estimated current started game progress in 0-100%, uint32_t max if not available.
|
|
int | m_last_live_join_util_ticks |
| Save the last live join ticks, for physical objects to update current transformation in server, and reset smooth network body in client.
|
|
std::mutex | m_current_track_mutex |
| Mutex to protect m_current_track.
|
|
std::string | m_current_track |
| Store current playing track in name.
|
|
GameSetup * | m_game_setup |
| Stores data about the online game to play.
|
|
ProtocolType | m_type |
| The type of the protocol.
|
|
bool | m_handle_connections |
| True if this protocol should receive connection events.
|
|
bool | m_handle_disconnections |
| TRue if this protocol should recceiver disconnection events.
|
|
Base class for both client and server lobby. The lobbies are started when a server opens a game, or when a client joins a game. It is used to exchange data about the race settings, like kart selection.