Help me solve the lag in my game

Discussion and feedback on Construct 2

Post » Mon Mar 06, 2017 8:06 am

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
Last edited by pikazho on Mon Mar 06, 2017 10:06 am, edited 1 time in total.
B
8
S
2
Posts: 16
Reputation: 530

Post » Mon Mar 06, 2017 8:45 am

@pikazho

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

how-do-i-stop-the-lag-from-the-endless-runner-template_p1095763?#p1095763

Also, I wouldn't call that a platform game, more like an endless flyer.
Last edited by OddConfection on Mon Mar 06, 2017 2:08 pm, edited 1 time in total.
Find all the Construct 2 games that were on Steam Greenlight here
B
36
S
10
G
7
Posts: 478
Reputation: 7,021

Post » Mon Mar 06, 2017 9:29 am

@OddConnfection
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!
B
8
S
2
Posts: 16
Reputation: 530

Post » Mon Mar 06, 2017 9:30 am

OddConfection wrote:@pikazho

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

how-do-i-stop-the-lag-from-the-endless-runner-template_p1095763?#p1095763

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!
B
8
S
2
Posts: 16
Reputation: 530

Post » Mon Mar 06, 2017 2:03 pm

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.
B
99
S
35
G
20
Posts: 438
Reputation: 17,910

Post » Mon Mar 06, 2017 2:31 pm

@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.
B
99
S
35
G
20
Posts: 438
Reputation: 17,910

Post » Sat Mar 11, 2017 4:58 am

AllanR wrote:@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.
B
8
S
2
Posts: 16
Reputation: 530


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 5 guests