Single-player optimizations
by Dan Keller · in Torque Game Engine · 03/12/2007 (1:41 pm) · 3 replies
How can I optimize my game if it's only going to be single player?
About the author
Recent Threads
#2
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?
04/07/2007 (12:46 pm)
See herewww.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.
Torque Owner James Terry
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
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