OpenRA/OpenRA · error · MapGenerationException
PlayableAreaDensityBonus must be >= 0
Error message
PlayableAreaDensityBonus must be >= 0
What it means
MISLEADING MESSAGE. The text reads 'PlayableAreaDensityBonus must be >= 0', but the condition at ClassicMapGenerator.cs:356 actually checks the AreaEntityBonus field (line 98). There is no field named PlayableAreaDensityBonus; the message is a stale/renamed label. To clear the error you must raise AreaEntityBonus, not search for a non-existent key. This is a source bug: the guard and the message disagree.
Source
Thrown at OpenRA.Mods.Common/Traits/World/ClassicMapGenerator.cs:357
throw new MapGenerationException("MaximumAltitude must be >= 0");
if (MinimumTerrainContourSpacing < 0)
throw new MapGenerationException("MinimumTerrainContourSpacing must be >= 0");
if (WaterRoughness > 0 && MinimumBeachLength < 1)
throw new MapGenerationException("MinimumBeachLength must be >= 1");
if (WaterRoughness > 0 && MinimumCliffLength < 1)
throw new MapGenerationException("MinimumWaterCliffLength must be >= 1");
if (MinimumCliffLength < 1)
throw new MapGenerationException("MinimumCliffLength must be >= 1");
if (RoadSpacing < 0)
throw new MapGenerationException("RoadSpacing must be >= 0");
if (RoadShrink < 0)
throw new MapGenerationException("RoadShrink must be >= 0");
if (Players < 0)
throw new MapGenerationException("Players must be >= 0");
if (CentralSpawnReservationFraction < 0)
throw new MapGenerationException("CentralSpawnReservationFraction must be >= 0");
if (AreaEntityBonus < 0)
throw new MapGenerationException("PlayableAreaDensityBonus must be >= 0");
if (PlayerCountEntityBonus < 0)
throw new MapGenerationException("PlayerCountDensityBonus must be >= 0");
if (SpawnRegionSize < 1)
throw new MapGenerationException("SpawnRegionSize must be >= 1");
if (SpawnReservation < 1)
throw new MapGenerationException("SpawnReservation must be >= 1");
if (SpawnBuildSize < 1)
throw new MapGenerationException("SpawnBuildSize must be >= 1");
if (MinimumSpawnRadius < 1)
throw new MapGenerationException("MinimumSpawnRadius must be >= 1");
if (SpawnResourceSpawns < 0)
throw new MapGenerationException("SpawnResourceSpawns must be >= 0");
if (ResourceSpawnReservation < 1)
throw new MapGenerationException("ResourceSpawnReservation must be >= 1");
if (MaximumExpansionResourceSpawns < 0)
throw new MapGenerationException("MaximumExpansionResourceSpawns must be >= 0");
if (MinimumExpansionSize < 1)
throw new MapGenerationException("MinimumExpansionSize must be >= 1");View on GitHub (pinned to a520984d91)
Solutions
- Set AreaEntityBonus to 0 or a positive integer (this is the field actually checked).
- Do not look for a PlayableAreaDensityBonus key; it does not exist.
- Keep the value within 0..1000000 (the EntityBonusMax bound declared at line 29).
- Consider fixing the upstream message to name AreaEntityBonus.
Example fix
# before (message says PlayableAreaDensityBonus, but the checked field is AreaEntityBonus) AreaEntityBonus: -5 # after AreaEntityBonus: 100
Defensive patterns
Strategy: validation
Validate before calling
// NOTE: message says PlayableAreaDensityBonus, but the checked field is AreaEntityBonus.
int areaEntityBonus = Exts.TryParseInt32Invariant(yaml.NodeWithKey("AreaEntityBonus").Value.Value, out var aeb) ? aeb : 0;
if (areaEntityBonus < 0)
throw new InvalidOperationException("AreaEntityBonus must be >= 0 (generator mislabels it 'PlayableAreaDensityBonus')"); Type guard
static bool IsValidAreaEntityBonus(int value) => value >= 0 && value <= 1000000;
Try / catch
try { generator.Generate(map, yaml); }
catch (MapGenerationException ex) when (ex.Message.Contains("PlayableAreaDensityBonus"))
{ /* the REAL fix is AreaEntityBonus >= 0; no PlayableAreaDensityBonus key exists */ } Prevention
- Map the error text 'PlayableAreaDensityBonus' to the field AreaEntityBonus in your troubleshooting notes.
- Clamp all *EntityBonus fields to 0..1000000 (EntityBonusMax) in your preset editor.
When it happens
Trigger: Map generation where AreaEntityBonus is set below 0. Validate() at line 356 throws MapGenerationException labelled 'PlayableAreaDensityBonus', but AreaEntityBonus is the offending field.
Common situations: A developer searches the config for PlayableAreaDensityBonus, finds nothing, and is stuck. Typically hit when tuning entity/density bonuses and entering a negative AreaEntityBonus value.
Related errors
- MinimumWaterCliffLength must be >= 1
- PlayerCountDensityBonus must be >= 0
- RoughnessRadius must be >= 1
- MaximumAltitude must be >= 0
- MinimumTerrainContourSpacing must be >= 0
AI-assisted analysis of OpenRA/OpenRA@a520984d91 (2026-08-13).
Data as JSON: /api/errors/dc440c57bcc5b4d8.
Report an issue: GitHub.