Game Development Community


#1
03/12/2007 (4:01 pm)
The single biggest optimization you can do for your game if it is single player is to up the packet rate between client and server

At line 176 in engine/sim/netConnection.cc we added

if (Con::getFloatVariable("$pref::HostMultiPlayer") == 0)
   {
	   gPacketRateToClient = 128;
	   gPacketRateToServer = 128;
	   gPacketSize = 5000;
   }

and in our defaults.cs adding

$pref::HostMultiPlayer = 0;

What this does is increase the amount of changes on your server go out each update. We have a rotating object with other objects mounted to it, and with the default values (and even the maximums in the engine) our object rotated pretty slowly on clients. Adding this to the engine made it move a lot faster and smoother.

Other than that, I'd recommend looking into the staticShape onRender and processTick methods as they do a lot of stuff with water, shadows, lighting, physics, that you may or may not be using in your game, and a number of them can slowdown your game significantly. If you are mounting objects, the mount code gets the positions for everything in your game every tick, which isn't neccessary, moving it out to only when an object gets moved or affected by something can give some pretty big gains as well
#2
04/07/2007 (12:46 pm)
See here
www.garagegames.com/mg/forums/result.thread.php?qt=23589

for this a few other suggestions.

@James
I actually have a question about this. If you added this feature and connected to a game as a client then $pref::HostMultiPlayer would still equal 0 right? So wouldn't this then cause problems trying to connect to the server? Not that it would matter if your game doesn't support multiplayer at all, but if you had both?
#3
04/07/2007 (3:29 pm)
I tried that, but the changes to netGost messed it up so it finishes loading, but never enters the mission.