optimizing tilemap for Android

super_turbosuper_turbo Posts: 24Member

Here is my experience with optimizing the game for Android. My game was running at 60fps on my PC, than I made an Android build, the frame rate was 20 to 30, unacceptable :) . My game is a retro 2d low-res, my resolution is 224 lines and than it is upscaled by Godot to fullscreen without any filter. The game is simple, sprite-based with a relatively small 8x8 pixels tilemap only for the ground, so not all screen is filed with the tilemap. So when trying to optimized it my first thoughts were the particle systems I use, it is the only thing more complex, with a green smoke that has quite some particles. The second option was the amount of characters on screen, there is a boss that summons a lot of bat minions. But for my surprise, these things were not the problem, but by taking out the tilemap the game went to solid 60 FPS. I don't do nothing fancy with the tilemap, it is static, not procedurally generated. The only thing I could do was to mess with the quadrant size, with no result. Also tried 16x16 pixels, also no results. My tilemap is old school with only the top tiles in the ground with colored texture, the tiles under the ground are solid color sprites. Than the next thing I did was do erase all the solid color tiles and the result: solid 60 FPS. Than I made polygons behind the tilemap to cover the area that had the solid color tiles, result: solid 60 FPS, and the game looks exactly the same as before with the polygon solution. There was a small area with lava tiles that I took out and put a big sprite to replace the tilemap and the result was the same: 60 FPS.

So my questions/discussion is:
- Have other Godot users had the same kind of experience?
- Am I doing something stupid with the tilemaps?

I never compiled Godot myself, but I might try to compile it to help with its development in the future and to dive in this question myself.


Tags :

Comments

  • The_DuskittyThe_Duskitty Posts: 30Member

    I have this issue with tilemaps using quite a bit of resources, i did a comparison here if you'd like to use the video if you're going to make an issue of it

    https://youtube.com/watch?v=TV6XGtbdSyw

  • super_turbosuper_turbo Posts: 24Member

    Yes, there is something strange with tilemaps, thanks the for video. I'll do some more tests and post an issue in the github.

  • super_turbosuper_turbo Posts: 24Member

    I did some tests. It seems that on PC adding a tilemap add 1% of processing load, even for small tilemaps. But the same tilemap when running on Android causes a massive frame drop. I created a very small godot project with a tilemap an also images covering the tilemap so that the amount of drawing is the same. Touching the button on Android toggle the tilemap visibility (but it is actually hidden by the images), a label shows the fps. With tilemap turned on, the frame rate is 20 to 30 FPS , without the tilemap (but drawing all screen), the FPS is 60, running on an asus zenphone.
    If someone is interested in testing it, I can share the project source and the apk for testing it.

  • super_turbosuper_turbo Posts: 24Member

    I just tested in my girlfriend phone, I Samsung galaxy win 2, same Andoid version 5.0.2, and her phone is much slower than mine, but the problem did not show up. Very strange, must be something wrong with my phone.

Sign In or Register to comment.