simple voxel engine starter kit (51 posts)

Topic tags: box, box world, boxes, minecraft, voxel engine, voxels
  • Profile picture of moonkey moonkey12p said 1 year ago:

    Hi
    for anyone who wants to quickly jump in or learn jmonkey while experimenting with voxels I am sharing what I have done so far.
    If you improve it share back if you like :)
    it currently is 255x256x120 and I get round 500 FPS
    When you start it, go up and turn right to see the terrain…
    1.5 month old video:

    current look:

    for bigger version:

    http://i.imgur.com/4pWSt.jpg

    I’ve removed texture (1 texture) I used, find your own on the net :)

    If you have questions ask here, if you want to know what can be optimized more to get over 500 fps ask here :)

    download link here:

    http://hotfile.com/dl/116679954/c923116/Box-fun.rar.html

  • Profile picture of nomnom nomnom7p said 1 year ago:

    That looks pretty cool! I’m gonna have to take a look at it sometime. If you want to go a step further with voxels, you should check out this post: http://jmonkeyengine.org/groups/free-announcements/forum/topic/voxel-terrain/. That would be cool if you could do that…. Just a suggestion ;) There’s a couple of resources there…

    But yeah, that looks really cool!

    -NomNom

  • Profile picture of Decoy Decoy8p said 1 year ago:

    that is pretty sweet! it looks like the whole terrain is generated from heightmap data and is 1 solid geometry, does that mean it is not (yet?) possible to add or remove voxels dynamically during runtime? and is there (will there be?) any way to assign seperate textures to each individual face?

  • Profile picture of ahoehma ahoehma7p said 1 year ago:

    Decoy, this would be easy (I guess) remove/add a “volume information” and recreate the MapNode (change the node in the scene graph too).
    I’m right moonkey?

  • Profile picture of moonkey moonkey12p said 1 year ago:

    yeah it should be easy I did not came so long, I am missing some features in jmonkey which I would like to see added before I invest my self in this with all my heart :)

    Currently there is one big mesh. As you can see I created map and chunk classes, and was thinking about adding a tile class could fit in there. However I didn’t come so far to break up the big object into chunks. If I did you’d probably have 1000 FPS when running.

    Having multiple textures shouldn’t be a problem as long as texture atlas is used. There is no support for that in jmonkey but I think you could just hardcode uw map coordinates when creating them to different part of atlas texture so that would probably be dirty and quick solution.

    For what I want to do I miss texture projection, automatic world uw mapping. I’d like to take it further but jmonkey is missing some stuff I dont have knowhow to add my self, so I am just releasing this to anyone who wants to learn and understand, it took me around 1.5 month to come this far and I learned alot :)

  • Profile picture of ahoehma ahoehma7p said 1 year ago:

    moonkey,

    I will try to put your MapNode into our application (https://code.google.com/p/bloxel/)… I’m waiting for such a piece of code ;)

    regards
    andreas

  • Profile picture of moonkey moonkey12p said 1 year ago:

    Hi

    if you think it can help sure :) I love what you did with bloxel but I had to do this my self to learn and also I wanted simpler code, bloxel had lots of stuff in there that looked too complicated for me. Let me know if you learn some new stuff and have time to share, it be great :) I plan to continue with this, but perhaps I’ll switch to some other engine untill jmonkey gets features I’d like to have, will see about this who knows what happens :)

  • Profile picture of Empire Phoenix Empire Phoenix157p said 1 year ago:

    Well you could always add the features yourself. (I highly doubt that there are (if at all) much engine that have even half the features of jmonkey, so you would have to switch over to the C++ engines.

  • Profile picture of moonkey moonkey12p said 1 year ago:

    EmpirePhoenix said:
    Well you could always add the features yourself. (I highly doubt that there are (if at all) much engine that have even half the features of jmonkey, so you would have to switch over to the C++ engines.

    I would if I had the know-how and my skills were enough to add those features, but I don’t have those skills :)

    I actually found one engine that uses phyton or c++, depending on what you like, with features I wanted in monkey. But I still like java and jMonkey, its so good for quick prototyping

  • Profile picture of ahoehma ahoehma7p said 1 year ago:

    Hi moonkey,

    last night I finished a simple version if your code-snippet :D

    http://code.google.com/p/bloxel/source/browse/trunk/bloxel/src/main/java/de/bloxel/world/ChunkNode.java

    And I have a lot more fps than with the actual “batchfactory-based” solution *jippi*!

    I have a idea for different textures/bloxel-types: create a mesh for each different texture (face-based: left, right, top, bottom, front and back) … then the result will be 6 * number of textures (worstcase) meshes. A optimization could be: merge all “same” textures to one (like BatchFactory) …maybe I can use the BatchFactory for the last step …

    moonkey, thxs for new motivation !!!

    regards
    andreas

  • Profile picture of moonkey moonkey12p said 1 year ago:

    Amazing, glad to have helped, how much improvment in FPs did you manage to get? :)
    you know you can play with this:

        final Vector2f t1 = new Vector2f(0, 0);
        final Vector2f t2 = new Vector2f(1.0f, 0);
        final Vector2f t3 = new Vector2f(0, 1.0f);
        final Vector2f t4 = new Vector2f(1.0f, 1.0f);
    

    to get that specific face that you are about to construct to map to another part of texture. Do a test, create small atlas texture perhaps with 6 textures, then play with those numbers to just get the texture from specific position. I’ve tested it and it works fine. Its not beatiful solution since you’d want to have solution that is more automated, but this will work and it will be much better then what you suggested :)

    Ofc dont froget that now you will need code above for each face of cube, so you’d place it in if case for each face you construct, but with different values :) or perhaps you put it a function and call it with some parameters :) =

  • Profile picture of ahoehma ahoehma7p said 1 year ago:

    My first hack run really faster (>200fps) … 4 chunks in each direction around the central player position, each chunk have 8 bloxels in each direction from the chunk-center (=16x16x16 bloxels per chunk) so we have a volume around the player with 128x128x128 bloxels. That’s not so much … 256 or more should be possible :)

    Your createWalls() code was very important for me … here I see how to do the http://en.wikipedia.org/wiki/Tessellation to create a mesh from “volume information” … I was too lazy to do this ;)

  • Profile picture of moonkey moonkey12p said 1 year ago:

    so my tesselation code with one bigh mesh was more optimized then yours chunk meshes :P nice, now imagine how much optimizations you get with chunks + create walls :)

    I read about that from a guy who experimented with openGL 4 and phyton, I thought it makes sens, lets do this instead of using cubes, since using cubes you have too many faces there that are never visible…

    as you saw in my code 256x256x128 is possible, and you can probably go even higher then that, perhaps 300x300x128. Notice also that memory usage is not that crazy, I get around 500MB, same as minecraft which is not bad, you can go up to 1.2 gb before java crashes, it doesn’t deal so good with higher memory even if you specify in Xmx1024m…

    What can also be optmized here is to remove the walls you see when you go outside of the terrain, you can remove 4 walls, since player will never see them, you don’t need them there…

  • Profile picture of moonkey moonkey12p said 1 year ago:

    YES :) go ahead do what you need with it, if you make millions give me some % you want :P

  • Profile picture of moonkey moonkey12p said 1 year ago:

    Btw

    some of you may notice I have function castDownLight(), well as you guest that would have been used to generate minecraft like lightning. Its not finished so that would have been something I would have added. I’m not sure if I’ll continue development of this in java, but since this is nice starter kit and you get to learn much by studing it, its up to you to make any kind of lightning you want! :)