{"record":{"id":"320b18669c844750","repo":"OpenRA/OpenRA","slug":"forestclumpiness-must-be-0","errorCode":null,"errorMessage":"ForestClumpiness must be >= 0","messagePattern":"ForestClumpiness must be >= 0","errorType":"exception","errorClass":"MapGenerationException","httpStatus":null,"severity":"error","filePath":"OpenRA.Mods.Common/Traits/World/ClassicMapGenerator.cs","lineNumber":329,"sourceCode":"\t\t\t\t\tthrow new MapGenerationException($\"TerrainSmoothing must be between 0 and {MatrixUtils.MaxBinomialKernelRadius} inclusive\");\n\t\t\t\tif (WaterRoughness > 0 && MinimumCoastStraight < 0)\n\t\t\t\t\tthrow new MapGenerationException(\"MinimumCoastStraight must be >= 0\");\n\t\t\t\tif (SmoothingThreshold < (FractionMax + 1) / 2 || SmoothingThreshold > FractionMax)\n\t\t\t\t\tthrow new MapGenerationException($\"SmoothingThreshold must be between {(FractionMax + 1) / 2} and {FractionMax} inclusive\");\n\t\t\t\tif (MinimumLandSeaThickness < 1)\n\t\t\t\t\tthrow new MapGenerationException(\"MinimumLandSeaThickness must be >= 1\");\n\t\t\t\tif (MinimumMountainThickness < 1)\n\t\t\t\t\tthrow new MapGenerationException(\"MinimumMountainThickness must be >= 1\");\n\t\t\t\tif (Water < 0 || Water > FractionMax)\n\t\t\t\t\tthrow new MapGenerationException($\"Water must be between 0 and {FractionMax} inclusive\");\n\t\t\t\tif (Forests < 0 || Forests > FractionMax)\n\t\t\t\t\tthrow new MapGenerationException($\"Forest must be between 0 and {FractionMax} inclusive\");\n\t\t\t\tif (ForestCutout < 0)\n\t\t\t\t\tthrow new MapGenerationException(\"ForestCutout must be >= 0\");\n\t\t\t\tif (MaximumCutoutSpacing < 0)\n\t\t\t\t\tthrow new MapGenerationException(\"TopologyAugmentationThreshold must be >= 0\");\n\t\t\t\tif (ForestClumpiness < 0)\n\t\t\t\t\tthrow new MapGenerationException(\"ForestClumpiness must be >= 0\");\n\t\t\t\tif (Mountains < 0 || Mountains > FractionMax)\n\t\t\t\t\tthrow new MapGenerationException($\"Mountains must be between 0 and {FractionMax} inclusive\");\n\t\t\t\tif (Roughness < 0 || Roughness > FractionMax)\n\t\t\t\t\tthrow new MapGenerationException(\"Roughness must be between 0 and {FractionMax}\");\n\t\t\t\tif (WaterRoughness < 0 || WaterRoughness > FractionMax)\n\t\t\t\t\tthrow new MapGenerationException(\"WaterRoughness must be between 0 and {FractionMax}\");\n\t\t\t\tif (RoughnessRadius < 1)\n\t\t\t\t\tthrow new MapGenerationException(\"RoughnessRadius must be >= 1\");\n\t\t\t\tif (MaximumAltitude < 0)\n\t\t\t\t\tthrow new MapGenerationException(\"MaximumAltitude must be >= 0\");\n\t\t\t\tif (MinimumTerrainContourSpacing < 0)\n\t\t\t\t\tthrow new MapGenerationException(\"MinimumTerrainContourSpacing must be >= 0\");\n\t\t\t\tif (WaterRoughness > 0 && MinimumBeachLength < 1)\n\t\t\t\t\tthrow new MapGenerationException(\"MinimumBeachLength must be >= 1\");\n\t\t\t\tif (WaterRoughness > 0 && MinimumCliffLength < 1)\n\t\t\t\t\tthrow new MapGenerationException(\"MinimumWaterCliffLength must be >= 1\");\n\t\t\t\tif (MinimumCliffLength < 1)\n\t\t\t\t\tthrow new MapGenerationException(\"MinimumCliffLength must be >= 1\");","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/OpenRA/OpenRA/blob/a520984d91eda9de48a62b1d15c1e3bad0d4fb1a/OpenRA.Mods.Common/Traits/World/ClassicMapGenerator.cs#L311-L347","documentation":"Validate() checks that ForestClumpiness is >= 0. ForestClumpiness controls how tightly forest patches cluster together during generation. Negative values would produce invalid clustering behavior. The field defaults to 0 and is [FieldLoader.Require].","triggerScenarios":"The ForestClumpiness key is set to a negative number in the generator YAML.","commonSituations":"Negative value entered accidentally or via sign error. Mod developer experiments with negative clumpiness expecting more scattered forests.","solutions":["Set ForestClumpiness to 0 or a positive integer","0 means minimal clumping; higher values create denser, more connected forest patches","Ensure the YAML value is a non-negative bare integer"],"exampleFix":"# before\nForestClumpiness: -10\n# after\nForestClumpiness: 0","handlingStrategy":"validation","validationCode":"// Pre-flight check: ForestClumpiness must be >= 0\nstatic void ValidateForestClumpiness(int clumpiness)\n{\n    if (clumpiness < 0)\n        throw new ArgumentOutOfRangeException(nameof(clumpiness),\n            \"ClassicMapGenerator ForestClumpiness must be >= 0\");\n}","typeGuard":"static bool IsNonNegative(int value) => value >= 0;","tryCatchPattern":"try\n{\n    var param = new Parameters(map, yaml);\n}\ncatch (MapGenerationException ex) when (ex.Message.Contains(\"ForestClumpiness\"))\n{\n    Console.Error.WriteLine($\"Invalid ForestClumpiness: {ex.Message}\");\n}","preventionTips":["ForestClumpiness controls forest patch clustering density; 0 means minimal clumping","All clumpiness/threshold parameters in this generator are non-negative","Validate generator YAML with the OpenRA utility"],"tags":["openra","map-generator","config-validation","forest","clumpiness"],"backgroundTag":null,"analyzedSha":"a520984d91eda9de48a62b1d15c1e3bad0d4fb1a","analyzedAt":"2026-08-13T15:30:14.787Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}