Inheritance diagram for Engine::ReplayReader:
Public Member Functions
|ReplayReader (std::istream &data)|
|Replay from a stream. |
|virtual void||posttick ()|
|Process any events that happen next tick. |
|void||operator() (GameScene *)|
|Called by LoadScene when it has finished loading. |
|Scene *||get_scene ()|
|Return the scene that will show the replay. |
Protected Member Functions
|void||ReadEvents (std::istream &data)|
|Read the events in the file into replay_events. |
|std::vector< ReplayEvent >||replay_events|
|The list of events in the replay, sorted in time order. |
|std::vector< ReplayEvent |
|Iterator to the next event to process. |
InputDeviceReplay > >
|Input devices to relay the events through. There is one per player. |
|std::map< long unsigned int,|
|Map identifiers found in the replay data to InputDeviceReplays. |
|std::vector< std::pair< Engine::InputHandler::iterator,|
unsigned int > >
|LoadScene< GameScene, ReplayReader > *||load_scene|
|The scene used to load the track. |
|The scene the replay takes place in. |
The replay is stored as some metadata, plus a series of timestamped events recorded from input devices. When created it reads the metadata. It can explain the metadata, and create an appropriate scene. As the scene runs, it will report the events at the correct time so that the same things happen.
For this method to work, we require that all physics, game logic, and AI is deterministic, i.e. when presented with the same events with the same timings, things turn out just as before.
The alternative would be to store a set of states. This has the following disadvantages:
With just the input, we only need to have a list of InputReport objects saved and timestamped, and determinstic state determined only from an input.
Definition at line 49 of file ReplayReader.h.
|Scene * Engine::ReplayReader::get_scene||(||)|
|void Engine::ReplayReader::operator()||(||GameScene *||)|
|void Engine::ReplayReader::ReadEvents||(||std::istream &||data||)||
|std::vector<std::pair<Engine::InputHandler::iterator, unsigned int> > Engine::ReplayReader::game_scene_devices_list
|std::map<long unsigned int, Engine::InputHandler::iterator> Engine::ReplayReader::input_map
Generated at Mon Sep 6 00:41:17 2010 by Doxygen version 1.4.7 for Racer version svn335.