Voronoi World Generation


(Zachary Lewis) #1

Demo →

Controls

  • Generate a new map by clicking anywhere.
  • S: Toggle site visibility.
  • E: Toggle edge visibility.
  • R: Toggle region visibility.

Overview

Tonight I got the urge to create a game for my girlfriend. We’ve been playing Diablo III together and she’s been having a great time. She loves leveling up and getting new spells and abilities, but she feels like she won’t enjoy the endgame of just farming for better loot so she can farm for better loot.

I figured that I could make something simple, more replayable, and with a much longer progression chain.

Replayability

I knew I wanted to have completely randomly generated worlds, but I’m not going to mess about with caves and platformers that such nonsense. I wanted something that feels like a large world and doesn’t conform to a grid. I decided I want to use a Voronoi diagram as the basis of my world. I randomly select sites on the screen as the basis of my Voronoi diagram. (In the future, I’ll be a bit less random in the selection of these sites to create a more uniform Voronoi diagram).

Once I had that working, I wanted to have blocks of terrain to be impassable. I randomly selected a few sites and a size, marking all the sites within that size range using a DFS. I then filled the “impassable” sites.

Sample Worlds

Next Steps

Next, I plan on improving the blocking site selection using a better algorithm to ensure all unblocked sites are accessible.