I really should let this whole 4k game thing go. But as I was sitting on the train today, idly hacking away at a completely different game I remembered a curious thing that I didn’t have time to investigate then. The mysterious bytes.
The compiled size of the same actionscript file will vary with up 4 bytes between compiles. You can really just bring up the command line and recompile the same file a couple of times and it will be 4098 bytes the first time and 4094 the next. Very strange. I tweeted about this suspecting some kind of metadata was stored inside the file, someone told me this shouldn’t be the case so I let it go. Turns out metadata is stored, and more than you’d think. A standard swf compiled with mxmlc can have these values:
- contributor
- creator
- date
- description
- language
- localized-description
- localized-title
- publisher
- title
The mysterious bytes come from the fact that there is a timestamp embedded, this will affect the compression of the swf making it compress a few bytes smaller if you’re lucky and a bit bigger on other occasions. These have default values, and these may be useful to keep track of stuff, they’re just a bunch of bloat to a 4k game. Luckily they’re a piece of cake to get rid off. Add these options to the compiler to set them all to be empty:
-contributor='' -creator='' -date='' -description='' -language='' -publisher='' -title=''
(In FlashDevelop you set these options in Project Properties -> Compiler Options -> Additional Compiler Options) However, the swf will still be up to three bytes bigger on occasion, I think the time still gets in there somehow. Nevertheless, this shaves of a whopping 40 bytes on my current version of asteroids4k!







that’s… GREAT
Middlingly interesting information
That’s hardcore
Good to know!
That’s awesome. Good sleuthing!
Wow that’s pretty interesting actually! Good find and good explanation!