Game Development Community

challenge: detect slow torquescript functions

by Orion Elenzil · in Torque Game Engine · 04/17/2009 (11:32 am) · 4 replies

(posting an engine thread in the public forum because of this website bug and the lack of a forum for engine topics common to several TG* products)

In TGE, if you some part of the simulation cycle takes a long time without returning control to the main loop, the engine prints a message "Simulation is behind; 1025 ticks elapsed since last iteration". In my experience this happens most often because some TorqueScript function is taking too long, or lots of resources are being loaded, or often those two causes are hand-in-hand.

It would be awesome if this warning message gave some indication of what might be at fault. The perfect diagnostic would be if it printed the full (script) stack-trace which consumed all the time, but that would probably be expensive to obtain, reducing overall performance.

Perhaps the time in each script stack frame could be tracked,
and when a frame is popped if the time is above some threshhold a warning could be printed.

Any pointers on where to time something like that ? con::exec() ?

#1
04/17/2009 (11:47 am)
hm, actually, this might be a custom diagnostic print, i'm not seeing it in stock TGE 1.4. the code i'm talking about is in main.cc:
if(elapsedTime > 1024)
      elapsedTime = 1024;
#3
04/17/2009 (3:35 pm)
Speaking of performance, is there an app that can simulate a load on a server? Say maybe 200-300 virtual players online? This would prove to be invaluable in performance testing for online games.
#4
04/17/2009 (3:44 pm)
some aspects of load you can simulate with AIPlayers,
but that doesn't really tell you the whole story since a lot of the server's load is dealing with network scoping and such.

afaik the only way to do this is to actually connect 200-300 clients, preferably with a little bit of automation in them to simulate them doing typical user activities.

launching 200-300 clients is obviously a bit difficult. one thing which can bring that task within range is to modify the client so that it runs without any graphics at all: no openGL, no loading textures, etc. there's no resource for this, and i don't have detailed instructions, unfortunately. i would suggest looking at how a dedicated server runs and going from there.

even with "headless" clients you may still need to use one or two actual computers in order to launch 200-300, tho.