PDA

View Full Version : maintaining constant frame rate


reg_free
02-20-2008, 01:37 PM
Hi,
Is there any way to maintain frame rate of a flash movie, particularly for a game? The game has lots of calculations, and the frame rate flickers a lot, which makes the game look like slowing down or speeding up at times.

thanks.

./s

rrh
02-21-2008, 05:09 PM
Have fewer calculations, have a lower frame rate, use AS3 instead of AS2.

What kind of calculations are you doing that are slowing it down?

Bombdogs
02-22-2008, 10:17 AM
There's no way to fix the frame rate - even if your game is very simple there will be times when the frame rate drops just due to what's happening on the client machine rather than what's in your code.

What you want is to make your game code run independant of the frame rate. This means that as frame rate varies the underlying game mechanic runs along at exactly the speed you set, so the game always plays the same. (just more jerky at low frame rates).

This is not nearly as hard as it sounds & is standard practice for any game regardless of the platform it's written on. There is a discussion thread on it here with all the information you need...

http://www.actionscript.org/forums/showthread.php3?t=158549

PMF

reg_free
03-01-2008, 09:55 PM
Hello Bombdogs,
Thats a neat thread you referred to. The same concept had infact occured to me but I had a reason not to implement it. Since the discussion in that thread seems promising, I wont rule it out before trying it on the coming monday. But, just to be curious, aren't we trying to realize a non-causal system by that method? What I mean is this: The extent of update ( of coordinates, speeds etc) to be made for a current frame depends on the length of the current frame, which is never known until it is spent.

Meanwhile, I too had come up with the constant frame rate technique that many seem to use, though futile in that the desired fps seems to be quantized, worse in my case of just 31 to 33.

I have recently started developing games, and seem to be spending valuable time re-inventing wheels which were solved eons ago in the flash community. Is there any good resource dealing with such non-obvious stuff?

Thanks for the help.

./s

Bombdogs
03-02-2008, 02:33 PM
You're right that these things have already been solved, but it's no bad thing re-solving them yourself - it certainly means you understand it well.

My two most used game development websites...

http://www.8bitrocket.com/
http://www.gamasutra.com/

But there are tons of good tutorials scattered all over the web on various common game development problems - google is your friend.

PMF