1
\$\begingroup\$

I'm developing a game using libgdx and have noticed on several occasions that other background apps running can cause lag in my game - especially when those apps are being updated in the background. I'm talking serious lag like from 50-60 fps down to under 10 fps while the other app installs.

How should I handle this very noticeable lag?

Thanks!

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

Of course if other apps are being installed while the user is playing your game it will lag. I don't think there's anything you can do about that since it is a function of the Android settings and not your game. Usually other apps do not take much processing power away from the current visible app. Maybe you personally have too many aggressive apps on your phone or you have an older phone that lags more readily.

\$\endgroup\$
6
  • \$\begingroup\$ I guess I should have said when background apps are running I see a small but consistent hit to fps like from 60 --> 58ish. But when an app gets updated in the background I see a HUGE hit down to less than 10 fps and then back up to the normal 50-60ish. \$\endgroup\$ Oct 10, 2014 at 20:43
  • \$\begingroup\$ I've never experienced a huge hit like that. I think it may be an Android user setting to define when it's okay to download and upgrade an app. For example I'm pretty sure mine only update automatically when wifi is available. I think you can even turn off automatic updating. In any case, I'm pretty sure it's not something your app should be able to control. \$\endgroup\$ Oct 10, 2014 at 20:51
  • \$\begingroup\$ I know its something I can't control but I was looking for was to deal with it better rather than just have my player randomly update, stutter across the screen and die. I was thinking to have it automatically go to a pause menu if it detects the fps is below a certain threshold but I wasn't sure if that would be more disruptive than just letting the lag happen for like 5 seconds. \$\endgroup\$ Oct 10, 2014 at 20:54
  • \$\begingroup\$ If you want to pause the screen on lag, you could measure the time between updates (I'm sure you update your game engine based on time already). Average the time deltas over a few seconds and if it's higher than a certain number you could pause the screen or do whatever you want to do. Like you said, that might be annoying to some users. Also, if someone's phone is just plain slow, it might end up pausing their game all the time. I, personally, wouldn't worry about it until your players complain about it. \$\endgroup\$ Oct 10, 2014 at 21:01
  • \$\begingroup\$ This is a great UX question but it is not such a good one for this site's community. It does fit the site however. I think if you pause the game unexpectedly and then resume it will confuse the player. \$\endgroup\$
    – AturSams
    Oct 11, 2014 at 4:07
0
\$\begingroup\$

I think you need to figure out why this is happening. Can you reproduce the behavior by creating a daemon app and letting it run in the background? Do other games respond the same way exactly? If not then why is your game slowing down so dramatically is the question and it's a debug question.

  1. If you let the game continue as normal, it will probably highly increase the chances that the player will lose the game. This will cause frustration.
  2. If you pause the game automatically it will possibly disrupt the player.

What you could consider is accepting more vague and inaccurate input from the user as correct input during this lag and when it occurs.

For instance, if the play had to touch the screen on the left between 7.3 and 7.7 seconds into the stage the give the player a wider time frame. This is hard to do but I feel it is more suitable than the other two options namely doing nothing & pausing.

Alternatively, you could simply slow down the gameplay pace when framerate drops beyond a certain point like under 30fp, you could slow down the gameplay according to the fps rate.

\$\endgroup\$
7
  • \$\begingroup\$ Slowing down the game is a good idea. But I disagree that a pause screen is a stronger disruption than lagging to death. \$\endgroup\$
    – v.oddou
    Nov 10, 2014 at 6:09
  • \$\begingroup\$ @v.oddou It is hard to say, I have never played a game that "lags to death" at any point of my life. However, I did play games that sometimes lag rather severely and having these pause would have interrupted my gameplay and break my immersion completely. It would feel like I'm being punished for my mediocre hardware or worse, the mediocre programming skills of the game designer. \$\endgroup\$
    – AturSams
    Nov 10, 2014 at 6:59
  • \$\begingroup\$ If you can check a "never bother me with this punishment again" box, would that save the day or not ? \$\endgroup\$
    – v.oddou
    Nov 11, 2014 at 0:53
  • \$\begingroup\$ lagging to death happens, for example in fast paced online shooters, at the time when internet connections weren't so great, having 200ms of ping meant you died all the time. In a PC car game, sometimes for unknown reason you can get a huge freeze, like 2 seconds, e.g. because windows decided to swap out something (or whatever), the game always run the physics fully even when it does not have time to display frames, the next time you see something you're crashed on the fence. This would obviously also happen with small platformers in case enemies are engaging etc etc \$\endgroup\$
    – v.oddou
    Nov 11, 2014 at 0:56
  • \$\begingroup\$ @v.oddou I am 32 so I played ID Software's Quake in 96-99 and I'm familiar with network lag but I don't think that's the case this person is describing. I disagree about "small platformers", there is no reason why they would lag severely. I never experienced the issue with any platformer I ever played. In fact the only way I could get a platformer to lag is by running other processes in the background intentionally. \$\endgroup\$
    – AturSams
    Nov 11, 2014 at 3:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .