Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/FICN/src/network/GameStateManager.h @ 433

Last change on this file since 433 was 425, checked in by scheusso, 18 years ago

some minor changes

File size: 1.4 KB
RevLine 
[247]1//
2// C++ Interface: GameStateManager
3//
4// Description:
5//
6//
7// Author:  Oliver Scheuss, (C) 2007
8//
9// Copyright: See COPYING file that comes with this distribution
10//
11//
12#ifndef NETWORK_GAMESTATEMANAGER_H
13#define NETWORK_GAMESTATEMANAGER_H
14
[413]15#include <vector>
16
17#include "zlib.h"
18
[332]19#include "Synchronisable.h"
20#include "orxonox/core/IdentifierIncludes.h"
21#include "orxonox/core/Iterator.h"
[415]22#include "PacketTypes.h"
[332]23
[247]24namespace network {
25
26
[403]27
28/**
[247]29 * This Class implements a manager for gamestates:
30 * - creating snapshots of gamestates
31 * - writing gamestates to universe
32 * - diffing gamestates ?
[385]33 *
34 * EN/DECODATION:
35 * a: last Gamestate a client has received
36 * b: new Gamestate
37 * x: diffed and compressed gamestate
38 * x=(a^b)
39 * b=(a^x)
40 * diff(a,diff(a,x))=x (hope this is correct)
[247]41 * @author Oliver Scheuss
42*/
43class GameStateManager{
44public:
45  GameStateManager();
46  ~GameStateManager();
[413]47  void update();
48  GameStateCompressed popGameState(int clientID);
[422]49  void ackGameState(int clientID, int gamestateID);
[425]50  void removeClient(int clientID);
[247]51private:
[422]52  GameState *getSnapshot(int id);
[413]53  GameStateCompressed encode(GameState *a, GameState *b);
54  GameState diff(GameState *a, GameState *b);
55  GameStateCompressed compress_(GameState a);
[422]56  bool deleteUnusedGameState(GameState *state);
[413]57 
58  std::vector<GameState *> clientGameState;
[422]59  std::vector<GameState *> idGameState;
60  GameState *reference;
[413]61  int id;
[247]62};
63
64}
65
66#endif
Note: See TracBrowser for help on using the repository browser.