How to Fix Game Lag in Android?

aroha

Veteran
Veteran
Joined
Apr 29, 2019
Messages
41
Reaction score
7
First Language
Chinese
Primarily Uses
RMMV
My game has received a lot of player returns lag since its launch. How can I fix it?

This is my game:
google play
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
3,714
Reaction score
4,675
First Language
English
Primarily Uses
RMMZ
Lol there is no general fix to "Lag". Lag can occur for different reasons at different places in different games. Lag can be caused by:
  1. Insufficient hardware.
  2. Non-optimized code.
  3. Caching problems.
  4. etc.
If the issue is simply hardware, then nothing you can do. Just think about it, Final Fantasy 15 cannot run on a lot of machine and necessitates a minimum of processing power. Although the power required to run a RPG Maker game is much less, it's the same principle. If the phone isn't powerful enough, it will lag.

As for optimization problem, then you should be able to fix it, but it will not be easy. Check for the number of parallel processes, the size of your maps, the number of events, etc. A map of more than 50x50 tiles will usually lag on mobile. It could also be due to a plugin and how the logic is coded. Sometimes the programmer hasn't coded the most lightweight way to execute a certain function. For that, you'll need to be a programmer to fix unfortunately.

Caching is the game loading assets into memory to be used by the CPU. If the memory is full, for example due to a memory leak, or simply due to the fact that you're loading too many stuff into memory and exceeding capacity (remember, although most computers have 8GB or even 16GB of ram, phones can somtime have 2GB or 3GB of ram in total, and the OS can take up more than half of that).

So to conclude, there's not one way only that lag occurs, and we can't know for sure what is the cause of lag in your game.
 

aroha

Veteran
Veteran
Joined
Apr 29, 2019
Messages
41
Reaction score
7
First Language
Chinese
Primarily Uses
RMMV
Caching is the game loading assets into memory to be used by the CPU. If the memory is full, for example due to a memory leak, or simply due to the fact that you're loading too many stuff into memory and exceeding capacity (remember, although most computers have 8GB or even 16GB of ram, phones can somtime have 2GB or 3GB of ram in total, and the OS can take up more than half of that).
Is there any way I can check the operation of the game on the phone?
For example, check if the memory is full?
 

jkweath

Goes Fast
Veteran
Joined
Sep 21, 2016
Messages
357
Reaction score
546
First Language
English
Primarily Uses
RMMV
On mobile right now so I can't give you an in depth reply, but for one: the lighting plugin. This will absolutely slow down the game a ton on any device that isn't mid-high end ($200+ at minimum). In general no low-end or cheap device can run RPGM games no matter what, so if you don't set your game up so those users can't download it, they will do so and then leave bad reviews.

I've written about it on my website (jkgames.net) if you're interested in learning more about mobile performance for MV games.
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
3,714
Reaction score
4,675
First Language
English
Primarily Uses
RMMZ
Code:
window.nw.performance.memory
This little line of code should access the cache usage, which you can write in any plugin or directly into the console. You can also check it directly into the console (F8 or F12) when you playtest it on your computer. I'm not sure it is possible to access the console on mobile or not (I have never tried, but the console isn't there in any deployed version by default that's for sure).
 

kako05

Veteran
Veteran
Joined
Sep 11, 2017
Messages
160
Reaction score
18
First Language
Australian
Primarily Uses
RMMV
What mostly causes lag is faulty plugins, bad eventing, lots of parallel events and big world map especially if you do complex parallax mapping with layers, etc. My own game which is pretty complex and runs ~100 plugins with animated busts etc. works pretty well (not perfectly, but good) on my $200 phone which I brought 2 years ago, but it plays more like VN novel/manager game.
The worst performance killers from my experience are parallax mapping and combat. And of course plugins. Some even very popular ones are not very well made and I would say highly hazardous for the projects since they cause memory leaks and game crashes. You can test on android studio turning on/off some of them to see if it changes performance.

As it was mentioned, I read that lightning plugins slow down the performance a lot. I would test performance starting that.
 

Failivrin

Final Frontiersman
Veteran
Joined
Jan 31, 2017
Messages
249
Reaction score
236
First Language
English
Primarily Uses
RMMV
Out of curiosity, has anyone tried a large map that's mostly empty space? My game has a 100x100 map, but most of it is just the Night Sky parallax background (the setting is outer space). Not sure if this would cause significant lag?
 

Black Pagan

Veteran
Veteran
Joined
Feb 21, 2017
Messages
350
Reaction score
271
First Language
English
Primarily Uses
RMMV
Also, I think there was an issue of Intense Lag related to a Water Tileset, Not sure if they fixed it in the Latest version. I have a Japanese Plugin to fix this (Plugin is in Japanese), Got it for free when i got my FSM - Woods & Cave DLC.
 

Isaac The Red

RedMage
Veteran
Joined
Jan 3, 2016
Messages
207
Reaction score
117
First Language
Gibberish
Primarily Uses
While there are many things that will contribute to lag, one major thing you can do for a game you plan on releasing on Android is minimize your file sizes. Lower bitrate audio, lower the quality a bit on resources... hum.. like in Photoshop, when saving, there is a save for web option that has specific settings that doesn't really lower the visible quality but reduces the file sizes significantly. phones often run with minimal ram available. I would expect between 2 and 4 GB of ram to be the average. not everyone is rocking a flagship 8 - 12 GB $1000 phone.

By minimizing these filesizes things in general should load faster, and by impacting ram less, some lag caused by such things can be mitigated. I do however recommend testing on a variety of devices before publishing to any platform as a general rule. I test on my note 9, an LG Stylo 2, and an older HTC phone. if it at least runs good on the LG and my note I am happy. if I can manage it running great on my old HTC as well thats great and means I could have the broadest userbase.

the default resources have reduced file size versions available in your dlc folder if your a steam user. you will have to do this on your own for dlc or custom resources of course.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,310
Reaction score
7,644
First Language
German
Primarily Uses
RMMV
@Failivrin that would depend on the picture used in the parallax, because that would be the most resource-intense part of such a map. A small but repeating night sky would be no problem, a larger one could cause lag.

@Black Pagan that was not a tileset, it was the way water was animated in the regular tilesets of version 1.0 of the engine. was solved with one of the updates years ago (current version is 1.6.2 after all).

In general, what people often forget is that lag is additive and that all devices have some reserves before lag becomes visible. The last changes before lag becomes detectable aren't always the biggest problem, they might just have been the minor additive lag that pushed the device beyond its reserves.

That said, in most mobiles those reserves are low to non-existant, making anything that creates lag directly important.
Basically to get a game to work on mobile without lag, you'll have to keep the deployment in mind from the get-go and consider everything you add to your game from a perspective of lag if you want to deploy to mobile.

Some Lighting plugins have been known to create lag in computer-deployments and even the best of them are a strain on the resources, so they are not to be advised for mobile use. Same goes for large parallaxes.
However what can be used is parallax maps that are limited to screen size. Yes, that is rather small for maps (especially as you should keep this near default screen sizes, not 4K-screens) but it can be handled - after all most mobiles can display pictures to their screens.
But you can't go much farther than that because the RAM-requirements for pictures go really up with the size, and for parallax mapping you usually need to display two or three pictures at the same time (ground and top and sometimes shadows, and again mobiles are only intended to display one picture at a time under regular use, which is why that strains RAM as well).
 

aroha

Veteran
Veteran
Joined
Apr 29, 2019
Messages
41
Reaction score
7
First Language
Chinese
Primarily Uses
RMMV
Code:
window.nw.performance.memory
This little line of code should access the cache usage, which you can write in any plugin or directly into the console. You can also check it directly into the console (F8 or F12) when you playtest it on your computer. I'm not sure it is possible to access the console on mobile or not (I have never tried, but the console isn't there in any deployed version by default that's for sure).
This code didn't work, and showed errors
"Uncaught TypeError: Cannot read property 'memory' of undefined"
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
3,714
Reaction score
4,675
First Language
English
Primarily Uses
RMMZ
@aroha It's the number of bytes used in memory.

  • rss stands for Resident Set Size, it is the total memory allocated for the process execution
  • heapTotal is the total size of the allocated heap
  • heapUsed is the actual memory used during the execution of our process
  • external is, according to the documentation, the memory used by “C++ objects bound to JavaScript objects managed by V8”
Yours seem a bit high compared to my projects, but it shouldn't be too problematic I think. But perhaps on mobile it might put a strain, although I have no idea since I'm not much of a mobile guy. Your lag is probably due to CPU usage more than memory usage.
 

Jilmer_Juan

Warper
Member
Joined
Apr 6, 2020
Messages
4
Reaction score
0
First Language
Filipino
Primarily Uses
RMMV
My game has received a lot of player returns lag since its launch. How can I fix it?

This is my game:
google play
Not related to your question... but how did you manage to put 340MB apk size ng Androod store? Thanks.
 

kako05

Veteran
Veteran
Joined
Sep 11, 2017
Messages
160
Reaction score
18
First Language
Australian
Primarily Uses
RMMV
Not related to your question... but how did you manage to put 340MB apk size ng Androod store? Thanks.
Turn off the lightning plugin and other stuff that eats performance. Usually, mobiles are not as fast as desktop PC and MV isn't known for good performance despite it's advertised as "For mobiles".
Big maps 50x50+, events, and plugins are performance killers, especially true on lower-end PC/laptops/mobile devices.
Also, avoid using too many parallel events, especially without the "wait" command as they will add lag significantly (depending on how your event them).
Other than that, nothing can't be done as the engine itself performs poorly.
 

aroha

Veteran
Veteran
Joined
Apr 29, 2019
Messages
41
Reaction score
7
First Language
Chinese
Primarily Uses
RMMV
Not related to your question... but how did you manage to put 340MB apk size ng Androod store? Thanks.
Reduce the size of pictures and music as much as possible, and upload them as obb
 

Jilmer_Juan

Warper
Member
Joined
Apr 6, 2020
Messages
4
Reaction score
0
First Language
Filipino
Primarily Uses
RMMV
Reduce the size of pictures and music as much as possible, and upload them as obb
Thanks! The difficult part is converting it to OBB? How did you managed it? Thanks in advance.
 

aroha

Veteran
Veteran
Joined
Apr 29, 2019
Messages
41
Reaction score
7
First Language
Chinese
Primarily Uses
RMMV
Thanks! The difficult part is converting it to OBB? How did you managed it? Thanks in advance.
Maybe you can try this
 

Users Who Are Viewing This Thread (Users: 0, Guests: 2)

Latest Threads

Latest Profile Posts

Hope you are all fine today~
Moderators, you must have so much patience to be able to deal with everything. I mod in a server of sorts and today we just got a message, which, despite it's helpful constructive criticism, basically stated that all of the mods were jerks and that was the only reason our server was unlikeable. So, thank you, for having patience. You are appreciated! :kaoluv:
Haired slime? Trying some different styles of art. Maybe I can make some resources with this new kind of painting.......
i love my game very much

Forum statistics

Threads
105,737
Messages
1,015,974
Members
137,417
Latest member
Knife77
Top