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 support for dynamic predecessor mapgen #52208

Merged

Conversation

jbytheway
Copy link
Contributor

Summary

Infrastructure "Add support for dynamic predecessor mapgen"

Purpose of change

The idea is that some oter_ts are just a modification of the existing terrain, and we want to remember what that terrain was and generate it before proceeding with the mapgen for the current terrain.

Describe the solution

We implement this by adding a flag to the oter_type indicating that it needs to save predecessor information, and a fallback predecessor terrain to the mapgen. This serves two purposes: allowing it to opt in to this feature, which means it is no longer forced to define terrain for every location, and defining a fallback oter_t to use in the event none is stored in the overmap (which can happen, e.g. when the mapgen definition changes between overmap mapgen and tile mapgen for a particular OMT).

Use this new feature for the anthill.

Describe alternatives you've considered

Could have switched these OMTs to use update_mapgen rather than plain mapgen.

Testing

Spawn some anthills; see below.

Additional context

Here are some pictures of anthills in various terrains:
anthill-in-swamp
anthill-in-forest
anthill-in-field
Previously all anthills appeared in mostly grass with a few bushes.

@jbytheway jbytheway force-pushed the mapgen_can_rely_on_predecessor branch from d9f6f53 to e9ed28d Compare October 10, 2021 02:42
@BrettDong BrettDong added Map / Mapgen Overmap, Mapgen, Map extras, Map display [C++] Changes (can be) made in C++. Previously named `Code` labels Oct 10, 2021
The idea is that some oter_ts are just a modification of the existing
terrain, and we want to remember what that terrain was and generate it
before proceeding with the mapgen for the current terrain.

We implement this by adding a flag to the oter_type indicating that it
needs  to save predecessor information, and a fallback predecessor
terrain to the mapgen.  This serves two purposes: allowing it to opt in
to this feature, which means it is no longer forced to define terrain
for every location, and defining a fallback oter_t to use in the event
none is stored in the overmap (which can happen, e.g. when the mapgen
definition changes between overmap mapgen and tile mapgen for a
particular OMT).

Use the new feature for anthills, so that they blend better into their
surrounding terrain.

Expose predecessors in the debug overmap editor for debugging purposes.
@jbytheway jbytheway force-pushed the mapgen_can_rely_on_predecessor branch from e9ed28d to 8ac05a0 Compare October 10, 2021 11:33
@jbytheway
Copy link
Contributor Author

clang-tidy kindly reminded me that I must serialize the new overmap data. Fixed now. I also added debug visualization of predecessor terrains in the overmap editor.

@ZhilkinSerg ZhilkinSerg merged commit 59c33df into CleverRaven:master Oct 11, 2021
@jbytheway jbytheway deleted the mapgen_can_rely_on_predecessor branch October 12, 2021 01:48
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` Map / Mapgen Overmap, Mapgen, Map extras, Map display
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants