Hi, I’m a beginner to game programming, but not programming in general, and really need some help in boosting performance in my project.
I’m working on a tile-based map system with heightmaps implemented, it looks a bit like this. What you see is a 10x10 grid with some height adjustments being generated 4 times in a 2x2 pattern, i.e. 400 tiles in total. The structure can be seen as:
- 4 Chunks with a procedural mesh component
- 100 tiles per chunk, a section of the Procedural Mesh Component
- 4 vertices /2 tris per tile with one 256px texture each, often sharing textures between tiles.
My problem is that the number of draw calls (~1600, seen in the image) becomes unsustainable when scaling this up to, say, 1m per tile and 50x50 tiles on the screen. Despite only 2 tris per tile, each tile generates 4 draw calls, which you can see in the image (4x400 = 1600) and despite being very simple constructs and using low resolution textures, this high amount of draw calls tanks the performance. It doesn’t seem like same-texture assets are being merged as well. I’ve already tried the following to increase performance:
- Disabling shadows
- Disabling collisions (although I need them)
- Disabling textures
- Tweaked random settings
- Treat as background enabled
Shadows did quite a bit to reduce computations, but the draw calls are still as high. Is there anything I’m missing that can be done to increase performance? Can I draw the entire chunk at once by dynamically generating a chunk texture of all the current tiles so, then update that in real-time?