Hello! I’m making a turn based strategy game with a grid-style combat arena (think Final Fantasy Tactics/Civilization). Each arena is a grid of cubes, which can vary in size from 8x8x3 to 40x40x3. This works fine up to about 20x20x3, where I notice some significant frame drops. Some comparisons are below;
10x10x1 - ~80fps 5.6k Tris 12k Verts 1000 Draw Calls
20x20x1 - ~55fps 22.4k Tris 50.4k Verts 4000 Draw Calls
30x30x1 - ~26fps 50.4k Tris 113.4k Verts 9000 Draw Calls
40x40x1 - ~15fps 89.6k Tris 201.6k Verts 16000 Draw Calls
Using just a simple base. All blocks use the same five materials (One for the top, one for the bottom, one for the four sides near the top, one for the four sides in the middle, and one for the four sides towards the top). In the actual game, I plan on there being many more materials being capable of being used, this is just for the above performance test.
I’m aware of texture batching, but haven’t been able to get it to work. My levels are instantiated from code, so this may be the cause. If it’s not possible to get texture batching to work in that circumstance, I can look into other options.
Here is the primary code I am using to instantiate the base of the level;
function MakeBase()
{
for(var j=0;j<boardSize.x;j++)
{
for (var k=0;k<boardSize.y;k++)
{
var block = Instantiate(boardPiecePrefab, Vector3(j,-1,k), Quaternion.identity);
floorPieces[j][k][0] = block as Transform;
}
}
}
If anyone has any suggestions on how I can improve performance or get texture batching to work properly, I would be very appreciative.
Thanks,
Brandon