I’m building a game using a 3d grid based, procedurally generated world (same world concept as Dwarf Fortress/Towns).
For the Blocks i use a 3D array of Block instances (normal class, not GameObject), like this: Block[,] blocks = new Block[sizeX,sizeY,sizeZ]. The block object contains all relevant block info like positions, and bools like “isWalkable” and vertice positions for rendering (they are then combined into “Chunks” for rendering)
This runs quite well, even with a million Blocks (128x128x64)
My question: Would it be better to store the data in seperate arrays? For example have arrays “BlockWalkable[,]”, “BlockVerts[,]”…
This way i could get rid of Objects.
I’d like to get rid of as much overhead as possible to make room for implementing pathfinding later… Would there be any advantages for lookups for example? Or memory savings? I woult test it but it would require quite a large rewrite, so i thought i’d ask first.