clock speed

Started by Captain Mostly, Thu 19/06/2003 18:52:50

Previous topic - Next topic

Captain Mostly

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?

undergroundling

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

Ishmael

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
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

undergroundling

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

Scorpiorus

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

SMF spam blocked by CleanTalk