Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / game speed

Author
Message
liquid
18
Years of Service
User Offline
Joined: 10th Mar 2006
Location:
Posted: 12th Mar 2006 13:43
i made my first game, based on a pong remake tutorial, and it seems to work. but if i run it on a pc more powerful than mine, the game speed becomes insane and it's impossible to play! how to fix that?

i'm a n00b
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 12th Mar 2006 16:19
you should monitor the FPS() each loop and adjust the ball/bat speed accordingly so it'll look the same on low end machines as well as faster ones

FREE Automatic file updates for your distributed Games and Apps - see Program Announcements Forum - DBP Demo
liquid
18
Years of Service
User Offline
Joined: 10th Mar 2006
Location:
Posted: 12th Mar 2006 16:50
can you show me how to do that? i'm still a newbie
the game code:


i'm a n00b
liquid
18
Years of Service
User Offline
Joined: 10th Mar 2006
Location:
Posted: 13th Mar 2006 14:01
up

i'm a n00b
roswell
21
Years of Service
User Offline
Joined: 17th Dec 2002
Location: United States
Posted: 13th Mar 2006 15:34 Edited at: 13th Mar 2006 15:53
I thought this sort of problem was what the "sync rate" command was for. You should be able to define the number of frames per second using this command.

Try putting this code at the start of your program:

And then putting this code wherever the screen needs a refresh (like immediately before the end of your loop:


CattleRustler, I realize that machine performance can vary greatly, but if you set the sync rate to say 40 fps, isn't 40 fps the same on every machine? Is the fps checking code really necessary?

Interesting....I just ran a quick test, and even though I set my sync rate to 40, I was getting 45 fps. I wonder why the discrepancy?

'Just one game,' they said, and started to play. That was yesterday.

Dual Athlon 2.0/1GB RAM/GeForce Ti4200-128/WinXP Pro
liquid
18
Years of Service
User Offline
Joined: 10th Mar 2006
Location:
Posted: 14th Mar 2006 19:22
seems to work, altought it's not perfect. thanks a lot!

i'm a n00b

Login to post a reply

Server time is: 2024-11-27 01:45:29
Your offset time is: 2024-11-27 01:45:29