Animation and Movie file format proposal
- Login to post comments
So as you know, I documented the animation and movie game binary file formats recently.
To summarise, an animation (.anim.binltl) is a sequence of keyframes affecting scale, rotation, position, alpha, colour and sound. But it doesn't specify what is animated, only how it is animated. It's used for animating single elements, e.g. an object in a level. A good example is rot_1fps with rotates 360 degrees every second and is used in many levels.
A movie (.movie.binltl) is basically one of the game cut-scenes (though there are a few special-case ones like end-of-level movies). It consists of a sequence of actors (images or text) each of which is animated according to an animation in the same format as above.
There's no magical encryption to these files, they're simply binary data that corresponds exactly to the structs used by the game itself. This makes it impossible for us to provide a standard "encrypt/decrypt" function for addin authors. So on the (seven hour) train ride today I spent some time perfecting my .binltl import and coming up with an XML file format describing both animations and movies.
The first thing I came up with was a direct like-for-like translation of the binary formats to XML. Check out anim_and_movie_v1.zip of both animations and movies.
Then I analysed the existing files a little more closely and came up with the following observations:
Keyframes
Even though a keyframe has fields for alpha, colour, angle, position, and sound strings, I have confirmed the following as true for all existing movies and animations:
- x,y are always -1 except for scale and translate transform keyframes. For those they are never -1
- angle is always -1 except for rotate transform keyframes, where it is never -1
- alpha is always -1 except for alpha keyframes, where it is never -1
- colour is always -1. On the few anims where colour keyframes exist (e.g. treeBlow_trunk) there is only one keyframe and its colour value is still -1. It's not used at all on movies, only animations. Not sure whether colour frames therefore have any purpose.
- soundStr is always 0 except for sound keyframes. 0 is an offset in the string table to a null-terminated string of length 0. Sound keyframes only ever exist in movies, not raw anims.
Transforms
- For movies, there are always exactly three transforms, and they're always SCALE followed by ROTATE followed by TRANSLATE (which is of course the order you want when doing matrix multiplication)
- For anims, this isn't always the case. Specifically, ball_counter_ocd breaks this by having SCALE,SCALE,ROTATE,TRANSLATE (the first scale is 2.0,2.0) and rot_1rps breaks it by having no scale or translate keyframes at all.
Frame congruency
For movies, there are always a matching set of transform, alpha and colour frames, each frame having the same nextframe index and same interpolation type.
This doesn't apply to anims. e.g. some only have a single alpha=255 frame for their whole duration.
This doesn't apply to sound frames in movies either, which have their own existence. The sound frames are inserted at the point when the sound needs to play, even if no other types of frame exist at this point in time. The other frame types then skip over this frame via nextframe.
Sound frames are normally (but not always) added to the last actor in a movie, but in every case there's never more than one actor with sound frames.
Interpolation
Interpolation is from the current item to its nextframe, not from the previous frame to this frame.
Interpolation is consistent within a movie across all keyframe types.
Analysis
All these things seem to imply that anims were created by hand or script, whereas movies were probably exported from some other format.
In movies, if you take out all the sound frames and then shuffle down empty keyframes, the frames are all consecutive per actor in a movie and so nextframe is superfluous (this isn't true for anims, specifically ball_counter_ocd with its dual SCALE transforms).
All actors have a final keyframe that coincides with the movie's end time, even if nothing changes between their last "real" keyframe and the movie end. Example:
<movie length="31.571428"> <actor type="image" depth="0.0" align="center"> <image id="IMAGE_MOVIE_CHAPTER1END_BLACK32"/> <simple-animation> <keyframe time="0.0" x="547.5" y="300.0" angle="0.0" scale-x="34.218964" scale-y="18.750275" alpha="255"/> <keyframe time="31.571428" x="547.5" y="300.0" angle="0.0" scale-x="34.218964" scale-y="18.750275" alpha="255"/> </simple-animation> </actor>
The following facts are true for all movie files (I define this as "simple" animation):
// A simple animation has: // 1. No colour, and no sound. // 2. Has transforms, exactly 3 of them: SCALE, ROTATE and TRANSLATE in that order // 3. No skipped keyframes. So all frames are present for all transforms. And they're all sequential, ending with -1. // 4. Has alpha, and no skipped frames there either. And an alpha frame exists for each transform frame, and vice versa.
So to simplify the XML for the most common cases, I created an <animation> element, which has a simple list of unnumbered keyframes, all with alpha. All movies can be generated into "simple" animations.
Some but not all anims can be generated into "simple" animations. The remainder retain the original format of individual keyframes of each type, within a <complex-animation> animation.
I therefore came up with a simplified and less verbose form for the common case.
I would very much appreciate your feedback on the anim_and_movie_v2.zip file format.
Note in particular that, since sound frames only ever get "attached" to an existing actor, I've removed them from the animation entirely and seperated them out into their own "sounds" element, and removed any remaining redundant keyframes from the original element.
I'm not too happy with having both animation and complex-animation but I think it's the best way to achieve full flexibility where required, without making "normal usage" overly verbose. And at the end of the day it's only a bit more code for GooTool.
Upon consensus this will become the standard format for ".anim.xml" and ".movie.xml" in the goomod specification version 1.1 and will be implemented in GooTool in the next release.
NB NB NB Don't bother coding anything to this format yet! It's liable to change, and if we get consensus I'll document it properly.
-davidc
Last call for comments. Work on the next version of GooTool is now underway and will include animation and movie compilation.
Beginning to take form:
Genius, pure genius.
Did you try to google it?
Crazeh man!
sorry
Crazeh man!
wtf is this?
last.fm
facebook.
.
it's the code of the 2dboylogo.movie.bintl i got this code when i opened it with notepad
Crazeh man!
Here's the source of the xml->flash converter script, as far as I got with it (producing the movie above). Obviously flash->xml is much more important but I haven't done anything with that.
This runs as an addon inside Flash CS4 so you need the Flash editor installed to do anything with it. The file goes in C:\Users\[user]\AppData\Local\Adobe\Flash CS4\en\Configuration\Commands\Import WoG Movie.jsfl
Why does "presents" keep on stickin' to the top left?
InfernoFans | Chest full of porkchops
Because I didn't implement visibility, so any item that hasn't been displayed yet is display at coordinates (0,0 ) at the top left.
2D Boy made a complex system for all the files in World of Goo. It makes me think that maybe THEY have some sort of level editor or animator that produces files in their formats. What is the probability of this being true?
I'll tell you, it's VERY HIGH.
Nooo, they made their levels in paint. And then manually wrote xmls...
My Gooish profile | Videos on YouTube | My WOG Mods
They do a really good job of it to have that kind of art.
InfernoFans | Chest full of porkchops
I thought that the xml encryption was just a creation of Mr. Croft...
Ron and Kyle first wrote xmls manually as ordinary text xml and then they encrypted them. After the game came out, few people including Soultaker cracked the encryption. I think davidc just implemented their formula in gootool.
My Gooish profile | Videos on YouTube | My WOG Mods
The game was released with hand-written encrypted XMLs. Someone "cracked" the encryption to make editing the game possible. Remember that user-generated content wouldn't have been possible without this step. When davidc wrote GooTool, he implemented en-/decrypting as well, because otherwise GooTool wouldn't work in the first place.
my gooey profile | my video channel | author of Hazardous Environment
If those functions weren't there in the first place, GooTool wouldn't even be a possiblity, well, except for the override folder in the addins. That wouldn't really need encryptions.
If those functions weren't there in the first place, GooTool wouldn't even be a possiblity, well, except for the override folder in the addins. That wouldn't really need encryptions.
But how would you make/write that addin?
My Gooish profile | Videos on YouTube | My WOG Mods
If those functions weren't there in the first place, GooTool wouldn't even be a possiblity, well, except for the override folder in the addins. That wouldn't really need encryptions.
But how would you make/write that addin?
The override folder won't need encryptions. The addin.xml is still just an xml and can withdraw data no matter what.
davidc, why you put to Goo Tool DECRYPTING animations without posibility of ENCRYPTING?
I couldn't try to make custom animations! And I don't know if I understand it...
Author of Platforms of Goo and 64 levels for World of Goo .
Encryption is missing until the file format is finalised. And more to the point it was decidedly harder to do than decrypting, particularly since I wanted to simultaneously release a flash exporter. It's not a high priority right now. The flash exporter script is in the GooTool source bundle at /flash.jsfl I think, if someone wants to work on it.
-davidc
When did this encryption/decryption thing come in? Wasn't the animations unencrypted by default? (Or are we talking about decoding/encoding? If so, please use the right terminology to reduce confusion.)
Author of World of Goo Portable. Download here!
Correct, he meant decoding/encoding. I can't remember if the files are encrypted or not (I think not), but the fundamental problem with them was their binary file format (which is also different on Linux 64-bit IIRC, since it's direct correspondence to C structs).
Possibly confusion arose because of the GooTool menus being named Encrypt/Decrypt which I will fix in the next release.
-davidc
I've been pondering the original purpose of this thread...
OK, I'm about a year late... but ....
Seems to me that with just 1 exception, and 1 "unknown", the stand-alone animations could all be decoded to a slightly modified version of the simple animation.
The exception is ball_counter_ocd with it's double scale, but I think that's just "laziness" on the part of 2DBoy. Likely sometime during development / beta someone said "Hey can you make the OCD! notification bigger"... and the easiest way to do that was just to add an extra initial Scale x 2 transform, rather than redo the animation from scratch, or modify all those scale values individually.
The modification to the spec/format is simply...
not every attribute / transform is required for every frame.
When decoding, if an attribute is missing from a frame (skipped by NextFrame, or maybe an entire transform is missing) that attribute is omitted from the output. (Like you do when interpolation=None in movie anims)
The encoding would simply set the "next frame" for that attribute to correspond to the next frame in which the given attribute did appear.
The "unknown" (at least by me) is whether interpolation is entirely "per frame" or whether it can be set "per attribute" as well. The file format would suggest that "per attribute" is possible, but as we see interpolation is uniform across the various tranforms, alpha etc in any frame.
How can you open the binltl files themselves? I tried using a hex editor, but it said something about a weird encoding.
Another Planet finally has an official release! Download chapters 1 through 3 here! Thank you for waiting so long while I kept starting over.
Regardless of whether you use a hex editor or notepad or whatever, looking at any binltl file "directly" is pretty pointless.
These files a different from .bin ... they are not encrypted xml, they are raw binary data in a 2DBoy "custom" format. The exact format and contents depend on what the file is... they are used on the MAC version to store all the game images, and on all versions to store animation and movie data.
At some point, the animation format was "cracked" / "investigated", and we found out what everything meant, but that didn't really help very much because the data is still all just numbers.. there's no text hiding in the files that you can "decode / decrypt"
So davidc came up with a conversion process to decode the information into an XML format.. and you can use GooTool's advanced Decrypt menu to do that.
However there's currently no encoding process available... so creating your own animations and movies is "near enough" impossible.
Ouch.
We're hoping to have custom animations in WOG2. I guess I didn't realize how tricky this would be...
IRC | Chapter Tutorial | Reference Guide
There's a possibility of making custom movies, but we need encrypting program for it...
Goo Tool can only decrypt it for now...
Author of Platforms of Goo and 64 levels for World of Goo .
The data has to be some sort of text encoding, because of the txt dumps of Chapter5End and Credits. How were those made?
Another Planet finally has an official release! Download chapters 1 through 3 here! Thank you for waiting so long while I kept starting over.
I have decrypted evey movie with Goo Tool and every text/xml file is correct.
Realy usefull is Notepad++!
Author of Platforms of Goo and 64 levels for World of Goo .