I’m messing around with a terrain generator like Minecraft, using cubes as voxels. So far, I can get blocks on the screen using OpenSimplex in a tentatively acceptable manner. However, predictably, I’m running into a brick wall with performance, as I try to generate more and more blocks. Generation time runs away, while frame rates plummet.
So far, nothing comes to mind that could effectively deal with either problem, but I do not know everything.
Future problems include: 1- ow to make actual mountains out of this…Right now, it would only work well for subsurface terrain. The best I can think of would be to generate 2d height data out of the noise, and then stack blocks up to that height. 2- water. These are problems I can probably figure out but not worth wasting my time until I know if there’s any way to make enough blocks on screen to be worthwhile.
Any ideas/hints/tips/tricks/insults are welcome and appreciated!
Here is the generator so far:
from bge import logic, render, events, types from opensimplex import OpenSimplex seed = 123 chunkSize = 15 noiseScale = 0.09 threshold = 0 blockSpacing = 1 noise = OpenSimplex(seed).noise3d s = logic.getCurrentScene() cs = int(chunkSize / 2) for x in range(-cs, cs, blockSpacing): for y in range(-cs, cs, blockSpacing): for z in range(-cs, cs, blockSpacing): n = noise(x * noiseScale, y * noiseScale, z * noiseScale) if n > threshold: o = s.addObject("Cube") o.worldPosition = [x,y,z]