Optimal framerate

Blitz3D Forums/Blitz3D Programming/Optimal framerate

napole0n(Posted 2004) [#1]
I'm currently working on a 2.5D shooter, and I didn't have any restrictions on the framerate, so it'd always churn out the maximum it could (85 fps in case of my 3D card). But now that I've added lots of effects and objects, it couldn't keep up this rate and would slow down.

Now I've locked the framerate to 50fps, and there are no problems. But obviously I want to make the framerate dependent on the system: a faster computer than mine might display 60 or 70 fps without problems, while slower computers might need a 30 fps option without slowing down the gameplay, just dropping frames.

Are there any good methods to find out what the maximum fps is on a certain system? So far I use a hardcoded fps setting, combined with an accelerator constant I use to keep all speeds in sync with the framerate. This works, but can I determine these values dynamically by measuring a host system's capabilities?


SabataRH(Posted 2004) [#2]
Check out the frame-tweenng code in the Castle demo... it runs game logic at a set frame-rate regardless of slow/fast computers.


napole0n(Posted 2004) [#3]
I don't really understand how it works, it seems like it skips frames when it can't keep up with the graphics but that's exactly the opposite of what I want.

I want to determine the perfect framerate for a system, and lock to that to keep the experience as smooth as possible. I do not want to drop frames (only if it's consistent, so not noticable).


Andy(Posted 2004) [#4]
>I don't really understand how it works, it seems like it
>skips frames when it can't keep up with the graphics but
>that's exactly the opposite of what I want.

Both skipping frames and adjusting when the individual 'pictures' in the game are taken as far as I know.

>I want to determine the perfect framerate for a system,
>and lock to that to keep the experience as smooth as
>possible. I do not want to drop frames (only if it's
>consistent, so not noticable).

But since the perfect framerate is based processing speed, bussspeed, graphicscard renderspeed, graphicscard memory speed and a host of other issues, you will find it dificult to do that.

Frametweening makes it easy to run the game logic at a set rate(for example 30 times per second) and leave the graphics to run at whatever the graphics hardware can achieve.

The frame-tweening code from the castle demo is in the code archives as a framework.

http://www.blitzbasic.com/codearcs/codearcs.php?code=9

Andy


napole0n(Posted 2004) [#5]
Okay, I'll see what I can do with it, thanks for your help guys!

-EDIT- Ah, this works perfectly. My game now runs at 100fps if it can, and slower if it has to without any difference in gameplay and just a slightly lower framerate. Excellent!