Procedural voxel terrain and vegetation generation

Hi all,

This is a short video showing the procedural terrain and plantlife generation functions in a voxel engine I’ve been working on. Everything in this generated procedurally on the fly, with the infinite terrain paging out in front of the player as he moves.




Now thats the prettiest one yet. Are the clouds procedural?

Yep, sure - they’re generated by noise functions running on the GPU.

In fact, for this video I disabled the day/night cycle and the weather systems (just because it’s hard to see the terrain being generated when it’s raining and night time : )

A weather forecast is generated for the next five days, updating every midnight, and determining how overcast or rainy or snowing it will be the following days… The clouds then increase in density depending on the weather - becoming dense cover when there’s a storm… Maybe I should post a video showing the weather and day/night systems.


Impressive! And yeah you should post a video with the day/night cycles.

dayum thats nice


This system also has Leap Motion support - which is pretty good fun with jMonkey - there’s a short video showing a less shiny, but motion-driven, version of the system here…


The vegetation system wasn’t finished at that point, and not much in the way of post-processing was hooked up - but it does show a bit of the rain and snow effects!

I’ll get together another video showing some more of the more interesting bits and pieces I’ve added.



Woooooooow, holly crap…
That looks amazing. I love the particle effect when blocks are eaten up.
And the lighting also looks brilliant.
What is the plan with this? Are you making a game and if so when can we start playing?

So cool :slight_smile:

Thanks! I’m not really sure what to do with this system - it’s pretty advanced on everything except actual gameplay - apart from building and destroying voxels… So that’s something I’m going to need to think about : )

Very nice!!!

@roleary said: Thanks! I'm not really sure what to do with this system - it's pretty advanced on everything except actual gameplay - apart from building and destroying voxels.. So that's something I'm going to need to think about : )

You could make a game where you have to mine blocks and craft things? Could be fun. :smiley:

Are you planning to release the source code for the engine bits or just teasing us? :stuck_out_tongue:

Hehe - I don’t know - but I guess so.

It’s quite large though - so I’d need to do quite a lot of work documenting everything first.

However, each sub-system is isolated and only connected via an event bus - so there’s very little spaghetti. Each component subscribes to and publishes events… So each sub-system can be encapsulated in terms of the events it listens for, the work it does when it hears events, and the new events it then publishes.

There’s also a scripting system - so scripts can be just dropped on the file system and used to fire events into the event stream to cause things to happen - and then a console that can be used to execute scripts by name. For example, I created a script called storm.groovy which is composed of this:

[java], Constants.HEAVY_WEATHER_EFFECT)


And then I can open the console and type “/ storm” and the rain, wind, cloud, fog, thunder, lightning and block lighting systems all hear the rain request (because they subscribed to that event) and go to work independently producing their own contributions to a rainy day effect - which is only really apparent when you see everything working together at runtime.

To add, let’s say, mushrooms that only bloom when it rains, you’d add a new and it could sign up to listen for the RAIN_REQUEST event to be told when to start adding mushrooms everywhere. Or to upgrade the rain to Rain2.0 (saltier!), you could just dike out the existing, and replace it with a new that listens for the same events - and none of the other parts of the system would even notice.

And then finally, the scripts can also listen for events - so if you wanted a world in which lightning strikes caused a spray of particles (and why not, eh), you could add a new script with something like:


 EventManager.register(Events.FORK_LIGHTNING, new Callback(final Vector3f strikeLocation) {, strikeLocation, '#FFFFFF', Constants.SPRAY, Constants.UP)  


1 Like

Wow, sounds really feature rich! I’d love to try it… documentation isn’t so important, we’re all monkeys here :slight_smile:

What I really love too is your flying camera with drag selection of blocks, so you can edit things much faster. Combine that with your weather system as well and I think this could lend itself well to an RTS / god game. Something where you need to build bases and units for realtime combat but in voxels :slight_smile:

That’s what I was thinking! Initially the only player point of view was running around on the ground Minecraft-style, but then - that’s what Minecraft does… So I got into the overhead God-mode kind of view (which unfortunately has the disadvantages of not showing off all the work I did on the cavern systems beneath the surface).

Maybe - and it’s just a thought - maybe voxels could be not so much individual bits of grass and rock, but something larger… I keep looking out the window of my apartment and thinking that the apartment building opposite could be composed of blocks - if each block was one apartment, they’re all piled up… Then there might be road blocks and - I don’t know - swimming pool blocks or something… In general so that the scale was different.

yep, or why not make a kind of building crafting system… make a 10x5 frame of ceramic blocks and fill it with water blocks… it becomes a swimming pool, with special textures and water shaders :slight_smile:

make a row of asphalt blocks the right width and length and it becomes a road, or a crude building of concrete blocks and glass cube windows and if it fits the blueprint the glass cubes become proper windows and the building gets proper textures :slight_smile:

Exactly - that sounds good!

I also played around with getting mobs to do the actual building - I must check and see if that sub-system is still working (leave something alone for a while and it starts to mysteriously malfunction, eh : )

With that approach you drop some little mobs around the place, and then when you make a selection area to place or destroy some blocks, the mobs run over and do the actual work… Which might be kind of cool too.

Then it might be possible to have mobs mining over here, chopping trees over there, building here - etc, etc… Then maybe the Minecraft style running around could be done if you were able to jump into one mob and control him (which I can totally do right now by just switching to on-the-ground view) - maybe for fighting, exploring deep underground, etc (It’d be such a shame to not get a chance to see all those caverns! : )

Whelp, turns out the builder mobs still work, more or less - though I’ve got to texture them properly so the bloom effect doesn’t makes them glow like little wizards - but anyway I recorded a short video showing them running around building something (and since they worked all night, for bonus points it also shows some day/night transition):


1 Like

Haha! This is EPIC, EPIC I tell you :slight_smile:

You could maybe go for a multiplayer approach… gods vs mortals…
The mortals are in FPS mode and can build and craft as in minecraft and dig underground, the gods can command mobs to build and attack.

Whilst underground, the mortals are safe, so can build underground networks and such. They’re beyond the reach of the gods. But they need to come up to gather resources from time to time :slight_smile:

The gods can command mobs to do their every whim, and they can send large attack waves and build structures quickly, but mobs are stupid and can’t craft, so they can’t get advanced weapons or tunnel through rock etc.

Something like that :slight_smile:

1 Like

That’s nice! Very interesting… I like the idea of one side evading the other - and of seeing the world from two different perspectives… Having a kind of guerilla war against another player - popping up in unexpected places, tunneling out foxholes - it sounds like fun!

Another thought I had was maybe to enforce the travelling side of things - so you’re not so much making fixed structures and then, well, sitting in them (or adding another east wing just for something to do, which I find myself doing after a while in building games)… But if you have to keep moving.

Maybe you’ve got an airship, or a balloon, or some contraption - or maybe you start on foot and you build one - and you’ve got some motivation to keep moving - some macguffin to keep you on the road.

Maybe visits down to the surface are necessary because you need resources to keep the airship going, or food, or both - but it’s dangerous down there - and temporary defensive structures will only keep out the beasties/space vampires/pod people/whatever so long, so you’re looking for good spots to temporarily put down and gather some resources before making a run for it. You might need lots of the things you find on the surface - wood, food, etc - but also a small amount of things deeper below - lazer space crystals for the steam engines, whatever - so you have motivation to go into a small amount of danger regularly, and a large amount of danger occasionally - and an overall objective - and it’s making the most of the voxel-breaky-collecty mechanic, and the infinite world size (and of course, pretty landscapes).

Of course, there’s not much space for builder mobs in there (unless, maybe, some sort of Robbie the Robot kind of remote resource gatherer you can build and send down)… But I like the idea of drifting along above the landscape between hectic fights/mining/wood chop chopping/etc.

Yep, you’re certainly right about the lack of challenge once you’ve established a base in most of these types of game.

I guess there are 2 mm ain incentives - to get somewhere with better loot, or because you are being chased :slight_smile:

Wow this seems so efficient! Is this in JME3? I coded a voxel engine, with the help of some of @pspeed’s code, and it is not performing as well as I would like. On my tower with a Geforce 460, it achieves about 100fps while rendering an eighth as many blocks as you ever show, and I have to render distance chunks in low resolution unlike you. On my laptop with a Radeon 6370m, it chugs along at about 10fps. My code generates a mesh for only the outside of each 16x16x16 chunk, assigning vertices, texture indices, and colors based on the cubemap, a short[][][].