Polished wall generation, though work is needed good enough for main now

This commit is contained in:
grimsace
2026-03-11 12:43:41 -05:00
parent 580d7e9d4c
commit 8dc7546e09
6 changed files with 605 additions and 22 deletions
+8 -3
View File
@@ -54,6 +54,7 @@ type Settings struct {
TurretSize float64 `json:"turret_size"`
TurretShape string `json:"turret_shape"`
TurretSpacing float64 `json:"turret_spacing"`
GateSpacing float64 `json:"gate_spacing"` // percent of wall circumference between gates (0=no gates)
// Building settings
NumBuildings int `json:"num_buildings"`
@@ -159,6 +160,7 @@ func LoadSettings() (*Settings, error) {
TurretSize: 0.6,
TurretShape: "circular",
TurretSpacing: 55,
GateSpacing: 25,
NumBuildings: 200,
MinBuildingSize: 3.5,
MaxBuildingSize: 10.0,
@@ -226,7 +228,7 @@ func LoadSettings() (*Settings, error) {
if _, ok := rawKeys["max_wall_width"]; !ok {
settings.MaxWallWidth = 4.0
}
if settings.NumWalls == 0 {
if _, ok := rawKeys["num_walls"]; !ok {
settings.NumWalls = 1
}
if settings.CityCoverage == 0 {
@@ -250,6 +252,9 @@ func LoadSettings() (*Settings, error) {
if _, ok := rawKeys["turret_spacing"]; !ok {
settings.TurretSpacing = 55
}
if _, ok := rawKeys["gate_spacing"]; !ok {
settings.GateSpacing = 25
}
// Wall widths are percentages of average image dimension.
// Migrate older pixel-based values when they exceed the valid percentage range.
@@ -262,8 +267,8 @@ func LoadSettings() (*Settings, error) {
settings.MaxWallWidth = (settings.MaxWallWidth / avgDim) * 100.0
}
settings.MinWallWidth, settings.MaxWallWidth = normalizeWallWidthPercentRange(settings.MinWallWidth, settings.MaxWallWidth)
if settings.NumWalls < 1 {
settings.NumWalls = 1
if settings.NumWalls < 0 {
settings.NumWalls = 0
}
if settings.NumWalls > 5 {
settings.NumWalls = 5