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

How do I increase the number of lakes? #5

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

How do I increase the number of lakes? #5

blacksmith94 opened this issue May 10, 2021 · 1 comment

Comments

@blacksmith94
Copy link

blacksmith94 commented May 10, 2021

The library works flawlessly with the tips you told me, I managed to rasterize the polygons in C# without issues :) I think i'll use mapgen2 for now, i love the results it gives, but i feel like there are very few lakes
How do I encrase the number of lakes generated?

@redblobgames
Copy link
Owner

The lakes and oceans are assigned in the same place: assign_r_water. Right now it uses a noise function (fbm_noise), and then when that value is < 0 then r_water[r] is set to true.

You can use anything you want here! :-) In my older version of mapgen2 (written in Flash) I had more options here, including one that formed islands in the shape of my blob logo (see example).

If you want some small lakes you can something like this:

for (let r = 0; r < mesh.numRegions; r++) {
    if (Math.random() < 0.1) { r_water[r] = true; }
}

Larger lakes are a little trickier because you'll want to find the neighboring regions and also make them into water.

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