Slowing down Torque
by Guimo · in Torque Game Engine · 07/28/2010 (1:13 am) · 2 replies
Hi all,
My game is using two dedicated server instances. Just text mode, no graphics. Not even a mission is loaded in memory. Basically those servers react to network messages and execute some TorqueScript method on each received message. Very simple.
The problem is that even when not running a full simulation those instances get a full CPU use so the hardware gets hot. I can only imagine Torque is running in a full speed loop, executes everthing it can execute and repeats the loop consuming all the available CPU resources.
I would like to reduce the CPU usage, by sending the engine to sleep for 5 msecs on each cycle. May someone point me where to look inside the engine to get that working? I tried to make a method in the TorqueSscript sleep but was no use.
Thanks!
Guimo
My game is using two dedicated server instances. Just text mode, no graphics. Not even a mission is loaded in memory. Basically those servers react to network messages and execute some TorqueScript method on each received message. Very simple.
The problem is that even when not running a full simulation those instances get a full CPU use so the hardware gets hot. I can only imagine Torque is running in a full speed loop, executes everthing it can execute and repeats the loop consuming all the available CPU resources.
I would like to reduce the CPU usage, by sending the engine to sleep for 5 msecs on each cycle. May someone point me where to look inside the engine to get that working? I tried to make a method in the TorqueSscript sleep but was no use.
Thanks!
Guimo
About the author
#2
The function DemoGame::main contains all the game startup, processing and shutdown.
Around line 440 there is the infinite loop which processes the game events
while(Game->isRunning())
...
After that comes the shutdown functions.
In case anone is interested, I just added a
Platform::sleep(1);
To force the process to sleep 1 msec each cycle. The drop in CPU usage was dramatic. Went from 80% usage while running the two servers in the same CPU to 2%. Means a lot of energy savings.
Luck!
Guimo
07/28/2010 (1:43 am)
Just in case someone is interested. Not like something anyone will need anytime but just as a mere curiosity.The function DemoGame::main contains all the game startup, processing and shutdown.
Around line 440 there is the infinite loop which processes the game events
while(Game->isRunning())
...
After that comes the shutdown functions.
In case anone is interested, I just added a
Platform::sleep(1);
To force the process to sleep 1 msec each cycle. The drop in CPU usage was dramatic. Went from 80% usage while running the two servers in the same CPU to 2%. Means a lot of energy savings.
Luck!
Guimo
Torque 3D Owner Caylo Gypsyblood