voxeltycoon / issues

18 stars 4 forks source link

Density calculations #840

Closed MizardX closed 3 years ago

MizardX commented 3 years ago

Describe the bug When calculating the density in a city for the purpose of spawning a building, the density seems to increase with the distance from the center.

The density at some location is currently calculated as: distance from city center / city radius × population factor. This value increases with the distance from the center and the population size.

Intuitively, the density should be larger closer to the center, not at the edge.

See VoxelTycoon.Cities.CityBuildingSpawner.GetDensity(City, Xz), called from SpawnBuilding(...) in same class. Value used in TryGetSpawnInfo(...).

Build version 0.86.0.0 steam

Platform Windows 10

MaximBarminov commented 3 years ago

Actually, there is also DistanceToDensity curve sampling that converts distance to actual density by inverting the value and applying the easing. So it works right as you expected.