Difference between revisions of "Replay file"
From Worms Knowledge Base
m |
(→File format) |
||
Line 16: | Line 16: | ||
Following the map data is a DWORD containing the chunk length (0x0000000C), then a null byte, then the game's starting time in [[w:Unix time|time_t]] format. After that, there are 7 bytes which may have something to do with the scheme format. After that is the scheme data. Following it are the players, the teams, and after some null padding are the message sequences (user input) which is piped to the game engine to play back the replay. | Following the map data is a DWORD containing the chunk length (0x0000000C), then a null byte, then the game's starting time in [[w:Unix time|time_t]] format. After that, there are 7 bytes which may have something to do with the scheme format. After that is the scheme data. Following it are the players, the teams, and after some null padding are the message sequences (user input) which is piped to the game engine to play back the replay. | ||
+ | |||
+ | === User Input === | ||
+ | '''Generalities''' | ||
+ | |||
+ | After the padding mentioned above, the game starts with a 09 xx xx xx xx 00. The four xx bytes are still to be determined. Each new turn is initiated by that 00 byte, and before advancing, the game engine will wait until all pending actions are stabilized (Mines triggered, flames falling, animals running, ...). Each turn is divided in frames, at a rate of 50 frames per second. Those frames are seperated by a 02 byte. A frame can be empty, or contain the '''actions''' taken at that very moment. Each 25 frames, the word 0C 1E is inserted. Its purpose is yet unknown, and it is sometimes followed by a 03 or 04, for unknown reasons too. Each time an weapon is used, a checksum gets inserted into the following frame. | ||
+ | |||
+ | '''Actions''' | ||
+ | |||
+ | Actions are usually constituted by 2 Bytes, the first one coding for the action, and the second one coding for the active team (01-06). However, it is not possible to change the "Active team" byte to move another worm while it's not his turn. For example, the action 1E corresponds to the left arrow ; the action 21 to the down arrow. If the active worm is in the third team, the frame will look like "02 1E 03 21 03" (New frame, pressing left and pressing up). Some actions are more complex, and require therefore additional arguments. Those are typically inserted before or after the "Active team" byte. Here is a list of actions codes, along with their arguments when applicable. | ||
+ | |||
+ | {| border="1" cellspacing="0" | ||
+ | ! Code | ||
+ | ! Arguments | ||
+ | ! Action | ||
+ | ! Example | ||
+ | |- | ||
+ | | 08 | ||
+ | | xx yy 00 00 zz zz zz zz | ||
+ | | '''Checksum'''. yy is a value incremented at each checksum computation. xx and the 4 zz bytes are still to be determined. | ||
+ | | 02 08 xx yy 00 00 zz zz zz zz | ||
+ | |- | ||
+ | | 0F | ||
+ | | xx yy FF tt .. tt 00 | ||
+ | | '''Discussion''' (in chatbox). tt .. tt is the text string, xx and yy represent sender and receiver of the text. More details about this have still to be added. | ||
+ | | 00 0F 01 01 FF tt .. tt 00 | ||
+ | |- | ||
+ | | 11 | ||
+ | | xx xx xx xx | ||
+ | | '''Mouse placing'''. The 4 xx bytes represent the position of the mouse on the screen. | ||
+ | | 02 11 01 xx xx xx xx : Player 1 has placed the mouse at xx xx xx xx | ||
+ | |- | ||
+ | | 12 | ||
+ | | xx | ||
+ | | '''Orienting a girder'''. xx represent the new orientation of the girder. (01-0F) | ||
+ | | 02 12 01 0B 01 : Player 1 oriented the girder to a long topright inclined girder. | ||
+ | |- | ||
+ | | 1E | ||
+ | | | ||
+ | | '''Left arrow''' (In all its in-game usages) | ||
+ | | 02 <u>1E 02</u> 21 02 : Player 2 had Up-Left pressed in that frame. | ||
+ | |- | ||
+ | | 1F | ||
+ | | | ||
+ | | '''Right arrow''' | ||
+ | | | ||
+ | |- | ||
+ | | 20 | ||
+ | | | ||
+ | | '''Up arrow''' (In all its in-game usages) | ||
+ | | | ||
+ | |- | ||
+ | | 21 | ||
+ | | | ||
+ | | '''Down arrow''' | ||
+ | | | ||
+ | |- | ||
+ | | 24 | ||
+ | | | ||
+ | | '''Releasing''' (unmounting) of the ninja rope ; '''Forward Jump ; Backward jump''' if used twice (Not in the same frame). | ||
+ | | 02 <u>24 04</u> 02 02 02 02 <u>24 04</u> 02 02 : Player 4 pressed Enter twice, with a 3 frames interval, to backjump | ||
+ | |- | ||
+ | | 25 | ||
+ | | | ||
+ | | '''Up jump, Backflip''' if used twice (Not in the same frame) | ||
+ | | 02 <u>25 04</u> 02 02 02 02 24 04 02 02 : Player 4 pressed Backspace-Enter, with a 3 frames interval, to backjump | ||
+ | |- | ||
+ | | 26 | ||
+ | | | ||
+ | | '''Usage (launching) of a weapon''', from the ground or from any utility (Rope, parachute, ...) allowing weapon drops. It can appear several times for weapons having multiple shots (shotgun, rope, ...), but not in the same frame. <u>It triggers a checksum</u> except in the case of a ninja rope being re-fired from the air. | ||
+ | | 02 <u>26 01</u> 02 <u>08 xx yy 00 00 zz zz zz zz</u> 02 <u>20 01</u> 02 20 01 02 20 01 02 20 01 02 20 01 02 24 01 02 <u>26 01</u> : Player 1 fires the ninja rope, causing a checksum, then shortens it during 5 frames, then releases it and fires it again. <u>The second firing won't generate any checksum</u>. | ||
+ | |- | ||
+ | | 27 | ||
+ | | | ||
+ | | '''Releasing of a power-managed weapon''' (Bazooka, grenade). | ||
+ | | 02 <u>26 02</u> 02 02 02 02 02 02 02 <u>27 02</u> : Player 2 presses space to fire a bazooka, and releases space 7 frames later. (Note the possible confusion between frame separator 02 and "Active team" 02.) | ||
+ | |- | ||
+ | | 2C | ||
+ | | | ||
+ | | '''Using self-managed weapon''' (sheep, skunk, ...) after having launched it. | ||
+ | | 02 <u>2C 01</u> 02 02 02 <u>2C 01</u> : Player 1 has its skunk start to fart, then makes it explode 3 frames later. | ||
+ | |- | ||
+ | | 32 | ||
+ | | ww 01 zz xx xx xx xx 26 nn | ||
+ | | '''Mouse click''': ww represents team number and worm number, zz represents the action involved by the click, xx are the coordinates, and nn the "Active team" number (Note the 26 nn of weapon usage). | ||
+ | | 02 32 23 01 01 xx xx xx xx 26 02 : Player 2 (nn = 02) places (zz=01 : initial placement) the 3rd worm of the 2nd team (ww = 23) at the position xx xx xx xx. This generates a Checksum (due to the 26 nn being there too) | ||
+ | |- | ||
+ | | 33 | ||
+ | | ww zz 01 | ||
+ | | '''Weapon selection'''. ww represents team number and worm number (the same way ww from action 32 does) and zz is the weapon code | ||
+ | | 02 33 14 0B 01 : Active player (Note: The syntax doesn't mention player number) selects a Shotgun (zz=0B) for the 4th worm of team 1 | ||
+ | |- | ||
+ | | | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''Tables''' | ||
+ | |||
+ | Related to action 0F : '''Game chat'''. xx and yy represent sender and receiver (Not sure about that anymore) | ||
+ | {| border="1" cellspacing="0" | ||
+ | !xx | ||
+ | !yy | ||
+ | !Result | ||
+ | |- | ||
+ | | 00 | ||
+ | | 00 | ||
+ | | Player 1 talking | ||
+ | |- | ||
+ | | 01 | ||
+ | | 01 | ||
+ | | Player 2 talking | ||
+ | |- | ||
+ | | Lex, | ||
+ | | Help | ||
+ | | Me ! | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | Related to action 32 : '''Mouse click'''. zz determines the action for which the click is for. | ||
+ | {| border="1" cellspacing="0" | ||
+ | !zz | ||
+ | !Purpose | ||
+ | |- | ||
+ | | 01 | ||
+ | | Initial worm placement | ||
+ | |- | ||
+ | | 0B | ||
+ | | Girder placement | ||
+ | |- | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | Related to action 33 : '''Weapon selection'''. zz determines weapon selected. Fuse, herds, bounces will be studied soon. | ||
+ | {| border="1" cellspacing="0" | ||
+ | !zz | ||
+ | !Weapon | ||
+ | |- | ||
+ | | 06 | ||
+ | | 3s minbounce grenade | ||
+ | |- | ||
+ | | 0B | ||
+ | | Shotgun | ||
+ | |- | ||
+ | | 15 | ||
+ | | Dynamite | ||
+ | |- | ||
+ | | 20 | ||
+ | | Blowtorch | ||
+ | |- | ||
+ | | 22 | ||
+ | | Girder | ||
+ | |- | ||
+ | | 25 | ||
+ | | Ninja rope | ||
+ | |- | ||
+ | | 2F | ||
+ | | Petrol bomb | ||
+ | |- | ||
+ | | 30 | ||
+ | | Skunk | ||
+ | |- | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
== Security == | == Security == |
Revision as of 13:22, 7 September 2006
Replay (.WAgame) files were introduced to Worms Armageddon with Deadcode's 3.6.19.15 beta update, which was released on 20 February, 2004. The files represent self-contained recordings of games, which can be played on any computer with the corresponding software updates installed.
Recordings of all games played (including offline, mission and training games) are saved automatically to the User\Games folder. File names consist of a date/time stamp, the game type, and the participating players.
The files contain all the information needed to play the replay flawlessly. This includes the game version which was emulated during the game, the map and the scheme, the participating teams (including the custom flags and graves), and the random seed used for random in-game events (such as random initial placement of worms and objects).
File format
The rest of this article needs to be reviewed by an expert who has more experience in this domain.
The file starts with two signature bytes ("WA"), after which follows a word with the file version. W:A 3.6.26.5 saves replays in the version 12 format (0x000C).
After this, two DWORDs follow. The first represends the map data length, and the second - the map type. The map type can be 1 for Monochrome map (.bit), 2 for Seed-generated monochrome map, or 3 for Colour map. The map data follows, its length being the 2nd DWORD in the file (see above).
Following the map data is a DWORD containing the chunk length (0x0000000C), then a null byte, then the game's starting time in time_t format. After that, there are 7 bytes which may have something to do with the scheme format. After that is the scheme data. Following it are the players, the teams, and after some null padding are the message sequences (user input) which is piped to the game engine to play back the replay.
User Input
Generalities
After the padding mentioned above, the game starts with a 09 xx xx xx xx 00. The four xx bytes are still to be determined. Each new turn is initiated by that 00 byte, and before advancing, the game engine will wait until all pending actions are stabilized (Mines triggered, flames falling, animals running, ...). Each turn is divided in frames, at a rate of 50 frames per second. Those frames are seperated by a 02 byte. A frame can be empty, or contain the actions taken at that very moment. Each 25 frames, the word 0C 1E is inserted. Its purpose is yet unknown, and it is sometimes followed by a 03 or 04, for unknown reasons too. Each time an weapon is used, a checksum gets inserted into the following frame.
Actions
Actions are usually constituted by 2 Bytes, the first one coding for the action, and the second one coding for the active team (01-06). However, it is not possible to change the "Active team" byte to move another worm while it's not his turn. For example, the action 1E corresponds to the left arrow ; the action 21 to the down arrow. If the active worm is in the third team, the frame will look like "02 1E 03 21 03" (New frame, pressing left and pressing up). Some actions are more complex, and require therefore additional arguments. Those are typically inserted before or after the "Active team" byte. Here is a list of actions codes, along with their arguments when applicable.
Code | Arguments | Action | Example |
---|---|---|---|
08 | xx yy 00 00 zz zz zz zz | Checksum. yy is a value incremented at each checksum computation. xx and the 4 zz bytes are still to be determined. | 02 08 xx yy 00 00 zz zz zz zz |
0F | xx yy FF tt .. tt 00 | Discussion (in chatbox). tt .. tt is the text string, xx and yy represent sender and receiver of the text. More details about this have still to be added. | 00 0F 01 01 FF tt .. tt 00 |
11 | xx xx xx xx | Mouse placing. The 4 xx bytes represent the position of the mouse on the screen. | 02 11 01 xx xx xx xx : Player 1 has placed the mouse at xx xx xx xx |
12 | xx | Orienting a girder. xx represent the new orientation of the girder. (01-0F) | 02 12 01 0B 01 : Player 1 oriented the girder to a long topright inclined girder. |
1E | Left arrow (In all its in-game usages) | 02 1E 02 21 02 : Player 2 had Up-Left pressed in that frame. | |
1F | Right arrow | ||
20 | Up arrow (In all its in-game usages) | ||
21 | Down arrow | ||
24 | Releasing (unmounting) of the ninja rope ; Forward Jump ; Backward jump if used twice (Not in the same frame). | 02 24 04 02 02 02 02 24 04 02 02 : Player 4 pressed Enter twice, with a 3 frames interval, to backjump | |
25 | Up jump, Backflip if used twice (Not in the same frame) | 02 25 04 02 02 02 02 24 04 02 02 : Player 4 pressed Backspace-Enter, with a 3 frames interval, to backjump | |
26 | Usage (launching) of a weapon, from the ground or from any utility (Rope, parachute, ...) allowing weapon drops. It can appear several times for weapons having multiple shots (shotgun, rope, ...), but not in the same frame. It triggers a checksum except in the case of a ninja rope being re-fired from the air. | 02 26 01 02 08 xx yy 00 00 zz zz zz zz 02 20 01 02 20 01 02 20 01 02 20 01 02 20 01 02 24 01 02 26 01 : Player 1 fires the ninja rope, causing a checksum, then shortens it during 5 frames, then releases it and fires it again. The second firing won't generate any checksum. | |
27 | Releasing of a power-managed weapon (Bazooka, grenade). | 02 26 02 02 02 02 02 02 02 02 27 02 : Player 2 presses space to fire a bazooka, and releases space 7 frames later. (Note the possible confusion between frame separator 02 and "Active team" 02.) | |
2C | Using self-managed weapon (sheep, skunk, ...) after having launched it. | 02 2C 01 02 02 02 2C 01 : Player 1 has its skunk start to fart, then makes it explode 3 frames later. | |
32 | ww 01 zz xx xx xx xx 26 nn | Mouse click: ww represents team number and worm number, zz represents the action involved by the click, xx are the coordinates, and nn the "Active team" number (Note the 26 nn of weapon usage). | 02 32 23 01 01 xx xx xx xx 26 02 : Player 2 (nn = 02) places (zz=01 : initial placement) the 3rd worm of the 2nd team (ww = 23) at the position xx xx xx xx. This generates a Checksum (due to the 26 nn being there too) |
33 | ww zz 01 | Weapon selection. ww represents team number and worm number (the same way ww from action 32 does) and zz is the weapon code | 02 33 14 0B 01 : Active player (Note: The syntax doesn't mention player number) selects a Shotgun (zz=0B) for the 4th worm of team 1 |
Tables
Related to action 0F : Game chat. xx and yy represent sender and receiver (Not sure about that anymore)
xx | yy | Result |
---|---|---|
00 | 00 | Player 1 talking |
01 | 01 | Player 2 talking |
Lex, | Help | Me ! |
Related to action 32 : Mouse click. zz determines the action for which the click is for.
zz | Purpose |
---|---|
01 | Initial worm placement |
0B | Girder placement |
Related to action 33 : Weapon selection. zz determines weapon selected. Fuse, herds, bounces will be studied soon.
zz | Weapon |
---|---|
06 | 3s minbounce grenade |
0B | Shotgun |
15 | Dynamite |
20 | Blowtorch |
22 | Girder |
25 | Ninja rope |
2F | Petrol bomb |
30 | Skunk |
Security
The format incorporates periodic checksums, embedded into specific actions. This allows to detect modifications to the replay, causing warning messages during playback.
The tool-assisted versions of W:A save replays in an encrypted format, which is playable only with the tool-assisted version. Only Deadcode can decrypt them, thus making them playable with normal versions of W:A.