Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: mode7 on Fri 15/04/2011 09:18:52

Title: Problem with SetGameSpeed
Post by: mode7 on Fri 15/04/2011 09:18:52
Hi Guys,
I'm trying to implent some kind of countdown in my game.
Therefore I calculate the time out of the game loops.

I set the game to 48 cycles/second. But my frames counter goes haywire. It jumps to 75fps when idle. Repeatedly setting it does not work. The problem is that my counter runs too fast even though I used GetGameSpeed.


time--;
hours = time/GetGameSpeed()/60/60;
minutes = time/GetGameSpeed()/60-(hours*60);
seconds = time/GetGameSpeed()-(minutes*60)-(hours*60*60);
lTime.Text= String.Format("Time: %d:%d:%d", hours, minutes, seconds);
}


Title: Re: Problem with SetGameSpeed
Post by: Khris on Fri 15/04/2011 09:38:40
I tried what you did; SetGameSpeed(48) and your code, exactly as you posted it.
I get a steady FPS of 50, and the counter runs down steadily and once per second.

If it still doesn't work for you you can use DateTime.RawTime to count seconds.
Title: Re: Problem with SetGameSpeed
Post by: mode7 on Fri 15/04/2011 10:47:25
Thanks Khris, hm strange. It might have to do something with my engine...I have no idea what would cause this.
But thanks for the RawTime tip. This might work.