Guillem Serra | Portfolio

{ video game programmer }

Procedural cave generation

UnityProcgen
Procedural cave generation
April 2019

Editor to create hexagonal cave levels.

Made this editor tool for a game about a goblin miner, that keeps digging and digging deep beneath to find minerals and defend against giant spiders and worms.
I used a hexagonal grid with a graph-based system to detect if all caves are reachable by the player.

Algorithm process:

  • Random positions in 2D hexagon grid.
  • 3D Hexagonal Caves instantiation, walls cutting.
  • Graph creation based on hexs (nodes).
  • Edges creation (tunnels) based on walls normals and checking intersections.
  • Breadth First Search to check if the level is explorable.
  • Tunnels instantiation according to edges.
  • Props instantiation.
  • Rocks instantiation using Poisson-Disc Sampling algorithm.
  • Falling Path creation (slightly different algorithm).

3D assets by Pol Blanes & Adrià Fret.

image
image
image
image
image
image
image
image

Deep Beneath:

The original game that uses it is Deep Beneath.

Image Image Image

It's open source but the code does not represent my current programming skills! GitHub (By bye SOLID!)