Click here to Skip to main content
Licence CPOL
First Posted 25 Oct 2010
Views 4,049
Bookmarked 0 times

Reducing game start up time

By | 25 Oct 2010 | Technical Blog
Two tips to reduce game start up time
A Technical Blog article. View original blog here.[^]

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. 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);
fclose(pFile);

License

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

Member

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

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 3 PinmemberJeff R.5:28 30 Dec '10  
GeneralComments Pinmemberadyinvienna@hotmail.com22:28 2 Nov '10  
GeneralRe: Comments Pinmembered welch4:15 3 Nov '10  
GeneralRe: Comments Pinmemberadyinvienna@hotmail.com6:11 3 Nov '10  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web02 | 2.5.120517.1 | Last Updated 25 Oct 2010
Article Copyright 2010 by ed welch
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid