GekkoNet 1.0
C/C++ Peer to Peer Game Networking SDK
Loading...
Searching...
No Matches
Gekko::MessageSystem Class Reference

#include <backend.h>

Collaboration diagram for Gekko::MessageSystem:

Classes

struct  NetInputQueue
struct  IncomingSpectatorState
struct  PendingDisconnect

Public Member Functions

 MessageSystem ()
void Init (u8 num_players, u32 input_size, u32 state_size=0, bool accept_spectator_state=false)
void AddInput (Frame input_frame, Handle player, u8 input[], bool remote=false)
void AddSpectatorInput (Frame input_frame, u8 input[])
void SendPendingOutput (GekkoNetAdapter *host)
void HandleData (GekkoNetAdapter *host, GekkoNetResult **data, u32 length)
void SendInputAck (Handle player, Frame frame, i8 local_advantage)
Frame GetLastAddedInput (bool spectator=false)
bool CheckStatusActors ()
bool DisconnectActor (Handle handle)
void ReclaimDisconnectedSpectators ()
void SetDisconnectTimeout (u32 timeout)
Frame GetDisconnectHoldFrame ()
void SendSessionHealth (Frame frame, u32 checksum)
void SendNetworkHealth ()
Frame GetLastAddedInputFrom (Handle player)
std::deque< std::unique_ptr< u8[]> > & GetNetPlayerQueue (Handle player)
Frame GetOldestSpectatorInput ()
void SetSpectatorState (Handle spectator, Frame frame, const u8 *state, u32 state_size)
bool TakeSpectatorState (Frame &frame, std::vector< u8 > &state)

Public Attributes

std::vector< std::unique_ptr< Player > > locals
std::vector< std::unique_ptr< Player > > remotes
std::vector< std::unique_ptr< Player > > spectators
SessionEventSystem session_events
std::map< Frame, u32 > local_health

Private Member Functions

void SendSyncRequest (NetAddress *addr)
void SendSyncResponse (NetAddress *addr, u16 magic)
void SendDisconnect (NetAddress *addr, u16 magic)
void SendPendingDisconnects ()
void SendInputsToPeer (Player *peer, GekkoNetAdapter *host, bool spectator)
void SendPendingSpectatorStates (GekkoNetAdapter *host)
std::vector< Handle > GetRemoteHandlesForAddress (NetAddress *addr)
Player * GetPlayerByHandle (Handle handle)
Frame GetMinLastAckedFrame (bool spectator=false)
void HandleTooFarBehindActors (bool spectator=false)
void MarkActorDisconnected (Player *actor)
void SendPendingClaims ()
void HandleUnrecoverableGap ()
u64 TimeSinceEpoch ()
void SendDataToAll (NetData *pkt, GekkoNetAdapter *host, bool spectators_only=false)
void SendDataTo (NetData *pkt, GekkoNetAdapter *host)
void ParsePacket (NetAddress &addr, NetPacket &pkt, u32 packet_size)
void OnSyncRequest (NetAddress &addr, NetPacket &pkt)
void OnSyncResponse (NetAddress &addr, NetPacket &pkt)
void OnInputs (NetAddress &addr, NetPacket &pkt)
void OnInputAck (NetAddress &addr, NetPacket &pkt)
void OnSessionHealth (NetAddress &addr, NetPacket &pkt)
void OnNetworkHealth (NetAddress &addr, NetPacket &pkt)
void OnSpectatorState (NetAddress &addr, NetPacket &pkt)
void OnSpectatorStateAck (NetAddress &addr, NetPacket &pkt)
void OnDisconnect (NetAddress &addr, NetPacket &pkt)
void OnDisconnectClaim (NetAddress &addr, NetPacket &pkt)

Private Attributes

const u32 MAX_INPUT_QUEUE_SIZE = 128
const u32 MAX_SPECTATOR_INPUT_QUEUE_SIZE = 600
const u32 NUM_TO_SYNC = 4
const u8 NUM_DISCONNECT_MSGS = 5
const u32 SPECTATOR_STATE_CHUNK_SIZE = 900
u32 _input_size
u32 _state_size
bool _accept_spectator_state
u16 _session_magic
u64 _disconnect_timeout
u8 _num_players
std::vector< NetInputQueue > _net_player_queue
NetInputQueue _net_spectator_queue
struct Gekko::MessageSystem::IncomingSpectatorState _incoming_spectator_state
std::vector< std::unique_ptr< PendingDisconnect > > _pending_disconnects
std::queue< std::unique_ptr< NetData > > _pending_output
std::vector< u8 > _bin_buffer
u64 _last_sent_network_check

Detailed Description

Definition at line 130 of file backend.h.

Constructor & Destructor Documentation

◆ MessageSystem()

Gekko::MessageSystem::MessageSystem ( )

Definition at line 9 of file backend.cpp.

Member Function Documentation

◆ AddInput()

void Gekko::MessageSystem::AddInput ( Frame input_frame,
Handle player,
u8 input[],
bool remote = false )

Definition at line 68 of file backend.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddSpectatorInput()

void Gekko::MessageSystem::AddSpectatorInput ( Frame input_frame,
u8 input[] )

Definition at line 82 of file backend.cpp.

Here is the call graph for this function:

◆ CheckStatusActors()

bool Gekko::MessageSystem::CheckStatusActors ( )

Definition at line 365 of file backend.cpp.

Here is the call graph for this function:

◆ DisconnectActor()

bool Gekko::MessageSystem::DisconnectActor ( Handle handle)

Definition at line 402 of file backend.cpp.

Here is the call graph for this function:

◆ GetDisconnectHoldFrame()

Frame Gekko::MessageSystem::GetDisconnectHoldFrame ( )

Definition at line 601 of file backend.cpp.

Here is the call graph for this function:

◆ GetLastAddedInput()

Frame Gekko::MessageSystem::GetLastAddedInput ( bool spectator = false)

Definition at line 353 of file backend.cpp.

Here is the caller graph for this function:

◆ GetLastAddedInputFrom()

Frame Gekko::MessageSystem::GetLastAddedInputFrom ( Handle player)

Definition at line 518 of file backend.cpp.

◆ GetMinLastAckedFrame()

Frame Gekko::MessageSystem::GetMinLastAckedFrame ( bool spectator = false)
private

Definition at line 342 of file backend.cpp.

Here is the caller graph for this function:

◆ GetNetPlayerQueue()

std::deque< std::unique_ptr< u8[]> > & Gekko::MessageSystem::GetNetPlayerQueue ( Handle player)

Definition at line 523 of file backend.cpp.

◆ GetOldestSpectatorInput()

Frame Gekko::MessageSystem::GetOldestSpectatorInput ( )

Definition at line 551 of file backend.cpp.

Here is the caller graph for this function:

◆ GetPlayerByHandle()

Gekko::Player * Gekko::MessageSystem::GetPlayerByHandle ( Handle handle)
private

Definition at line 323 of file backend.cpp.

Here is the caller graph for this function:

◆ GetRemoteHandlesForAddress()

std::vector< Handle > Gekko::MessageSystem::GetRemoteHandlesForAddress ( NetAddress * addr)
private

Definition at line 312 of file backend.cpp.

Here is the caller graph for this function:

◆ HandleData()

void Gekko::MessageSystem::HandleData ( GekkoNetAdapter * host,
GekkoNetResult ** data,
u32 length )

Definition at line 145 of file backend.cpp.

Here is the call graph for this function:

◆ HandleTooFarBehindActors()

void Gekko::MessageSystem::HandleTooFarBehindActors ( bool spectator = false)
private

Definition at line 734 of file backend.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HandleUnrecoverableGap()

void Gekko::MessageSystem::HandleUnrecoverableGap ( )
private

Definition at line 723 of file backend.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Init()

void Gekko::MessageSystem::Init ( u8 num_players,
u32 input_size,
u32 state_size = 0,
bool accept_spectator_state = false )

Definition at line 25 of file backend.cpp.

◆ MarkActorDisconnected()

void Gekko::MessageSystem::MarkActorDisconnected ( Player * actor)
private

Definition at line 638 of file backend.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnDisconnect()

void Gekko::MessageSystem::OnDisconnect ( NetAddress & addr,
NetPacket & pkt )
private

Definition at line 1290 of file backend.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnDisconnectClaim()

void Gekko::MessageSystem::OnDisconnectClaim ( NetAddress & addr,
NetPacket & pkt )
private

Definition at line 1314 of file backend.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnInputAck()

void Gekko::MessageSystem::OnInputAck ( NetAddress & addr,
NetPacket & pkt )
private

Definition at line 1057 of file backend.cpp.

Here is the caller graph for this function:

◆ OnInputs()

void Gekko::MessageSystem::OnInputs ( NetAddress & addr,
NetPacket & pkt )
private

Definition at line 994 of file backend.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnNetworkHealth()

void Gekko::MessageSystem::OnNetworkHealth ( NetAddress & addr,
NetPacket & pkt )
private

Definition at line 1110 of file backend.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnSessionHealth()

void Gekko::MessageSystem::OnSessionHealth ( NetAddress & addr,
NetPacket & pkt )
private

Definition at line 1082 of file backend.cpp.

Here is the caller graph for this function:

◆ OnSpectatorState()

void Gekko::MessageSystem::OnSpectatorState ( NetAddress & addr,
NetPacket & pkt )
private

Definition at line 1174 of file backend.cpp.

Here is the caller graph for this function:

◆ OnSpectatorStateAck()

void Gekko::MessageSystem::OnSpectatorStateAck ( NetAddress & addr,
NetPacket & pkt )
private

Definition at line 1262 of file backend.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnSyncRequest()

void Gekko::MessageSystem::OnSyncRequest ( NetAddress & addr,
NetPacket & pkt )
private

Definition at line 905 of file backend.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnSyncResponse()

void Gekko::MessageSystem::OnSyncResponse ( NetAddress & addr,
NetPacket & pkt )
private

Definition at line 940 of file backend.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ParsePacket()

void Gekko::MessageSystem::ParsePacket ( NetAddress & addr,
NetPacket & pkt,
u32 packet_size )
private

Definition at line 839 of file backend.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReclaimDisconnectedSpectators()

void Gekko::MessageSystem::ReclaimDisconnectedSpectators ( )

Definition at line 528 of file backend.cpp.

◆ SendDataTo()

void Gekko::MessageSystem::SendDataTo ( NetData * pkt,
GekkoNetAdapter * host )
private

Definition at line 807 of file backend.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendDataToAll()

void Gekko::MessageSystem::SendDataToAll ( NetData * pkt,
GekkoNetAdapter * host,
bool spectators_only = false )
private

Definition at line 766 of file backend.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendDisconnect()

void Gekko::MessageSystem::SendDisconnect ( NetAddress * addr,
u16 magic )
private

Definition at line 214 of file backend.cpp.

Here is the caller graph for this function:

◆ SendInputAck()

void Gekko::MessageSystem::SendInputAck ( Handle player,
Frame frame,
i8 local_advantage )

Definition at line 290 of file backend.cpp.

Here is the call graph for this function:

◆ SendInputsToPeer()

void Gekko::MessageSystem::SendInputsToPeer ( Player * peer,
GekkoNetAdapter * host,
bool spectator )
private

Definition at line 1418 of file backend.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendNetworkHealth()

void Gekko::MessageSystem::SendNetworkHealth ( )

Definition at line 494 of file backend.cpp.

Here is the call graph for this function:

◆ SendPendingClaims()

void Gekko::MessageSystem::SendPendingClaims ( )
private

Definition at line 651 of file backend.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendPendingDisconnects()

void Gekko::MessageSystem::SendPendingDisconnects ( )
private

Definition at line 230 of file backend.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendPendingOutput()

void Gekko::MessageSystem::SendPendingOutput ( GekkoNetAdapter * host)

Definition at line 96 of file backend.cpp.

Here is the call graph for this function:

◆ SendPendingSpectatorStates()

void Gekko::MessageSystem::SendPendingSpectatorStates ( GekkoNetAdapter * host)
private

Definition at line 1377 of file backend.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendSessionHealth()

void Gekko::MessageSystem::SendSessionHealth ( Frame frame,
u32 checksum )

Definition at line 479 of file backend.cpp.

◆ SendSyncRequest()

void Gekko::MessageSystem::SendSyncRequest ( NetAddress * addr)
private

Definition at line 175 of file backend.cpp.

Here is the caller graph for this function:

◆ SendSyncResponse()

void Gekko::MessageSystem::SendSyncResponse ( NetAddress * addr,
u16 magic )
private

Definition at line 195 of file backend.cpp.

Here is the caller graph for this function:

◆ SetDisconnectTimeout()

void Gekko::MessageSystem::SetDisconnectTimeout ( u32 timeout)

Definition at line 596 of file backend.cpp.

◆ SetSpectatorState()

void Gekko::MessageSystem::SetSpectatorState ( Handle spectator,
Frame frame,
const u8 * state,
u32 state_size )

Definition at line 557 of file backend.cpp.

◆ TakeSpectatorState()

bool Gekko::MessageSystem::TakeSpectatorState ( Frame & frame,
std::vector< u8 > & state )

Definition at line 583 of file backend.cpp.

◆ TimeSinceEpoch()

u64 Gekko::MessageSystem::TimeSinceEpoch ( )
private

Definition at line 760 of file backend.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ _accept_spectator_state

bool Gekko::MessageSystem::_accept_spectator_state
private

Definition at line 270 of file backend.h.

◆ _bin_buffer

std::vector<u8> Gekko::MessageSystem::_bin_buffer
private

Definition at line 306 of file backend.h.

◆ _disconnect_timeout

u64 Gekko::MessageSystem::_disconnect_timeout
private

Definition at line 274 of file backend.h.

◆ _incoming_spectator_state

struct Gekko::MessageSystem::IncomingSpectatorState Gekko::MessageSystem::_incoming_spectator_state
private

◆ _input_size

u32 Gekko::MessageSystem::_input_size
private

Definition at line 266 of file backend.h.

◆ _last_sent_network_check

u64 Gekko::MessageSystem::_last_sent_network_check
private

Definition at line 308 of file backend.h.

◆ _net_player_queue

std::vector<NetInputQueue> Gekko::MessageSystem::_net_player_queue
private

Definition at line 279 of file backend.h.

◆ _net_spectator_queue

NetInputQueue Gekko::MessageSystem::_net_spectator_queue
private

Definition at line 282 of file backend.h.

◆ _num_players

u8 Gekko::MessageSystem::_num_players
private

Definition at line 276 of file backend.h.

◆ _pending_disconnects

std::vector<std::unique_ptr<PendingDisconnect> > Gekko::MessageSystem::_pending_disconnects
private

Definition at line 302 of file backend.h.

◆ _pending_output

std::queue<std::unique_ptr<NetData> > Gekko::MessageSystem::_pending_output
private

Definition at line 304 of file backend.h.

◆ _session_magic

u16 Gekko::MessageSystem::_session_magic
private

Definition at line 272 of file backend.h.

◆ _state_size

u32 Gekko::MessageSystem::_state_size
private

Definition at line 268 of file backend.h.

◆ local_health

std::map<Frame, u32> Gekko::MessageSystem::local_health

Definition at line 186 of file backend.h.

◆ locals

std::vector<std::unique_ptr<Player> > Gekko::MessageSystem::locals

Definition at line 178 of file backend.h.

◆ MAX_INPUT_QUEUE_SIZE

const u32 Gekko::MessageSystem::MAX_INPUT_QUEUE_SIZE = 128
private

Definition at line 259 of file backend.h.

◆ MAX_SPECTATOR_INPUT_QUEUE_SIZE

const u32 Gekko::MessageSystem::MAX_SPECTATOR_INPUT_QUEUE_SIZE = 600
private

Definition at line 260 of file backend.h.

◆ NUM_DISCONNECT_MSGS

const u8 Gekko::MessageSystem::NUM_DISCONNECT_MSGS = 5
private

Definition at line 262 of file backend.h.

◆ NUM_TO_SYNC

const u32 Gekko::MessageSystem::NUM_TO_SYNC = 4
private

Definition at line 261 of file backend.h.

◆ remotes

std::vector<std::unique_ptr<Player> > Gekko::MessageSystem::remotes

Definition at line 180 of file backend.h.

◆ session_events

SessionEventSystem Gekko::MessageSystem::session_events

Definition at line 184 of file backend.h.

◆ SPECTATOR_STATE_CHUNK_SIZE

const u32 Gekko::MessageSystem::SPECTATOR_STATE_CHUNK_SIZE = 900
private

Definition at line 264 of file backend.h.

◆ spectators

std::vector<std::unique_ptr<Player> > Gekko::MessageSystem::spectators

Definition at line 182 of file backend.h.


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