Bobbie Smulders Freelance Software Developer

How Driver (1999) was able to store movies in 16 kB

Police chase in the game Driver

In 1999 the game Driver was released. A game that let you drive at high speeds through an open-world game, engage in police pursuits and do daring stunts. The most fascinating feature of the game was the Film Director. After a gaming session, you could not only watch a replay but also position the cameras to direct your very own movie. The resulting movie could be saved on the 1 megabit PlayStation memory card.

In the age of game streams, capture cards and having gigabytes of storage at your disposal, it’s not that difficult to create such in a feature. But in 1999 it was a technical marvel. You could store up to seven of your personally directed movies on a memory card, take it to a friends place and watch them back. I always wondered how it was possible to store such a large number of data on such a tiny storage device until I came across an interview with the lead developer of the game:

We didn’t have the memory to store position data for all the objects in the scene for each frame of animation so I developed a system which just stored player input but it relied on everything being totally deterministic.

An elegant solution but with the caveat that every single detail in the game had to be deterministic, leaving nothing up to chance in the big open world cities. By replaying the player input the game could be replayed exactly like how it was first played. The team was able to pull it off as the Film Director was praised in the magazine reviews.

Being curious about the technical implementation I dusted off my PlayStation to look at the data format of the movies made with the Film Director feature. I stored a very short movie on a memory card and extracted the binary data from it.

PlayStation memory card

The PlayStation memory card has a total capacity of 1 megabit. There are 15 save blocks available. The card is divided into 16 blocks, the first block is a directory with pointers to the other 15 blocks. Each block contains 64 frames of 128 bytes each.

A Film Director save takes up two save blocks, giving us a total capacity of 16,384 bytes or 16 kilobyte. Even knowing that the game is deterministic, it is still an impressive achievement to store an entire game session in such a limited capacity.

First block: Directory

Skip to ‘Second and third block: Savegame’

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
4D430000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000E 
51000000 00400000 01004241 534C5553 2D303038 34324031 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000068 
53000000 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000053 
A0000000 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000000A0 
A0000000 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000000A0 
A0000000 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000000A0 
A0000000 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000000A0 
A0000000 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000000A0 
A0000000 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000000A0 
A0000000 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000000A0 
A0000000 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000000A0 
A0000000 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000000A0 
A0000000 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000000A0 
A0000000 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000000A0 
A0000000 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000000A0 
A0000000 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000000A0 
FFFFFFFF 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
FFFFFFFF 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
FFFFFFFF 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
FFFFFFFF 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
FFFFFFFF 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
FFFFFFFF 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
FFFFFFFF 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
FFFFFFFF 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
FFFFFFFF 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
FFFFFFFF 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
FFFFFFFF 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
FFFFFFFF 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
FFFFFFFF 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
FFFFFFFF 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
FFFFFFFF 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
FFFFFFFF 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
FFFFFFFF 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
FFFFFFFF 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
FFFFFFFF 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
FFFFFFFF 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

The first block looks rather daunting and I’ve only included the first 36 frames of the 64 in total. The data is displayed in hexadecimal. Let’s go over the first frame:

4D430000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000E 

The first frame is the identification frame. If the first two bytes contain the ASCII value of ‘MC’, are followed by 125 ‘NUL’ bytes and end with an XOR byte of 0x0E we are dealing with a valid PlayStation memory card.

51000000 00400000 01004241 534C5553 2D303038 34324031 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000068 
53000000 00000000 FFFF0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000053 

The second and third frame are directory frames containing metadata for the first and second save block of the memory card.

The first 32 bits (51000000 and 53000000) start with 0x51, 0x52 or 0x53 for an initial block, a middle block or a final block. A Driver Film Director save uses two blocks so the first save block starts with 0x51 (initial block) and the second save block starts with 0x53 (final block).

The second 32 bits (00400000 and 00000000) are for the total save size. 16,384 in decimal, exactly the size of two save blocks. The final block does not contain this data.

The following 16 bits (0100 and FFFF) are for the pointer to the next save block. The first save block contains 0100, meaning that the second save block is on position 1 of the memory card (counting from zero). The second save block contains FFFF, meaning that this is the final block and that there is no next block.

The following 2 bytes (4241 and 0000) are for the region. The first byte is always 0x42 or ‘B’, the second byte is either ‘A’ (American), ‘E’ (European) or ‘I’ (Japan). In our case, it is 0x41 for ‘A’. The final block does not contain this data.

The following 10 bytes (534C5553 2D303038 3432) are for the name of the game. This translates to ‘SLUS-00842’ (Driver - You’re the wheelman - NTSC-U)

To close off we have 8 bytes to differentiate between saves (4031 0000), a ‘NUL’ end byte, 94 unused bytes and an XOR code.

Second and third block: Savegame

1
2
3
4
5
53431102 82638271 82688275 82648271 81408169 82718264 826F826B 82608278 816A8140 8140817C 82548255 82560000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 21041602 09211B37 C8009001 FE7B630C 734E8C31 39677A02 EF39C614 3C434204 
BBBBBBBB 1BBBBBBB BBBB1BBB BB3BA6BC BBB1BBBB 638A00B4 BBBBEBA6 7C47B5B1 BB639A72 54B111B5 6B7C4015 1B4500B0 0B545104 406C29B6 9B87266C 79868FB9 6B670986 770700B0 0B07D027 7F0D00B0 0B070020 22D2DDB2 0B2DD222 700D77B0 0BDD0DD0 F00DDFB0 0B2D7DD0 475415B1 0B405415 B1BBBBBB BBBBBBBB BBBBBBBB 
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
00177814 00000000 00403200 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

I have created a one-second movie of a car driving forwards to keep the savegame easy to understand. The first four frames are a PlayStation standard, the fifth frame contains the actual movie.

53431102 82638271 82688275 82648271 81408169 82718264 826F826B 82608278 816A8140 8140817C 82548255 82560000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 21041602 09211B37 C8009001 FE7B630C 734E8C31 39677A02 EF39C614 3C434204 

The first frame contains metadata about the savegame.

The first two bytes (5343) always contain 0x53 and 0x43 (ASCII: ‘SC’).

The third byte (11) contains information about the savegame icon, as displayed on the screen when choosing a block. 0x11 for a static icon, 0x12 for a two-frame icon and 0x13 for a three-frame icon.

The next byte (02) is to signify the number of blocks the save uses in total.

The following 64 bytes (82638271 82688275 82648271 81408169 82718264 826F826B 82608278 816A8140 and 8140817C 82548255 82560000 00000000 00000000 00000000 00000000) are used to store the (user typed) name of the save, in Shift-JIS kanji character set. The characters use two bytes each giving us a total name of 32 characters. This translates to ‘DRIVER (REPLAY) -567 ‘. Not a very creative name, sorry about that.

To close off we have 28 ‘NUL’ bytes and 32 bytes used for the icon palette.

BBBBBBBB 1BBBBBBB BBBB1BBB BB3BA6BC BBB1BBBB 638A00B4 BBBBEBA6 7C47B5B1 BB639A72 54B111B5 6B7C4015 1B4500B0 0B545104 406C29B6 9B87266C 79868FB9 6B670986 770700B0 0B07D027 7F0D00B0 0B070020 22D2DDB2 0B2DD222 700D77B0 0BDD0DD0 F00DDFB0 0B2D7DD0 475415B1 0B405415 B1BBBBBB BBBBBBBB BBBBBBBB 
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

The second, third and fourth frame contain the savegame icon. Because we have a static icon (0x11, defined in the first metadata frame), the third and fourth frame are empty.

00177814 00000000 00403200 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

The fifth frame and everything beyond that point is a non-defined data format used in this game only. It is up to ourselves to figure that one out!

Cracking the code

To figure out how the user input is stored, I created multiple save games with different approaches.

Look at the difference between a movie with a car driving forwards for one second:

Screenshot

00177814 00000000 00403200

or two seconds:

Screenshot

00177814 00000000 00406500

The 0x32 byte is suddenly a 0x65 byte. These numbers are quite relevant, as they translate to 50 and 101 in decimal. Which is the number of frames that fit in one or two seconds.

Changing the 0x32 byte to 0x65 changed nothing in the movie. So I did a full binary comparison on both savegames to find the difference. Next to the difference in the save name and the difference seen above, there was an isolated byte at offset 0x4B70, almost at the end of the second save block, that contained 0x32 on the first movie and 0x65 on the second movie.

Changing this byte confirmed my theory: This byte stores the length of the movie. After changing it to 0x96 (150 frames), the movie would last three seconds and the car would drive forwards for two of those seconds.

Backwards

A movie with a car driving backwards for one second:

Screenshot

00177814 00000000 00803200

The 0x40 byte changed to 0x80. In binary that is 01000000 and 10000000 which could mean that the game uses a bit field of the controller state. After doing some more investigation I noticed that the input consisted of not one but two bytes. By trying all buttons I was able to decode the bit field:

7 6 5 4 3 2 1 0
           
7 6 5 4 3 2 1 0
× R1 L1    

The undefined bits in the first bit field are for analogue steering.

Creating a scene

A movie with a car driving backwards for one second, doing nothing for one second and then driving backwards another second:

00177914 00000000 00002300 80290000 2A000000 00802900 002A0000

Due to my imperfect hands and timing, this was not a clean run. But we can see a pattern here:

Buttons Frames Result
0x00 0x00 0x23 No input for 35 frames
0x00 0x80 0x29 Press square button for 41 frames
0x00 0x00 0x2A No input for 42 frames
0x00 0x00 0x00 No input for 0 frames
0x00 0x00 0x23 No input for 35 frames
0x00 0x80 0x29 Press square button for 41 frames
0x00 0x00 0x2A No input for 42 frames

This is where it gets interesting. My initial assumption was that the state of the controller input would be saved for each frame. The (non-analogue) PlayStation controller has 14 buttons so we would need 2 bytes for a button map. At 50 frames per second, that would be 100 bytes per second, 6 kilobytes per minute. The 16 kilobytes would then fill up in less than three minutes.

By only recording the input state changes, the total length of the recording can be greatly increased depending on how many times the buttons are pressed. In the example above, the total movie was 236 frames or 4.72 seconds which took 28 bytes. At that rate a full minute would be just 356 bytes, theoretically giving us 45 minutes of recording before filling a 16-kilobyte savegame.

After doing a couple of test runs the maximum recording time was around 17 minutes. Looking at the savegame confirmed that the full 16 kilobyte was used for the recording of the input, the initial game state, the positions of the cameras and metadata.

Out of tape message in left bottom corner of the game

Wrapping it up

Storing a movie in 16 kilobytes. For comparison: the short animated GIFs used in this page are around 500 kilobytes in size after resizing them down to 300x240 pixels and applying a smart compression algorithm. The game Driver was able to store a movie spanning multiple minutes in a 16-kilobyte savefile while not even using all of the available data. It all came down to impressive engineering such as making the entire open-world game deterministic, recording the player input and on top of that only recording the input state changes to minimize the footprint even further. Only three bytes are used each time a button is pressed or released making it possible to store long gaming sessions.

In a world where we have gigabytes or even terabytes of storage freely available, it nice to be grateful and remember the dark times where a megabit of persistent storage was all you had.

Sources