Author Topic: Bug in population count after map creation  (Read 680 times)

0 Members and 1 Guest are viewing this topic.

Offline Jando

Bug in population count after map creation
« on: August 16, 2017, 03:09:32 PM »
Hello again! And my apologies for these pesky bug reports. :)

Want to report a little bug I noticed some time ago but forgot to report it. Noticed it again now, thus here it comes. Town population in/after map creation has several oddities. How to observe:

1. Create a new map. I don't think it matters but in case it does: I used size 512x512 tiles, 16 cities, zero big cities, zero clusters, 3000 median town population, year 1840.
2. Pause game, open city list.
3. Note that all towns (or almost all) will have a stated population below the requested median town population.
4. Note that visually towns seem to have a higher population than stated in city list and town info. Towns may even show an upgraded city hall.
5. Note that sorting the city list by population will show an incorrect sort order.
6. Save the game.
7. Reload the saved game.
8. Pause game, open city list.
9. Note that all towns (or almost all) will now have a population above the requested median town population.
10. Visual presentation and stated town size now fits expectations.
11. Sorting of towns by population in city list will still give incorrect results though.

Thanks again!

Offline grivlad0

  • *
  • Posts: 9
  • Total likes: 0
  • Helpful: 1
  • Sorry for my weak english.
  • Languages: russian
Re: Bug in population count after map creation
« Reply #1 on: August 24, 2017, 10:31:25 AM »
I confirm all the points.
In some cases, the negative value of the number of individual cities.
Attach SVE, but on load, go to "7. Reload the saved game."
https://drive.google.com/open?id=0B4qmsfVgiXX5a3QyOTRtY3BUQms

Offline zook2

Re: Bug in population count after map creation
« Reply #2 on: August 24, 2017, 05:48:19 PM »
Could that be related to what I posted here?
http://forum.simutrans.com/index.php?topic=17334.0

Although I didn't notice anything unusual before eight months into the game.

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15857
  • Total likes: 407
  • Helpful: 177
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Bug in population count after map creation
« Reply #3 on: August 26, 2017, 03:44:01 PM »
I have just pushed a fix for this. The problem was that the statistics were incorrect when the map was generated and were only corrected after the map was saved and re-loaded: now, the statistics (and passenger generation numbers) should be consistent before and after loading a map. Note that this will not fix the records of the previous incorrect statistics if these have been recorded from an older saved game.

I should be grateful if you could re-test with the next nightly version and confirm whether this is now fixed.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline Jando

Re: Bug in population count after map creation
« Reply #4 on: August 28, 2017, 08:48:23 AM »
Hello James, thank you for addressing this issue!

Made a few new maps and compared the population statistics:

1. There are still some (minor) population changes when saving a new map for the first time. Example: total map population changing from 49680 to 50640. No big issue I would say unless the change in numbers points to another potential bug.
2. Sorting city list by population count will still give incorrect sort order.
3. All towns (or almost all towns) will have a population above the stated median town population. Unless my understanding of median is totally wrong I would expect roughly 50% of towns to have a population below and 50% of all towns to have a population above the median town population.

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15857
  • Total likes: 407
  • Helpful: 177
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Bug in population count after map creation
« Reply #5 on: August 28, 2017, 10:34:00 AM »
Thank you for your feedback. The latter two issues, I suspect, are caused by remnants of a legacy method for counting town populations. This legacy method must be retained until the town growth algorithm is updated, which may need to wait for some time until other, balance critical feature are completed and tested.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline Jando

Re: Bug in population count after map creation
« Reply #6 on: August 29, 2017, 08:37:31 AM »
Thanks for the explanation, James!

No big deal, just good to know it's not some unknown bug that causes it.