CSE6363 Project Data Format

The data stream is saved in 5 files: 2 files for video, 1 for each of mouse, keyboard and game data. These files are given the extensions .video, .vd, .mouse, .kb and .game. Each data instance saved in all of these files is time-stamped which has the following format:
        T (seconds) (milliseconds)
Example:
        T 972164413 348
Several time stamps can follow each other without having a corresponding data instance. At creation time, each file is time-stamped.

The video files

The video data is captured is two separate file. The one with extension .video contains the above mentioned time stamp, and the corresponding image's resolution.
        T 972164415 634           Time stamp
        160 120                   Resolution (x, y)
The image file (.vd) is a binary file (open using the binary switch). It contains the images in 24-bit true color format. Each pixel is defined by 3 bytes: 1 for each color blue, green, and red, in this order. The first triple is the bottom left pixel of the image, the next is one over to the right. The size of the image is
        (horizontal resolution) * (vertical resolution) * 3

The mouse file

The mouse file describes mouse events such as button pressed or released, mouse moved and window resized. The format is as follows:
        L D x y                   Left button down at (x,y)
        L U x y                   Left button up at (x,y)
        R D x y                   Right button down at (x,y)
        R U x y                   Right button up at (x,y)
        M x y                     Mouse moved to position (x,y)
        W R w h                   Window resized to w width and h height

The keyboard file

The keyboard file describes keys pressed in the following format:
        K a                       Key a pressed
        K space                   The space key was presssed
The following control keys (ASCII value < 32) are also saved:
        K enter                   Enter key
        K tab                     Tab key
        K esc                     Esc key
        K del                     Backspace key

The game file

The game file describes the flow of the game in the following format:
        N                         New game
        O r c                     O picked box at row r and column c
        X r c                     X picked box at row r and column c
        W X                       X won
        W O                       O won
        W T                       Tie (nobody won)
        P X                       Human player is X's
        P O                       Human player is O's
        D easy                    New difficulty level is easy
        D medium                  New difficulty level is medium
        D hard                    New difficulty level is hard