Game Development Community

Torque in the background

by Gary "ChunkyKs" Briggs · in Torque Game Engine · 12/15/2006 (11:56 am) · 1 replies

When torque 1.5 is in the background, it seems to go really, /really/, slowly.

Bit of a pain when it takes a really long time to do mission lighting for Stronghold, but where I can't move the window to the background to troll on IRC while it does it.

I opened up macCarbTime.cc and around lines 80-86:

change this:
static void _MacCarbUpdateSleepTicks()
{
   if( platState.backgrounded )
      platState.sleepTicks = Platform::getBackgroundSleepTime();
   else
      platState.sleepTicks = sgTimeManagerProcessInterval;
}

to this:

static void _MacCarbUpdateSleepTicks()
{
   if( platState.backgrounded )
      platState.sleepTicks = Platform::getBackgroundSleepTime()/1000; // milliseconds as opposed to seconds
   else
      platState.sleepTicks = sgTimeManagerProcessInterval;
}

Which makes the game run at merely one third of normal speed or so, instead of one three-thousandth of normal speed.

This may have unintended consequences on really slow machines [if sgTimeManagerProcessInterval > Platform::getBackgroundSleepTime()/1000 the application will actually gobble CPU when backgrounded instead of cooling it a bit], I don't have my really slow mac on hand to try it :-/

Gary (-;