DanoMagnum.com

>Roguelike_Bezier_Map 

Last Edit: May 18, 2020, 2:28 a.m.

I've been working on trying to add different feels for each of the biomes in my game's overworld aside from just using different characters / sprites. For forests, I wanted to have twisting and winding paths and I've come up with a solution that produces pretty good results. After seeing the results and how easy it is to create paths betwen two arbitrary points I suspect it would also be a good way to connect disjointed areas in for some map types.

There are some GIFs at the bottom. showing the generation process and final products.

Here is the general algorithm.

First, fix the curve end points. In this case, I want entries and exits on the border of the map. Fix the first and last N points next to the start/end points. This is to define a general "approach angle" of the bezier as it goes to your target coordinates. I fixed one extra point just inside of the start/end points in the examples below. (I wanted the exits to be mostly normal to the edges) Add some number of randomly selected middle points between the start fixed points and ending fixed points. Draw the bezier on the map using the points you've built up. Expand the curves to a usable path size - I used a couple different ones you can see below. (You could also use a larger "brush" when you draw the curve in the first place) Finally, prune out any walls that are standing alone just to make it look less noisy.

Examples:

Cellular Automota:

Basic "Grow" algorithm.:

More curves = more open area:

For the bezier curves I found a stack overflow answer (of course) that referenced this website: https://pomax.github.io/bezierinfo/ which has a ton of info on them.