Add experimental RA procedural map generator

Add an experimental procedural map generator for the Red Alert mod,
along with supporting code that may assist in the development of map
generators for other mods.

Map generation may be accessed as a tool in the Map Editor. This change
does not presently introduce direct lobby options for generated maps.

Features:

- Terrain with land, water, beaches, cliffs, roads, debris, and trees.
- Placement of mpspawns, neutral buildings, and resources.
- Rotational and mirror symmetry options.
- Various configurable parameters with presets.
- Deterministic with configurable seed.
- Performant.
This commit is contained in:
Ashley Newson
2025-01-07 22:48:08 +00:00
committed by Gustas
parent 0536c58b78
commit 417f787294
41 changed files with 11795 additions and 7 deletions

View File

@@ -1145,6 +1145,11 @@ namespace OpenRA
}
public byte GetTerrainIndex(CPos cell)
{
return GetTerrainIndex(cell.ToMPos(this));
}
public byte GetTerrainIndex(MPos uv)
{
// Lazily initialize a cache for terrain indexes.
if (cachedTerrainIndexes == null)
@@ -1153,7 +1158,6 @@ namespace OpenRA
cachedTerrainIndexes.Clear(InvalidCachedTerrainIndex);
}
var uv = cell.ToMPos(this);
var terrainIndex = cachedTerrainIndexes[uv];
// PERF: Cache terrain indexes per cell on demand.
@@ -1168,7 +1172,12 @@ namespace OpenRA
public TerrainTypeInfo GetTerrainInfo(CPos cell)
{
return Rules.TerrainInfo.TerrainTypes[GetTerrainIndex(cell)];
return GetTerrainInfo(cell.ToMPos(this));
}
public TerrainTypeInfo GetTerrainInfo(MPos uv)
{
return Rules.TerrainInfo.TerrainTypes[GetTerrainIndex(uv)];
}
public CPos Clamp(CPos cell)