Tetris Replays
Posted: Sun Dec 01, 2013 12:30 pm
Hey, I want to write an HTML5 replayer based on simonlc's "tetr.js".
My first goal is to parse replays on Tetris Friends, particularly ones for Sprint and Ultra. The GameData (that's what they call it) format is the same as for all replays from Tetris Battle (with minor variations per game). For example, this is a Battle2P replay from Tetris Friends, and this is a Battle2P replay from Tetris Battle. I can successfully replay games using the GameData from either site (using the official Flash-based replayers). It's kind of cool, you can use Ultra replays for each player in Battle2P and pit them against each other (Chocobana's replay almost always wins ).
As you can see, the replay data is very compressed, not nearly as readable as TOJ replay data. So, I've been trying to decypher the GameData format.
I know basic details about the structure of the replays. The whole thing is Base64-encoded. Inside that, there's a header that they refer to as the "TPRHeader", from offset 00-6D. That includes details like the mino style (offset 3D) and the size of the replay portion (offset 04-07), which follows the TPRHeader.
The replay portion itself is zlib-compressed, and goes from offset 6E to the end of the GameData. The replay portion is self-contained and includes enough information that it will work with any TPRHeader. For example, offset 2A-2D of the replay portion is the seed for the bag randomizer.
Anyway, I'm a little stuck figuring out the format of the replay portion, and I'm wondering if anyone else has any helpful information I can work with. Thoughts?
My first goal is to parse replays on Tetris Friends, particularly ones for Sprint and Ultra. The GameData (that's what they call it) format is the same as for all replays from Tetris Battle (with minor variations per game). For example, this is a Battle2P replay from Tetris Friends, and this is a Battle2P replay from Tetris Battle. I can successfully replay games using the GameData from either site (using the official Flash-based replayers). It's kind of cool, you can use Ultra replays for each player in Battle2P and pit them against each other (Chocobana's replay almost always wins ).
As you can see, the replay data is very compressed, not nearly as readable as TOJ replay data. So, I've been trying to decypher the GameData format.
I know basic details about the structure of the replays. The whole thing is Base64-encoded. Inside that, there's a header that they refer to as the "TPRHeader", from offset 00-6D. That includes details like the mino style (offset 3D) and the size of the replay portion (offset 04-07), which follows the TPRHeader.
The replay portion itself is zlib-compressed, and goes from offset 6E to the end of the GameData. The replay portion is self-contained and includes enough information that it will work with any TPRHeader. For example, offset 2A-2D of the replay portion is the seed for the bag randomizer.
Anyway, I'm a little stuck figuring out the format of the replay portion, and I'm wondering if anyone else has any helpful information I can work with. Thoughts?