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 / I dont understand - "sync" in work with a picture..

Author
Message
Shaovanlin
14
Years of Service
User Offline
Joined: 17th Sep 2010
Location:
Posted: 21st Sep 2010 17:05
Good day..

I have a problem with my understanding of the usage of the "sync" command.

"sync" means that the program or me is (when I would say sync rate 60) limiting the FPS rate.. right ?!

so I have made a code:

----------------------------------
sync on
SYNC RATE 60
sync

cls

set display mode 800, 600, 32

LOAD image "main_background.png",1

PASTE IMAGE 1,0,0,1

WAIT KEY

------------------------------------------

..when I now start the program (game..lol) then it is showing nothing..

BUT

..when I remove the whole sync commands then it is showing the image...

WHY IS THAT ?? is it because it is refreshing all the time and I can't see it that fast or.. ??? I can't get any logic behind this problem..


------------------------------------------------
can someone 'also' please explain why I have to place "sync" so often.. cant I make it one time 60fps and that is it for all ?? Also when I would have a complex game is then not a global 60fps possible without that I have to write every time sync here & sync there ???
-----------------------------------------------

Thanks for any help !!!


I'm new to programming and eager to learn but it is sometimes hard to get a logic and STRUCTURE behind all this.. I hope you understand.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 22nd Sep 2010 00:24 Edited at: 22nd Sep 2010 00:25
SYNC ON tells DBPro that you will be instructing it when you want the current frame displayed.

SYNC RATE is used to set up a delay - for example, a rate of 60 will cause a delay of 16.666~ms between frame switches.

The SYNC command is used by you to tell DBPro when you have got everything drawn and positioned to your requirements, and now it can render and display it.

Without those commands, the default rate is 40 times per second (25ms delay), and the SYNC happens automatically within certain commands (eg WAIT KEY) - the downside is that there's a good chance that not everything you want drawn and positioned has actually been drawn and positioned before being displayed.

Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
Shaovanlin
14
Years of Service
User Offline
Joined: 17th Sep 2010
Location:
Posted: 24th Sep 2010 18:14
so what is now the answer to my problem ??

That I have to place sync after paste image ??? But like said - WAIT KEY is also refreshing the screen.. so.. I am still not sure why I have this problem..

Naja when I'm back home then I will try it again and post a new message when there is still nothing changed.

With Sync like shown it doesn't work but without and I read all the manuals and couldn't find any help or LOGIC

anyway THANKS for the message "IanM" & "Google Ad" !
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Sep 2010 22:23
When you use SYNC ON, you have to use SYNC to show everything you've drawn.

When you don't use SYNC ON, then DBPro will show what you've drawn when it feels like it, and that may not be when you think it should.

The answer is that when you use SYNC ON, you should use SYNC - that's why you got the blank screen when you added SYNC ON:


Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
Burning Feet Man
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 25th Sep 2010 11:03
Currently I'm having complications employing full screen shaders. I'm finding that they're incompatible with other common commands, such as "set display mode", also thati have to use a "sync mask %01" command, which I'm still trying to figure out too. Anyone able to link me a tutorial?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 27th Sep 2010 21:40 Edited at: 27th Sep 2010 21:41
The SET DISPLAY MODE command will cause you a lot of problems if you don't take care. When you use it, DirectX is basically restarted (that's an oversimplification, but it'll do), which means that pretty much anything graphical will be lost and need to be reloaded. My advice is to only use the command at the beginning of your program.

The SYNC MASK command is (to be polite) a bit of a bodge, and was added to the command set relatively late. It allows you to cause the system to render to specific cameras, by specifying a binary bit mask. If you use the binary representation (which you have), then you can work out which camera will be synced with a SYNC by counting the 1's from the right-hand side.

For example %1011001 will sync cameras 0, 3, 4 and 6.

Camera 0 is special, as this will also carry out a number of other tasks (including updating the display), so generally, you will sync camera 0 last in your game loop.

Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
luskos
17
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 28th Sep 2010 14:13
My basic setup that works like charm everytime :



Coding is My Kung Fu!
And My Kung Fu is better than Yours!
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 2nd Oct 2010 17:15
Quote: "The SYNC MASK command is (to be polite) a bit of a bodge, and was added to the command set relatively late. It allows you to cause the system to render to specific cameras, by specifying a binary bit mask. If you use the binary representation (which you have), then you can work out which camera will be synced with a SYNC by counting the 1's from the right-hand side."


Another way to do it is to raise 2 to the power of the camera that you want to sync. For example, to sync cameras 0,3,4 and 6 you could do this:



That's a lot of calculations though, so you could probably add the numbers up beforehand and just do this (2^0 + 2^3 + 2^4 + 2^6 = 89):




Guns, cinematics, stealth, items and more!

Login to post a reply

Server time is: 2024-11-23 07:40:06
Your offset time is: 2024-11-23 07:40:06