• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Android Game lagging on high end device!

jazzzar

Member
Ok so I started making my second game and already run into a big problem I guess, the thing is that I already got the game mechanics down and started making some levels and adding stuff, and I decided to test it today on some phones that are available in my house, tested the game on my galaxy S6 and it worked perfectly, 60 fps (almost constant), now I took my brother's phone which is a HTC m10 (also called HTC 10 I guess), and the game is having a bad time there, it starts at 60 fps, and after some seconds drops to 40ish fps for some reason and stays there until he reaches the next level which ofcourse leads to the game actually lagging, and that is really bothering me, so I waited for the galaxy S7 edge to get under my hands to give it a try, and again, the game worked perfectly there, I don't understand now where's the problem, I checked the instance count and there's nothing abnormal, like 450 max for a heavy level I tested and that should be no issue, I really don't feel like converting my whole game to use delta_time now after all this work I've done! I can't imagine how it will run on lower end phones, any help plz?
 

Smiechu

Member
I had the same dillema for 2 months...
And finally ended up with implementing delta time...
The sooner you do this, the better...
And it was not so hard at all... took me 8h together with new movement system which is actually now even better then before DT...
I used free extension from @2drealms called DeltaTimer... available in the market...

Problem with GMS is that it has no support for multithreading... so only thing that counts is the speed of single processor core... so your game will run slower on 8core 1.5GHz CPU than on 2core 2GHz CPU even if the first is theoreticly better...
And in the end... it can happen that somebody has very good phone but has so much junk in the background that the game will lag anyway...

So don't think to much... I don't assume that YYG will implement multithreading any soon... and even then DT is "must have" if you want your game to be close as possible to "pro"...
 

jazzzar

Member
I had the same dillema for 2 months...
And finally ended up with implementing delta time...
The sooner you do this, the better...
And it was not so hard at all... took me 8h together with new movement system which is actually now even better then before DT...
I used free extension from @2drealms called DeltaTimer... available in the market...

Problem with GMS is that it has no support for multithreading... so only thing that counts is the speed of single processor core... so your game will run slower on 8core 1.5GHz CPU than on 2core 2GHz CPU even if the first is theoreticly better...
And in the end... it can happen that somebody has very good phone but has so much junk in the background that the game will lag anyway...

So don't think to much... I don't assume that YYG will implement multithreading any soon... and even then DT is "must have" if you want your game to be close as possible to "pro"...
Oh that's bad, I guess I'm gonna use delta time tomorrow than, gonna be a pain but what can I do :( my first game is working surprisingly well on the mentioned phone, which is really weird, and no one out of 26.000+ people said there's lag with my first game, didn't use delta timing there too! thanks for the input man!
 

Smiechu

Member
Maybe your game was not so complicated?

You may also look if you don't have any big loops? Even if that loop is made every 10-15 frames than GMS slows down FPS to equal the slowest frame...

On the end look also what debugger says about the load and what's causing it...

But like I said... in the end you'll end up with DT anyway...
 

jazzzar

Member
Maybe your game was not so complicated?

You may also look if you don't have any big loops? Even if that loop is made every 10-15 frames than GMS slows down FPS to equal the slowest frame...

On the end look also what debugger says about the load and what's causing it...

But like I said... in the end you'll end up with DT anyway...
True, thanks for your input!
 

jazzzar

Member
Maybe your game was not so complicated?

You may also look if you don't have any big loops? Even if that loop is made every 10-15 frames than GMS slows down FPS to equal the slowest frame...

On the end look also what debugger says about the load and what's causing it...

But like I said... in the end you'll end up with DT anyway...
So a little update on that, as I gave up and started implementing delta time, I got my hands on an old samsung galaxy S3 which is a 2012 phone, it was the beast of it's time, and for the surprise, the game ran 60 fps on that, I guess there's a problem with game maker on htc phones if i'm not mistaken, as every other heavy 3D game runs very well on that phone so I don't think a simple game maker game is gonna lag on it, I won't use delta time because if an 2012 phone handles the game, no problem with it, but with the phone or game maker engine itself!
 
M

Matt Hawkins

Guest
Do you have application surfaces enabled? because if you do it will make android games lag badly.
If you put this code in your room creation code it will disable application surfaces.
application_surface_enable(false)
 

DukeSoft

Member
Enable the debug draw and see if the red or the yellow bar is big. If the yellow bar is big its drawing functions slowing it down, otherwise its CPU.

Be aware that some simple drawing functions (blend modes for example) are killers for mobile devices.

EDIT: Also, mobile phones are not big fans of texture swaps, so try to prevent that as much as you can.
 

jazzzar

Member
not all smartphones can bring you 60 fps, most smartphones run with max 45 fps.
but it's a high end phone, a 2016 flagship, and it's specs are more than enough to run almost anything, so I doubt that!
In the end... it's up to you to make the decision...
Thanks anyway man!
Do you have application surfaces enabled? because if you do it will make android games lag badly.
If you put this code in your room creation code it will disable application surfaces.
application_surface_enable(false)
Oh totally forgot about that, will definitely give it a try! thanks for the heads up!
Enable the debug draw and see if the red or the yellow bar is big. If the yellow bar is big its drawing functions slowing it down, otherwise its CPU.

Be aware that some simple drawing functions (blend modes for example) are killers for mobile devices.

EDIT: Also, mobile phones are not big fans of texture swaps, so try to prevent that as much as you can.
Thank you, will try that!
 

jazzzar

Member
Do you have application surfaces enabled? because if you do it will make android games lag badly.
If you put this code in your room creation code it will disable application surfaces.
application_surface_enable(false)
tried it, and sadly it had no effect whatsoever!
Enable the debug draw and see if the red or the yellow bar is big. If the yellow bar is big its drawing functions slowing it down, otherwise its CPU.

Be aware that some simple drawing functions (blend modes for example) are killers for mobile devices.

EDIT: Also, mobile phones are not big fans of texture swaps, so try to prevent that as much as you can.
well it begins normally nothing unusual (60 fps) and the debug bar looks fine, however when the fps drops to 49 constant, I see lots of grey which, in reference to game maker manual indicates that :
Grey - The time required to clear screen each draw step
so any idea what might be the problem?
EDIT : and on my S6 with a stable 60 FPS, the dominant color is white, and got no problems!
which phone got this trouble? do you got the full name of it?
the device is a HTC 10 also called HTC m10, the model number is HTC 10 too for some reason, while my galaxy S6 is SM-G920F I dunno how HTC works with that
 

jazzzar

Member
HTC 10 series is nailed to 50 fps, but i can hickup after around 20 secs to 60 for short time.
Oh how dumb am I? just after reading your comment, a quick google search revealed that the phone is indeed locked at 50 fps, enabling high performance in developer options fixed that! now fps is stable 60, what a stupid move by HTC tho!
 

Bingdom

Googledom
I did a quick lookup on this.

This might be something to do with a power saving feature on the HTC 10.

You could try this;
Code:
os_powersave_enable(false);
Or, go into developer options on the phone and enable high-performance mode.
[Source]

Edit: Ninja'd
 

Jabbers

Member
It sounds like you have solved your problem, but I just want to add a few notes here...

but it's a high end phone, a 2016 flagship, and it's specs are more than enough to run almost anything, so I doubt that!
Don't overestimate the gaming capability of your phone. High end smartphones are incredible little computers that are very capable, but they are still mobile devices, and you must not be wasteful when developing a game. Furthermore, if you have any intention of releasing this game, you should develop it to run on low to mid-range devices. It is no good releasing a product that your average person cannot play.

Also, here are some standard things to check if your mobile game is running slow, for anyone who is still dealing with a similar issue:
  • Do you have too many sound emitters?
  • Are you using huge surfaces, e.g in a lighting engine that isn't optimised for mobile?
  • Do you have lots of big sprites and backgrounds? Are you using large amounts of texture pages, and are your pages bigger than 1024x1024?
  • Is there a memory leak? Are you cleaning up data structures, sounds, imported sprites / backgrounds, and handling persistent objects correctly?
 

DukeSoft

Member
Also note that some phones might give 100% until it gets too warm, then it will downclock computational units to prevent overheating.
 

jazzzar

Member
I did a quick lookup on this.

This might be something to do with a power saving feature on the HTC 10.

You could try this;
Code:
os_powersave_enable(false);
Or, go into developer options on the phone and enable high-performance mode.
[Source]

Edit: Ninja'd
Appreciate your effort anyway!
It sounds like you have solved your problem, but I just want to add a few notes here...



Don't overestimate the gaming capability of your phone. High end smartphones are incredible little computers that are very capable, but they are still mobile devices, and you must not be wasteful when developing a game. Furthermore, if you have any intention of releasing this game, you should develop it to run on low to mid-range devices. It is no good releasing a product that your average person cannot play.

Also, here are some standard things to check if your mobile game is running slow, for anyone who is still dealing with a similar issue:
  • Do you have too many sound emitters?
  • Are you using huge surfaces, e.g in a lighting engine that isn't optimised for mobile?
  • Do you have lots of big sprites and backgrounds? Are you using large amounts of texture pages, and are your pages bigger than 1024x1024?
  • Is there a memory leak? Are you cleaning up data structures, sounds, imported sprites / backgrounds, and handling persistent objects correctly?
True, and I didn't overestimate it, I was just trying to give the impression of something being wrong, when an old flagship like samsung galaxy S3 is having no problem, and a new 1 year old is having problems, but what you said is very true indeed, and great tips too! none of them is existing in my game tho! most of lighting engines I used doesn't work on android so I try to stay away from that! Thanks for your input man!
 

jazzzar

Member
Ah. You could check out Nocturne's Aura lighting engine. In my opinion it's the best one around. It supports mobile devices.
yeap I bought glare engine which actually is a great engine but only works on PC as far as the tests I've done indicated! and the CBNA one is pretty old and doesn't do well on android as well! might try Aura engine, and it's only 8 bucks so seems like a good deal! don't need lighting for my game right now maybe for future ones!
 
Top