>Python3dcubeworld
Last Edit: Dec. 18, 2011, 2:20 p.m.
Panda 3d voxel world in python.
So I was playing around today with making a minecraft style voxel cube world in python. I spent some time looking for a 3d engine to play with and settled on Panda 3d. I did some learning with it for a while then I got to where I could draw cubes on the screen in a grid. The next step was getting some kind of terrain generator so I had more than a cube of cubes. I found a Perlin Noise generator for use with pygame. I hacked out all the pygame parts and simplified it to generate (x,y,value) sets where value is the terrain height.
Disregard the text, I never bothered to change it from the tutorial I used as a base
The problem now was getting it to run smoothly. My computer is no slouch, but as the world size went up, it began to bog down. The first way to reduce computer strain is to only render those cubes that are exposed. Not having a good way to look up a cubes neighbor to see if they existed, I set about finding a solution. I did some reading on octrees and looked for a while to see if any libraries existed to do this. I found one but it would give errors and crash periodically (I never did figure out exactly why. It would run fine then give a recursion depth error.) After much grumbling I decided to roll my own. It works pretty darn well if I do say so myself. I'll definitely do some more playing around with this in the coming days.