Game Development Community

dev|Pro Game Development Curriculum

Speeding Mission Loadtimes

by Sebastien Bourgon · 11/15/2005 (2:52 pm) · 16 comments

There are a couple very important and very old and unchanged prefs in Torque and Torque 2D. I also assume Torque Shader Engine has this "problem" as I'm sure if it had been changed there, it would have changed for the others also.

There are 3 Net prefs in TGE that do not get set by default (outside of C++). The names and values are as follows:
$pref::Net::PacketRateToServer = 32 (per second)
$pref::Net::PacketRateToClient = 10 (per second)
$pref::Net::PacketSize = 200 (bytes)

The rate to server is not terribly important as this normally only includes movemanager updates 95% of the time. I also assume client messages are sent at this interval. 32 packets per second works out to roughly a packet every 32 ms, which goes along with the tick rate that TGE maintains (incase anyone was curious as to why the particular number)

Rate to client along with the low packet size limit both LOCAL and non-local connections. This means single player games are effected by these values. 10x200 bits is only 2kbytes a second. Depending on your game, this is not enough for actual gameplay. A DH: Lore server with 32 players, will start showing problems due to this. Projectiles will stop appearing as there is simply too much information that is more important being sent over the line.

The hardcoded rate and packetsize you can set are 32 and a packet size of 450 (which works out to a nice 14.4kbyte). Having done this for Lore, our mission load times have drastically increased, and although I haven't played in a 32 player server, I did get 30 bots into a tight area on a dedicated server to see if the problems would re-occur and they did not.

As these are simple prefs, there are no real script or code changes involved in this process. I have actually used it to speed up the load times for Rocketbowl, which is purely single player. Lighting times are uneffected of course, but if you have alot of objects (some of the Lore maps hit 500+ objects) or alot of datablocks, then your loadtime has been most likely capped by the network bandwidth being "used".

If you are interesting in changing the actual hardcoded cap,

Look in NetConnection::checkMaxRate(), they are all outlined there. When you take a look, you'll see why there is no code being pasted for changes, the whole issue is rather simple, and has been entirely overlooked by everyone.

About the author

Former Indie Game Developer for Max Gaming Technologies. I then spent a couple years doing mobile work for Capcom Interactive Canada, the highlight being Mega Man II for iPhone. Now doing various mobile contract jobs (mostly iPhone)


#1
11/15/2005 (4:40 pm)
very interesting info. Thanks Sebastion.
Going to try it.
#2
11/16/2005 (12:22 am)
Very useful info. Thanks a lot.
#3
11/16/2005 (4:40 am)
Excellent...
#4
11/16/2005 (5:50 am)
Not only does this seem to speed load times it seems to have helped with the "jerky bot" syndrome.

nice.
#5
11/16/2005 (8:54 am)
Its cool that there is no engine changes to make this happen.
#6
11/16/2005 (10:27 am)
this is very useful stuff especially for any single player game makers, thanks.
#7
11/16/2005 (9:54 pm)
I've got some GUI code floating around that adds the ability to customize your network performance using the three script values listed above. My favoured presets are:

14.4K Modem (Minimums)
$Pref::Net::PacketRateToClient = 10;
$Pref::Net::PacketRateToServer = 8;
$Pref::Net::PacketSize = 100;

28.8K Modem
$Pref::Net::PacketRateToClient = 12;
$Pref::Net::PacketRateToServer = 16;
$Pref::Net::PacketSize = 200;

56.6K Modem
$Pref::Net::PacketRateToClient = 16;
$Pref::Net::PacketRateToServer = 20;
$Pref::Net::PacketSize = 240;

DSL/ ADSL Connection
$Pref::Net::PacketRateToClient = 20;
$Pref::Net::PacketRateToServer = 24;
$Pref::Net::PacketSize = 350;

Cable Connection
$Pref::Net::PacketRateToClient = 24;
$Pref::Net::PacketRateToServer = 24;
$Pref::Net::PacketSize = 400;

T1/ LAN Connection (Maximums)
$Pref::Net::PacketRateToClient = 32;
$Pref::Net::PacketRateToServer = 32;
$Pref::Net::PacketSize = 450;
#8
11/16/2005 (11:20 pm)
Daniel if you feel up to it you should post that GUI code as a resource, I for one would love to have something like that for my FPS game.

But, these presets are also extremely useful, thanks.
#9
11/17/2005 (7:08 am)
1. . Do these settings occur on server or separately on each client?

2. If the latter, can each client truly have different rates from the server?

3. Is there any quanta to the rates (as in, you can select anything less than 32 but the actual rate will be squashed into some uneven slotting within a polling cycle of 32 Hz, leaving odd values with irregular duty cycles)?

4. Is it possible, in the case that this can be done separately for each client, to permit it to be done dynamically so that a client will connect at a rate optimized to having his level load as rapidly as possible, and then throttle back to one amenable to smooth gameplay with fair sharing of sustained packet delivery capabilities?

tone
#10
11/17/2005 (11:15 am)
Anthony,
I would like to point out, that these settings are not the actual settings used at all times. Torque maintains a current packet size/rate and a maxPacket rate/size. The settings outline, set your max packet rate/size. If your packets happen to be small one second, and increase the next (like a player joining), Torque will inform the clients with the packet, and send the data required. So it does throttle dynamically already.

The only checks that I have seen, have been that the server reads and sets the current/max settings, and then passes them along to the client. The rate to server is only used in one function, so I assume, clients could have seperate rates to the server, but lowering your rate to less then 32 does not seem like a good idea, as you would like your inputs sent asap normally :)

I hope this explains a bit more.
#11
11/23/2005 (5:57 pm)
Wow, excellent code archeology! This is a nice find. Arcane-FX is very heavy on the datablocks and I was getting rather worried about the load times. This improves the situation considerably.

I'm curious... does Lore run flat out 32/32/450 all the time or do you adapt to connection speed somehow, as suggested by Daniel Eden?
#12
11/25/2005 (10:02 am)
Lore ran on 10/32/200 until 2.02 which just came out recently.
We upped the servers to 16/32/400 with the new release. We run multiple dedicateds on single boxes so if they were to all get heavy use, it'd most likely quickly suck up bandwidth
#13
12/21/2007 (7:03 pm)
WHERE DO YOU PUT IT IN THINKTANKS!!??
#14
09/21/2008 (10:00 am)
Awesome, I just made my loading times 4x faster.
#15
12/06/2008 (2:28 pm)
There is some really good resources on GG but when you come to one that you really like and it dont say what files you need to do what with just plain stinks, I am sure this is a good thing, but I will find out later if ever
#16
12/08/2008 (3:16 am)
Prefs go in game\scriptsAndAssets\client\prefs.cs