Help Solving Android Deployment Lag

Hello everyone,
I wanted to test my RPG Maker MV game on my Android device - Google Pixel 6 and I've encountered very disturbing lag issues.
Now I know this has been addressed on multiple threads as I've read through each and every one of them to try and solve multiple issues I've encountered and all were resolved except for the lag.

I noticed the most noticeable lag occurs when animations are played - Especially during battles.
There is also some small lag when interacting with events that open a message box.
To me, this makes the game pretty much unplayable.

Details about everything I've tried (And haven't tried for a reason):
  • I have approximately 1.2GB of assets which consist of audio and images. I know this is a lot and I have plans to minimize it but I doubt it'll be less than ~800MB as my game is quite big with a lot of content.
    I saw this thread where @Milennin mentioned having the same issues and was recommended to reduce the assets sizes, however that did not solve the issue after reducing ~70-80% files size.
    That's the main reason I haven't tried it, though I do plan to do it anyways for optimization reasons.

  • I have used this guide by @TehGuy (Combined with this guide), without the Google Play Store part, to move all my assets to an OBB file and that seems to have worked as my APK is ~7MB in size and the game works but I did not see any improvement in the lag.

  • All parallel process events have a small "wait 5 frames" to improve performance on all maps.

  • I have a lot of Yanfly's scrips that have some optimizations and have written a lot of code myself and did the best to optimize my own code as well.

  • I know a lot of assets are already cached either by the latest updates to RPG Maker MV or the optimizations done by Yanfly's core plugin so I'm not sure if adding even more caching would help, especially when I've read there's still a limit to the amount of memory allocated to the app even in a relatively strong device as the Pixel 6.

  • As a side note, I've solved all other issues like Iconset size being 4096px in height resulting in black boxes for icons and setting `PRECISION_FRAGMENT` to "highp" to solve the tilesets black lines issue.
Another thing worth mentioning is that I run my game on a very strong PC and relatively weak laptop on battery and I have never encountered anything like the lag I experience.

I'd like to know if anyone has any suggestions on how to solve this as I was really hoping to release it not only for PC...

Thanks in advance for you patience and help.
what android did you test it on and what is their specs?
as if the specs are lower or not the required, it can lag as well.

if you keep the remember the cache to keep in memory, remove those
and try again because I doubt what you did should work.
@ShadowDragon
My Pixel 6 is running Android version 14, 8GB RAM with CPU Google Tensor (5 nm).
Compiled the APK with minSdkVersion = 21, ANDROID_SDK_TARGET = 29.

I ran much more demanding games on it and they worked well so I think the phone should handle an PG Maker game..

Regarding what you mentioned about the cache, I did not make any additional caching than what is already done in the latest RPG Maker MV versions, if that's what you meant.
If not, please explain as I may have misunderstood.

Thank you.
on the phone, you have 3 lines, or dots or something else.
pressing it will open the cache of the android (also know as fast access)
that is last opened, this cache can slow down games too.

but while I don't know the Pixel 6 or CPU name of 5nm, I cannot help you.
as there are tons of game, 8gb ram and 14 should work.

depends on what plugin you use, you can try adding MVCommon or another
to increase the cache limited (default is 1000*1000*1000) if not mistaken.
in the param you can increase it 1000 if it is set to 10-100.

depending what plugin you use, like MrTs_Monsterbook, that plugin has a nasty
bug that can make the game lag fast as there is a fix made for it.

also in Olivia_HorrorEffect is a nasty bug which also has a bug.

if you don't use those 2, and only YEP plugins for example in the correct order,
than I have no idea what it could cause.
Thank you @ShadowDragon .
I checked the cache used by the app and see it's ~300KB. I guess it's because it's just the beginning of the game so nothing was loaded yet but then it appears this isn't the cause for the lag.

I don't use any of the plugins you mentioned.
Mostly Yanfly, GALV and custom made plugins the should not affect performance.

Thank you again
What is the average size of your maps, and how big is your biggest map?
are you using default mapping or is there anything added to the mapping process (Parallax, doodads, external editor,...)

I ran much more demanding games on it and they worked well
doesn't really matter as those other cames are most likely compiled for Android.
RPG Maker is NOT a compiler engine, but an interpreter based engine - actually it's doubly interpreted in case of event code, and that costs a lot of performance.

Which is the reason why you have to keep the limitations of android in mind even before beginning to develop the game, or you end up looking for where the lag comes from.
Thank you @Andar.
The average size of my maps is ~100KB with very big variations - The biggest map is 4.75MB but that's due to lots of events and it was never loaded in my play tests on mobile (I played for 1 minute).

However the first "biggest map" the game actually loads in my play test on mobile is ~70KB and the first map with battles is much smaller than that.

I'm using the default mapping - No Parallax or anything.
Experienced RPG Maker Android dev here. You'd be surprised by how unoptimized most plugins on the forum are (for mobile). Large maps alone don't affect performance as you think they would.

Avoid big sprite files. Mobile can't handle a large sprite sheet. Something above 500x500 that is constantly being called would already give massive lag. Just don't use the default RPG Maker spritesheet animation system lol.
The average size of my maps is ~100KB with very big variations
I wanted to know the mapsize in tiles, not the filesize
Please give both the average and biggest map in tiles (a x b).

While the json files of map data are not compressed and thereby not as badly out of range as picture files, they still do not give a true estimate of the map size due to containing other data like event codes and more.
@SangHendrix Thanks. What about the animations files? They are much bigger, are you suggesting the file sizes are the problem?
I am using a lot of default animation and others that are the same style.

@Andar Sorry. The biggest map is 173x106 but that's really standing out.
The average is about 70x70 - For example the first city which I tested in the play test was 60x40 and the map with the battle testing was 40x39.
Have you tried to pack a small project, which doesn't use any plugin?
It is odd because I have played some MV projects on my phone's browser, and I have never seen notable lags.

You mentioned dialogues also have lags. I only had the problem on some very ancient pc (i3 45xx or something like that, and it's running other programs in the background).
@utunnels Actually you mentioned playing on your phone's browser.
I am talking about an APK but I am definitely considering testing this on some server and seeing if it works as that might suffice (Not sure how that would affect the experience for users though).
@SangHendrix Thanks. What about the animations files? They are much bigger, are you suggesting the file sizes are the problem?
I am using a lot of default animation and others that are the same style.

@Andar Sorry. The biggest map is 173x106 but that's really standing out.
The average is about 70x70 - For example the first city which I tested in the play test was 60x40 and the map with the battle testing was 40x39.

So for example, if you have a 1024x1024 animation spritesheet file running constantly or a lot of animation is being played using said file, it'll overload your mobile device due to it having to load the file and run it again and again, making the fps drops. RPG Maker is extremely bad for mobile development. Barely anyone put their game on mobile so the subject was not widely discussed. I had to create my own animation system using singular frames instead of spritesheets for this matter alone, lol.

Here are my tips for a good performance on mobile:
- Don't use a large spritesheet file, something above 1000x1000 is already large (depending on how powerful the device is). LOTS of people use low-end phones so probably 500x500 is already too big.
- Compressing your file size also helps a little. An extra 2 - 3 framerate is better than nothing.
- Check all your plugins. Optimize any plugins that have a function to update along with the game every frame, these plugins contributed A LOT to your performance failure. They're basically like when you're running parallel events but not all tasks are lightweight. Optimize them by yourself (cuz devs are probably retired).
@SangHendrix Thank you very much!
Interesting insight on the fact there aren't that many mobile deployments...
This makes me think I should attempt using a server and let users run the game from their browser.

It'll probably take some time but I'll go over your tips and see if there's any change.

Thanks again!

Original thread: https://forums.rpgmakerweb.com/threads/help-solving-android-deployment-lag.170259/