Performance problems with android deployment.

● ARCHIVED · READ-ONLY
Started by Koder 17 posts View original ↗
  1. I have a problem with android deployment of demo of my game.


    I'm deploying with Crosswalk, reference device is Samsung GT-I9300 (aka Galaxy S3) - that's slowest hardware I'm targeting to support. Unfortunately, performance is uneven at best. Initial, vanilla deployment (with all plugins disabled) worked at uneven 15 FPS with drops below 1 FPS in some cases - especially playing combat animations and on fist few steps on any map. Also, only BGM was playing - no other sounds whatsoever. With plugins enabled FPS dropped below 10.


    I have performed following tests and actions. Some of them actually had results to share:


    1. Downgraded Crosswalk to 18.48.477.13. This worked around sound issue. It seems that newer versions of Crosswalk have some issue with playing WebAudio.


    2. Upgraded Pixi to 4.1.1. This was a hit, instant ~50% performance boost. Game is now running at 22-25FPS on the average, with drops to ~10FPS in first few steps on the map, but there are spikes down to below 1 FPS when playing combat animations.


    3. Optimized parts of core engine. Specifically, changed few instances of this.children.forEach to simple loops. While forEach is more elegant, it's not as efficient. This yield ~20% performance gain, up to 25-30FPS.


    4. Forced WebGL renderer and disabled GPU blacklist. This was disaster, WebGL is actually slower on GT-I9300 (framerate dropped down to below 10FPS) and it crashed frequently.


    I'm testing with following plugins:

    Spoiler
    • "TerraxLighting" (modified for performance, gives ~5FPS performance hit)
    • "YEP_CoreEngine"
    • "YEP_BattleEngineCore"
    • "YEP_X_AnimatedSVEnemies"
    • "YEP_BattleStatusWindow"
    • "YEP_ElementCore"
    • "YEP_VictoryAftermath"
    • "YEP_X_AftermathLevelUp"
    • "HIME_GameOverEvents"
    • "YEP_CreditsPage"



    For now, my biggest issue is a lag when playing combat animations. I get one or two frames at most, and sometimes lag measured in seconds, which is a game-breaker level issue. This happens both in and out of combat. Curiously, some of the combat animations play smooth, ie: default "Ball of Light" (Light4.png)
  2. lag is usually caused by events, especially parallel process events, not by plugins.


    You have to check for those options, especially in common events, because the PC has a lot more power reserves and can handle suboptimal parallel processes.


    But you have to find out if the problem is really lag, or if it is loading times - especially if it happens on the first seconds of a map only, that sounds as if it is loading delays for resources
  3. Andar said:
    lag is usually caused by events, especially parallel process events, not by plugins.



    I don't have any parallel process events. I mentioned plugins only for sake of completeness.


    This does indeed sound like loading times, I'll investigate in this avenue. Perhaps pre-loading some of resources will help.


    My real problem is lag when playing combat animations, it freezes game for 1-2 seconds.
  4. Is this made in manual process?
  5. Linard said:
    Is this made in manual process?



    I'm not sure what you mean.


    This is the profiler output during combat:

    Spoiler
    animation combat profile - zoom.png


    animation combat profile - all.png



    I'm noting that there is a lot of time spent in Sprite._executeTint / drawImage. Perhaps this is a clue?
  6. Andar said:
    But you have to find out if the problem is really lag, or if it is loading times - especially if it happens on the first seconds of a map only, that sounds as if it is loading delays for resources

    I just checked that no resources are being loaded during mentioned lagging.
  7. I just tried decreasing resolution down to 640x360 (which should be acceptable on phone), but it doesn't seem to impact performance all that much.


    Problem with combat animations is most probably caused by compositing multiple sprites on top of each other. Merging them into single sprite should help, but it's a lot of work. Is there a chance to get this kind of export from MV? It has all the data to make composition.
  8. @Koder: Sorry sir, What i mean is what kind of method did you follow? it's a Intel XDK or The manual method which uses python to compile APK? Thanks again.
  9. Linard said:
    What i mean is what kind of method did you follow? it's a Intel XDK or The manual method which uses python to compile APK?



     @Linard I'm using variation of manual method. Packaging to APK is done on CI server using docker image koder/crosswalk-builder (source), which is essentially node.js 7 + oracle jdk 8crosswalk + android SDK packed together into convenient portable virtual machine.


    Actual command line to pack debug APK is:


    $ crosswalk-pkg --crosswalk=18.48.477.13 target/android


    Whole build process is bit more involved, it handles finding files right for platform, optimizing (compressing) resources - but should have no effect on issue I'm experiencing.
  10. @Koder: Woaaah! That's all jargon for me. Can you please make a tutorial for that? If ever you have a free time please? :)  i just want to try that because my project don't have any battle scenes and less parallel process and still it's laggy when i deploy it on android (with quadcore CPU). Thanks a lot if ever you make a video tutorial  :D :D
  11. @Linard: Unfortunately it isn't a simple process. I mean - it is if you already have background in programming. Do you feel comfortable in setting up your own development environment with git, npm, docker, gitlab? If you are interested I certainly can make of presentation of environment I'm using, but tutorial how to set everything up would be hours long.
  12. @Koder: I'll Send a PM to you sir, I'm interested with that process or give a try to have different options. Thanks :)
  13. I managed to narrow down lagging-on-map issue. It seems that it takes longer for first display of any image by pixi. So, when first playing an animation frame, it lags. Subsequent displays are much faster. This is observable by fact that lagging is experienced in each first movement of character in any given direction.


    I managed to narrow it down right now to SceneManager.updateScene @ rpg_managers.js:1822 taking abnormally long in this case - 155ms vs 25ms in normal operation.
  14. I managed to improve framerate quite a lot (from ~1FPS to 5FPS in peak) by replacing few more .forEach iterators with plain loops - these things are not performant enough for older mobile phones. Slower display of first occurence of each image is a fact - right now, after playing each animation at least once, game is actually playable with framerate drops to 4-5FPS in combat (previously way below 1FPS). It would be nice to eliminate that last artifact - it gives terrible fist impression.
  15. Try yanfly's fps sync plugin, it should work.
  16. Hisao Shou said:
    Try yanfly's fps sync plugin, it should work.

    Yes I just checked out it's code and it should help indeed. Thanks, building a test version right now.


    It works quite well out-of-the-box. Gameplay is slower overall, but this is not a problem actually. There are some issues with cutscene SE not playing when expected, I'll have to investigate that.
  17. Koder said:
    Yes I just checked out it's code and it should help indeed. Thanks, building a test version right now.


    It works quite well out-of-the-box. Gameplay is slower overall, but this is not a problem actually. There are some issues with cutscene SE not playing when expected, I'll have to investigate that.



    You should try to force .ogg instead of .m4a , so there should be less issues with the sound.


    In rpg_managers.js search the line with "AudioManager.audioFileExt = function()" , then modify that function to return .ogg only.