OpenRA/OpenRA · error · MapGenerationException

Could not fit tiles for coast

Error message

Could not fit tiles for coast

What it means

Thrown when Terraformer.PaintLoopsAndFill() returns null while rendering the coastline. Coast paths (built from landPlan borders, partitioned into beach/water-cliff segments) must be tileable end-to-end and fillable; if the segment templates (BeachSegmentTypes[0], WaterCliffSegmentTypes[0]) cannot legally tile the loop set, the call returns null and generation fails.

Source

Thrown at OpenRA.Mods.Common/Traits/World/ClassicMapGenerator.cs:595

								map,
								param.SegmentedBrushes,
								beach,
								param.MinimumLandSeaThickness - 1,
								param.BeachSegmentTypes[0],
								param.BeachSegmentTypes[0])
									.ExtendEdge(4))
					.ToList();
			}

			var landCoastWater = terraformer.PaintLoopsAndFill(
				coastTilingRandom,
				coastPaths,
				landPlan[0] ? Terraformer.Side.In : Terraformer.Side.Out,
				[new MultiBrush().WithTemplate(map, param.WaterTile, CVec.Zero)],
				null,
				null,
				0)
					?? throw new MapGenerationException("Could not fit tiles for coast");

			if (param.Mountains > 0)
			{
				var cliffMask = MatrixUtils.CalibratedBooleanThreshold(
					roughnessMatrix,
					param.Roughness, FractionMax);
				var cliffPlan = Matrix<bool>.Zip(landPlan, mapShape, (a, b) => a && b);

				for (var altitude = 0; altitude < param.MaximumAltitude; altitude++)
				{
					cliffPlan = terraformer.SliceElevation(
						elevation,
						cliffPlan,
						param.Mountains,
						param.MinimumTerrainContourSpacing);
					cliffPlan = MatrixUtils.BooleanBlotch(
						cliffPlan,
						param.TerrainSmoothing,

View on GitHub (pinned to a520984d91)

Solutions

  1. Verify BeachSegmentTypes[0] (and WaterCliffSegmentTypes[0] when WaterRoughness>0) map to complete tile templates in the tileset.
  2. Increase MinimumLandSeaThickness so the coast brush has room.
  3. Lower WaterRoughness to 0 to use the simpler single-segment beach path branch.
  4. Raise MinimumBeachLength tolerance only if templates genuinely support longer runs.

Example fix

// before
Water: 50
WaterRoughness: 50   // activates water-cliff partitioning
// after (simplify coast)
WaterRoughness: 0
Defensive patterns

Strategy: fallback

Try / catch

try { /* generate map */ }
catch (MapGenerationException ex) when (ex.Message.Contains("coast"))
{ /* retry with WaterRoughness: 0 or larger MinimumLandSeaThickness, or report missing beach templates */ }

Prevention

When it happens

Trigger: Coast geometry produced by the land/water plan that no valid beach/water-cliff tile sequence can cover; WaterRoughness > 0 producing partitioned zones whose segment types are missing or incomplete in the tileset.

Common situations: Tileset lacks complete beach or water-cliff templates; MinimumLandSeaThickness too small for the brush; MinimumCoastStraight or MinimumBeachLength constraints incompatible with available tiles.

Related errors


AI-assisted analysis of OpenRA/OpenRA@a520984d91 (2026-08-13). Data as JSON: /api/errors/e2d0309ecbecb183. Report an issue: GitHub.