reduced the ammount of loops and discuraged roads that cut across large parts of the city
This commit is contained in:
@@ -503,6 +503,7 @@ func connectPOIs(pois []*PointOfInterest, width, height int, settings *Settings,
|
|||||||
}
|
}
|
||||||
collectorTarget := max(len(pois)-1, max(roadTarget, roadTarget+max(2, roadTarget/8)))
|
collectorTarget := max(len(pois)-1, max(roadTarget, roadTarget+max(2, roadTarget/8)))
|
||||||
totalBudget := max(collectorTarget, roadTarget+max(3, roadTarget/4))
|
totalBudget := max(collectorTarget, roadTarget+max(3, roadTarget/4))
|
||||||
|
isSmallSettlement := settings.NumBuildings <= 120 || len(pois) <= 18
|
||||||
|
|
||||||
centerX := float64(width-1) * 0.5
|
centerX := float64(width-1) * 0.5
|
||||||
centerY := float64(height-1) * 0.5
|
centerY := float64(height-1) * 0.5
|
||||||
@@ -718,6 +719,9 @@ func connectPOIs(pois []*PointOfInterest, width, height int, settings *Settings,
|
|||||||
}
|
}
|
||||||
a := pois[c.a]
|
a := pois[c.a]
|
||||||
b := pois[c.b]
|
b := pois[c.b]
|
||||||
|
if !a.IsExit && !b.IsExit && c.dist > edgeDist*0.72 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
connectedBonus := 0.0
|
connectedBonus := 0.0
|
||||||
if arterialNodes[c.a] || arterialNodes[c.b] {
|
if arterialNodes[c.a] || arterialNodes[c.b] {
|
||||||
connectedBonus = 0.20
|
connectedBonus = 0.20
|
||||||
@@ -725,7 +729,11 @@ func connectPOIs(pois []*PointOfInterest, width, height int, settings *Settings,
|
|||||||
distScore := 1.0 - clamp01(c.dist/(edgeDist*1.1))
|
distScore := 1.0 - clamp01(c.dist/(edgeDist*1.1))
|
||||||
centerPenalty := centerCloseness(a) * centerCloseness(b) * 0.35
|
centerPenalty := centerCloseness(a) * centerCloseness(b) * 0.35
|
||||||
degreePenalty := clamp01(float64(a.Connections+b.Connections) / 7.0)
|
degreePenalty := clamp01(float64(a.Connections+b.Connections) / 7.0)
|
||||||
score := c.score*0.28 + c.arterialMean*0.27 + distScore*0.35 + connectedBonus - centerPenalty - degreePenalty*0.14
|
longDiagonalPenalty := 0.0
|
||||||
|
if !a.IsExit && !b.IsExit {
|
||||||
|
longDiagonalPenalty = clamp01((c.dist-edgeDist*0.45)/(edgeDist*0.35)) * 0.28
|
||||||
|
}
|
||||||
|
score := c.score*0.28 + c.arterialMean*0.27 + distScore*0.35 + connectedBonus - centerPenalty - degreePenalty*0.14 - longDiagonalPenalty
|
||||||
if score > bestScore {
|
if score > bestScore {
|
||||||
bestScore = score
|
bestScore = score
|
||||||
bestIdx = idx
|
bestIdx = idx
|
||||||
@@ -751,12 +759,23 @@ func connectPOIs(pois []*PointOfInterest, width, height int, settings *Settings,
|
|||||||
if len(selectedEdges) >= totalBudget {
|
if len(selectedEdges) >= totalBudget {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if pick.dist > edgeDist*0.85 {
|
if pick.dist > edgeDist*0.60 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
a := pois[pick.a]
|
||||||
|
b := pois[pick.b]
|
||||||
if !canUseEdge(pick, RoadTierLocal) {
|
if !canUseEdge(pick, RoadTierLocal) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if a.Connections >= a.TargetDegree || b.Connections >= b.TargetDegree {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if isSmallSettlement && (a.Connections > 1 || b.Connections > 1) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if !a.IsExit && !b.IsExit && pick.dist > edgeDist*0.42 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
addEdge(pick, RoadTierLocal)
|
addEdge(pick, RoadTierLocal)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user