Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Jerky gameplay  (Read 18862 times)

0 Members and 3 Guests are viewing this topic.

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: Jerky gameplay
« Reply #15 on: December 10, 2014, 05:44:42 pm »
Your example is not jerky on my machine.

You could try logging the time per frame and see if it ever jumps to a large or small amount than the average. Maybe your machine is having a hard time keep the framerate at 60fps?

Jycerian

  • Newbie
  • *
  • Posts: 49
  • Weakness of attitude becomes weakness of character
    • View Profile
Re: Jerky gameplay
« Reply #16 on: December 10, 2014, 10:38:46 pm »
Your example is not jerky on my machine.

You could try logging the time per frame and see if it ever jumps to a large or small amount than the average. Maybe your machine is having a hard time keep the framerate at 60fps?

Yeah I will check that tomorrow and post back, do you experience any 'tearing' in the shape at any point?

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Jerky gameplay
« Reply #17 on: December 10, 2014, 11:09:12 pm »
Not sure it's relevant, but I saw the comment
Quote
Maybe your machine is having a hard time keep the framerate at 60fps?
and I just wanted to point out that; the first thing you should do (IMHO) is make your drawing independent of the actual frame rate, since it will fluctuate regardless of setFramerateLimit/setVerticalSyncEnabled or whatever you do yourself.
If you don't take a variable frame-rate into account (you really have to) you will see jerky movement.
If you haven't already read it, then the Fix Your Timestep article is a great place to start.
« Last Edit: December 10, 2014, 11:15:05 pm by Jesper Juhl »

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: Jerky gameplay
« Reply #18 on: December 10, 2014, 11:18:55 pm »
Your example is not jerky on my machine.

You could try logging the time per frame and see if it ever jumps to a large or small amount than the average. Maybe your machine is having a hard time keep the framerate at 60fps?

Yeah I will check that tomorrow and post back, do you experience any 'tearing' in the shape at any point?
Nope, looks fine.

And yep, that's where I was headed next in replying, Jesper!

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Jerky gameplay
« Reply #19 on: December 10, 2014, 11:22:15 pm »
And yep, that's where I was headed next in replying, Jesper!
Huh? I really don't know what to make of that..

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: Jerky gameplay
« Reply #20 on: December 11, 2014, 12:59:22 am »
Sorry, I meant, that I assumed he'd ask how to solve separating the rendering and the logic, and then I was going to reply with something along the lines of what you replied with.

Jycerian

  • Newbie
  • *
  • Posts: 49
  • Weakness of attitude becomes weakness of character
    • View Profile
Re: Jerky gameplay
« Reply #21 on: December 11, 2014, 01:50:21 am »
Hihi, no I know how to seperate the logic and render and to apply a fixed timestep. But again this does not resolve the issue. Maby its my machine? I am really not sure. It seems everyone else can run it just fine? I can play League of Legends on all low settings with 60 fps and super smooth, but can't have a square move across my screen without being sometimes 'jerky' and the 'tearing'. So weird.
« Last Edit: December 11, 2014, 01:52:52 am by Jycerian »

Jycerian

  • Newbie
  • *
  • Posts: 49
  • Weakness of attitude becomes weakness of character
    • View Profile
Re: Jerky gameplay
« Reply #22 on: December 13, 2014, 02:22:11 pm »
Your example is not jerky on my machine.

You could try logging the time per frame and see if it ever jumps to a large or small amount than the average. Maybe your machine is having a hard time keep the framerate at 60fps?

Timed my timestep with setFramerateLimit(60)

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: Jerky gameplay
« Reply #23 on: December 13, 2014, 05:31:42 pm »
Hmm, looks fine to me. I'm not sure what to make of it.

Jycerian

  • Newbie
  • *
  • Posts: 49
  • Weakness of attitude becomes weakness of character
    • View Profile
Re: Jerky gameplay
« Reply #24 on: December 13, 2014, 11:08:36 pm »
I am not sure if this will help but this is my DxDiag, anyone got an idea what causes the tearing and jerky movement?

underww

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: Jerky gameplay
« Reply #25 on: December 14, 2014, 04:14:59 am »
I think this is because of the floating numbers of the sprite's position.
Try to use an integer value for velocity.

For example


        if (isMovingUp)
                velocity.y = -1.f;
        if (isMovingDown)
                velocity.y = 1.f;
        if (isMovingLeft)
                velocity.x = -1.f;
        if (isMovingRight)
                velocity.x = 1.f;

        rect.move(velocity);
 
« Last Edit: December 14, 2014, 04:27:44 am by underww »

Jycerian

  • Newbie
  • *
  • Posts: 49
  • Weakness of attitude becomes weakness of character
    • View Profile
Re: Jerky gameplay
« Reply #26 on: December 14, 2014, 12:56:47 pm »
How would you go about this using deltatime? Because that is a floating point number. In my example my player velocity.x would be something like 1.5.

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Jerky gameplay
« Reply #27 on: December 14, 2014, 09:18:09 pm »
How would you go about this using deltatime?
You could round() or floor() the value when setting the sprite position if you want to keep it to an integer value.
This can improve the sprite's display quality but is more likely to cause jerky movement than to solve it.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Jycerian

  • Newbie
  • *
  • Posts: 49
  • Weakness of attitude becomes weakness of character
    • View Profile
Re: Jerky gameplay
« Reply #28 on: December 14, 2014, 09:43:00 pm »
How would you go about this using deltatime?
You could round() or floor() the value when setting the sprite position if you want to keep it to an integer value.
This can improve the sprite's display quality but is more likely to cause jerky movement than to solve it.
'

Alright, do you have any insight in my problem? You seem like a well established community member, ever stumbled across something like this?

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Jerky gameplay
« Reply #29 on: December 15, 2014, 02:57:28 am »
Unfortunately, I have unsure which exact problem you're getting and what its effect is. The code that causes you to have the problem doesn't seem to cause it for others so we can't see it. I suppose you could record a video of it but it's possible that it wouldn't capture the "jerkiness", or may even create some of its own.

As you may've also noticed, the word jerky is slightly ambiguous.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*