Move objects smoothly in mobile app?

  • I try to use the bullet behavior, which does the job well on a browser and when in remote preview. But when I export the project to Android, the movement becomes jaggy. The fps remains at 59-60 but the movement is just very rough.

    You can try to reproduce it by having two sprites, each 250x250, and set bullet speed to 400. It doesn't matter whether the bullet speed is large or small and the browser can have smooth movement, only when it is exported as a mobile app the movement becomes jaggy. I also tried to update the position by using every tick, update Object.Y to Object.Y + speed*dt, but same result (smooth when viewing in browser but jaggy when exported as mobile app). Any ideas on what's happening and how to solve this?

    I found this thread on Unity and am not sure if it is related. Any help would be appreciated. Thanks.

    https://answers.unity.com/questions/599 ... ty-43.html

  • Wai

    Bullet behavior use delta time to move, so you dont need to adjust it on events.

    Maybe a sprite of 250x250 is too big to move at that speed. On mobile when I use bullet behavior is with small sized objects. Try to do it 128x128, if not go smaller.

  • Thanks for your reply.

    I know that bullet already use delta time. What I want to say is it doesn't make any difference whether I use bullet, or try to set the position of object by using delta time (of course not implementing both at the same time). And the problem of jaggy movement only happens when export as a mobile app, it runs very smoothly on the browser in remote preview.

    So you did not experience any jaggy movement when exported as a mobile app? Is there any app you have published that I can download to try?

    I made a simple example that clearly demonstrate the difference in the smoothness of movement between remote preview in browser and exported as mobile app.

    https://drive.google.com/file/d/1Yo5NJR ... sp=sharing

    https://drive.google.com/file/d/1sx4kr- ... sp=sharing

    Ashley

    What is your view on this? As you are a strong advocate in remote preview, there must be something wrong if their performance (not in fps, but the smoothness of movement) differ so much.

  • Have you tried different phones?

    I tested your app on my phone and it runs fine, no flickering. There are a few very small hiccups during the first few seconds, but after that it runs smooth.

  • Thanks for your feedback. What device are you using?

    I tried on Nexus 6 running Android 7.1 and Samsung Note 4 running Android 5.0, objects in the mobile version move not smoothly on both phones but the browser version is smooth. I let the program run for a minute and still no improvement.

    Maybe flickering is a strong word, but if you look carefully, you should see the objects in mobile version have rough movement (maybe sometimes move back a pixel or so? not sure what's the cause of that rough movement feeling), but the browser version has very smooth movement, even though both are running at near 60fps.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I tried on Xiaomi Redmi 4, with Android 6.0.1

    Tested the apk again - first few seconds some jerking, then smooth movement.

    Sometimes (maybe once in 10-20 seconds) the sprite jumps forward or back a couple of pixels, but it's hardly noticeable. I would suggest this is due to some background processes running on the phone.

  • I would assume if you try it on browser version, it would be all smooth then.

    I can see a clear difference in the smoothness of movement between browser version and mobile app version (nearly all movements in mobile app version are jerky, while the browser version is all smooth), which should not be the case. Maybe your phone has very good spec and it hides the problem, but there is a problem there if there is a noticeable difference between browser version and mobile app version.

  • I have tried on Sansung S6. I can see the sprite just a little little bit jumping.

    In my apps I try to avoid heavy behaviors in big sprites. I say heavy because bullet have to recalculate and draw position every tick.

    Is not an option make the sprite 126x126 and resize in the layout view?

  • Rasputin

    I am not sure if I understand you correctly. I tried to resize my image to 100x100 before importing to C3, and then set it back to size 250x250 in game, the movement is still a bit "jumpy".

    My main question is why the sprites can move smoothly in remote preview on phone, but when running on mobile app, the movement becomes jerky.

  • Wai

    Have you tried building the apk using other services, like cocoon.io, phonegap?

    If jerking/flickering occurs only with C3 build, you should log this as a bug.

  • I tried to build apk using Android Studio and PhoneGap, and same result. Maybe it is a Cordova thing?

    But that would make remote preview's usefulness decreases a lot, as the performance can differ so much.

    Update:

    If I compile using Cocoon IO with Webview+, the movement is smooth, same as viewing in browser on phone. Is there any way I can still use C3 build and get that smooth movement? I really don't want to use other 3rd party service to minimize the chance of getting other problems. Thanks.

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