Hey, so I’ve been using unreal for almost a year now, using paper2d and it’s been going well despite some learning curves etc. In my project, I’ve been using the 2d snapping layers with grouped sprites for level art and box collisions for… Well, collisions. Aside from a cumbersome workflow, this has worked well as far as performance goes. Anyway, I decided to give tile maps a go this weekend and it has been a disaster to say the least. I could go into details with all of the problems I’ve had with tile maps, but I’ll just leave it at the only show stopping problem I’m having.
*Project set up
All materials I use are derived from a slightly modified defaultMaskedLitSpriteMaterial. Most of the sprites, textures etc use a normal map. Game logic is about 90% made with c++, sprinkled with a few BP functions or some prototype BP functions I haven’t gotten around to cleaning up or converting to c++. Most of the project settings are about as low as I could get, with the exception of HDR, bloom post processing and using 4 movable point lights.
*My tile map set up
I have a very simple tile map. 128x128 tiles, at 16x10 tile map size, using 3 tilesets. I have Z separation at 0(zero) because I use a perspective camera.
To get depth, I duplicated the tile map. On the first one, I deleted some layers, leaving only the layers I wanted to use as the foreground. The other tile map, I deleted some layers, leaving only the layers I want to use as the background. I brought both of them into my level/map and positioned them where I wanted and threw in the player and a point light light.
*The platform test
I then launched on my android device and I was getting around 15-25 fps, where as my other levels/maps (using grouped sprites and is actually populated with gameplay stuff like enemies and interactive objects) runs a solid 60fps on the same device (lows around 55, highs around 64).
After doing some profiling, I turned off post processing, scaled down resolution and screen percentage etc and still was barely managing 20+ fps. After having a look at shader complexity view, I’m getting pink areas (in es2 preview mode. All green on sm5). My main map (which doesn’t use tile maps) has a few dark red spots, but way more things overlapping at various depths.
I set up a debug with volume up and down buttons to toggle the two tile map’s visibility and I get massive performance gains when they’re not rendering. Otherwise, rendering the two tile maps will throttle my cpu to max and that’s where it stays, though my gpu seems to barely take a hit. In my other map (with sprites instead of tiles), the gpu is working a little harder, but cpu only hits near max at the very start of the level’s load and then stays around 20-30% usage.
I tried to make a new material (because masked materials “should be used sparingly”) by manually cutting out the image but all that seemed to do is trick the shader complexity view into the green and actually resulted slightly worse performance.
Instancing the tile maps does nothing for performance.
Adjusting z separations does nothing for performance.
Making an actor that holds both tile maps worsens performance and creates some odd errors and can lead to crashes.
Using a single layer in each tile map DOES lower shader complexity significantly, but it’s not the most practical thing to do. (I’d have to have more textures and have repeated tile maps to make this work with my assets.)
TLDR: Tile sets seem harsh to render, does anyone have a suggested solution or hack to get better performance from tile maps or should I just give up on this?
Shader-Complexity — ImgBB
Tile-Map-Performance — ImgBB