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.

DarkBASIC Professional Discussion / Problems with Sync Rates ? Please Help

Author
Message
Darclyte
23
Years of Service
User Offline
Joined: 13th Jun 2003
Location: Cydonia, Mars
Posted: 9th Jul 2003 04:08
I'm about half way through making my fist full game, Nothing too ambitious, just a 2d side scrolling shooter using some 3d models. Works great and doesn't tax DBPro too much (Plenty of FPS to Spare).

I want this game to run at 60 FPS in a window, but am having a lot of trouble achieving this. If I use SYNC RATE 60 I always get about 64 FPS and juddery updating of the graphics. I spent a long time making them so I don't want to watch them jerk accross the screen.

If I use SYNC RATE 0 I get around 110-120 FPS and smooth updating. Trouble is, The game runs too fast to play. and will run at different speeds on different computers.

By running in 'Full Screen Exclusive' mode I found that with a SYNC RATE of 0, DBPro Defaults to the refresh rate of my monitor (75Hz) and updates graphics nice and smoothly. At this speed my game is just about playable but still faster than I intended.

So, How on earth do I let my game keep it's origonal timing, without limiting it's fps (which makes it judder).
AzureZeal
23
Years of Service
User Offline
Joined: 10th May 2003
Location:
Posted: 9th Jul 2003 04:15
Use time limits.

Example -

If you only wanted to be able to hit the fire button every second, add a line like this...

`rem check to see if youre pressing the fire key
if keystate(firekey)
if timer() - lastfire# > firedelay#: lastfire# = timer()
`rem fire code here
endif
endif

Likewise if you only wanted the ship to move at one pixel per second...

if timer() - lastmove# > movedelay#: lastmove# = timer()
`rem move ship code here
endif

AzureZeal
23
Years of Service
User Offline
Joined: 10th May 2003
Location:
Posted: 9th Jul 2003 04:16
PS - Remember when working with the timer() function, 1000 = 1 second

Login to post a reply

Server time is: 2026-07-18 03:14:44
Your offset time is: 2026-07-18 03:14:44