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 Discussion / Optimising loop for different computers

Author
Message
Sph!nx
10
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 19th Mar 2011 17:46 Edited at: 19th Mar 2011 21:04
Hello everybody!

Well, stripped down my loop is a simple "do loop" but I've set sync to 60 and allow the loop to sync to that.

However, my laptop (Windows 7) machine runs it correctly at 60 fps but my coding computer (Windows XP) shows more than 100 and runs at a considerable higher speed.

Perhaps I misinterpreted what sync means...

Can anyone explain to me how to make a loop run at the same speeds at different computers?

Thanks!

Edit: ohw darnit, wrong section. Could a moderator please move this to the db pro board? Thanks!

Regards Sph!nx
http://www.mental-image.net
Quel
10
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 19th Mar 2011 23:50
Wrong section or not, Decoupling your main loop into two separate might just be the solution for this. For efficient working sooner or later it is highly recommended for any kind of program.

Do a quick search for it here on the forum, plenty of help, and even a ready to use example will be there.
Sph!nx
10
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 20th Mar 2011 00:07
Hey thanks. I will do a search on it!

Regards Sph!nx
http://www.mental-image.net
Neuro Fuzzy
12
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 21st Mar 2011 12:53 Edited at: 21st Mar 2011 12:55
I think the problem may lay in VSync - it limits the refresh rate of your program to the refresh rate of your monitor. I think most computer screens have a refresh rate of 60hz=60 refreshes per second=60 frames per second.

Basically: with V-Sync enabled, you won't notice any visual lag, but your game may run "slower", because your game loop doesn't occur as many times per second.

Sph!nx
10
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 21st Mar 2011 21:20
Yeah, I can agree with you on that because the faster running version of my project is on my desktop, which has 75 (or something) and my laptop has 60.

So decoupling the things that decides the looping speed from the actual loop seems logical.

Regards Sph!nx
http://www.mental-image.net
Libervurto
13
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 30th Mar 2011 01:37
hmm, why is this thread in the DBC board? Is it doing the rounds? lol
Well in DBC the sync rate may be limited to 60fps by a setting in the settings.ini file, err I can't remember exactly what it is called now.

Here's a link to some other help (although I can't find what I'm talking about lol)


Everything worthwhile requires effort.

Login to post a reply

Server time is: 2019-08-23 23:03:15
Your offset time is: 2019-08-23 23:03:15