Skip to main content
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
  • 139k
42 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,744
37 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
  • 28k
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
  • 139k
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
29 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
  • 13.2k
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
  • 30.4k
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
  • 139k
24 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
  • 30.4k
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
  • 122k
18 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
  • 139k
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
  • 139k
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 runs ...
congusbongus's user avatar
  • 14.9k
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
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,059
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
  • 122k
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
  • 139k
11 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
  • 221
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,793
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
  • 122k
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,323
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
  • 122k
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
  • 15.1k
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
  • 903
8 votes
Accepted

How can I procedurally find a wall that separates two or more points on a grid-based map?

I will present a general concept and three solutions using that concept. Concept is an Influence map: For each location in the map, you are going to store a number that represent the distance to each ...
Theraot's user avatar
  • 28k
8 votes
Accepted

3D terrain generation: geological slices and noise function

(1) Using the same perlin seed (map) as used for terrain You could treat ranges in the perlin result as different materials. Thus at a certain threshold, you transition from air / vacuum to matter, ...
Engineer's user avatar
  • 30.4k
8 votes

How does Terraria generate such large worlds initially?

Couple of additions to Steven's informative answer, at a technical / processing level... speaking here in a general sense of the techniques used to generate large worlds (not Terraria specifically). ...
Engineer's user avatar
  • 30.4k
7 votes
Accepted

Making dialogue different with each playthrough

There's a great GDC Talk by Elan Ruskin of Valve on what they call "AI-Driven Dialogue through Fuzzy Pattern Matching" or "Rule Databases for Contextual Dialogue and Game Logic" - it's the system that ...
DMGregory's user avatar
  • 139k
7 votes

Procedurally generating a building of specific area

Given a restriction of "all areas are at are at least 3-4 blocks wide" the first idea that leaps to my mind is something like the following: pick one of 3x3, 3x4, 4x3 or 4x4 place a block of that size ...
Ryan1729's user avatar
  • 724
7 votes
Accepted

Procedurally generating a building of specific area

You could use pre-generated polyominoes as meta shapes to build an assortment of buildings. Let's say your minimum acceptable distance is 3 blocks. Then the smallest acceptable building unit we'll ...
Pikalek's user avatar
  • 13.2k

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