Help me solve the lag in my game

0 favourites
  • 7 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hi

    I have made a very simple endless flyer game, but scrolling background has lag on mobile devices,

    my mobile is LG G4

    this is my capx:

    http://shikpoosh24.ir/tmp/p1_4_3_SD.capx

    and this is the exported game in html5 if you want to run on mobile:

    http://shikpoosh24.ir/tmp/test

    thank you for your time

  • pikazho

    On tablet so can't check capx, but guessing you're using bullet for background, try using lerp

    Also, I wouldn't call that a platform game, more like an endless flyer.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you for your answer.

    I don't use bullet behavior, I just change Y position of background in every Tick,

    I replace my scrolling code with lerp function but no difference, by the way, I had tried bullet bahavior and 8-direction for scrolling too!

  • pikazho

    On tablet so can't check capx, but guessing you're using bullet for background, try using leap

    Also, I wouldn't call that a platform game, more like an endless flyer.

    Thank you for your answer.

    I don't use bullet behavior, I just change Y position of background in every Tick,

    I replace my scrolling code with lerp function but no difference, by the way, I had tried bullet bahavior and 8-direction for scrolling too!

  • Just tried on my old iPhone 5, and it seemed pretty smooth to me (got a distance of 70 on my second try).

    What you see is pretty much what you get with an HTML game on a phone that is a couple years old. Make sure your OS is as up-to-date as possible. One of the biggest disadvantages of HTML is that it can only use one core of a cpu. So, while things have improved over the last few years (because cpu's are getting so much better), it still takes a lot of low level optimization to make a game run smoothly on mobile.

  • pikazho

    Just took a look at your code, and the only big problem I see is that you are setting a text object every tick. That causes major trouble on mobile. Instead, only update the text object when the distance changes. Better yet, use a sprite font... although, with only one text object being rarely updated (only when it needs to change) you will probably not see much difference.

  • pikazho

    Just took a look at your code, and the only big problem I see is that you are setting a text object every tick. That causes major trouble on mobile. Instead, only update the text object when the distance changes. Better yet, use a sprite font... although, with only one text object being rarely updated (only when it needs to change) you will probably not see much difference.

    Thank you very much for your time, I changed my code and just update text when needed! it get a little bit better but the lag is still obvious, my phone is LG G4 with Android OS 6.0!

    so I think its just happened because of html limitations and no way to fix it to bee completely smooth on all devices.

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