Click here to Skip to main content
15,888,062 members
Articles / STL

Reducing Game Start Up Time

Rate me:
Please Sign up or sign in to vote.
3.50/5 (2 votes)
25 Oct 2010CPOL 10.1K   4
Two tips to reduce game start up time

A lot of game developers consider the start-up time of a game to be of little importance. Unfortunately, the truth is that users do not like looking at the hourglass. So, here are two tips to reduce start-up time.

1. Use Targa instead of PNG

PNGs take several times longer to decode than compressed Targa. I think it’s around 5 times slower. (I once made some measurements on the iPhone, but I lost the figures <duh>). On the other hand, compressed Targa files are about 40% bigger, but disk space usually isn't that critical. You can use the code here to decode targa files: http://dmr.ath.cx/gfx/targa/.

An interesting side effect of this optimization is that it also reduces development time. Every time you start up the debugger, it has to decode all those 1024×1024 textures, before you can begin.

2. Read Files by Blocks, Not Word by Word

Preferably, read the whole file in one go. This is how you do it with C code:

C++
FILE* pFile;
pFile = fopen(fileName.c_str(), "rb");
if (pFile == NULL) return;
fseek(pFile, 0, 2 /* SEEK_END */);
fileSize = (int)ftell(pFile);
fseek(pFile, 0, 0 /* SEEK_SET */);
pBuffer = new char[filesize];
int bytesRead = (int)fread(pBuffer, fileSize, 1, pFile);
fclose(pFile);

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer Astronautz
Spain Spain
After working in the software industry for many years, I've started my own games company that specialises in strategy games for mobile platforms.

Comments and Discussions

 
GeneralMy vote of 3 Pin
Jeff R.30-Dec-10 5:28
professionalJeff R.30-Dec-10 5:28 
GeneralComments Pin
Mr Crisp2-Nov-10 22:28
Mr Crisp2-Nov-10 22:28 
GeneralRe: Comments Pin
ed welch3-Nov-10 4:15
ed welch3-Nov-10 4:15 
GeneralRe: Comments Pin
Mr Crisp3-Nov-10 6:11
Mr Crisp3-Nov-10 6:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.