• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

rentgen23

Private
20 Badges
Mar 6, 2023
10
38
  • Surviving Mars
  • Cities: Skylines - Campus
  • Prison Architect
  • Cities: Skylines Industries
  • Shadowrun: Hong Kong
  • Shadowrun: Dragonfall
  • Shadowrun Returns
  • Cities: Skylines - Parklife
  • Cities: Skylines - Green Cities
  • Age of Wonders III
  • Cities: Skylines
  • Cities: Skylines - Mass Transit
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris
  • Cities: Skylines - Snowfall
  • Cities: Skylines - After Dark
  • Pillars of Eternity
  • Cities: Skylines Deluxe Edition
Hi all! I'm the author of the Demographics mod (thank you to everyone who is using it!) and I've been banging my head for a couple of weeks against a wall of one issue: how does the game count Citizens. Besides jobs vs workers the mod calculates all kinds of population stats - health, happiness, wealth etc - my total number of citizens in most of the games is bigger than what the game reports by about 5-7%. It's not such a big deal but still annoying - so in case there are people who really understand the game mechanics in depth I'll appreciate the pointers.


The way the calculation is currently done is via iterating over ALL Residential Buildings, and then over all CitizenUnits inside these buildings, and over all Citizens inside the CitizenUnits:

(see attached file, can't insert code here for some reason...)

The important thing is the Building flags comparison and the Citizen flags comparison parts - by playing with it I have reduced the discrepancy significantly (apparently the game caches LOTS of citizens that are not used in real simulation), but it still exists. Before anyone asks - iterating over Citizens array was tried as well, with the same result, and also it's slower since it's much much bigger than buildings array.

So the question is - which additional guards should i use so that my total citizen count will match 100% with what the game reports? It matches perfectly in the early game, but then starts to be slightly different.

Thank you for any ideas!
 

Attachments

  • CodePiece.txt
    1,8 KB · Views: 0