New Settlement Sizes

A quieter space for design discussion of long-term projects
CMDR ARGHouse
Posts: 54
Joined: Mon Feb 11, 2019 1:34 pm
Location: Australia

New Settlement Sizes

Post by CMDR ARGHouse »

So before I improve upon economy system, add wealth levels (which is needed for deterimining High Tech economies), I am working on adding new settlement sizes to the game. These settlement types will have varying frequencies, so you'll be more likely to see Megaloposis's of millions on older colony worlds, as opposed to the frontier, where you will see plenty of fresh encampments, homesteads, hamlets, villages and small towns.
Settlement size types are as follow:

(We generate a cityFreq number with rng.Int32(135430))

Pop lvl 0: Encampment : Population 1 to 10 : Freq <= 41
Pop lvl 1: Homestead : Population 10 to 100 : Freq <= 1294
Pop lvl 2: Hamlet : Population 100 to 500 : Freq <= 6515
Pop lvl 3: Village : Population 500 to 2500 : Freq <= 54231
Pop lvl 4: Small Town : Population 2500 to 10,000 : Freq <= 98997
Pop lvl 5: Large Town : Population 10,000 to 50,000 : Freq <= 125154
Pop lvl 6: Small City : Population 50,000 to 250,000 : Freq <= 133343
Pop lvl 7: Large City : Population 250,000 to 1 million : Freq <= 134898
Pop lvl 8: Metropolis : Population 1 to 3 million : Freq <= 135300
Pop lvl 9: Conurbation : Population 3 to 10 million : Freq <= 135390
Pop lvl A: Megalopolis : Population 10 to 100 million : Freq <= 135408
Pop lvl B: Gigalopolis : Population 100 million to 1 billion : Freq <= 135423
Pop lvl C: Eperopolis : Population 1 to 3.6 billion : Freq <= 135430

Eventually, giving these different port/station unique models would be good, but I'll settle on getting it to work first.
First hurdle is understanding this bit of code:
Image
I know that it is a fixed operation, and that it results in a random number between 0.00008 (probably to do with 80,000) & 0.000025 (250,000), okay now that I wrote this out, I might understand a little bit better what is going on here.
CMDR ARGHouse
Posts: 54
Joined: Mon Feb 11, 2019 1:34 pm
Location: Australia

Re: New Settlement Sizes

Post by CMDR ARGHouse »

Now as for the amount of these surface settlements, I know that there is a cap of 6 per world, for now I may boost it up to a cap of 8, later on I will experiment with adding caps for each size of settlement, so long as the total per world does not lead to a memory overflow. As of 2024, there are around 135408 settlements on Earth, it would be +328318 if we covered the ocean surface (this number is useful for barren worlds). On an Earth sized Marine world with ~50% ocean coverage, we *could* have up to 231863 settlements, but it's taken up to 12024 years for us to get up to 135408 settlements on Earth... so if this planet was colonised a millenia prior to the game start the maximum number of settlements is a number between 1 and 11262. Generating all these settlements would lead to a memory overflow, so only up to 8 of the largest populated settlments are generated, the others are counted toward the unlisted population centers (which comprise the total world pop). To top it off, +19.3 to 43 percent of a world's population will be rural, based on the total amount of settlement/urban population. I know that something similar to this is done with outdoor agri worlds.
impaktor
Posts: 994
Joined: Fri Dec 20, 2013 9:54 am
Location: Tellus
Contact:

Re: New Settlement Sizes

Post by impaktor »

so you'll be more likely to see Megaloposis's of millions on older colony worlds, as opposed to the frontier, where you will see plenty of fresh encampments,
1. Granted. As long as not zero probability for big cities on the frotiner. There can still be new cities that grow explosively, due to being on the/a frontier, and being the hub attracting all the people looking for fresh opportunities, e.g. consider Shenzhen which I think has exploded in size past 10-15 years.

Also, consider you need also define what/where the "frontier" is.

2. What I'd like to see first is a description and diagnosis of our current system for generating populations. I'd encourage you to write a debug tool for this, that walks through all generates systems in some radius, and gathers statistics on distribution of differently sized ground and orbital settlements. Then figure out what is lacking, and how to improve it.

As it now stands, it's not clear what the problem in master that you're trying to fix is.

Look at:
- https://github.com/pioneerspacesim/pioneer/pull/5676
- Ctrl+i debug window. (and data/modules/Debug/)
CMDR ARGHouse
Posts: 54
Joined: Mon Feb 11, 2019 1:34 pm
Location: Australia

Re: New Settlement Sizes

Post by CMDR ARGHouse »

impaktor wrote: Wed Mar 27, 2024 10:46 am
1. Granted. As long as not zero probability for big cities on the frotiner. There can still be new cities that grow explosively, due to being on the/a frontier, and being the hub attracting all the people looking for fresh opportunities, e.g. consider Shenzhen which I think has exploded in size past 10-15 years.
Yep, I am going to account for boom-cities, the possibility for huge cities on the 'frontier' of colonised space, and on the polar opposite low-pop systems in the established core of space is going to be unlikely, but not zero. I consider frontier space to be systems anywhere from a century to a year ago, the fresher the colonisation, the more likely it will have small settlements.
impaktor wrote: Wed Mar 27, 2024 10:46 am
2. What I'd like to see first is a description and diagnosis of our current system for generating populations. I'd encourage you to write a debug tool for this, that walks through all generates systems in some radius, and gathers statistics on distribution of differently sized ground and orbital settlements. Then figure out what is lacking, and how to improve it.

As it now stands, it's not clear what the problem in master that you're trying to fix is.
Will do, nothing particularly wrong with the master, just improving upon it.

Image
After finishing the first iteration of the if else branch, looks like it is working. Chance depending on time of colonisation has not yet been implemented (neither has some of the other stuff I was floating), just wanted to see if it would work first. Only 1 surface settlement in the entire system, this has yet been implemented with stations. Probably a Megalopolis that has generated. I'll look into adding language tags, and tags for custom systems (so you can define the settlement size, or a specific population) along withsomething that will give you total pop for the entire planet and total pop of the surface/orbital station that you have selected. I'm going to head down to the surface settlement and see how big the sprawl is.
CMDR ARGHouse
Posts: 54
Joined: Mon Feb 11, 2019 1:34 pm
Location: Australia

Re: New Settlement Sizes

Post by CMDR ARGHouse »

Image
Not much of a difference in terms of sprawl here, could have something to do with CityOnPlanet, though my internal reasoning is that this is on a Zero-Atmosphere planet, so most of the sprawl is probably underground.
Gliese852
Posts: 14
Joined: Sat Jun 06, 2020 12:12 pm

Re: New Settlement Sizes

Post by Gliese852 »

I would like to express some of my thoughts on this topic.It seems to me that with sufficient accessibility to space travel, people will en masse prefer to settle on Earth-like planets. It is unlikely that many people would be interested in spending their entire lives in a box or underground. That is, I would expect huge cities on planets favorable to humans, and small working settlements of miners on the moons.
CMDR ARGHouse
Posts: 54
Joined: Mon Feb 11, 2019 1:34 pm
Location: Australia

Re: New Settlement Sizes

Post by CMDR ARGHouse »

Crud... might not be working as expected. Just tested an older version, same population in GJ 1061 as in my experimental version. Time to figure out what is going on here.
CMDR ARGHouse
Posts: 54
Joined: Mon Feb 11, 2019 1:34 pm
Location: Australia

Re: New Settlement Sizes

Post by CMDR ARGHouse »

Oh I see what I did, forgot to remove 'outTotalPop += sbody->m_population;' from some of the else if statements, it's been positioned at the end of the branch.
CMDR ARGHouse
Posts: 54
Joined: Mon Feb 11, 2019 1:34 pm
Location: Australia

Re: New Settlement Sizes

Post by CMDR ARGHouse »

Gliese852 wrote: Thu Mar 28, 2024 12:06 pm I would like to express some of my thoughts on this topic.It seems to me that with sufficient accessibility to space travel, people will en masse prefer to settle on Earth-like planets. It is unlikely that many people would be interested in spending their entire lives in a box or underground. That is, I would expect huge cities on planets favorable to humans, and small working settlements of miners on the moons.
A factor for desirability would also work well, true most folks won't want to live underground, but without the fancier future tech it's where you're going to be if you have solar radiation to contend with.
CMDR ARGHouse
Posts: 54
Joined: Mon Feb 11, 2019 1:34 pm
Location: Australia

Re: New Settlement Sizes

Post by CMDR ARGHouse »

Okay, still not quite working, this is the new code in StarSystemGenerator.cpp:
// orbital starports should carry a small amount of population
if (sbody->GetType() == SystemBody::TYPE_STARPORT_ORBITAL) {
sbody->m_population = fixed(1, 100000) + fixed(starportPopRand.Int32(-1000, 20000), 1000000000);
outTotalPop += sbody->m_population;
} else if (sbody->GetType() == SystemBody::TYPE_STARPORT_SURFACE) {
// No permanent population on gravities larger than defined in MAX_SETTLEMENT_SURFACE_GRAVITY
if (sbody->CalcSurfaceGravity() > MAX_SETTLEMENT_SURFACE_GRAVITY) {
outTotalPop = fixed();
} else {

const Uint32 cityWeight = rng.Int32(135430);
if (cityWeight <= 41) {
// give surface encampments a population between 1 and 10
sbody->m_population = fixed(1, 100000000) + fixed(starportPopRand.Int32(-9, 0), 1000000000);
//outTotalPop += sbody->m_population;
} else if (cityWeight <= 1294) {
// give surface homesteads a population between 10 and 100
sbody->m_population = fixed(1, 10000000) + fixed(starportPopRand.Int32(-9, 0), 1000000000);
//outTotalPop += sbody->m_population;
} else if (cityWeight <= 6515) {
// give surface hamlets a population between 100 and 500
sbody->m_population = fixed(1, 1000000) + fixed(starportPopRand.Int32(-900, -500), 1000000000);
//outTotalPop += sbody->m_population;
} else if (cityWeight <= 54231) {
// give surface villages a population between 500 and 2500
sbody->m_population = fixed(1, 1000000) + fixed(starportPopRand.Int32(-500, 1500), 1000000000);
//outTotalPop += sbody->m_population;
} else if (cityWeight <= 98997) {
// give surface small towns a population between 2500 and 10,000
sbody->m_population = fixed(1, 100000) + fixed(starportPopRand.Int32(-7500, -20000), 1000000000);
//outTotalPop += sbody->m_population;
} else if (cityWeight <= 125154) {
// give surface large towns a population between 10,000 and 50,000
sbody->m_population = fixed(1, 100000) + fixed(starportPopRand.Int32(-20000, -60000), 1000000000);
//outTotalPop += sbody->m_population;
} else if (cityWeight <= 133343) {
// give surface small cities a population between 50,000 and 250,000
sbody->m_population = fixed(1, 100000) + fixed(starportPopRand.Int32(-60000, 240000), 1000000000);
//outTotalPop += sbody->m_population;
} else if (cityWeight <= 134898) {
// give surface large cities a population between 250,000 and 1,000,000
sbody->m_population = fixed(1, 1000000) + fixed(starportPopRand.Int32(2490, 9990), 10000000);
//outTotalPop += sbody->m_population;
} else if (cityWeight <= 135300) {
// give surface metropolises a population between 1,000,000 and 3,000,000
sbody->m_population = fixed(1, 1000000) + fixed(starportPopRand.Int32(9990, 29990), 10000000);
//outTotalPop += sbody->m_population;
} else if (cityWeight <= 135390) {
// give surface conurbations a population between 3,000,000 and 10,000,000
sbody->m_population = fixed(1, 1000000) + fixed(starportPopRand.Int32(29990, 99990), 10000000);
//outTotalPop += sbody->m_population;
} else if (cityWeight <= 135408) {
// give surface megalopolises a population between 10,000,000 and 100,000,000
sbody->m_population = fixed(1, 1000000) + fixed(starportPopRand.Int32(99990, 999990), 10000000);
//outTotalPop += sbody->m_population;
} else if (cityWeight <= 135423) {
// give surface gigalopolises a population between 100,000,000 and 1,000,000,000
sbody->m_population = fixed(1, 1000000) + fixed(starportPopRand.Int32(999990, 9999990), 10000000);
//outTotalPop += sbody->m_population;
} else {
// give surface eperopolises a population between 1,000,000,000 and 3,600,000,000
sbody->m_population = fixed(1, 1000000) + fixed(starportPopRand.Int32(9999990, 35999990), 10000000);
//outTotalPop += sbody->m_population;
}
outTotalPop += sbody->m_population;

}
}
1. Either I have m_population iteratively counted at the end of the branch... or in each case???
Post Reply