How do I fix janky movement?

0 favourites
  • 6 posts
From the Asset Store
Run and Jump in 3 Dimensions! Take your platformer to the next level!
  • So just create a sprite.. add a sine behaviour to it and export as debug APK.

    Observe carefully.

    The movement is janky. Even tho the FPS is 60. Why?

    Same issue if I use

    self.x + speed * dt

    How to fix this?

  • it could be a lot of things depending on what you mean by "janky" specifically. if the movement is stuttering, my guess is you probably have it locking to integer positions, which you can change by making sure the pixel rounding setting is turned off in the properties bar for your project:

    if you want this setting on, you can have non-janky movement by using movement speeds where the player is mostly moving at whole pixel values every frame, which would be any multiple of 60. if you're moving at, say, speed 30, which is 30 pixels per second, your character would be stationary for 1 frame, and then move 1 pixel for 1 frame (assuming your game is running at 60 FPS). likewise, if you're moving at, say, 200, which would be 3.33 pixels per 60FPS frame, your character would move by 3 pixels for 2 frames, and 4 pixels for 1 frame, which can cause noticeably uneven movement

    the sin behavior isn't generally going to move like that though, because the nature of sin waves is that the change in position is non-constant.

    in my project i'm letting the characters have non-integer positions, but i set them to an integer position when they hold still. this causes other problems i had to deal with, but i don't like the effect of uneven pixel overlap when things are offset by half (or quarter) pixels, so this is my solution to make them line up with the other graphics when idling.

    if your sprite is moving jankily in a different way, though, the problem could be something else

  • Hello paxclara, thanks for replying.

    By janky movement, I meant that the sprite is moving smoothly and suddenly few frames are lost while moving, then back to smooth movement again. This happens like every few sec and I noticed that the game is at 59-60 FPS constantly.

    - Pixel rounding is always off in my games, because I need smooth movement which requires decimal values.

    - I've tested on a remote preview on my phone and the movement is smooth compared to an APK.

    - I tested on a blank project just in case I had lots of functions being called but the issue happens there as well. Note : only when it is exported as an APK

    - Also tested with WebGPU or Worker being on/off

    I've come to the conclusion that this might be related to the Android's webview. I don't know how other devs have been doing it or never cared about small issues like that.

    But to me this is a huge problem as I want to give a very good product on the store and I know I have uninstalled many games when I came across "janky" issues like that (where the game required accurate movement to win etc).

    There's something that needs to be done on the export, but I'm not sure what it is.

  • R0J0hound Ashley or others

    Any help from you all, on this issue or on how to export properly?

    I feel like this post will be lost in the forum soon...

  • Can’t help since I don’t use export. That is annoying if remote preview is smooth but the export is not though.

    Is there a difference between exporting a debug apk and a normal release one? No idea of it relates to construct but in many other languages a debug build will perform worse than a normal release since it’s doing more debug stuff.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • R0J0hound

    Hello,

    I'm not sure about a debug APK vs a signed/normal release version yet... I will test it out later.

    About the debug version... it happens even if there's a single sprite moving in the whole project and the FPS is constantly between 59-60, so I'll bet there's something else going on...

    ... but thanks!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)