Skip to main content
Share Your Experience: Take the 2024 Developer Survey
48 votes

How can bays and straits be determined in a procedurally generated map?

Here's a rough idea using image processing transformations to isolate the features of interest: Apply a flood fill from an ocean cell to make a mask of all ocean cells. Depending on how your rivers ...
DMGregory's user avatar
  • 135k
41 votes

Procedurally generate regions on island

In the real world, those provincial borders will often be following geological features like rivers. So maybe a good approach would be to model the geology of the island and have the borders fall out ...
Bram's user avatar
  • 3,719
36 votes

What's the difference between 'Dynamic' , 'Random', and 'Procedural' generations?

Disclaimer: If true random exists in our reality, and what is the nature of free will are topics beyond this answer. The random I speak about in this answer is pseudo-random (when I say "random&...
Theraot's user avatar
  • 27k
32 votes

Continents with Simplex noise

It looks like you're looking for "Turbulence", "Fractional Brownian Motion", or something similar. This is where we take multiple samples of the noise at different scales - like the different panes ...
DMGregory's user avatar
  • 135k
30 votes
Accepted

How can bays and straits be determined in a procedurally generated map?

The way Dragons Abound identifies bays is to walk along the coastline and find two spots on the coastline where the straight-line distance between the spots is less than the distance along the ...
Dr. Pain's user avatar
  • 416
28 votes

Procedurally generate regions on island

I would solve this problem with two passes of Voronoi diagrams: First Pass: Region Partitioning The first pass would use a somewhat sparse distribution of points (i.e. the distance between the points ...
Pikalek's user avatar
  • 12.4k
27 votes
Accepted

Why is this Procedural Content Generation while that other isn't?

By way of analogy A circuit does not generate power. A light bulb does not generate power. A battery does not generate power. None of the things which use or store generated power, are power ...
Engineer's user avatar
  • 29.9k
26 votes
Accepted

Consistent cross platform procedural generation

The best resource I've found on this topic is Bruce Dawson's blog article "Floating-Point Determinism" It establishes that yes, in theory, you could get cross-platform determinism out of ...
DMGregory's user avatar
  • 135k
23 votes
Accepted

How to generate a city street network?

A good place to start with procedural city generation is Parish and Müller's Procedural Modeling of Cities. Their paper presents an L-System in which rules concerning population density & road ...
Pikalek's user avatar
  • 12.4k
23 votes
Accepted

How do Minecraft know where village's buildings are if the village is not generated yet?

Yes, it generates more chunks (or at least more of the village tree) than you think it does. This is what I call "area of interest" in my voxel code. There are two kinds of area of interest: Logical (...
Engineer's user avatar
  • 29.9k
18 votes
Accepted

How to report bugs found on procedurally generated levels?

It can also be very useful when your map generation algorithm is deterministic and repeatable based on an initial seed value. So when you enter the same seed value, you get the same map. This might be ...
Philipp's user avatar
  • 120k
17 votes

How can I fix zig-zagging UV mapping artifacts on a generated mesh that tapers?

Typical UV mapping is what's called an affine transformation. That means the mapping of each triangle between 3D space and texture space can include rotation, translation, scaling/squash, and skew (ie....
DMGregory's user avatar
  • 135k
16 votes
Accepted

How would I go about generating a star map?

A Poisson-Disk sampling distribution will allow you to select random points a minimum distance apart & Bridson's algorithm can efficiently solve the problem in O(n) - fast enough for real time ...
Pikalek's user avatar
  • 12.4k
16 votes

Procedurally generating a building of specific area

A simple way to build a procedural generator is: Randomly build things Run a function that checks whether the output is good If the output is not good, go to step 1 Even if it takes thousands of ...
congusbongus's user avatar
  • 14.8k
16 votes
Accepted

How to Instantiate an array of Prefabs in a chequerboard pattern

In the decision on what tile prefab to choose, you can think of it this way: If (xCoord + yCoord) % 2 == 0, then select prefab1 If (xCoord + yCoord) % 2 != 0, then select prefab2 This ensures the ...
Panagiotis Iatrou's user avatar
16 votes
Accepted

How to randomly generate biome with perlin noise?

There are three main steps here: Use some method to assign biomes to regions (this is the hard part, with multiple strategies I'll break down shortly) For each point in your mesh or tile/node in ...
DMGregory's user avatar
  • 135k
15 votes

Procedural generation of semi-correct planetary systems

Simplify to 2-body physics. N-body physics is in general chaotic and you cannot simulate them to a stable orbit. Single stars For systems with a single star, I'd ignore the N-body problem and just ...
Jimmy's user avatar
  • 9,029
14 votes

How do I programatically lay tiles with the Godot engine?

You can programmatically set a cell in the TileMap class by using the set_cell function. Note: if you're new to an engine & ...
Pikalek's user avatar
  • 12.4k
13 votes
Accepted

Procedural generation of semi-correct planetary systems

In order to create a plausible solar system, make sure every orbit is within the sphere of influence of the parent body, but not within the hill sphere or roche limit of another body. The sphere of ...
Philipp's user avatar
  • 120k
13 votes
Accepted

How can I tile Perlin noise to more accurately represent a world map?

For this particular mapping, I'd stick to 2D Perlin noise. To recap, 2D Perlin noise works by... dividing space into square cells, and examining the one cell our sample point falls inside picking a ...
DMGregory's user avatar
  • 135k
10 votes

Minecraft style world generation

What you are looking for is Fractal Noise generation algorithms, the most popular of which being Perlin noise with successive octave noise generation (in addition to simplex noise, which is patented ...
Krupip's user avatar
  • 1,763
10 votes
Accepted

Town generation algorithms

Introversion Software made a really impressive city generator for their cancelled indefinitely suspended project Subversion: The algorithm is designed to generate large, modern metropoles. But the ...
Philipp's user avatar
  • 120k
10 votes

Continents with Simplex noise

Not with noise alone. The other answer is correct, you overlay several octaves of noise to get a realistic structure. But you need to bring in physics as well or it won't be a result resembling ...
Tom's user avatar
  • 1,314
10 votes

How can I make a solitaire game that can be solved?

Backtracking. Start with a solved game. Then perform random valid moves in reverse until the game is in the initial state. This usually works with any puzzle game.
Philipp's user avatar
  • 120k
10 votes

How do Minecraft know where village's buildings are if the village is not generated yet?

Technical stuff During Minecraft's chunk generation a chunk passes several stages before it is done and can be rendered. These stages, in order, are as follows: ...
hoffmale's user avatar
  • 211
9 votes

How can I implement world generation like in Don't Starve?

You can achieve a very similar result by using voronoi diagrams: You'll need to generate a set of points (one for each biome) with a seeded pseudo random generator (if you want the maps to be ...
Bálint's user avatar
  • 14.9k
9 votes

How does Terraria generate such large worlds initially?

When the world generates, you'll see various texts appearing while waiting. These texts aren't random, the world is actually processing what the text says. I've seen a video that showcases how the ...
Steven's user avatar
  • 881
8 votes
Accepted

Procedural Generation, Game Updates, & Butterfly Effect

I think you've covered the bases here: Using multiple generators or re-seeding at intervals (eg. using spatial hashes) to limit the spillover from changes. This probably works for cosmetic content, ...
DMGregory's user avatar
  • 135k
8 votes
Accepted

How to automatically generate (creative) names for stuff?

In one game I used this technique to generate names for procedurally generated NPCs. They are not true Markov chains, but follow a similar idea: Take a bunch of real-world names for the entities (...
Philipp's user avatar
  • 120k

Only top scored, non community-wiki answers of a minimum length are eligible