You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Is it possible to create more mountain ranges?
The text was updated successfully, but these errors were encountered: