Water is not playable in CnC, so, the map generator may fill it in if
it's not attributed to the largest playable region. This would often
happen for circular-in-water maps when DenyWalledAreas is enabled.
This change adds a step to adopt any neighboring partially playable
space (such as beaches and water) into the largest region, which is
exempt from debris filling.
The change is almost purely cosmetic, though the previous debris filling
could slightly reduce playable space (due to filling playable beach
tiles), possibly causing generation to fail. As such, map generation is
now a very tiny bit more reliable.
When searching for ore, harvesters will prefer ore close to their refinery, the dockPos. However this only works when this is set, and is was not being set when expected. Fixing this prevents harvesters moving in straight lines, particularly when the ore is to the left of the refinery, which is the default path search direction.
Fixes a regression from d0974cfdd2.
- Tweak the Update and Remove methods to reduce the number of dictionary lookups required.
- Change the Update method to an indexer, this allows simplifying callers who wanted to AddOrUpdate a value.
- Implement IDictionary<T, Rectangle>, since the class already implements these semantics by providing a backing store of the bounds for each item.
- Clean up some naming to use the generic `item` instead of `actor`.
- Make the MutateBins action methods static.
Adds tooltip descriptions for a few map generator settings. The tooltips
are limited to dropdown choices. No tooltips are added for the options
containing the choices or any non-dropdown settings.
- Terrain type
- Bounds shape
- Buildings
The "Square" bounds shape is rephrased as "Rectangle" for consistency
with the added description.
This is UI-only change.
Target.Invalid acts like a NaN, and will not compare equal with itself. Compare against the TargetType instead, which performs the intended comparison.
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
This is similar to #21727, but in CellLayerUtils instead of MatrixUtils.
Note that the lack of long does not result in any overflows/crashes in
existing code, but can cause crashes for new features requiring larger
calculations.
Adds a fuzzer that iterates through map generation settings combinations
to either discover crashes or measure the frequency of rejected maps.
All generated maps are in-memory only and discarded immediately after
generation.
Running the fuzzer on anything other than a small combination of
settings is time expensive. It is added only as a utility for manual
invocation and is not integrated into the regular set of tests.
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.
Reorders and groups selective clearing of the resource placement plan to
-int.MaxValue to avoid subsequent code from inappropriately trying to
use it in arithmetic, which may just underflow to some completely wrong
value and lead to resources in illegal places.
Fixes a crash which happens when trying to generate very large maps,
such as 256x256.
```
Exception of type `System.IndexOutOfRangeException`: Index was outside the bounds of the array.
at OpenRA.Mods.Common.MapGenerator.MatrixUtils.CalibrateQuantileInPlace(Matrix`1 matrix, Int32 target, Int32 count, Int32 outOf) in /home/ashley/devel/OpenRA/OpenRA.Mods.Common/MapGenerator/MatrixUtils.cs:line 719
at OpenRA.Mods.Common.Traits.RaMapGenerator.Generate(Map map, MiniYaml settings) in /home/ashley/devel/OpenRA/OpenRA.Mods.Common/Traits/World/RaMapGenerator.cs:line 755
...
```
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).
Previously, only the RectangularIsometric case was handled, despite
this currently only being used in Rectangular mode. Additionally,
the calculation was slightly off.
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.
Updates the random map generator to produce more elaborate roads:
- Roads extend beyond map bounds.
- Shorter, unviable roads are pruned and merged to create longer roads.
- Roads can loop.
Use the covariant return type feature of C# 9 to allow method overrides to be more specific about their return type. By exposing this information, e.g. for Widget.Clone(), callers will have more information. This allows various casts to be removed as the information is now available within the type system.
Coastlines and cliffs at the edge of a map should have been getting
extended beyond the map edge help them tile reliably. This was not
happening due to a conditional that accidentally got inverted during a
refactor.
Fixing the conditional makes beach and cliff tiling significantly more
reliable. (Note that there is no effect on road tiling.)