Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continent generation? #6

Open
blacksmith94 opened this issue May 10, 2021 · 1 comment
Open

Continent generation? #6

blacksmith94 opened this issue May 10, 2021 · 1 comment

Comments

@blacksmith94
Copy link

Is it possible to create more mountain ranges?

@redblobgames
Copy link
Owner

The current algorithm is to assign elevation as the distance from the closest water. This is the style of mountains we needed in the game mapgen2 was for.

The code is in assign_t_elevation. It uses the coastline as the starting point, then runs breadth first search (also called "flood fill" or "dijkstra map" or "distance map") to calculate the distances from the coast. That turns into values from -1 to +1, where -1 means higheset distance in the ocean and +1 means highest distance on land.

I think another reasonable (and easy) way to make mountains is to use a noise function like the one in fbm_noise to calculate elevation. This is what mapgen4 does. It doesn't produce good mountain ranges though, because noise tends to make isolated peaks. You can tweak the noise by using ridged noise.

Yet another way to make mountain ranges is to use tectonic plate simulation like this or this. I think you may not have to run the entire simulation, but get a quick approximation by assigning random velocities to plates. I tried this in this project but didn't spend a lot of time on it. More about tectonic plates.

The one thing to be aware of is that if you have elevation that has "local minima", the rivers won't know where to go from there. This opens up a can of worms, as you have to decide whether the river should erode a canyon, fill up a lake (endorheic), or turn into an underground stream (cryptorheic). Mapgen2 and mapgen4 do not have any of this simulation, as we didn't need it for the games these projects were for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants