Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Vsync vs No vsync in relation to frame based movement

  1. #1

    Vsync vs No vsync in relation to frame based movement

    Some games benefit more from frame based movement compared to time based.

    Take my pong game, I decided to leave it as frame based or maybe even give user the option but I find problems.

    Most systems WILL keep up with 100 fps frame rate. The bad thing however is that this is only the case when vysnc is off.

    If vsync is on (according to some this is because the timer is on the same thread), the timer only produces ontimer events at the refresh rate

    So take for example my timer. Set to 100 fps and yet vsync will make it output at 75 ontimer events a second no matter what I do.

    So, logically I assumed the way round this is to find what refresh rate the game is running at and then move the sprite by X:=X+(Y/Refresh rate) (unless it is no vsync in which case I can set RR to 100).

    The problem with no vsync is the horrible jerkiness you get, and if I set delphix to fullscreen vsync is automatically activated and cannot be turned off. And further problem is, a monitor with very high refresh rate would have more problems than a lower one. If I set the timer for 100 fps, and vsync comes along to tell me that aint happening buddy, how can I ever hope to achieve frame based motion with vsync on with a set FPS of 100?

    The only options I have so far found:

    1. Have varying timer speeds depending on refresh rate (not a nice idea)

    2. Somehow find a way to have the rendering and motion calculations seperate (no idea how with delphix)

    How do you guys work with frame based motion when your timers change ontimer event depending on refresh rate of the monitor?

    And a final question. Why is it no vsync with 200 fps is about 15% of my cpu but when I put vsync on it takes a whopping 100% even at 75 fps?

  2. #2

    Vsync vs No vsync in relation to frame based movement

    With VSync on your CPU is busy mainly with waiting; because it horribly
    slows down everything.

    The best way dealing with framebased motion is completely leaving it.
    And: Don't use divisions in your motion code for gods sake; multiplication
    is much faster and very easy in that case.

    It would be nice if you could tell me in which way Pong benefits from
    framebased movement (except from that its very hard to control ^^).

  3. #3

    Vsync vs No vsync in relation to frame based movement

    I can't find a single explanation, why a game should calculate frame dependant... It makes no sense to me
    <a href="http://www.greatgamesexperiment.com/game/Valgard/?utm_source=gge&amp;utm_medium=badge_game"><img border="0" alt="GGE" title="GGE" src="http://static.greatgamesexperiment.com/badge/game/valgard/gge400x56.png"></a>

  4. #4

    Vsync vs No vsync in relation to frame based movement

    I agree with Huehnerschaender and Waran. With time-based movement you have control over the speed of objects in your game on different machines with different specs. With frame-based movement you don't have the same control...it will run slow on a slow PC and fast on a faster PC. My game runs with VSync on and it's not jerky
    Wake up from the dream and live your life to the full

  5. #5
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Vsync vs No vsync in relation to frame based movement

    With physics I calculate it per frame with a fixed value, not in time.
    However, I have time slices that do th trick for me. if I got 600 FPS, it renders only at that rate. The udates of my game are in 60 FPS. When I render with 30 FPS, I just double the frames so the game update would still run at 60 FPS (doing 2 updates and 1 rendering).
    In this case you have frame based motion thats always the same. (Time Sliced something it was called,)
    NecroSOFT - End of line -

  6. #6

    Vsync vs No vsync in relation to frame based movement

    yeah but wizard we are talking pong here Not halo 3

    Well there are 2 benefits I have found:

    1. If I want to use recordings similar to the movie states you get in emulators, it is much easier

    2. Making objects appear. have a minigame in my pong where you collect jewels.

    The problem is, that I want it to have an event table: So with frame based I could say create on frame 523 and it ALWAYS would, but in time base, it might just skip that frame completely....

    makes event tables so much easier for me.

    How would you go about sorting that> make a new timer within the main timer to make sure the object is made? Make the event table time based (and of course make sure the section of time can't be skipped by capping delta time)

    While we are at it...any idea how I can make vsync take less tham 100% cpu...and more to the point, is it damaging for CPU's to be drilled at 100 ina game or is it ok?

  7. #7

    Vsync vs No vsync in relation to frame based movement

    Quote Originally Posted by Wizard
    I agree with Huehnerschaender and Waran. With time-based movement you have control over the speed of objects in your game on different machines with different specs. With frame-based movement you don't have the same control...it will run slow on a slow PC and fast on a faster PC. My game runs with VSync on and it's not jerky
    That's not true. You can have frame based movement moving same speed on slow and fast PC cause it's handled by timer, and in this unDelphiX case TDXTimer.

    I have found TTimer quite good and extremely cpu saving one (graphically simple game running 50 fps might take 0-1% cpu time). But it has a downside that is operating system which makes interval length different on different PC's. For example set interval to 20 to get 50 fps on your computer but someone else running it might see 100 or 30 fps with a faster PC. Workaround might be using very small interval and counting frames by yourself, it should still save cpu.

  8. #8

    Vsync vs No vsync in relation to frame based movement

    With timebased movent you get 0% as well if you insert a 1ms-Delay
    (sleep or SDL_Delay).

    Instead of saying "Appear at Frame 573 (note: Frames may not have
    fixed lengths)" you say "Appear after 5 sec." - where is the problem?

    100% CPU:
    It doesn't damage it at all (assuming you didn't do any overclocking).

  9. #9

    Vsync vs No vsync in relation to frame based movement

    waran, ideally theer would be no problem, but consider:

    a slow computer will use a delta time, which will skip depending on how slow. Even capped it will skip alot of milliseconds.

    So you say "send on 5 seconds" and has missed 5 seconds completely. There are ways around it, but with frame based motion, each and every game will be EXACT to the one before.

    With time based, this can NEVER be so.

  10. #10

    Vsync vs No vsync in relation to frame based movement

    and sleep only takes it down to 70-80% on mine...

    Well as long as it doesnt damage it or whatever I don't care/. But there dpoes seem to be ALOT of negativity attached to 100% cpu.

    For example, when i sent game to someone they said "what tjhe hell is this! pong at 100% cpu"

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •