Which is best Flip 1 or Flip -1?

BlitzMax Forums/BlitzMax Programming/Which is best Flip 1 or Flip -1?

Grey Alien(Posted 2006) [#1]
Basically I had been using Flip -1 because I thought that sometimes Flip 1 might not work (if card has VSync off for example) and that Flip -1 would still work as it used timing instead. However, since the new VSync in windowed mode BRL fix only works for Flip 1, I've had to change to Flip 1 as my default. Can anyone forsee any negative results of this? I am using proper timing so my game won't speed up or anything if Flip 1 fails. Maybe there was no point to using Flip -1 before...

Thanks for any feedback.


Grey Alien(Posted 2006) [#2]
bump?


TartanTangerine (was Indiepath)(Posted 2006) [#3]
I always thought it was either
Flip False
or
Flip True



tonyg(Posted 2006) [#4]
Can anyone forsee any negative results of this?

Badly worded if you want some feedback regardless.
If you get no responses does it mean everybody believes there are no negative results or they can't be bothered to answer.
Anyway, can't you set sync depending on graphicsdepth()?
Afaik sync=1 is only a problem if you just miss a vertical blank and have to wait for the next. Whether this matters... I don't know you'd need to test.


Grisu(Posted 2006) [#5]
Well, I use flip 0 as bmx seems to have problems with flip 1.

Simple as that... ;)


popcade(Posted 2006) [#6]
When using -1, returns no error, but doesn't fix tearing on Windowed mode as well as 0.

When using 1, the frame rate slightly dropped, bu maintain a working fix for tearing..

It's good to make it switchable using an ini, so user can choose how to work it out.


Grey Alien(Posted 2006) [#7]
Indiepath: the docs say the flag can be a 0, 1, or -1.

Tonyg: point taken. I've test a lot on my PC and both work the same. I'll have to test on more.

Grisu: What problems with flip 1? Flip 0 gives no vsync which can make some games look not so good due to tearing.

yoxola: With the module tweak to BMax 1.20 that I documented in my framework FAQ, it showed how to modifty the modules to get VSync working for 1 AND -1 in Windowed mode. However, when BRL implemented the VSync fix themselves, they only did it for Flip 1 as that's a hardware sync whereas Flip-1 is a software sync based on the hertz of your graphics mode, and they felt it shouldn't vsync - fair enough. So is Flip 1 best? Yes if it works on your card, no if it doesn't I guess. But what happens if it doesn't? Does it just miss badly each time or run at full speed (no sync)? At least my timing functions won't mess up animations/movement etc. whatever happens to the VSync.

It's probably not an issue, I just was interested in hearing all experiences and ideas, thanks.


popcade(Posted 2006) [#8]
Yes, only 1 works, actually the FPS imapct isn't that big, about 3% around, shouldn't be a major problem.

Before BRL implemented this, still 1 works here(GFX5200), I guess this is a card issue.


Jake L.(Posted 2006) [#9]
The more I read about Flipmods and Timing methods (Delta, fix logic etc) the more I got confused. I spent the last day reading all posts related to this topic and trying example code. Now I have the feeling to know absolutely nothing.

I really don't know which way to go. "All" I want is a somewhat smooth movement while maintain physics stability - like everyone else I think.

For physics stability I best use a fixed rate logic, right? But what Flipmod should I use it with?
If using Flipmode 1/-1, do I even need a proper Deltatiming? Or just to compensate slow machines?

Anybody who knows a good way to go for smooth 2D with Physics, could you please enlight me?

Jake.Flip()

PS: Ooops, out of sync now ;)


Grey Alien(Posted 2006) [#10]
Yes you always need proper timing. Flip 1 is a hardware VSync and probably best as it works in windowed mode too with no vertical tearing, it's what I'm using now. Fixed Rate Logic or Delta Timing would work fine but Fixed Rate logic can give you higher accuracy for physics. I actually sorta combined the two.


Yan(Posted 2006) [#11]
...Like so...
http://www.gaffer.org/articles/Timestep.html


Jake L.(Posted 2006) [#12]
Thank you both, I'll try to implement the gaffer-method and see how far I get.


QuietBloke(Posted 2006) [#13]
So am I to assume flip 1 shoudl stop tearing in a windowed game ?

Ive finally decided to get back to coding.. I did a syncmods.

Ive started writing a simple platformer. I got the thing to display the tiles.. then added scrolling and LO !

I get tearing.

I changed the Flip to Flip 1.

still tearing.. Its a single tear near the top of the window. I also notice its seems to be a bit jerky.. I guess I should search the forums for that now too.


QuietBloke(Posted 2006) [#14]
OK.. when I said the top part of the window it turns out its just the top part of my screen. As I move the window up and down on the screen the tear stays in the same physical place.
Guess moving the window down will stop the tearing annoying me.
I still get jerky movement though... slight pauses every second or so.. the time between pauses seems random.
Ho Hum.. guess I'll put up with it.


tonyg(Posted 2006) [#15]
or post some code in case somebody can help?


Red Ocktober(Posted 2006) [#16]
coming from a blitz3d perspective, i don't think that Flip one way or the other is gonna solve all your tearing issues... at least judging from my experiences in b3d it doesn't seem to...

i think you've gotta also consider a timing algorithm in your game, and sometimes slow down the game logic so that it doesn't outpace the refresh logic...

i had a lot of problems with jerkiness until i realized this... now i use a simple timing loop as outlined in the b3d manual, with the WaitTimer set to 22... and Vwait():Flip False...

that seemed to solve all the jerkiness and screen tearing problems for me... now i can pile a bunch of particles, with cubemapped reflection and a lot of other things going on...

but this is all in Blitz3D, i dunno how it will translate in 'Max... i just added my lil 2cents in the off chance that maybe it might be of some help to someone...

good luck

--Mike


Grey Alien(Posted 2006) [#17]
QuietBloke: Yeah, proper timing be it Delta time or Fixed Rate Logic is a must. You may still get "catch up" jerks if you have other processes hogging CPU time aperiodically on your PC. Flip 1 *should* result in no tears in Windowed mode since the update (it does on MY PC and many others). If you have a fixed tear at one point on the screen, that would mean that the VSync isn't working properly with your card/driver combination. Obviously the system tells Blitz, "I'm in Vertical blanking now" and it's not, it's actually a few inches down the screen. I bet it's fine on other PCs. Problem is that not all PCs are the same and some don't report VSync very well (oh by the way, check VSync is on or app controlled in your drivers, not off).

When I first investigated the VSync in Windowed mode and Skidracer posted a possible (early) fix, I implemented it in such a way that I always got a stationary vertical tear somewhere on the screen, but it was random where it was. In the end I concluded that Flip 0 actually looked better as the tears were so quick you didn't notice as much as with the static tear. In the end I have a VSync option in my game engine so people can try it on or off.

Just a thought, have you downloaded and tried my AOTMG demo yet? See if that tears in windowed mode or not. Click the framework link in my sig and just see it. A comparison will tell you if it's your code or your hardware/driver. Also you can see if my game jerks or not on your PC...