YAVE – Yet Another Voxel Engine [Dev blog.]

Hello,
let me introduce myself. I am Remy, 28years old and ~5years working as a JAVA consultant. When seeing the rise in populariy of minecraft, I was intrigued that this game was written in JAVA, knowing that the general assumption is that JAVA is slow - I am sick of hearing this -…
So I looked around a bit, and noticed JME. Looking at the projects (Mythruna = awesome!, Cubes was also very helpfull!), I bought the book a few months ago and started playing around with the engine.
After getting to know the basics of jme, and reading some info on voxel engines, I wondered if could pull of a very basic voxel-engine (cartoony look and feel with only vertex coloring) on my own.
This is what I have after ~25hours:

this is what I have already done, and what I would still like to do:

* Arange blocks in chunks (ok)
* generate a mesh of the chunk, instead of rendering the blocks seperatly (ok)
* optimize the generation of the mesh, so unneeded triangles are removed (ok)

  1. Rendering 4 chunks (16x16x16) containing blocks

    Okay, we have something. But rendering 4 chunks with such a complex mesh is not good. Let’s apply some optimization when calculating the mesh of the chunk.

  2. Rendering 4 chunks (16x16x16) containing blocks, but remove the blocks that are not visible (enclosed)

    This is better, but the mesh still contains a lot of triangles that could be removed. Let’s calculate the mesh of the chunk, based on the faces of the blocks that are visible.

  3. Rendering 4 chunks (16x16x16) containting blocks, rendering only visible faces of the blocks

    Okay, now we are getting somewhere. At this point, the mesh of the chunk is not containing any ‘unwanted’ triangles. But we still could merge the triangles of the faces next to each other.

  4. Rendering 4 chunks (16x16x16) containing blocks, merging the faces of the visible blocks.

    Okay, I think this is already quite awesome.

At this point, I noticed that the mesh generation, depending on the complexity of the chunk, could take some time, resulting in some framerate drops.
When I placed the generation of the mesh in a different worker thread, the framerate was stable again.

* create a chunk repository implementation, so the chunks can be persisted and loaded again (ok)

I opted for a file-based repository. I serialize and deserialize a small portion of the chunk - only the basic information that is needed to recreate the chunk - to file. I am happy with the speed so far (loading a chunk takes around 20ms, writing around 45ms).

* use a noise function to create procedural terrain (wip)


This is what I have so far, but very far from done.

todo:
* add some vegetation, trees, flowers, …
* create a day/night cycle
* block picking / adding - removing blocks
* look into LOD
* enable physics

5 Likes

Edit: how can I edit my topic? I notice the image links are wrong…

@remy_vd said: Edit: how can I edit my topic? I notice the image links are wrong...

Bugged. You can add /edit at the end of the url.

1 Like

Hi, after my holiday, I picked up where I stopped a few weeks ago.
I did some major refactoring on the chunk repository, the local chunk memory cache, completely rewritten the terrain noise generation, and I fixed a memory leak! Hooray!

This is a small video of a generated terrain of 21x21 chunks (and 8 chunks high, I think). Each chunk contains 32x32x32 blocks.
[video]http://www.youtube.com/watch?v=SV-VMYuJ4LU[/video]

This is another where the camera is ‘hovering’ 1 block above the terrain.
[video]http://youtu.be/LGrbTGYwl0g[/video]

I’m pretty happy with what I have so far.

I’ll start on the next step, a skybox with a day/nigh cycle.

2 Likes

Is this project only for block implementations? Or does it support non-block results as well ?

Kind regards,
Asser

Only block implementations.
The mesh is generated based on the blocks in the chunk. But if you override the resulting mesh (generated from the blocks), you can have any shape you want… Should I ever need this, it will not be that hard to adapt my current implementation.

Today I started on a very basic day/night cycle.
Here is the result of my first try-out of a rotating sun, and a dynamic directional light.

[video]http://www.youtube.com/watch?v=0z_aOCbJW3g[/video]

1 Like

I (partially) completed my skybox with with a rotating sun.
The skybox is made of 5 quads (not using the bottom one) using only vertex coloring.

sunrise with bloom effect:
[video]jMonkey 1409055979 - YouTube

sunset with bloom effect:
[video]jMonkey 1409055891 - YouTube

sunrise with bloom + light scattering
[video]jMonkey 1409063578 - YouTube

sunset with bloom + light scattering
[video]jMonkey 1409063696 - YouTube

no moon / stars etc… more to come!

The sky appstate, also contains a very basic game ‘calendar’ I quickly created. It just keeps track of the date + time in-game. A full in-game day is 1200seconds (20min). The sunrise and sunset event in the uploaded movies are between 6am - 7am and 21pm - 22 pm.

I might change from a skybox to a sphere, because I do notice the ‘edges’ of the box…
But at the moment it is not bothering me enought to adapt it yet :slight_smile:

1 Like
@remy_vd said: I might change from a skybox to a sphere, because I do notice the 'edges' of the box... But at the moment it is not bothering me enought to adapt it yet :-)

For a sky box you have to use images that are distorted in such a way that they look like a sphere even if they are “pasted” onto a box.
The same thing applies to a skysphere but a different distortion of course. If the image is generated by code it is probably easier to generate for a sphere I guess.

After a very busy period at work, I was finally able to work a little bit more on YAVE.

I added horizontal fog to the skybox, to hide/dissolve distance objects.
[video]http://youtu.be/Eg8Dd__aOZU[/video]

The mesh generation logic of the chunks now also creates 2 additional meshes with a lower Level of Detail. I still need to add a control to the chunk itself, to pic the correct mesh, depending on the distance of the camera.

Next steps:

  • fully implement LOD
  • physics + character control to walk around in the ‘world’
  • create some trees/flowers/…
1 Like

I changed my mind about the water. Since I am going for a cartoony look and feel, I don’t think the water ‘fits’ in at the moment. I removed the processor, and tweaked the transparancy a bit. The result is probably not nicer, but it just fits with the current look and feel.

[video]http://youtu.be/dMIP1ZWsP9o[/video]

Hi,
last week I fixed a final bug in the water rendering:

I did some tests with LOD, but in the end, the results on the terrain, where not that impressive, so I removed this from the chunk control. I will probably resuse this later on in the project for other meshes.

I started and finished the physics control! I created my own camera control, combined with a new EntityControl. This entity control uses a capsule collission shape to move around on the terrain. The camera control can support both first person perspective as third person perspective.

Demo: (free look, walk, jump, sprint, step over obstacles and zoom in/out camera to change from first person to third person)
[video]jMonkey 1412250028 - YouTube

1 Like

I have a working tree generator implemented in yave.
The trees are generated (so no model that is loaded) at noise-based locations on the terrain. At this moment, I only have one tree model that is generated (rectangle + sphere).

tree model:

demo:
[video]http://youtu.be/PuRt4R85lLc[/video]

1 Like

Hello,
do you host the source anywhere? I am new to JME and I’d like to learn the methods you are using.

Thank you!

Hi, I don’t host the sources online. But if you have any questions, I’ll try to answer them as good as I can. But everything I used/learned actually comes from the beginners guide and the cookbook. Those 2 are really a massive help!

Wow, this is looking really good, great work! love that tree too :slight_smile:
Voxel worlds are new to me, but very interesting in learning and creating these types of worlds, care to share ideas?

Yay Awesome Voxel Engine !

Are you planning to implement different display modes? like cartoon, 16bit, realistic… ? you can use that cool water then :slight_smile: and what about geocube ? :smiley:

Hello.

Very interesting project. I shall keep watching this one.

I’ve done all the studying of Perlin Noise that I can, but it continues to elude me as to how Perlin Noise can be used to generate random, yet constant terrain. Is there anyone who has perfected this art to a level where they can provide a quick education?

Pretty much the entire web, actually. I think google starts providing links before I even type a search in there is so much stuff out there.

What have you read so far?

I understand how Perlin Noise works and what noise is on a technical level.

What I can’t understand is how you can come across an equation that would accomplish the task of creating a good heightmap.