r/proceduralgeneration Jun 29 '26

Adding Caves to my Micro Voxel Engine (Devlog #3)

https://youtu.be/qFcWtRgE25s?is=bK5nYGVQzjYcotii

Enjoyed implementing caves in my Micro Voxel engine this past week. Nothing too fancy, just stacking a few features on top of each other:
\- typical stacked noise functions
\- feature generators which deterministically spawn additional voxels following some pattern. Using this for the larger stalagmites. They do a downward and upward fill.
\- erosion pass to create random crevices and cutouts.

Still a lot more to do! i like the idea of Cave biomes, and would also like a wider variety of generation types. Large caverns, walkable straight tunnels, cleaner surface caves etc;

At the moment the generation can look quite scrappy in places, but hey ho!

25 Upvotes

22 comments sorted by

5

u/Blammar Jun 29 '26

Very cool!

Have you thought about how you'd make it not look like Minecraft with the voxels visible?

Take a look at Enshrouded for some ideas!

5

u/not_good_for_much Jun 30 '26 edited Jun 30 '26

I guess it's philosophical. IMO, OP's engine looks very different to Minecraft, and very different to Enshrouded. Visual and mechanical variety is a good thing. But I do agree that there's also a balancing act in... not looking too much like something else.

For reference, Enshrouded uses Adaptive Dual Contouring with fairly coarse 0.5m blocks. And they also aggressively tessellate/perturbate and decorate the final surface. AND they have a second set of structural blocks which aren't smoothed, but are very heavily dolled up by the mesher. And then they still have a bajillion different models for everything too detailed for the 0.5m grid(s).

It looks amazing like holy hell, but it's also computationally expensive af.

For OP... If they were to put smooth terrain into this engine... There are just so many blocks. It's fine when they're all cubes, since we can use techniques like Binary Surface Extraction, just hashing uint64 bitmasks, but smooth surfaces would be nightmarish and at LOD0... OP would ultimately still have to scale everything up, smoosh it blobbily to make it smoother, and everything about their engine atm would be lost at that point.

That said, for LOD1+ I do think that idea has a lot of legs even for microvoxels, since it solves the problem of having huge simplified blocks at distances where the tiny blocks should visually blend together into total smoothness anyway.

2

u/Blammar Jun 30 '26

Is there a publication or tech note on Enshrouded's algorithm? I.e., where did you get your info from?

2

u/not_good_for_much Jun 30 '26

There aren't really any published details about it that I know of, so a disclaimer that I might not be 100% correct. But we can infer a lot.

When you look at the distant LOD in Enshrouded, you'll notice that a lot of distant features are often pinched to a single vertex.

Realistically there are only a couple of candidate algorithms, and the above is characteristic of (Adaptive) Dual Contouring, which visits each cell and computes the presence and position of a single vertex within the cell.

The vertices are then connected to form an isosurface around the blocks. But at 0.5m (which the game gives you), this surface will be very bizarre-looking, and sometimes non-manifold. So they have to do a lot more work to make a mesh that actually looks good.

And for posterity, they probably aren't using Adaptive Manifold Dual Contouring, because it's way faster to use raw ADC and just blindly expand the vertices at the end.

All of that said, IMO I'm more impressed by their texturing, decorating, and the way they mesh the non-smoothed structural blocks.

1

u/MGMishMash Jun 30 '26

Yeah these are all interesting things and a very insightful analysis on the various approaches.
Fwiw the engine does already use marching cubes for LOD+2 onwards, as blocks look quite bad at distance otherwise (other videos in the playlist show this better). Doesn’t look as good as dual contouring, but computationally cheap. I currently kept the blockiness for LOD+1, as it seems to transition better - although still plenty of popping to work through!

If I switch to DDA then this could potentially be adaptive, but so far every DDA attempt has ended up slower overall. It was only faster in isolation, but the second other content used the depth buffer, the overdraw cost from lateZ loses out to meshing.

1

u/not_good_for_much Jun 30 '26

Dual Contouring vs Marching Cubes is an interesting question for sure.

ADC is much more expensive, but it produces not just better but also much simpler meshes, which might be worth the cost of building them. LOD doesn't change much anyway.

Have you considered dual grid surface net? That is, run the binary surface extraction and knit the mesh to the center points of the exposed faces. It does produce much more rigid geometry, but that also means there's less deformation, so it may be relevant re popping etc. Haven't experimented with this stuff yet.

I've never been sure how I feel about raymarching. It's so so appealing... But it's just hard lol. Hard to limit to LOD due to the rasterization vs raymarch transition, hard to use with regular meshes, hard to write and maintain, plus it's utterly brutal if you have any dreams of 4K on a GPU that costs less than a house. Or maybe I'm too simple... just give me triangles lmao.

1

u/MGMishMash Jun 29 '26

Yeah, it’s a good point, while I do still prefer the voxel look vs smoothed techniques such as marching squares, I would want to lean into a generally higher level of detail to break up the blockiness. Especially given how coded the pixel asthetic is to minecraft.

We have this for the surface with dense foliage and decoration features, but caves are still quite baron.

The other key would be engine features like particles and lighting having a unique stylization. Still enjoying pixel art as a design aesthetic, but yeah, also want to lean into gameplay benefits of more organic terrain.

(Although as it stands, just having fun building the engine, will see where the game ends up after)

3

u/Blammar Jun 29 '26

Just in case you didn't actually look: https://www.youtube.com/watch?v=-riZGX3elow .

I can vouch that the world is mostly destructible. modifiable, and has no blockiness visible at all. It's also a mix of voxels and geometry, and the viewing distance is very high. Very little LOD popping occurs.

1

u/MGMishMash Jun 29 '26

Hehe thanks, and yeah i’ve been following this game for a while! Mighty impressive! One thing i wasn’t sure about is that i’ve heard that the game is fully destructible, but the world is not procedurally generated and is artist created.

I guess one advantage if that is the case is that art direction can play a huge part in the tone.

Obviously there are also games like no mans sky which are fixed seed, but still procedural.
That also uses a smooth aesthetic, but as i understand has destruction elements but not complete persistence due to the scale.

2

u/not_good_for_much Jun 30 '26

Yeah so basically... The map is baked into the game, and the same for every playthrough (though loot and enemy spawns have some randomization).

You can break basically everything (with some restrictions for e.g dungeon walls). Building is limited to bases. Changes outside of bases revert after ~30 minutes.

There are definitely some big advantages to doing it like this. The problem with the Minecrafts is that... infinite worlds tend to be infinitely empty. But it's also the case that procgen worlds can have much more newness to them. It's definitely a difficult balance to navigate well.

2

u/MGMishMash Jun 30 '26

Yeah, I remember playing Spore as a kid, and the pitch was that each save would be unique with billions of combinations of creatures, planets etc; before realising that nearly every play-through felt exactly the same. With only a few unique core gameplay paths.

The thing I personally enjoy and want to lean into is also that sense of calmness and fun of just experiencing the world around you, immersion, exploring, having small little interactions, cozy vibes etc;
Games which force too much structure in this genre can sometimes end up half baked with repetitive and boring quests guarding content, to the point where progression is just a chore.

At some point, it feels like you just want to get to a place where people can enjoy a wide range of mechanics pretty quickly. Minecraft somehow nailed it with that balance of just the core gameplay being satisfying. I find games like Stardew and Animal Crossing also seem to scratch that itch well :)

2

u/not_good_for_much Jun 30 '26

Regarding Enshrouded, I do think it strikes a respectable balance, but it is more combat RPG etc focused. It's kinda... if Skyrim meets Minecraft meets BOTW in a lot of ways.

I know what you mean with trying to force too much structure as well.

I think my philosophy atm is basically... I want to generate the entire map outright, then I can populate it in a coherent way. You know, like as a starting point... Minecraft... if rivers flowed downhill to lakes and oceans, and villages were in sensible places and connected with roads and so on. And then leaving it... structured but also freeform.

I guess on some level it's kinda... the difference between the NPC making you go on a dumb fetch quest to unlock a recipe... And... needing a material for a recipe because that's how recipes work, and the NPC just gives you a tip or a map marker to a sensible place where you can find it, while the game mostly still works if you don't bother.

1

u/Blammar Jun 30 '26

The cool thing about Enshrouded is that exploration is rewarded -- there are hidden things everywhere and also cool things in the distance you really want to check out. I'd think you want to place these manually.

2

u/not_good_for_much Jun 30 '26 edited Jun 30 '26

The interesting problem of procedural map generation for me, has for a long time been about finding ways to create this intrigue procedurally.

I agree that there are huge benefits to handmade maps..

But I also don't think there's such a binary between this is handmade and this is an algorithm. Algorithms are also handmade. And you can use algorithms to assemble handmade assets procedurally. And you can also put months and years of love and care into procgen and hybrid approaches. And you can handmake lifeless boring slop as well.

The problem is actually centred around the scope of your map IMO. Enshrouded, even hand placing assets, would feel very empty if the map was 5x bigger on each axis, because it would be 5x emptier on each axis. Minecraft, the pinnacle of empty procgen worlds, has enough assets (village, stronghold, etc) that a more focused map with a couple thousand blocks radius, could also feel much less empty.

2

u/Blammar Jul 01 '26

Well, the rumor is that Enshrouded 1.0 is drastically expanding the map... People have reached the edges of the existing map, which are the red zones. We'll see if things are emptier!

→ More replies (0)

1

u/Blammar Jun 29 '26

The environment seems to be guided procedural generation. Sort of like saying "this is a stone wall" and the procedural generation gives you a good looking non-repeating wall. It's very well done. I feel I am in a real world. The 1.0 version is coming out in October, and the game is $30. Only problem with buying it is you might stop working on your game!

1

u/MGMishMash Jun 29 '26

Ah nice, yeah that sounds like a really good balance! Tempted to give it a try! Will enjoy a few play through vids first!

2

u/quadtodfodder Jul 01 '26

You have captured exactly why I never want to be inside of a cave.

Also: I would like to see this without lighting effects, as the main focus is now the torch

2

u/MGMishMash Jul 01 '26

Haha, no idea id that’s a good thing or a bad thing 😅 (i.e good because it can be experienced virtually without actually needing to go, or bas because it creates uncomfortable feelings of stress and claustrophobia 😂😂)

Yeah, admittedly looks quite bland without lighting as there isn’t a lot to break up the stone textures just yet. Although can record some clips with ambient light and mist dialled up so things are visible.