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

Lakes #30442

Merged
merged 7 commits into from May 15, 2019
Merged

Lakes #30442

merged 7 commits into from May 15, 2019

Conversation

ralreegorganon
Copy link
Contributor

Summary

SUMMARY: Content "Lakes"

Purpose of change

Add lakes as an overmap feature.

A picture is worth a thousand words and all that...

overmap
image

local lake shore mapgen
image

Describe the solution

  • Define a noise based lake generation approach indexed by the global overmap terrain coordinates.
  • Define a lake shore local mapgen for smooth lake shores that follow the overmap-level shoreline, with a bit of randomness.
  • Make river and and lake mapgen a bit more aware of each other so rivers can cleanly flow into and out of lakes.
  • Update region settings to allow some control over lake generation, along with associated documentation.
  • Retire the old Lake overmap special that just plopped a few river_center terrains down on the overmap.

Some additional housekeeping was required to make this clean, namely:

  • 4db1531 - extracting the river and road placement out of the overmap::generate and into methods of their own
  • 4545869 - extracting the logic used in mapgen to invoke a given overmap terrain's mapgen function out into a function of its own

This PR is in draft since I'm still play-testing it. Right now it feels pretty done to me but I'm still settling the numbers and playing it looking for oddities.

Unlike normal overmap specials, you don't get a lake on every single overmap, and I think that's a good thing. In playtesting, sometimes I'd travel many overmaps before finding a lake, and other times I'd start right on the shore of a massive lake. Because the lakes are created globally, they continue in reasonable ways across overmaps. In general, the lakes are also connected to rivers, so if you've got a suitable vessel you can travel pretty far on the water (look out for those bridges!).

I'm hoping that this prompts some more aquatic content creation--sailboats, aquatic creatures, locations, and the like--and also helps provide some motivation to tackle some features and bugfixes like fish colliding with your vessel and underwater gameplay mechanisms.

Describe alternatives you've considered

I intend to have the lakes carve out some additional water column z-levels and a lake bed, giving us multi-z-level water locations, but I didn't want this PR to get any bigger and there will be some additional work to be done there anyway beyond just placing the overmap terrains.

I'd also like to place overmap specials on lakes and lake shores--think docks, marinas, and the like. I've taken some steps to ensure that those get handled appropriately--for example, there are new overmap terrain flags to indicate that an overmap terrain should be considered a lake shore or a lake, and the local mapgen checks those rather than specific overmap terrain ids when building the shore. Actually adding these specials seems a bit too much for this PR, and I'd rather leave that sort of content generation to those with experience doing it.

Right now, the lakes use the same monster/critter groups and logic for placement as rivers. There's may be some value in differentiating those, but doing it as part of this PR seemed like a bit too much.

Additional context

Screenshot time.

one overmap, with city size 16 and spacing 0
We can just see the edge of a lake that our mega-city sits on...
image

same location, but with an expanded view of adjacent overmaps
image

a sequence of lakes in a wilderness (city size 0) run, many overmaps wide
image

standing on the shore of one of those lakes
image

a lightly forested tiny island
image

local view of the island
image

a campground on the lake shore by the forest
...ignore the lab, it's totally safe...
image

local view of the campground on the shore
image

A link to a big map (17280 x 17280 pixels) that some of the above are from if you've got the horsepower to view it: https://user-images.githubusercontent.com/11464/57579311-af5ab180-7446-11e9-9f1e-6e9e8b1f1aa3.png

@ralreegorganon ralreegorganon added <Documentation> Design documents, internal info, guides and help. [JSON] Changes (can be) made in JSON Map / Mapgen Overmap, Mapgen, Map extras, Map display [C++] Changes (can be) made in C++. Previously named `Code` [Markdown] Markdown issues and PRs labels May 12, 2019
@Night-Pryanik
Copy link
Contributor

Holy cow, that's just too good to be true! Good job, as always!

@Inglonias
Copy link
Contributor

I'd like to be able to adjust the size of these lakes in the world options. I'm also concerned about being stranded on an island when I spawn.

Other than those concerns, this is freakin' gorgeous. Absolutely beautiful and I cannot wait to see it happen!

@Mecares
Copy link
Contributor

Mecares commented May 13, 2019

I am not very concerned about being stranded on a island as starting position, as long it is not too often, we do not guarantee every run to be winnable. A stranded on an island starting scenario on the other hand might be a great challenge scenario. Name your Character Robinson Crusoe and enjoy.

@ralreegorganon
Copy link
Contributor Author

I'd like to be able to adjust the size of these lakes in the world options.

Lakes are controlled by regional settings, not world settings. They may vary across regions as we introduce actual different regions (e.g. biomes), and in general we want to keep the options menu light.

The existing mechanism for customizing region settings is the region overlay and this PR includes some configurable settings which are documented here.

Because of the generation mechanism, you can't just define a size you want the lakes to be, but instead are controlling the threshold for what should be considered a lake, and they'll expand and shrink accordingly.

Here's an animated example of an area that is 10 overmaps wide and 10 overmaps tall, visualizing what would be considered a lake based on the settings (lake is white, non-lake is black) as the settings move in 0.01 increments from 0 (everything is a lake) to 0.59:

out

So, while you can't set options for lakes in the world menu, you can trivially add a "big lakes", "tiny lakes", "all lakes" or "no lakes" mod and include it in your world. Observers might also note that with the single threshold as written you can't really have "lots of lakes" and "small lakes" at the same time, as the frequency and size are related here. It is entirely possible to adjust the maths to allow for that, but I'm not interested in that level of external customization for my first pass at this.

I'm also concerned about being stranded on an island when I spawn.

I think if this actually becomes an issue, it's better tackled primarily from the "adjust the code that picks spawn locations" angle rather than from the mapgen side of things. In practice, it's relatively rare to actually get a completely isolated island in the lake because of the mechanism used to create them, and I expect that any content that causes you to spawn on such an island (e.g. someone's "Alcatraz Island"-esque prison location) will also provide the means to leave the island, either directly or indirectly.

@ralreegorganon ralreegorganon marked this pull request as ready for review May 14, 2019 18:46
@ZhilkinSerg ZhilkinSerg self-assigned this May 15, 2019
@ZhilkinSerg ZhilkinSerg merged commit 0311e76 into CleverRaven:master May 15, 2019
@ZhilkinSerg ZhilkinSerg removed their assignment May 15, 2019
@KurzedMetal
Copy link
Contributor

So freaking cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` <Documentation> Design documents, internal info, guides and help. [JSON] Changes (can be) made in JSON Map / Mapgen Overmap, Mapgen, Map extras, Map display [Markdown] Markdown issues and PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants