How do I handle game lag due to background apps

| | August 8, 2015

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!

2 Responses to “How do I handle game lag due to background apps”

  1. 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.

  2. 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.

Leave a Reply