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

Add regional terrain/furniture resolution to mapgen #35627

Merged
merged 1 commit into from
Nov 22, 2019

Conversation

ralreegorganon
Copy link
Contributor

@ralreegorganon ralreegorganon commented Nov 20, 2019

Summary

SUMMARY: Infrastructure "Add regional terrain/furniture resolution to mapgen"

Purpose of change

Adds functionality to the regional map settings and mapgen so that regional terrains like a "t_region_shrub" can be used in JSON mapgen to denote regional appropriate terrain/furniture should be used, and the actual weighted list of valid terrain/furniture can be defined in the
region settings and resolved from the regional "pseudo terrain" to an actual terrain/furniture during mapgen.

This is more groundwork for allowing multiple regions and region overlays to better impact the overall content of a region, while also allowing map developers to defer some specifics of terrain/furniture selection to the region (e.g. "I want some fruit trees here, of whatever fruit tree type is appropriate for this region").

Describe the solution

  • Add new section in regional settings to define regional terrain/furniture
  • Add some new regional "pseudo terrain" for usage in JSON mapgen (the ones I added are examples and I'll leave the content work of coming up with a real useful hierarchy of these for later / to someone else)
  • Update mapgen to resolve the actual types from the regional psuedo terrain
  • Update documentation
  • Update trailhead mapgen as an example usage of this functionality

Describe alternatives you've considered

I'd actually like for the resolution of the terrain/furniture to not have to be explicitly invoked the way it is, but to do that requires something like making the map ter/furn set methods aware of their current region, or further abstracting away how mapgen invokes those methods, but both are refactoring tasks in and of themselves.

There's also nothing particularly special about the pseudo terrain entries--I contemplated adding some flags to them, but decided against it since they'd only be used in validation and by allowing this functionality to work with any terrain/furniture, it leaves the door open for more manipulation via JSON only. For example, if you REALLY hate the t_grass_long and t_grass_tall terrains, you can make a mod with a region overlay that says those two both resolve to t_grass and then you will not get any t_grass_long or t_grass_tall via JSON mapgen, just t_grass.

Testing

As part of developing this, I updated the trailhead mapgen to use this functionality, then teleported around until I found a trailhead and confirmed it worked as expected.

This functionality will work just fine with existing worlds, but note that it only gets applied during mapgen so it won't affect any overmap terrains that have already had mapgen run.

I also did some non-sensical but visually obvious things like updating the t_region_groundcover entry to instead resolve to t_lava, which gives this nightmare:

image

@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 Nov 20, 2019
src/mapgen_functions.cpp Outdated Show resolved Hide resolved
@ralreegorganon ralreegorganon force-pushed the region-terrain-types branch 2 times, most recently from ed99368 to c3e6861 Compare November 20, 2019 21:27
Adds functionality to the regional map settings and mapgen so that
regional terrains like a "t_region_shrub" can be used in JSON mapgen to
denote regional appropriate terrain/furniture should be used, and the
actual weighted list of valid terrain/furniture can be defined in the
region settings and resolved from the regional "pseudo terrain" to an
actual terrain/furniture during mapgen.
@ZhilkinSerg
Copy link
Contributor

Resolves #22268

@ralreegorganon ralreegorganon deleted the region-terrain-types branch April 7, 2020 16:09
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.

3 participants