smooth animation in a window - not possible?

Advanced game related topics
Brice Manuel

Post by Brice Manuel »

but I talked to the techie who maintains the screen, and he explained that a screen of this size doesn't actually have a refresh frequency,
I said response time, not refresh rate. They are two entirely different critters. Older LCDs have slower reponse times and have all kinds of visual issues for gaming. Newer LCDs don't really have this issue and have response times well under 10ms, but on older LCDs, some of them were pushing 30ms back in the day.

*note* I am NOT saying this is the problem. Very unlikely since you are having the issue on multiple monitors.
I need to draw large sprites with alpha channels, I need to resize images with anti-aliasing, etc. - so I'm afraid I do need DX for this one...
I am curious if you have tried the DX9 subsystem for PB that somebody wrote, perhaps it will give you better performance?
mp303

Post by mp303 »

Brice Manuel wrote:I said response time, not refresh rate.
ah, you mean latency? as far as I know, that only affects how fast the diodes can switch on and off - it's a physical limitation, not related to the controller as such. as far as I'm aware, higher latency (slower response) is only responsible for artifacts like ghosting and shadows - it's not something that causes flicker or tearing (?)

anyhow, what I've seen on the little screen hooked up to signal replicator in the server room, is exactly the same as on the big screen outside... heavily jagging scroll text and movie clips with bad tearing.

it's the same as I've seen in every Flash player on any machine, for that matter. Adobe hasn't denied that the Flash player does this either - in fact, they seemed like they were perfectly aware of it and just don't care. Despite the fact that Flash is quickly becoming the main video platform on the internet. Pretty disappointing, really, as this makes it practically impossible to deploy quality video in Flash - the player itself will cause tearing and drop frames regardless of how high bitrate you use. But they don't seem to care...
Brice Manuel wrote:I am curious if you have tried the DX9 subsystem for PB that somebody wrote, perhaps it will give you better performance?
Worth a try, I suppose - got a link? thanks! :)
Brice Manuel

Post by Brice Manuel »

mp303 wrote:higher latency (slower response) is only responsible for artifacts like ghosting and shadows - it's not something that causes flicker or tearing (?)
Been a long, long time, but when LCDs were first getting big, some of the ones we had at Microprose would exhibit jittering and flickering on certain hardware setups. Never could figure out why.

But, isn't an issue on today's LCDs.
mp303 wrote:Worth a try, I suppose - got a link? thanks! :)
http://stefanmoebius.de/DX9S_03.zip

Not a bad third-party addition. Doubt it will help your situation, but doesn't hurt to try :wink:
whertz
Enthusiast
Enthusiast
Posts: 124
Joined: Sat Jun 25, 2005 2:16 pm
Location: United Kingdom

Post by whertz »

changing framerate to 60 still yields the same result here. Correct me if I'm wrong, but doesn't Flipbuffers(1) have to be set to Flipbuffers(0)? Flipbuffers(1) is the default setting and syncs to the refresh rate, so setting a high frame rate does nothing. In any case, Flipbuffers(0) and a high frame rate is really jerky.
netmaestro wrote:The trick is to set a high framerate and counterbalance it with a delay in the display loop. However, you can't finetune the timing closely enough with the default Windows timing resolution. You have to set it up higher while the screen is active and set it back when you're done. This (windowed only) version is moving perfectly smooth here:

Code: Select all

ExamineDesktops()
framerate = DesktopFrequency(0) * 3 ; *** change *** // Choose a nice high framerate
              
maxx.l = 482
maxy.l = 258

If InitSprite() = 0 Or InitKeyboard() = 0
  MessageRequester("Error", "Can't open screen & sprite enviroment!", 0) 
  End 
EndIf 


If OpenWindow(0, 0, 0, 512, 288, "A screen in a window...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) 
  If Not OpenWindowedScreen(WindowID(0), 0, 0, 512, 288, 0, 0, 0) 
    MessageRequester("Error", "Can't open windowed screen!", 0) 
    End 
  Else 
    SetFrameRate(framerate) ; *** change  *** // Set framerate up 
  EndIf 
EndIf 

CreateSprite(0, 30, 30) 
If StartDrawing(SpriteOutput(0)) 
  Box(0, 0, 30, 30, RGB(255, 0, 0)) 
  Box(5, 5, 20, 20, RGB(0, 255, 0)) 
  Box(10, 10, 10, 10, RGB(0, 0, 255)) 
  StopDrawing() 
EndIf 

dx = 2 : dy = 1 

timeGetDevCaps_(@tc.TIMECAPS, SizeOf(TIMECAPS)) 
res = tc\wPeriodMin 

timeBeginPeriod_(res) ; *** change  *** // Raise timer resolution for added Delay()
                      ;                 // (counterbalances the high framerate) 

Repeat 

  FlipBuffers(1) 
  
  ExamineKeyboard() 
  If KeyboardPushed(#PB_Key_Escape) : End : EndIf 
  
  If WindowEvent() = #WM_CLOSE:End:EndIf
  
  Delay(11) ; *** change  *** // Add a finetuned Delay() to counter high framerate
  
  ClearScreen(#Black) 

  x = x + dx 
  y = y + dy 
  
  If x > maxx : x = maxx : dx = -dx : EndIf 
  If x < 0 : x = 0 : dx = -dx : EndIf 
  
  If y > maxy : y = maxy : dy = -dy : EndIf 
  If y < 0 : y = 0 : dy = -dy : EndIf 

  DisplaySprite(0, x, y) 
  
ForEver 

timeEndPeriod_(res) ; *** change  *** // Reset timer res to normal
Another advantage to this method is the low cpu usage provided by the Delay(). It's only using 3% here, compared to 100% with your code.
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Post by Rescator »

Check this out: http://www.tweakguides.com/Graphics_1.html

Especially look at page 7,8,9 about refresh rate, response time and vsync.
mp303

Post by mp303 »

Rescator wrote:Check this out: http://www.tweakguides.com/Graphics_1.html

Especially look at page 7,8,9 about refresh rate, response time and vsync.
explains what it is, but doesn't seem to explain what to do about it?
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post by pdwyer »

I'm new to PB and and trying to learn a bit about PB's GFX stuff by reading through threads like this one but I tell you what, you guys spend more time arguing over who's last post was the most offensive than talking about the issues! You guys need to take some drugs or something and calm down :shock:

Just remember, in posts, tone, (like sarcasm etc) doesn't always come across so take it easy. People are taking the time to reply so be happy even if they do seem to miss the point at times.

Now, back to the topic :)

Paul

(why do I suspect that this post may have the opposite to hoped effect)
mp303

Post by mp303 »

pdwyer wrote:you guys spend more time arguing over who's last post was the most offensive than talking about the issues!
sharp observation, Paul - but you're as off-topic as the rest of us now, so welcome to the club ;-)
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post by pdwyer »

Blah! :mrgreen:

Drop in the bucket on this thread!

Admittedly it was a bit of a drive-by-posting :P I'll try to keep my comments to myself.

as you were... :wink:
byo
Enthusiast
Enthusiast
Posts: 635
Joined: Mon Apr 02, 2007 1:43 am
Location: Brazil

Post by byo »

Brice Manuel wrote:we had at Microprose
You worked for the mighty Microprose!? :shock:
mp303

Post by mp303 »

@pdwyer: that was merely humour, you should try to take most things that come from me with a grain of salt - I'm sure the rest of these folks know what I mean ;)
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

pdwyer wrote:Blah! :mrgreen:

Drop in the bucket on this thread!

Admittedly it was a bit of a drive-by-posting :P I'll try to keep my comments to myself.

as you were... :wink:
:lol:

Does a drive by - hooting (with laughter)
Dare2 cut down to size
Brice Manuel

Post by Brice Manuel »

You worked for the mighty Microprose
Yes.
@pdwyer: that was merely humour, you should try to take most things that come from me with a grain of salt
He did, he was being humorous in his reply :wink:
Post Reply