All my games have jerky motion?

terblus

  • Posts: 205
Whenever I have a character moving across the screen, the animation always looks just a bit jerky. I made a little test to illustrate this.

http://www.stencyl.com/game/play/33631

This is about as simple of a game as I can make. Just a rectangle with the standard 4 way movement behaviour (there's also a slightly wonky respawn behaviour). Is there any way to make motion smoother?

TheIndieStation

  • *
  • Posts: 2263
it's smooth here? Are you sure it isnt your player?

terblus

  • Posts: 205
I've seen this on a few computers, so I do think it's a real problem. The jerkiness isn't huge, you have to look a bit closely to notice it.

mdotedot

  • Posts: 1607
Hello Terblus,

Please post code/behavior value.

What my guess is that you have the default speed of the 4 Way Movement actor behavior. Try experimenting with the speed  (make it lower) and the option ' cannot turn on movement'
Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

terblus

  • Posts: 205
I was indeed using the default value for speed. I've played around with it, as well as the "cannot turn on movement" check box, and the problem still persists.

Forgive my ignorance, but what exactly are you asking me to post?

Tepastelija

  • Posts: 51
It's not your fault or something that you could fix with coding. Jerkiness is serious problem in old openFL which will be eventually fixed when Stencyl switches to use new openFL called Next. When that will happen? Only god knows :)

terblus

  • Posts: 205
Oh, really? There's no way to compensate for this known problem? Other stencyl games don't seem to be jerky, but maybe that's just because they're visually busy so it's not as noticeable.

tigerteeth

  • Posts: 734
It's not your fault or something that you could fix with coding. Jerkiness is serious problem in old openFL which will be eventually fixed when Stencyl switches to use new openFL called Next. When that will happen? Only god knows :)

I think this is not necessarily the case here.

It's more likely  that it's just your example that seems jerky because of the size and shape of the object, the light background, etcetera.

edit: I take this back, I have no idea.

« Last Edit: March 04, 2016, 03:11:32 pm by tigerteeth »

SadiQ

  • Posts: 1795
Mind exporting the game so we can look at it?
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

terblus

  • Posts: 205
tigerteeth: I do believe the sparseness of my game exaggerates the problem, but I don't think it's the cause.

sadiQ: The game is really just a red rectangle with the basic 4 way movement behaviour that comes with stencyl. There is one other behaviour in there for respawning that I quickly made, but the jerkiness was there before I added it.

merrak

  • *
  • Posts: 2593
It seems to be more noticeable on games with large screens and simple scenes. I've never noticed it before, but since it's come up so much lately and now I'm  curious about it, I put together a little test using default behaviors.

In this demo, the camera follows the ball. Hold down + right. Once the camera starts moving, there is some jittering.

Putting a background in makes it much harder to notice.

Interestingly enough, moving straight horizontal or vertical is smooth. If you take the 8-way movement behavior out, and set the ball x-speed and y-speed to 20 'on created', you get smooth movement. The key seems to be integer values.

In 'Jitter Bug 2', I modified the 8-way movement behavior so that the x and y-speed of the ball is always an integer, and I get smooth movement (on Linux desktop build)


terblus

  • Posts: 205
I appreciate you looking so closely into this, merrak, though I don't fully understand what you're saying. In my example game, the movement values are always integers. I just modified my program to print x and y speed, and they're both always 0, 45, or -45.

merrak

  • *
  • Posts: 2593
The more I thought about it, I realized we may be talking about two separate issues. There seems to be a number of ways to get jerky motion. I couldn't reproduce jittery movement like in your example, but I did stumble upon a lot of discussion on the issue in OpenFL. One suggestion that was mentioned in another forum was setting the FPS to 61 or 100. I can't test that idea, though, since I don't have a game that produces the problem in the first place.

terblus

  • Posts: 205
So you can see the jittery motion in my example, but you can't make a game that has it? This is odd because, as I've said, I get that motion any time I do....well, pretty much anything. Any time I use the basic movement behaviours, or even ones of my own making, it looks like that. I've had this happen on two different computers too.

How can I set the framerate of a game?

letmethink

  • *
  • Posts: 2545
I posted a PR for the engine that should improve your issue Merrak, and to fix it completely you need to enable pixel snapping in the settings. You can make the changes I've suggested before the PR is accepted if you replace your Layer.hx with this one:

https://github.com/iamletmethink/stencyl-engine/blob/680e56ec9bde6846afe652cdc1750777889b8c0f/com/stencyl/models/scene/Layer.hx

~Letmethink