Voxels in the BGE - Download Available

Haha, is so slow! But good job anyway. (it’s blender’s fault)

i tried adding a player setup to it in first person view and its actually pretty fast because you not looking at the whole thing at one you just seeing part of it.

Well, the simplex noise function is quite heavy! It takes some time to load, but the system works pretty well!
Thank you, now I know mine will work as well, I’ll try a vegetation voxel to implement in mine!

@BlendingBGE - It could be improved, but it’s not especially slow, and even then, only when it’s loading the chunk data. Even MineCraft is slow when it loads the first chunks (the ones around the camera).

@torakunsama - Yeah, this method could be really useful.

This still needs to load only the chunks closest to the camera first. Each chunk should create a data list of its cubes, and then create the cubes from that. This way, objects can interact with the world before it loads. In addition, it’s adding whole cubes - it might go faster to add individual faces and refactor the chunk data after those faces.

at the end how many cubes are there?

normal cube -no collision- start to give problem to 10 000

anyway is pretty cool (as all thing of SolarLune :wink: ), only not “seem” very fast (depend from the number)

After a few hours of coding and testing, I made a simple example, of what I was talking about earlier!
there are 256 trees, making a total of more than 19k vertices.
http://dl.dropbox.com/u/6162142/VoxTrees.jpg
you can try it, just unzip this folder

Wow… awesome stuff there! I’m looking for a way to generate smooth voxel terrain, but this is a very good and useful resource. Keep up the great work :smiley:

my interest is sparked in this again :smiley:

so SolarLune with this setup are you able to like go in and delete individul blocks like dig up the ground ans what not?

also does it have depth or is it just like one layer of blocks?

You can’t delete the blocks yet, but it should be possible to implement. I think it’s one layer of blocks as of right now, but I can’t quite remember. It would probably be best to keep it at a single layer (or a few) and add blocks as you dig down to preserve frame-rate and keep down the total poly count.

oh ok ya that makes sense.

Solar Lune , any love here lately?

This is promising.

Idea

on init, build a list of all physics objects/logic targets

every x ticks, make a list of the ones that are in a distance (just outside draw distance?)


import bge
cont = bge.logic.getCurrentController()
own = cont.owner
reset = cont.sensors['reset']
if 'init' not in own:
    own['PhysicsList']=[]
    own['CloseList']=[]
    for objects in bge.logic.getCurrentScene().objects:
        if 'PhysicsMesh' in objects:
            own['PhysicsList'].append(objects)
        if 'centroid' in objects:
            own['Center']=objects
if reset.positive:
    own['CloseList']=[]
    index=0
    for objects in own['PhysicsList]:
        if objects.invalid:
                  own['PhysicsList'].pop(index)

        else:
            if own['Center'].getDistanceTo(objects)<Max and objects['Populated']==False:
                own['CloseList'].append(objects)
        index+=1

and here is the real kicker,

can you generate a list of any ‘Gfx mesh’ face somehow using the gpu? (culling data ?)

then this list is ‘used up’ populating any meshes in range that are on the list (CloseList)

when doing these calculations, you can only process X parts per list with a while loop, and it only does it when there are meshes on the close list, and it pops them off as it does.

so the FPS will stay steady, physics will always work, the worst that could happen is you move to fast, and outrun the graphics?

so every 60 frames a new ‘close’ list is generated (just a little bit longer then the draw?)
and then sorted 1 time,

all the closest physics meshes are then populated until your out of faces?

(it would use nothing while standing still?)

store the UV data as a list in each ‘Physics mesh’?

Thanks for reading,
I would do it myself but I am still learning to use the vertices moving stuff,

adding a block ? add it to MasterList

removing one ? Pop it from MasterList using object.invalid?

if it was ‘constructing’ in front of you and you could see it, it may actually look kinda cool…
(as it’s not all happening instantly and radiating out from you)