Your favourite procgen functions?

S

Slothagami

Guest
What are some cool functions for procedural generation or texture generation? Things like perlin noise that can be used to make different types of shapes? Something that generates a cool texture?

I think it would be useful to have a list because I can't find one online (I don't really know the propper search terms)

If there is a better place to put this post let me know as well.

Thanks!
images (5).jpeg
 
Last edited by a moderator:
Well, some stuff to look into for proc gen is:

Poisson Sampling
Voronoi Diagrams
Flood Fill
Wang-tiles
Cellular Automata
Drunkard Walk
Delauney Triangulation
Grammar (search procedural generation grammar for this one)

Those are some stuff of the top of my head. The thing with proc gen is that...there's a lot of stuff that can be applied to it. Like a lot a lot. Each proc gen game tends to have a unique take on procedural generation so there's about as many approaches as there are programmers willing to approach it. But here's a link dump that you can dive into:

https://www.redblobgames.com/ (AMAZING resource for tons of pathfinding and map generation techniques)
 

Yal

🐧 *penguin noises*
GMC Elder
A lot of games also use hybrid approaches... the first algorithm I ran into used a technique where you first generate a perfect maze (for every cell in a grid, make a tunnel to a different cell until you intersect another visited cell) and then removed dead-ends (cells with only one connection) until the desired density was reached, and finally superimposed rooms on top of the maze for variety. I've seen an algorithm that generates a Hilbert Curve (which isn't random) and then picks a random part of the curve to "zoom in" on (and only keeps the rooms that are connected) to get an undulating shape in constant time (but with less "randomness ceiling"). Binding of Isaac, Eldritch, and Spelunky all just glue predefined, uniform-size rooms together, and all the time spent on not making complex terrain generation instead was spent on making lots of rooms to choose from.


There's a lot of lore in this field as well... this has been a thing for almost as long as videogames have existed.
  • "Vaults", predefined rooms, are used to add meaningful and less-random content (e.g. cool boss arenas), but if you don't have enough vault variety players will start spotting the repeats really quickly.
  • "Random tables" are lists for valid entities that can fill a given spot (e.g. "loot container", "melee enemy", "doorway" etc), especially in top-down approaches where you decide what something is first and THEN fill it in they're a good way to maintain control over the output.
  • Top-down vs bottom-up approaches are fundamentally different ways to design an algo: in top-down, you first decide what you want to make, and then make it according to certain rules (e.g. a "house" need to have manmade walls and floor tiles, a "poison swamp" needs to have 75% poison water tiles and can only spawn certain enemy types). In bottom-up, you first design stuff using a single algorithm (e.g. perlin noise) and then afterwards decide what it looks like the most (e.g. if the terrain altitude is over a certain amount, it's a MOUNTAIN region, so change it to pure rock with some snow on top). Top-down needs more work to maintain the same amount of randomness, but usually gets better results. Usually top-down works better for human-made structures and bottom-up works better for natural stuctures, but there's nothing fundamentally better with either.
 
Top