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 / sync (DBPro)

Author
Message
Allanon Shadeslayer
17
Years of Service
User Offline
Joined: 28th Dec 2006
Location:
Posted: 12th Jan 2007 23:43
can anyone tell me what the command sync does? I've tried it lots of times and played with the sync rate but it just makes my programs run slower or if i set the sync rate to 0 i can't tell a difference between without sync or with it?

I'm confused!
Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 13th Jan 2007 00:25 Edited at: 13th Jan 2007 00:28
The template is usually this one:

(beginning of code)
sync on ------ enables sync command
sync rate somevalue ------- sets the refresh speed of the screen
..... ---------- 0 means the fastest possible
.....
.....

(Do-Loop) Main Code
DO
....
....
....
SYNC
LOOP

Subroutines
Functions

end

The Sync command calls the screen refresh operation- the Sync at the bottom of the do-loop ensures that all your main code has been run before drawing anything to the screen

You can use it in other places for specific use like showing an intro picture on screen while loading stuff in the background:

...
load image "path/myimage.jpg",imagenumber
paste image imagenumber
sync
.....
Allanon Shadeslayer
17
Years of Service
User Offline
Joined: 28th Dec 2006
Location:
Posted: 13th Jan 2007 01:51
Ty that helped a lot!
Kieran
18
Years of Service
User Offline
Joined: 6th Aug 2006
Location: Hamilton, New Zealand
Posted: 13th Jan 2007 02:41
i reccomend setting sync to 60 (60 frames per second) because when i had mine at 0 the speeds kept changing as the rate did (for example if i got the character to make at speed 2 at sync rate 0 it would move at light speed sometimes but othertimes it would go slow) so sync rate 60 is a good way to go

its up to you really but im just trying to help

Allanon Shadeslayer
17
Years of Service
User Offline
Joined: 28th Dec 2006
Location:
Posted: 13th Jan 2007 02:48
ty but won't i have to go all over my code and reset the speed for everything to keep it from being slow?
Kieran
18
Years of Service
User Offline
Joined: 6th Aug 2006
Location: Hamilton, New Zealand
Posted: 13th Jan 2007 03:08
well if ur movement speed is usually 0.01 or sumthing you will have to change it to like 2 but then it will save u a hell of a lot of problems.

just try it if you want



or whatever its up 2 u

Allanon Shadeslayer
17
Years of Service
User Offline
Joined: 28th Dec 2006
Location:
Posted: 13th Jan 2007 03:26
ok, ty
Kieran
18
Years of Service
User Offline
Joined: 6th Aug 2006
Location: Hamilton, New Zealand
Posted: 13th Jan 2007 03:27
Np hope it helps
btw if your a newbie i got a really helpful tutorial called "a tutorial to get started" on this forum

Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 13th Jan 2007 10:55
The ideal is a refresh rate of 60 fps but there is no rule.
Above 30 fps -actual-, i.e. not below that even when the code gets intensive usage of CPU and GPU, is normally considered fairly good.

the best is to set sync rate 0 and check what is the maximum you can achieve (set cursor 0,0:print screen fps())
in the most intense moments of the code (max.polys on screen + shooting + AI etc.) and set it to that value so it won't scatter too much when less demanding tasks are underway.

In order to get consistent, this implies having like 80 % of the code done and continually readjusting some speeds and settings as the code progresses.

Login to post a reply

Server time is: 2024-11-26 23:22:50
Your offset time is: 2024-11-26 23:22:50