• 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 Simple game lags too much

sercan

Member
Hi friends. I am working on a very simple game. It works fine with testing on pc but when it comes to android device it is lagging on phone. I have samsung s8 plus so no doubt about device performance. I use game maker studio 2. In one room there are only two of moving objects. I use 1920x1080 resolution for my game and my sprites are quite simple. There are nothing being created by any step event. Just two objects moving from left to the right. What may cause this problem. Anything can be about export settings? Please give any ideas. That kind of simple game should not lag that much.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
A lot of Android devices are FPS capped, and in my own experiments I found a number of devices seemed locked to 45fps maximum. What FPS are you getting? What is the game speed set to? In general, when I dev for mobile I only ever use 30FPS, especially with how fragmented the market is and how many low end devices there are out there. Oh, there is ONE thing I've seen that can get a full 60fps for some people and that's to disable the application surface and use the back buffer for drawing instead. This means that you can no longer use the fixed aspect ratio option in the game options, but for mobile that probably shouldn't be getting used anyway....
 

sercan

Member
I undeestand but I dont think it is about fps because a year ago i made a game published on google play. Game speed was 60. With same android device i faced no problem. And never heard anyone faced. And that game was even using physics. Now I think i am missing something on build options. Or it is about resolution. No idea. Will check settings i hope i can find something. Thank you.
 

TsukaYuriko

☄️
Forum Staff
Moderator
Hang on - you say that the game is lagging, then state that you don't think it's about FPS. If it's not about FPS, then what problem are you facing that could be described as "lag"?
 

8BitWarrior

Member
I'm guessing it's the resolution+application surface. If you don't want to disable the application surface, at least try something like the following to see if it improves performance...

// Call once at start of game
surface_resize(application_surface, 1280, 720);

This will effectively lower the output resolution of your game.
 

sercan

Member
Hang on - you say that the game is lagging, then state that you don't think it's about FPS. If it's not about FPS, then what problem are you facing that could be described as "lag"?
I ment room speed and you should have understood that. Nocturne had an idea about room speed setting and i sad i had same speeds in my previous games with no lagging. Im looking for the reason causes the low fps. I expected some advices about resolution or build setups etc. instead of mentioning about lag-fps relationship.

I'm guessing it's the resolution+application surface. If you don't want to disable the application surface, at least try something like the following to see if it improves performance...

// Call once at start of game
surface_resize(application_surface, 1280, 720);

This will effectively lower the output resolution of your game.
Thanks for suggestion. I ll look.
 

TsukaYuriko

☄️
Forum Staff
Moderator
I ment room speed and you should have understood that. Nocturne had an idea about room speed setting and i sad i had same speeds in my previous games with no lagging. Im looking for the reason causes the low fps. I expected some advices about resolution or build setups etc. instead of mentioning about lag-fps relationship.
*raises hands in the air* I'm terribly sorry! Guilty as charged! Please don't shoot. :p


It still sounds contradictory to me. Room speed is the target FPS. If your room speed is 60 FPS, your game will attempt to achieve 60 FPS. Room speed is also static, so regardless of what your actual FPS is, your room speed stays 60 FPS if you set it to that. Room speed can, by definition, not be affected by lag, as it can not change unless the user changes it.

If you're expecting clear-cut answers, you will have to provide clear-cut information - which is why I'm asking you about it - as it's close to impossible for us to find the source of a problem when we don't know what the problem is. All we can do in the current state - as you can see - is guessing, which may or may not lead to a solution.

Would it be possible to upload a video that showcases the problem? This way, we will be able to see it on our own and there will be no room for misunderstandings from either side.
 

sercan

Member
*raises hands in the air* I'm terribly sorry! Guilty as charged! Please don't shoot. :p


It still sounds contradictory to me. Room speed is the target FPS. If your room speed is 60 FPS, your game will attempt to achieve 60 FPS. Room speed is also static, so regardless of what your actual FPS is, your room speed stays 60 FPS if you set it to that. Room speed can, by definition, not be affected by lag, as it can not change unless the user changes it.

If you're expecting clear-cut answers, you will have to provide clear-cut information - which is why I'm asking you about it - as it's close to impossible for us to find the source of a problem when we don't know what the problem is. All we can do in the current state - as you can see - is guessing, which may or may not lead to a solution.

Would it be possible to upload a video that showcases the problem? This way, we will be able to see it on our own and there will be no room for misunderstandings from either side.
I know it sounds weird. I set the room speed 60 and expect to have that speed in game on my android device. I always use 60 room speed and never faced this issue before even with my older devices with lower cpus or other performance parameters.
Think of a simple room of 1920x1080 and a box moving to left with speed of 10. I have begin step and hspeed=10 thats all. On my device the game runs slowly. Not consistently, barely i get the performance i expect. There looks like something causing my game runs slowly other than room speed value. This is first time i use this resolution(1920x1080). I always worked on pc before getting android export. So if there are other options to try i want to check them before i start to re-develop it with lower resolution.
 

Pushloop

Member
Are you running ads? My games are slow at the start, you really notice it when the ads are loading in the background, it's shaking and stuttering.
 

sercan

Member
Are you running ads? My games are slow at the start, you really notice it when the ads are loading in the background, it's shaking and stuttering.
no not yet. im getting average 200 fps and 55 mb memory in debugger. my object is supposed to go consistently with speed of 15 but looks like it goes 15 for a second and slower ( 5-10 ) for a few seconds. sometimes i feel like it stops and goes again for a moment. really weird. it is like you play a game with thousands of objects moving but there is only one.
and this is the code for it. cant be more simple.

create
a=10;
hspeed=0;

if(obj_bitis.bitis==1 || obj_bitis.bolumsonu==1)
{
hspeed=0;
image_alpha-=0.03;
}
else
{
hspeed=a;
}

I disabled the app surface. it didnt work. Built with all 4 proccesor types and still same. I cleaned all background and made the code as simple as it can be. still didnt work. I dont know what to do next.
 
M

MishMash

Guest
The Galaxy S8 is definitely capable of running at 60fps @ 1080p, though the maximum possible FPS the device can support is 60. The setup you have "should" be fine, however, it does sound like something odd is going on. For a first test, I would try enabling Vsync. All android devices have an implicit vsync, therefore there is no additional penalty to having it enabled (unlike on PC), as Android apps should generally be set up with Triple Buffering.

What I would try however is first attempt to verify that what you are visually seeing is indeed what is happening. You can download GameBench: https://developer.samsung.com/game/bench to get an external FPS measure (which won't be affected by any data GM reports).

Secondly, many smartphones have power saving features that will determine how expensive apps are and therefore choose how much power to use. Sometimes, if an app is really simple, the phone ends up running in the equivalent of low power mode because it doesn't think it needs much horsepower. The downside is that this can sometimes negatively impact simple apps which are targetting consistent performance. This is unlikely to be the case, but a simple test would be to make the app a bit more complex (create a demo, chuck in physics, lots of objects etc) and see if that one still lags.

Also, out of interest, how do other games run on your phone? (Just ruling out the possibility of it being related to background apps)
 

sercan

Member
The Galaxy S8 is definitely capable of running at 60fps @ 1080p, though the maximum possible FPS the device can support is 60. The setup you have "should" be fine, however, it does sound like something odd is going on. For a first test, I would try enabling Vsync. All android devices have an implicit vsync, therefore there is no additional penalty to having it enabled (unlike on PC), as Android apps should generally be set up with Triple Buffering.

What I would try however is first attempt to verify that what you are visually seeing is indeed what is happening. You can download GameBench: https://developer.samsung.com/game/bench to get an external FPS measure (which won't be affected by any data GM reports).

Secondly, many smartphones have power saving features that will determine how expensive apps are and therefore choose how much power to use. Sometimes, if an app is really simple, the phone ends up running in the equivalent of low power mode because it doesn't think it needs much horsepower. The downside is that this can sometimes negatively impact simple apps which are targetting consistent performance. This is unlikely to be the case, but a simple test would be to make the app a bit more complex (create a demo, chuck in physics, lots of objects etc) and see if that one still lags.

Also, out of interest, how do other games run on your phone? (Just ruling out the possibility of it being related to background apps)
Thanks for reply. I will try the first point you touched.
For your second point, i tried the game with other phone huawei p20 lite. First 4 or 5 levels everything was ok. I wasnt facing the problem i mentioned. but later it suddenly dropped to something like getting 30 fps instead of 60. This was different from my problem on s8. I think it is about what you say on lowering the performance, so i guess you are right there. Really tough point to get over.
I play other games without any problem by the way. Pubg with hd mode it is pretty fine. And some other simple games are still ok.
I feel frustraited and the thing in my mind is rebuilding the game with lower resolution. Just to see the difference. Didnt think that making a simple game is ti be that complex:)
 
M

MishMash

Guest
Thanks for reply. I will try the first point you touched.
For your second point, i tried the game with other phone huawei p20 lite. First 4 or 5 levels everything was ok. I wasnt facing the problem i mentioned. but later it suddenly dropped to something like getting 30 fps instead of 60. This was different from my problem on s8. I think it is about what you say on lowering the performance, so i guess you are right there. Really tough point to get over.
I play other games without any problem by the way. Pubg with hd mode it is pretty fine. And some other simple games are still ok.
I feel frustraited and the thing in my mind is rebuilding the game with lower resolution. Just to see the difference. Didnt think that making a simple game is ti be that complex:)
So the "simple" workaround, if this is the case, is just to introduce a dummy routine that keeps the CPU busy (Perhaps doing a short loop of computation each frame in the step even). That doesn't mean maxing out the CPU as such, but just providing a consistent bit of workload that keeps things ticking over. When your game gets more complex, it'll naturally incur a higher performance cost and thus this shouldn't be an issue. Naturally, I know that sounds like super counter-intuitive advice, but it can be enough to stop those power saving modes kicking in.

Another explanation for this is that both the Galaxy S8 and the P20 Lite have split cpu clusters, with 4 cores being high power and 4 being low. If the OS decides that an app is not intense, the slowdown may be the result of it flicking it over to the low-power cores. (These were initially designed for the high volume of small background tasks smartphones have).
 
Top