Click here to Skip to main content
12,829,669 members (47,409 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


Posted 25 Oct 2010

Reducing game start up time

, 25 Oct 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
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:

An interesting side effect of this optimization is that it also reduces development time. Everytime 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:

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);


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


About the Author

ed welch
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.

You may also be interested in...


Comments and Discussions

GeneralMy vote of 3 Pin
Jeff R.30-Dec-10 6:28
memberJeff R.30-Dec-10 6:28 
GeneralComments Pin
adyinvienna@hotmail.com2-Nov-10 23:28
memberadyinvienna@hotmail.com2-Nov-10 23:28 
GeneralRe: Comments Pin
ed welch3-Nov-10 5:15
membered welch3-Nov-10 5:15 
GeneralRe: Comments Pin
adyinvienna@hotmail.com3-Nov-10 7:11
memberadyinvienna@hotmail.com3-Nov-10 7: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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170326.1 | Last Updated 25 Oct 2010
Article Copyright 2010 by ed welch
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid