I am developing a clone Minecraft for the purpose of study. I am working with Java and LibGDX. I have read some other codes on web, and reading LibGDX tutorials and currently I could develop something on map using Perlin Noise, etc.
But my biggest problem is the render performance. I splitted my map in chunks, as Minecraft does, but even with few elements on screen (2.000 blocks) the FPS drops to 20 by second on Desktop. Even if I not looking for any block.
My logic is that:
Main()
callsRegion.draw()
to draw all loaded region chunks (currently about 16 chunks);Region.draw()
calls eachChunk.draw()
to draw all blocks on each chunks, about 128 blocks (total 2048 blocks).
I really do not see reason to performance be poor like that. I read that small things like that send a lot of instructions to GPU, like each vertices coordinates, etc. and it make sense. But Minecraft do thinks even more complicated like that and works without lag on my PC. I could simulate, on Minecraft, a render of 51.522 blocks without FPS issues. So I think that there are some method to avoid upload my blocks each time to GPU, and just call draw on it directly (I don't know if I am on right direction).
I'm studying 3D game development currently, and I have a similar problem on Unity (lot of objects, low performance).
What I missing?
My current render with 20 FPS: