Refine map generator spawn placement rules

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.
This commit is contained in:
Ashley Newson
2025-01-27 21:46:19 +00:00
committed by Gustas Kažukauskas
parent 440987c0a4
commit 1fda679b9f
4 changed files with 39 additions and 42 deletions

View File

@@ -278,26 +278,5 @@ namespace OpenRA.Mods.Common.MapGenerator
action(projections, original);
}
}
/// <summary>
/// Returns true iff xy is within reservationRadius of the center of a given CellLayer. If
/// a mirroring is specified, the radius is measured from the mirror line instead of the
/// center point.
/// </summary>
public static bool IsCPosNearCenter<T>(
CPos cpos,
CellLayer<T> cellLayer,
int reservationRadius,
Mirror mirror)
{
CPos[] testPoints;
if (mirror == Mirror.None)
testPoints = RotateAndMirrorCPos(cpos, cellLayer, 2, Mirror.None);
else
testPoints = RotateAndMirrorCPos(cpos, cellLayer, 1, mirror);
var separation = (testPoints[1] - testPoints[0]).LengthSquared;
return separation <= reservationRadius * reservationRadius * 4;
}
}
}