Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Captain Mostly on Thu 19/06/2003 18:52:50

Title: clock speed
Post by: Captain Mostly on Thu 19/06/2003 18:52:50
will the clock speed of other peoples computers effect my game:

Here's the deal. I've got an int, and in the global script, it says to increase that int in the repeatedly execute section.

Will this occur at the same speed on everyone's computer? If not, is there a way to make sure it does?
Title: Re:clock speed
Post by: undergroundling on Thu 19/06/2003 18:53:55
i think it would just run based on game cycles, which should be approximately the same on everyones computer.

but what do i know?

- bryan
Title: Re:clock speed
Post by: Ishmael on Fri 20/06/2003 12:45:27
I believe it wont be the same... for example in a 1.4 GHz and 266 MHz machines the time of 40 game cycles would be difrent... but I'm not sure
Title: Re:clock speed
Post by: undergroundling on Fri 20/06/2003 15:12:12
I think...maybe in the manual or one on of the forums somewhere, can't remember where I saw it...but it gave the approximate time for one game cycle.  I'll see if I can try and find it again.

- Bryan
Title: Re:clock speed
Post by: Scorpiorus on Sat 21/06/2003 15:55:55
I think AGS uses a timer to calculate how frequently update the frames. That means it's CPU speed independent and therefore people with 300Mhz systems and the ones with 2Ghz would expect the relatively equal framerates. What could happen, however, is when a 200Mhz system is unable to run so fast as the game wants. In that case it goes as fast as possible.

Example:

SetGameSpeed(20);

200Mhz..... ~ 20 fps
2Ghz....... ~ 20 fps


SetGameSpeed(100);

200Mhz..... ~ 30  fps
2Ghz....... ~ 100 fps

So it's a good idea to choose the game speed suitable for a wide range of different systems. (40fps which is AGS default may be a satisfactory choice)

If your game has a slider to change the frame rate speed (game speed) and you want some event to occur through the same time intervals then it may be a good idea to rely on the value returned by GetGameSpeed() function. The next example demonstrates a message displayed every 4 seconds (the appearing time would be almost the same on every machine unless the last is too slow):

int timer = 0;
function repeatedly_execute() {

if (time > 4*GetGameSpeed()) {
   Display("ring ring");
   timer=0;
}
timer++;

}

-Cheers