Tonypa Crunches Your Swf
Tonypa posted some interesting data that 4kers would probably find useful. Tonypa is a really talented game developer and his tutorials are pretty much a bible of how to make good games in AS2. One of the reasons I started game poetry is because of people like Tonypa who have contributed so much to the community.[
Thanks Tonypa for posting this very helpful information!
Some tests about filesize (did with Flash CS3, Win, published for F9/AS3). What and how different things add to the size (bytes).
Empty file, no code, no content - 36
oval shape drawn with tool with stroke and fill - 137
rectangle shape drawn with tool with stroke and fill - 101
rectangle shape drawn with tool without stroke only fill - 88
rectangle shape drawn with tool only stroke no fill - 101
Result: draw rectangles, delete stroke
1 line of code:
var a:* = 1; - 354 bytes
var a = 1; - 354 bytes
var a:int = 1; - 360 bytes
var a:Number = 1; - 364 bytes
Result: use untyped variables
Now the fonts were already mentioned so I will just post some results.
Use system fonts.
If you use non-system font and embed characters notice following things
*larger text increases size, reduce font size
*using other anti-alias setting may save over 20 bytes
*fonts have huge difference in size. Embedding 10 characters increased filesize compared to system font anywhere from 400 to 4000 bytes, even smallest font takes 40 bytes per char but some fonts may eat up all 4k with just couple of characters.
*static text is same as dynamic texfield with embedded font
sound
Tested with very short wav file (2670 bytes), imported and placed on frame.
default publish settings mp3/16kB/fast - 415 bytes
mp3/8kB/fast - 246 bytes
mp3/24kB/best - 577 bytes
mp3/24kB/fast - 565 bytes
mp3/32kB/best - 404 bytes
mp3/32kB/fast - 403 bytes
ADPCM 5kHz/2bit - 88 bytes
raw 5kHz - 228 bytes
Result: ADPCM looks to be best here and mp3 not so good.



ickydime
Wow, would never have guessed that an untyped variable would take up less memory. Interesting…
And I agree, TonyPa’s site was a huge inspiration when I was in college. I spent hours looking over the Tutorials there as well as from Strille and eventually made an Isometric game to use as my portfolio… good memories.
February 9th, 2009 at 12:34 pmFreelanceFlashGames
This is some interesting stuff. I didn’t know embeddable fonts could take up so much memory. I won’t be participating in the contest, but it should be interesting to see what games developers can come up with.
February 9th, 2009 at 4:16 pmRichard Davey
Just like to add one thing about the un-typed variables suggestion: If they are global class vars then you need to un-type all vars of the same type for it to work, otherwise in my testing you actually add bytes to your SWF. For example if you have 6 different “ints” and only un-type 5 of them, the final SWF will be larger! Not sure what is going on with that, but it consistently worked out that way in my tests. Un-typing ALL vars of the same type resulted in 1 byte saved (that’s 1 byte overall, not 1 byte per var).
February 23rd, 2009 at 2:31 amRichard Davey
Sorry just wanted to add – the advice only works for un-typing ints (and probably Numbers and Booleans too). Un-typing TextFields or Bitmaps actually increases AS byte size!
February 23rd, 2009 at 2:36 am