OpenRA/OpenRA · error · MapGenerationException
OreUniformity must be >= 0
Error message
OreUniformity must be >= 0
What it means
Thrown when OreUniformity is negative. OreUniformity controls how uniformly ore is spread (higher = more even distribution, lower = patchier); negative values break the resource-generation weighting. Zero is permitted.
Source
Thrown at OpenRA.Mods.Common/Traits/World/ClassicMapGenerator.cs:403
throw new MapGenerationException("MaximumResourceSpawnsPerExpansion must be >= 1");
if (MinimumBuildings < 0)
throw new MapGenerationException("MinimumBuildings must be >= 0");
if (MaximumBuildings < 0)
throw new MapGenerationException("MaximumBuildings must be >= 0");
if (MinimumBuildings > MaximumBuildings)
throw new MapGenerationException("MinimumBuildings must be <= maximumBuildings");
if (CivilianBuildings < 0 || CivilianBuildings > FractionMax)
throw new MapGenerationException($"CivilianBuildings must be between 0 and {FractionMax} inclusive");
if (CivilianBuildingDensity < 0 || CivilianBuildingDensity > FractionMax)
throw new MapGenerationException($"CivilianBuildingDensity must be between 0 and {FractionMax} inclusive");
if (MinimumCivilianBuildingDensity < 0 || MinimumCivilianBuildingDensity > FractionMax)
throw new MapGenerationException($"MinimumCivilianBuildingDensity must be between 0 and {FractionMax} inclusive");
if (CivilianBuildingDensityRadius < 0)
throw new MapGenerationException("CivilianBuildingDensityRadius must be >= 0");
if (ResourcesPerPlayer < 0)
throw new MapGenerationException("ResourcesPerPlayer must be >= 0");
if (OreUniformity < 0)
throw new MapGenerationException("OreUniformity must be >= 0");
if (OreClumpiness < 0)
throw new MapGenerationException("OreClumpiness must be >= 0");
foreach (var kv in BuildingWeights)
if (kv.Value < 0)
throw new MapGenerationException("BuildingWeights.* must be >= 0");
foreach (var kv in ResourceSpawnWeights)
if (kv.Value < 0)
throw new MapGenerationException("ResourceSpawnWeights.* must be >= 0");
foreach (var kv in ResourceSpawnWeights)
if (!ResourceSpawnSeeds.ContainsKey(kv.Key))
throw new MapGenerationException($"ResourceSpawnSeeds does not contain possible resource spawn `{kv.Key}`");
if (!(terrainInfo.Templates.TryGetValue(LandTile, out var landTemplate) && landTemplate.Contains(0)))
throw new MapGenerationException("LandTile is not valid");
if (!(terrainInfo.Templates.TryGetValue(LandTile, out var waterTemplate) && waterTemplate.Contains(0)))
throw new MapGenerationException("WaterTile is not valid");
if (Players > 32)View on GitHub (pinned to a520984d91)
Solutions
- Set OreUniformity to 0 or a positive integer.
- Increase it for smoother ore fields, decrease toward 0 for clumpier ore.
Example fix
# before OreUniformity: -5 # after OreUniformity: 10
Defensive patterns
Strategy: validation
Validate before calling
if (param.OreUniformity < 0)
throw new InvalidOperationException("OreUniformity must be >= 0"); Type guard
static bool OreUniformityOk(ClassicMapGeneratorInfo.Parameters p) => p.OreUniformity >= 0;
Try / catch
try { mapGenerator.Generate(modData, args); }
catch (MapGenerationException ex) when (ex.Message.Contains("OreUniformity"))
{ /* use 0 or a positive scalar */ } Prevention
- OreUniformity is a non-negative scalar, not a 0-1000 fraction.
- Raise for smoother ore, lower toward 0 for patchier ore.
When it happens
Trigger: Map generation with the OreUniformity yaml field set to a negative integer.
Common situations: Sign error or typo; confusion with the 0-1000 fraction fields (this one is a plain non-negative scalar, not a fraction).
Related errors
- MaximumExpansionSize must be >= 1
- ExpansionBorder must be >= 1
- ExpansionInner must be >= 1
- MaximumResourceSpawnsPerExpansion must be >= 1
- MinimumBuildings must be >= 0
AI-assisted analysis of OpenRA/OpenRA@a520984d91 (2026-08-13).
Data as JSON: /api/errors/6a577d58f8c4e1b6.
Report an issue: GitHub.