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

Author Topic: Jerky gameplay  (Read 18861 times)

0 Members and 2 Guests are viewing this topic.

underww

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: Jerky gameplay
« Reply #30 on: December 15, 2014, 03:22:33 am »
I heard that old games like Super Mario Bros stored subpixels in a separate integer.
So you might also use an another variable for the decimal units of the velocity.
But I don't know this is good for modern game dev or not.

as I know on it is also a kind of limit of pure 2D graphics.
You need to use 3D graphics (means directly use OpenGL) to solve this problem completely.
« Last Edit: December 15, 2014, 05:35:04 am by underww »

Jycerian

  • Newbie
  • *
  • Posts: 49
  • Weakness of attitude becomes weakness of character
    • View Profile
Re: Jerky gameplay
« Reply #31 on: December 15, 2014, 10:20:18 am »
Well let me try to explain it in more detail:

When I stand still there is no problem, no flashy things or screen tearing (only visible on the sprite.) When I move the character it moves in the given direction but then it becomes slightly jerky like it seems to skip a couple of pixels so it isn't smooth maybe because it skips a couple of frames? Or just skips the pixels in general maybe due to using floats? Also another effect appears where it looks like the Sprite is tearing for instance when I move to the right the top half would be something like 2 pixels to the left and the bottom half 2 pixels to the right and then it becomes normal again. It seems this tearing and jerkiness appear at random intervals.

It seems like other people have no problems with my code? I have updated SFML and my graphics driver so maybe it is a bug that has to do this the support of my video-card / processor? Games like League of Legends run fine for instance. I posted my computer stats in an earlier post.
« Last Edit: December 15, 2014, 10:23:47 am by Jycerian »

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Jerky gameplay
« Reply #32 on: December 15, 2014, 03:34:20 pm »
It sounds like you're having two issues. One with tearing, and another with skipping.
The tearing can only (as far as I'm aware) be fixed by using vertical sync.. Unfortunately, the graphics card is in charge of that and its drivers are in charge of that card so they could easily be ignoring SFML's request for v-sync.
The skipping does sound like it's skipping frames; it's been mentioned on the forum a few times already and I've seen it on my own projects. You should make sure you've tried a release build instead of a debug build first as that often makes a difference.
You also mentioned that it could be skipping pixels because of using floats. I don't think floats would directly be the cause. It would only be if the two draw positions are two pixels apart. If you're rounding and the two positions are 2.49 and 3.5 (distance of about 1), the rounded positions would be 2 and 4 (distance of 2).

Comparing with League Of Legends is an odd thing to do. It's rendering in 3D for a start  :P
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 #33 on: December 15, 2014, 05:46:07 pm »
Thanks for the input, just tested without frame-rate limit and then it is pretty much smooth and the tearing doesnt happen that often. Also the borders of the square become kinda fuzzy when moving and sharp when not moving but that is because you are moving using floating points I guess. So it seems like the program is skipping frames, is this normal or is it just me?

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Jerky gameplay
« Reply #34 on: December 15, 2014, 06:13:12 pm »
Thanks for the input, just tested without frame-rate limit
You should never use both vsync and frame-rate limit both in the same program. They interact badly and if that's what you were doing (which I get the impression you were, since vsync is usually the best way to counter tearing), it is not surprising that you were having issues. This is well documented btw.

Jycerian

  • Newbie
  • *
  • Posts: 49
  • Weakness of attitude becomes weakness of character
    • View Profile
Re: Jerky gameplay
« Reply #35 on: December 15, 2014, 11:05:53 pm »
Thanks for the input, just tested without frame-rate limit
You should never use both vsync and frame-rate limit both in the same program. They interact badly and if that's what you were doing (which I get the impression you were, since vsync is usually the best way to counter tearing), it is not surprising that you were having issues. This is well documented btw.

I know about this, I am not using both, enabling v-sync doesn't work for me anyways even though my display driver is setup properly.

 

anything