Voxel engine library project

Hi everyone,

I am currently developing a voxel engine.

This project’s goal is not about making a video game it is rather to create a library that could be used by as many types of voxel based game as possible. I know that this is a difficult matter because I am already well into this project.
It is impossible to make an engine fully optimized for all types of voxel based games but I believe that it is possible to develop one that is good enough for a wide spectrum of games.

Here are some ideas on how to achieve this goal:

  • The library can have multiples implementations of some parts of the engine, for example a version of the chunk management system for terrain that are infinite in 2D and another version for terrain infinite in 3D.
  • Provide support to developers who need to modify the engine source code for there games.
  • For some games the voxel engine’s performances are not the first priority and/or game developers may not have time to implement a custom voxel engine.

My engine currently has infinite terrain generation in 2D, a good view distance with Minecraft like terrain and voxel lighting, but there still is a lot of work and improvement to do.

Here is a video showing the progress of the project:

6 Likes

Do you plan on adding the ability to have smooth voxel terrain?

1 Like

I haven’t thought much about it yet… and I love the cubic look of voxel worlds.
But it’s the kind of functionality that could be interesting to develop in the future.

This is really cool. Is it available somewhere to play with or contribute too?
(Sorry if this information is available obvious somewhere, this is my first visit to this site)

Thanks, my code isn’t ready for publication but you can download an executable here:

it could be interesting but there are already several implementation of voxels around. I myself created an algorithm for that (not saying that it’s a brand new algorithm, only that i did it myself without checking how people do that), like this:

when you add a cube, you are 6 face, each face has a position (the position of the cube for example) and a direction.
when you add a face, you check first if a face if directly facing the one you add. It such a face exists, you remove this existing face instead of adding the new one.

this remove a lot of faces (every face you’ll never be able to see), and is pretty fast to update, for add and remove (you can imagine the algorithm when you remove a cube: it’s the trivial one, remove all the face of the cube you are removing and add the good faces of cubes adjacent to it)

However, this doesn’t solve the “cave” problem, i.e. faces you are not able to see because they are underground/behind a wall. This kind of culling is the key to have a fast game, and relies often on portals (= if i can’t see a portal i can’t see anything behind it).

A voxel engine with a good optimization (like the one i described, not optimization that remove two addition and a multiplication) and the possibility to have smooth voxel would be great.

1 Like

I believe the several implementation of voxel that you are talking about are meshing algorithms implementation. My project is not about implementing meshing algorithms or making my own. Meshing algorithms are an important part of a voxel engine but has you said we already have several of them.
As you can see in my first video I’m using greedy meshing (Mikola Lysenko implementation ported to Java by Rob O’Leary).
I plan on adding other meshing algorithms and it seems that marching cubes is a good candidate that would allow me to support smooth voxel terrain. I tested a marching cubes algorithm on my engine yesterday and you can see the result in the video down below. As you can see it’s buggy because the other parts of the engine are not made for smooth voxel terrain. That’s why I said supporting different types for voxel based game is difficult, to have smooth voxel terrain I need to modify or have a different implementation of some other parts of the engine. So it will become more like a pile of lego pieces with which one can build his engine.

Concerning the cave culling this can indeed by a very good optimization (if there is a lot of caves obviously), Mojang added this feature to Minecraft in 2014. It is difficult to say whether I will be able to implement this kind of algorithm in the near future and there are many other more important things to do before tackling this kind of advanced functionalities. That said if someone else solves this problem I could integrate his code.

https://sites.google.com/site/letsmakeavoxelengine/

That’s a good example of all-in-one voxel based game project that could have been a whole lot easier using JME and a voxel engine library. This guy made everything himself in C++ and OpenGL from a wrapper around OpenGL to a good looking voxel based RPG. Which is great by the way…

I should had said something aside putting the link (my bad).

Neither the link is a tutorial or code of mine.
Just happened to seen it before reading this post and in spite of the tutorial being for pure C/C++ and OpenGL some of the points are with some effort migratable to your project.
Posted the link because thoughted some points may be useful for your project.

Hi,

You can get this library here: GitHub - francois5/voxelengine: A voxel engine library developed for jMonkeyEngine

The code is not well documented yet but I think it’s pretty easy to use and there is an example in the test package. The engine has 3 very simple interfaces that let you define your voxel types and the world generation procedure (the world is generated on the fly).

This is my first 3D project and this library is not very good for graphical stuff right now but I will work on that soon.

1 Like