I tried to plot a 40x40x5 grid of individual cubes using AActors and spawning with GetWorld()->SpawnActor(), but the performance is junk with this many AActors. I read that I should be using InstancedStaticActors for this, but I am not sure how to implement this in C++. I tried using the following, but the code is out of date, and after I converted it over, I get crashes:
I see regular talk of plugin, but I do not think this is useful for voxel landscapes since they need to be procedurally generated and maintain their individual quality for potential in-game modification.
Any help is appreciated, but just please remember that the cubes need to be generated dynamically in game (procedurallly), and that I prefer to use C++.
Sorry to survive and this topic, but for researching people about voxels:
DO NOT instantiate actor for each voxel! No modern PC and NO Pc in next 20 years will be able to handle this.
You must divide your world into zones, called chunks, and store voxel data for each chunk. How you serialize it is then up to you. In your generic case, 40x40x5 is small and really does not ned chunking.
You must then generate an isosurface. There are a lot of algorithms, and each algorithm expects different input data.
For example, to make minecraft like world, you iterate each voxel, check neighbours and add a quad to the mesh only on places where a solid voxel borders air. You end up with optimized mesh. But you can even optimize it more, this is a geometry task.
You can also generate smooth isosurface. Algorithms are called Marching Cubes and Dual contouring.
And of course you need to be a real programmer that can take this challenge.