View Full Version : Compression techniques
Sirrus
12-13-2005, 06:55 PM
What sort of techniques do you guys do to keep your file size low?
Trying to cram 19 megs of game files into a max of 15mb...
Any suggestions other than the obvious?
:)
Are there third party compressors? Our installer only pushes it down by 1.6mb...
ggambett
12-13-2005, 07:10 PM
Start here...
http://forums.indiegamer.com/showthread.php?t=685
http://www.indiegamer.com/archives/t-1053.html
http://www.indiegamer.com/archives/t-1440.html
soniCron
12-13-2005, 07:10 PM
Using an installer with LZMA compression and uncompressed graphics (TGA) yields far better results than PNG alone. Of course, if you're using JPG, then this will result in a much greater file size. Also, be willing to sacrifice a little clarity for size when using lossy compression (graphics/sound). Unless you're making a hardcore game -- in which case, why worry about 19MB? --then your audience won't be particularly attuned to the slightly lower quality of your assets.
Sirrus
12-13-2005, 07:30 PM
Thanks guys...
Read over the links, but some seems to be obvious (and a bit out of date from the Dexterity days)...
What installer do you recommend and by how much can it compress your files? Install Creator is easy to use (and only $49 to register), but I suppose it doesnt do the best compression.
Obviously I should use Search, but I'd figure I'd ask if there are any off the cuff suggestions ;)
Been way busy during this crunch mode!
soniCron
12-13-2005, 07:32 PM
You can't go wrong with NSIS. It's got an itty-bitty footprint (34K) and free, to boot. Many people also like Inno Setup (also free).
ggambett
12-13-2005, 09:17 PM
What installer do you recommend and by how much can it compress your files?
I don't think a different installer will give you the 4 MB you need. Your best bet is to use lossy compression (ogg/jpeg) if you aren't already (!) or tweak its parameters if you are.
What IS the format of your graphics and audio? Do your sound effects and music use the same format? Can you say how much space the graphics and audio take up each as well?
Emmanuel
12-13-2005, 11:25 PM
We use jpeg for most graphics assets. (and still make 18 MB downloads :))
Best regards,
Emmanuel
chanon
12-13-2005, 11:42 PM
Use JPGs for larger images like backgrounds.
For smaller sprites and graphics use 8bit palettized alpha PNGs.
The best PNG compressor I've found is Web Image Guru (http://www.vimas.com/ve_guru.htm). It can convert 24bit PNGs to 8bit palettized alpha PNGs at a lot smaller size. Your eyes will barely see the difference, but the file size will be a lot less.
Be sure to use "Perceptual" for the best results and try lowering the number of colors some more if you want even smaller file sizes. (Use the SRC button to compare with the original.)
Sirrus
12-14-2005, 06:34 AM
We use low quality ogg (right now, there are 5 tracks, 3 minutes each, around 2mb/piece. We are working with the musician on decreasing this)...
We use JPG for background images and PNG for smaller images.
We are converting our wav sounds to ogg and doing any compression we can. The music is the biggest zap of space, but we really wanted to have high quality, and varied, music.
I'll keep crunching away the bits and see what we come up with - thanks for the suggestions guys.
Phil Steinmeyer
12-14-2005, 07:10 AM
For all images that don't need transparency/opacity, use JPEG. I've found that the ImageReady tool built into Photoshop does the best job compressing to JPEG (i.e. best quality at lowest size, plus very nice preview tools to see what it will look like)
For images that DO need transparency/alpha, either use PNG, or, if you want to be a bit fancier, you can get smaller file sizes by splitting the alpha channel all by itself to a .GIF, then compressing the color channel into either GIF or JPEG - recomposite them at load time within your code. ImageMagick is a great command line tool that can do many things, including splitting out the alpha channel automatically.
For sounds, use OGG, lowest quality setting.
For music, there's a more complex set of tradeoffs - the alternatives are OGG, MIDI, MOD/XM, and compressed MOD/XM (i.e. using FMOD or Bass). Search for threads on this forum discussing this in more detail. Basically, there are major trade-offs between quality, size, and flexibility of what kind of music can be made.
Finally, use a good installer that compresses things (will squeeze remaining stuff like your EXE). I like InnoSetup - it's free, flexible, and has very good compression rates - much better than ZIP in my experience.
soniCron
12-14-2005, 10:12 AM
If your OGGs are 2MB for 3 minutes, then you should compress them more. You can go down to about 64Kbits with OGG and still have a relatively high quality sound. It sounds like you're hanging around at about 96Kbits, and you could probably save around 2.5-3MB just by encoding with "Quality" mode set to 0.
James C. Smith
12-14-2005, 05:37 PM
JPEG everything even if it uses transparency/alpha. (What doesn't use transparency/alpha? (rhetorical question trying to emphasize the point that almost everything should have an alpha channel to make the edges look nice)) Obviously you can’t store the alpha channel in the JPEG, but it is still a great idea ot use JPEG compression on the RGB bytes even if you stoee the A bytes in another format.
Matthew
12-14-2005, 09:29 PM
Glow Worm has 7:10 minutes of of music weighing in at 2.14MB. We used Vorbis at quality -1 or quality -0.5 for settings...I don't remember which. The audio guys will complain, but it sounds about the same to your average player who's listening on the POS speakers that came with their computer.
Definitely compress the hell out of your audio assets. Lay people will notice graphics artifacts long before audio artifacts.
MadSage
12-15-2005, 02:55 AM
Tools like UPX (http://upx.sourceforge.net/) are great for compressing your exe too. UPX will probably reduce your exe to 30-40% of the original size.
soniCron
12-15-2005, 02:56 AM
True, but the installer's compression will likely trump that.
Sirrus
12-15-2005, 06:40 AM
Thanks for the tips guys...
We have about 16 minutes of commericial quality music so we are working at compressing the hell out of it, but retain most of the quality.
Jan. 1 we will see if it works ;)
Don't let me get another game out before you Daniel!
soniCron
12-15-2005, 12:18 PM
Jan. 1 we will see if it works ;)
Don't let me get another game out before you Daniel! Actually...I don't think you will! :D
Alex Saveliev
01-26-2006, 11:51 PM
There is also a perfect format for games - JPEG2000 :)
Smaller than JPEG, better look plus alpha-channel!
See for yourself:
http://j2k-codec.com/jpeg2000-vs-jpeg.html
soniCron
01-27-2006, 12:00 AM
Yep. It also takes forever and a day to decompress.
Alex Saveliev
01-27-2006, 12:12 AM
I guess you have tried JasPer. This piece of sh... software makes JPEG2000 look bad in terms of speed. :)
J2K-Codec is more than 50 (!) times faster. I am using it in my own game for almost all graphics and pretty happy.
Here's also a quote from one of my users:
“...I run www.moonpod.com making downloadable PC games. Previously I was using Jasper and a Lurawave Photoshop plug-in to handle converting all my game art to jp2. My game would install and then decompress all the jp2 files back into 32bit tga's, but this was incredibly slow. I downloaded your codec and on the test images it was a lot, lot faster...”
— Mark Featherstone, MoonPod Games, UK
I think Mark is going to mention his use of Alex's jpec2000 codec in our next dev diary. Needless to say - I know he's been really impressed. Previously, we were using Jasper to decompress all the images at install time, because otherwise, it would take a couple of minutes to load the game. Now we can actually load the jpeg2000 images directly. I think on Mr. Robot (our current game ) it's added 2-3 seconds at most - and that's with art data that has yet to be scaled down (I always create art much bigger than needed so we have stuff for renders, and if we need it, it's there). That's a lot of data, I expect it to be a quarter the current size (uncompressed) for the final install - so the effect of using the coded at load time should be negligible.
Oh, and Alex's support has been second to none too!
Alex Saveliev
02-02-2006, 02:29 AM
Thanks, Nick! :)
Pallav Nawani
02-02-2006, 09:23 AM
What about Licensing issues in the J2k codec? I believe that the IJG (independent Jpeg Group - that made the Jpeg codec which nearly everyone uses) refused to make a codec for J2k because of the patent issues involved.
Alex Saveliev
02-02-2006, 12:52 PM
What about Licensing issues in the J2k codec?
Part 1 (no fancy features) of the standard has no issues as far as I know. The other parts may have some patent issues, but J2K-Codec works only in the boundaries of Part 1 (even a limited subset of Part 1), whereas JasPer uses some more extras.
In the specific case of JPEG 2000 Part 1, as of 17th July 2003 a total of 27 such declarations from 11 companies or individuals were submitted. All patents that WG1 believes to be essential to practice JPEG 2000 Part 1 are available on ITU-T’s patent policy 2.1, which is fee-free.
-- http://jpeg.org/faq.phtml?action=show_answer&question_id=q3f042a68b1081
Part 1 is more than enough for usual applications. Medical or satellite images may require some extravagant features, like more than 8-bits per channel, but usually even they stay inside the Part 1.
Part 2 allows you to replace JPEG2000 algorithms with your own (for example, create your own Wavelet Transform).
Part 3 describes MotionJPEG2000.
Part 6 describes multi-paged images.
Just a small update - Mark talks about using J2k-codec a little in our latest dev diary here (http://www.moonpod.com/board/viewtopic.php?t=1778)
(scroll down to second post - 'Download Size' heading)
vBulletin v3.6.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.