Thursday, June 30, 2011

I feel the need for speed

So this will be the first Retromite development focused posting, and will sadly contain no awesome pixels. Instead I thought i'd share some findings about something we all hate. Loading Times...

Robotriot for the iPhone is making great progress, however one issue which was bothering me was the game's loading time. Due to using several large sprite sheets (2048x2048x32 bit, and 2048x1024x32 bit being common) actually loading the game was taking on average around ten seconds to start up.

This in my opinion was pretty terrible, but how can you speed up the loading of large PNG files? Well I don't have the answer to that question, I found no solution to speed up the loading of these large PNG files. What I did find however, was an alternative approach that actually saves more disk space and is loading on average 4-5x faster.

The solution to amazing loading speeds, is to abandon graphic file formats all together, and go with straight binary pixel data. If you use a format like uncompressed PVR that is written out to be Open GL compatible from the beginning, you skip the entire slow decode process, and simply load into memory the bytes, and blast them off to Open GL texture memory land. This saves a ton of loading time.

The problem of course than becomes disk space usage, as a raw uncompressed image can take a ton of space. The solution to this is to simply compress the raw image data with a fast and easy to implement compression, like gzip. Suddenly in most cases you have files that are smaller than their PNG forms, and still load much quicker, only requiring you to unzip the image into a byte array in memory and pass it off to Open GL.

We're now using this technique across the board, and our load time of 10 seconds average is down to around 2 seconds on average, we've also knocked off around 200k in disk size compared to the PNG version.

Wednesday, June 22, 2011

soon for the iPhone


yeah.