Larian Studios

Sleep( 0x80 ) more.

Posted By: VillageIdiot

Sleep( 0x80 ) more. - 25/05/15 03:07 AM

Hey, I missed something. Like the general suggestions forum. Could we move this thread there please (unless there's a D:OS suggestions forum)? crazy

Code:
while( bInRenderLoop )
{
     ...

     if( GetForegroundWindow() != hMainWindow &&
          bSinglePlayer )
     {
          Sleep( 0x80 );
     }
     else
     {
          SceneGraph->Draw();
          SceneGraph->Tick( delta );
     }
     ...
}


10% CPU on a i5-3570 (@3.0ghz, "turbo" disabled) tabbed out. frown

Though I very well could be missing something here.
Posted By: Raze

Re: Sleep( 0x80 ) more. - 25/05/15 03:22 AM


UBBCode is disabled on new accounts, to discourage spam (no clickable links). It'll work now, though.

Running the game in Win 9x compatibility mode will restrict it to a single core. I don't know if that will help with the CPU usage when minimized.
Posted By: VillageIdiot

Re: Sleep( 0x80 ) more. - 25/05/15 03:53 AM

Originally Posted By: Raze

UBBCode is disabled on new accounts, to discourage spam (no clickable links). It'll work now, though.


Thanks. smile

Originally Posted By: Raze
Running the game in Win 9x compatibility mode will restrict it to a single core. I don't know if that will help with the CPU usage when minimized.


One of the threads seem to hover around 7% or 8%. I think most of the time is used in a main thread.

I know the input is handled in the render loop - tried the game on my onboard while zip-tie'ing a new fan to my graphics card. It lagged so hard (~3 seconds/frame) I had to hold down clicks until the frame advanced just to have it register mouse up and down. X-)
© 2020 Larian Studios forums