Orxonox
0.0.5 Codename: Arcturus
|
This Class implements a manager for gamestates: More...
#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/network/GamestateManager.h>
Classes | |
struct | peerInfo |
Public Member Functions | |
GamestateManager () | |
~GamestateManager () | |
virtual bool | ackGamestate (unsigned int gamestateID, unsigned int peerID) override |
Acknowledge a received gamestate. More... | |
virtual bool | addGamestate (packet::Gamestate *gs, unsigned int peerID) override |
void | addPeer (uint32_t peerID) |
Add a peer to the game. More... | |
void | finishGamestate (unsigned int peerID, packet::Gamestate *&destgamestate, packet::Gamestate *base, packet::Gamestate *gamestate) |
virtual uint32_t | getCurrentGamestateID () override |
std::vector< packet::Gamestate * > | getGamestates () |
Return a vector with the gamestates of all peers. More... | |
virtual uint32_t | getLastReceivedGamestateID (unsigned int peerID) override |
Return the ID of the last received gamestate for a certain peer. More... | |
bool | getSnapshot () |
Update the current gamestate. More... | |
bool | hasPeers () |
bool | processGamestates () |
Process the queued gamestates. More... | |
void | removePeer (uint32_t peerID) |
Remove a peer from the game. More... | |
bool | sendAck (unsigned int gamestateID, uint32_t peerID) |
Send Acknowledgement packet. More... | |
void | setSynched (uint32_t peerID) |
bool | update () |
Protected Member Functions | |
virtual bool | sendPacket (packet::Packet *packet)=0 |
Protected Member Functions inherited from orxonox::GamestateHandler | |
GamestateHandler () | |
virtual | ~GamestateHandler () |
Private Member Functions | |
bool | processGamestate (packet::Gamestate *gs) |
Process an incoming Gamestate packet. More... | |
Private Attributes | |
packet::Gamestate * | currentGamestate_ |
std::map< unsigned int, packet::Gamestate * > | gamestateQueue |
unsigned int | id_ |
std::map< uint32_t, peerInfo > | peerMap_ |
ThreadPool * | Pool_ |
This Class implements a manager for gamestates:
Inherited by Host
EN/DECODATION: a: last Gamestate a client has received b: new Gamestate x: diffed and compressed gamestate x = (a ^ b) b = (a ^ x) diff(a, diff(a, x)) = x (hope this is correct)
orxonox::GamestateManager::GamestateManager | ( | ) |
orxonox::GamestateManager::~GamestateManager | ( | ) |
|
overridevirtual |
Acknowledge a received gamestate.
gamestateID | The ID of the gamestate to be acknowledged |
peerID | The ID of the peer to send the Acknowledgement to |
Implements orxonox::GamestateHandler.
|
overridevirtual |
Implements orxonox::GamestateHandler.
void orxonox::GamestateManager::addPeer | ( | uint32_t | peerID | ) |
Add a peer to the game.
peerID | The ID of the peer to add. |
void orxonox::GamestateManager::finishGamestate | ( | unsigned int | peerID, |
packet::Gamestate *& | destgamestate, | ||
packet::Gamestate * | base, | ||
packet::Gamestate * | gamestate | ||
) |
|
inlineoverridevirtual |
Implements orxonox::GamestateHandler.
std::vector< packet::Gamestate * > orxonox::GamestateManager::getGamestates | ( | ) |
Return a vector with the gamestates of all peers.
|
overridevirtual |
Return the ID of the last received gamestate for a certain peer.
peerID | The ID of the peer\ |
Implements orxonox::GamestateHandler.
bool orxonox::GamestateManager::getSnapshot | ( | ) |
Update the current gamestate.
|
inline |
|
private |
Process an incoming Gamestate packet.
gs | Pointer to the incoming Gamestate packet |
bool orxonox::GamestateManager::processGamestates | ( | ) |
Process the queued gamestates.
void orxonox::GamestateManager::removePeer | ( | uint32_t | peerID | ) |
Remove a peer from the game.
peerID | The ID of the peer to be removed |
bool orxonox::GamestateManager::sendAck | ( | unsigned int | gamestateID, |
uint32_t | peerID | ||
) |
Send Acknowledgement packet.
gamestateId | The gamestate ID we want to acknowledge |
peerID | The ID of the peer we want to send the Acknowledgement to |
|
protectedpure virtual |
Implemented in orxonox::Client, and orxonox::Server.
|
inline |
bool orxonox::GamestateManager::update | ( | ) |
|
private |
|
private |
|
private |
|
private |
|
private |