game generation process
This commit is contained in:
@@ -31,7 +31,6 @@ func (ms MapSetting) String() string {
|
||||
}
|
||||
|
||||
func (ms MapSetting) ExpectedSize() uint32 {
|
||||
// 1.5 coefficient is enough if all free planet probability will be 1.0
|
||||
return uint32(math.Sqrt(float64(ms.Players)) * float64(ms.HWMinDistance) * 1.5)
|
||||
}
|
||||
|
||||
@@ -49,11 +48,12 @@ type PlanetSetting struct {
|
||||
MaxSize float64
|
||||
MinResource float64
|
||||
MaxResource float64
|
||||
Probability float64
|
||||
Ratio float64 // The proportion of the total number of free planets in the galaxy
|
||||
}
|
||||
|
||||
func (ps PlanetSetting) MaxCount(freePlanets uint32) int {
|
||||
return int(math.Ceil(float64(freePlanets) * ps.Probability))
|
||||
// Number of planets need to be placed within freePlanets amount
|
||||
func (ps PlanetSetting) Number(freePlanets uint32) int {
|
||||
return int(math.Ceil(float64(freePlanets) * ps.Ratio))
|
||||
}
|
||||
|
||||
func DefaultMapSetting() MapSetting {
|
||||
@@ -73,7 +73,7 @@ func DefaultMapSetting() MapSetting {
|
||||
MaxSize: 2500,
|
||||
MinResource: 0,
|
||||
MaxResource: 3,
|
||||
Probability: 0.06,
|
||||
Ratio: 0.06,
|
||||
},
|
||||
BigPlanets: PlanetSetting{
|
||||
MinDistanceHW: 10,
|
||||
@@ -81,7 +81,7 @@ func DefaultMapSetting() MapSetting {
|
||||
MaxSize: 2000,
|
||||
MinResource: 1,
|
||||
MaxResource: 10,
|
||||
Probability: 0.18,
|
||||
Ratio: 0.18,
|
||||
},
|
||||
OthersMinDistance: defaultFactor, // min. is 1 pixel on the plotter
|
||||
NormalPlanets: PlanetSetting{
|
||||
@@ -90,7 +90,7 @@ func DefaultMapSetting() MapSetting {
|
||||
MaxSize: 1000,
|
||||
MinResource: 0,
|
||||
MaxResource: 10,
|
||||
Probability: 0.5,
|
||||
Ratio: 0.5,
|
||||
},
|
||||
RichPlanets: PlanetSetting{
|
||||
MinDistanceHW: 0,
|
||||
@@ -98,7 +98,7 @@ func DefaultMapSetting() MapSetting {
|
||||
MaxSize: 500,
|
||||
MinResource: 5,
|
||||
MaxResource: 25,
|
||||
Probability: 0.18,
|
||||
Ratio: 0.18,
|
||||
},
|
||||
Asterioids: PlanetSetting{
|
||||
MinDistanceHW: 0,
|
||||
@@ -106,7 +106,7 @@ func DefaultMapSetting() MapSetting {
|
||||
MaxSize: 0,
|
||||
MinResource: 0,
|
||||
MaxResource: 0,
|
||||
Probability: 0.08,
|
||||
Ratio: 0.08,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user