What is the use of a book without pictures?

Since the last post I’ve worked on the screenshots feature. There was few requirements:

  1. During the recording process screenshots should record into the same file as other evetns
  2. It should be possible to setup period of screenshot recording
  3. During the playback process screenshots should read from playback file and compare with current game screen. Best of all it would do using MD5 hash, so it must be recorded with image data.

New recording format

Last 2 weeks I’ve worked on developing of format for holding recorded gameplay data. Why this needed and how does it work you may read under the cut.

In first versions I wrote without formatting and then just read it in same order to the written. It worked, but wasn’t flexible and hadn’t any abilities to provide backward compatiblity in future. And there was a problem with navigation between file sections: for example, file has a header section, a section with info about autor and a section with gameplay data.
So, it was necessary to find the way to structure the data. I thought that the  most appropriate format for current purposes is the RIFF, i.e. use containers with fields of unique identifier and size for every file section. It give us opportunity to find identify any section in file. Also we can easily skip any unsupported section.

Now file has following sections:

PBCK //format id, length = file length - 8
     VERS //version of recorder
     HEAD //Header, contains unnecessary info about author
          HAUT //Author's name
          HCMT //Comments
     HASH //table of MD5 hash of game files
          HRCD //record for one file
               HNAM //name
               HMD5 //MD5 hash  
     RNDM //Seeds for random number generator      
     SETT  //Game's settings
          SKEY //Name of setting
          SVAL //Value of setting
     RCDS //Gameplay data
RCDS section always has 0 in size field, because isn't possible to calculate it during the recording.

To process this file, I wrote state machine which may be illustrated by following diagramm:

My first success

Hi. Last week was pretty fruitful. I got to work EventRecorder on KYRA engine. Let’s describe it in more details.