Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 423 was 422, checked in by scheusso, 17 years ago

extended GameStateManager

File size: 1.4 KB
Line 
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
15#include <vector>
16
17#include "zlib.h"
18
19#include "Synchronisable.h"
20#include "orxonox/core/IdentifierIncludes.h"
21#include "orxonox/core/Iterator.h"
22#include "PacketTypes.h"
23
24namespace network {
25
26
27
28/**
29 * This Class implements a manager for gamestates:
30 * - creating snapshots of gamestates
31 * - writing gamestates to universe
32 * - diffing gamestates ?
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)
41 * @author Oliver Scheuss
42*/
43class GameStateManager{
44public:
45  GameStateManager();
46  ~GameStateManager();
47  void update();
48  GameStateCompressed popGameState(int clientID);
49  void ackGameState(int clientID, int gamestateID);
50private:
51  GameState *getSnapshot(int id);
52  GameStateCompressed encode(GameState *a, GameState *b);
53  GameState diff(GameState *a, GameState *b);
54  GameStateCompressed compress_(GameState a);
55  bool deleteUnusedGameState(GameState *state);
56 
57  std::vector<GameState *> clientGameState;
58  std::vector<GameState *> idGameState;
59  GameState *reference;
60  int id;
61};
62
63}
64
65#endif
Note: See TracBrowser for help on using the repository browser.