This change lifts large portions of ExperimentalMapGenerator's logic
into a new "Terraformer" class with highly documented methods that can
theoretically be used by alternative map generator classes. Some
additional refactoring may occur in future, subject to the practical
needs of additional map generators. ClearMapGenerator is also
simplified.
This is not a pure refactor and contains some algorithmic and
behavioral changes, as well as few minor bug fixes. Notably:
- The logic for obstructing unreachable water has been somewhat
replaced.
- In CnC, where water is already unplayable, EMG no longer obstructs
water. (RA still does, as water is playable there.)
- Mountain (cliff) generation is now somewhat more effective. This
increases the number of cliffs seen on many presets. Settings should
no longer use "Mountains: 1000".
- PlayableSpace logic has been consolidated into Terraformer.
- PlayableSpace.Playability no longer exists as PartiallyPlayable
became redundant. Its uses have been replaced with a simple
boolean. Consequently, some defunct code and configuration has been
removed.
- Adjust MultiBrush replaceability contract painting behavior to be
more intuitive.
- Fix off-by-one error in map bounds computation.
- Fix some usages of mixed up MersenneTwisters.
Exposes the TilingPath code used by the map generator as a map editor
tool to help automate the process of tiling sequences of templates
together.
No additional template stitching definitions are added as part of this
commit. As such, the tool currently only supports the same auto tiling
as the map generator does. This includes:
- RA and CnC support.
- Beaches, land cliffs, and roads.
Support for additional mods and templates can be added in follow-ups
by adding the necessary MultiBrush definitions.
Related changes included in this commit to support this work include:
- Add support for sparse EditorBlits.
- Add support for MultiBrush to EditorBlitSource conversion.
- Add support for EditorBlitSource previewing.
- Adjust the "Road" types used in segmented MultiBrush definitions.
The editor's resource value calculation logic was fixed in #21820 to
match actual gameplay. The map generator logic originally copied the
editor logic from EditorResourceLayer rather than ResourceLayer and
associated game logic. As such, it inherited incorrect calculations.
This change updates the map generator logic to match the now
consistent logic in both ResourceLayer classes. Map generator resource
settings are also adjusted -25% to continue roughly matching the
previous resource output.
CnC map generation previously only supported maps with water/beaches
for the DESERT tileset, as it is the only tileset with a complete set
of beach tiles. This change adds support for the other tilesets
(TEMPERAT, SNOW, WINTER) by adding fake beach templates constructed
from actors and other templates' tiles that look reasonable in both
original and remastered graphics.
This means all CnC tilesets have feature parity in the map generator.
This tileset was community content, and does not have remastered assets.
There is no realistic prospect to creating equivalent remastered assets,
which leaves removal in order to achieve parity between classic and
remastered modes.
Allows the random map generator to optionally place civilian buildings
around the map for extra decoration. Buildings are placed last with
lowest priority to avoid competing for play area and resources.
Depends on #21738
Spawn generation generally tries to place spawns:
- In spacious areas
- Away from the center (true center or mirror lines)
- Away from a symmetry-projected spawn
- Away from previously placed spawns
This commit introduces the following adjustments:
- The spacing between sequentially placed spawns is relaxed.
- Fix spawn mines contributing too much to the space reservation.
- Factor rotations into anti-center biasing calculation.
- Preserve spacing information in center space fallback decisions.
- Use a linear (instead of binary) falloff for anti-center biasing.
- Enforce that spawns have a minimum buildable area around them.
- Enforce that symmetry-projected spawns have as much separation as
sequentially placed spawns would.
- Allow spawns on or near roads.
Removes all use of floating point from the RaMapGenerator map generator
and its dependencies.
Floating point behavior is potentially non-portable across client
hardware. Removing them should make the map generation logic
consistent even across clients with different floating point hardware
or compiler behavior. This may be useful for sync-safe multiplayer map
generation where clients independently generate the map from settings.
Most previously fractional public-facing settings are now represented
as numbers out of 1000, with some exceptions using 1000000. Most
internal logic which relies on fixed-point concepts now uses 1024ths,
though some floating point mechanisms have been replaced with
alternative discrete approximations (e.g. gaussian to binomial).
Adds map generator support for CnC (all tilesets), largely on par with
RA.
Most tilesets do not have a complete set of beach templates and
therefore do not support terrain settings involving water. DESERT is the
only tileset supporting water. Unlike in RA, water is not playable space
in CnC (no naval units), so only terrain settings with small bodies of
water are available.
Most changes are configuration (tileset and map generator config), with
just a small number of code changes.