Game Development Community

Speeding up Mission Loading Time in an Out of Focus Window

by Pisal Setthawong · 04/21/2008 (9:24 am) · 5 comments

For developers who like to develop their games in Window Mode (e.g. like me) you would find that with TGE from version 1.5.X onwards, it seems that it takes forever to load if you are not focusing on the game Window when loading a mission. For those developers who want to spend the time waiting for the mission to load to do other tasks in their OS, it isn't quite possible as the TGE window has to be focused at all times.
It seems that this issue is caused that from the previous version to the current version, there was a huge increase in the TGE default $pref::backgroundSleepTime up to 3000 in the current version of 1.5.2.

To fix that issue you could modify the preference file which is located at yourmod/client/pref.cs and change the value before to a smaller one.

e.g.
$pref::backgroundSleepTime=10;

As the pref file is automatically generated by the engine when there is no file, you can change the default value by doing the following:
1) Open up the file located in core - engine/platform/platform.cc
2) Change the value of the static variable sgBackgroundSleepTime in line 7
e.g.
S32 sgBackgroundSleepTime = 10; //new value of the default backgroundSleepTime
3) Compile TGE
4) Delete the prefs
5) Start the engine and the prefs generated with have the value as the above.

I haven't tested extensively what issues might arise from a small backgroundSleepTime, but from what I've been using so far it works well.

About the author

An Educator moonlighting as the Technical Lead at the indie game development studio called Flying Pig Game Studio


#1
04/21/2008 (3:41 pm)
Nice one. I often try to do something else while I wait for mission loading and lighting, but I did notice the extreme bog-down when TGE loses focus, and was less than happy with it. Thanks for pointing this out.
#2
04/22/2008 (8:49 am)
Excellent!! Just what I needed and didn't even think to look the variable controlling it. Thanks a lot, I have been loading my level as I typed this message.
#3
04/22/2008 (4:03 pm)
Nifty. I could use this i think.
#4
04/28/2008 (5:56 am)
if i remember correctly, somebody in AFX forum said the 3000 sleep time is there for a purpose, it prevents the whole game stop functioning when somebody joinning your network game
#5
04/19/2009 (3:18 pm)
"if i remember correctly, somebody in AFX forum said the 3000 sleep time is there for a purpose, it prevents the whole game stop functioning when somebody joinning your network game"

why?, i dont understand why affect the network game, in dedicated mode?