The International Simutrans Forum

Simutrans Extended => Simutrans Extended Development => Topic started by: Jando on February 16, 2019, 03:13:21 PM

Title: Seeing odd job numbers in industries
Post by: Jando on February 16, 2019, 03:13:21 PM
I have to say that I can't make much sense of the job numbers I see in my games. Here's just one example:

(http://i.imgur.com/m7DBoq1m.png) (https://imgur.com/m7DBoq1)

There we have a pub on the left and a bookshop on the right side of the street. Both 4-5 tiles away from the station, both got 0 commuters this year, both have stock, yet the pub is fully staffed while the bookshop has almost nobody working there. But it's difficult for me to say what exactly it is that's happening there, because most of the information about jobs is hidden from the player. I don't see how many jobs are in town (the number of jobs shown in city building can't be correct, adding up all buildings with jobs in town gives much different numbers), I don't know how many inhabitants are looking for employment, I don't know how many are employed, I don't know whether a town needs commuters from outside town. Or I somehow never found how to get that info. :)

I'm also seeing very little commuting traffic in general (my trains carry all classes from very low to very high), I estimate that more than 95% of all passenger travel I see is visiting.

Awfully sorry James, you invested a lot of time and effort into that feature, but it seems I can't make it work, I have set
minimum_staffing_percentage_consumer_industry and minimum_staffing_percentage_full_production_producer_industry both to zero in my options, else I see industries stopping operations seemingly at random.

Somehow that feature is not quite working well on my map.
Title: Re: Seeing odd job numbers in industries
Post by: Ranran on February 16, 2019, 05:30:05 PM
To reflect the rewritten somuconf.tab setting to the already created map data, you need to change one of the following to 1.
Which you change depends on which folder the simutrans saved data is located.
Only the correct ones need to be 1.
Code: [Select]
progdir_overrides_savegame_settings = 0
pak_overrides_savegame_settings = 0
userdir_overrides_savegame_settings = 0
Title: Re: Seeing odd job numbers in industries
Post by: Ranran on February 16, 2019, 10:17:23 PM
I have created a new map with one city with a population of 0. The employment of an automatically placed city hall counts twice the number first. However, the city hall set up manually will be counted correctly. There are only city halls in either city.
(https://i.imgur.com/zD3WzMb.png)

It will not be fixed by reopening the dialog. But when I saved the map and reloaded it it got the correct number.

In another test, it was 84. It seems that the total value has been doubled.
(https://i.imgur.com/XichsfV.png)

Result of repeated test, I confirmed that the initial placement is always doubled.


Quote
the number of jobs shown in city building can't be correct, adding up all buildings with jobs in town gives much different numbers
The possibility that the count is wrong will remain, but please reload if you have doubts about the number of jobs. I suppose that it will be the correct value.

I sometimes confirm that the value goes wrong but I do not know how it occurs. There may be cases that it does not decrease jobs when buildings near the boundary are removed.
Title: Re: Seeing odd job numbers in industries
Post by: Jando on February 16, 2019, 10:52:02 PM
The possibility that the count is wrong will remain, but please reload if you have doubts about the number of jobs. I suppose that it will be the correct value.

I see this on multiple maps, Ranran, one of them I'm playing since 3 weeks now, that game has been saved and loaded many times by now. :)

But then, the number of jobs shown in City Hall may not even matter, depending on how James implemented this feature. I agree that it's a good feature, it's just that what I see in my half-developed game doesn't make much sense to me. :)
Title: Re: Seeing odd job numbers in industries
Post by: jamespetts on February 21, 2019, 01:08:59 AM
Thank you for the report, and apologies for not having had time to deal with this so far. May I ask whether the incorrect display number in the graph (which does not itself affect any other aspect of the game) appears initially, after saving and loading or both?
Title: Re: Seeing odd job numbers in industries
Post by: Ranran on February 21, 2019, 02:20:56 PM
What I revealed in my simple test of last post:
(1) When a map is newly generated, the number twice as many as the actual employment of the initial arrangement will be displayed.
(2) Those numbers will be correct when reloading
(3) The number of employment of the newly constructed building is also counted almost exactly
However, it seems that there are times when the number of employment may be inaccurate for some reason during the game.

--------
Additional Information:
I made a new map and discovered that when I first removed the power plant, the total number of employment became minus. (´・ω・`)
https://imgur.com/bvEmE2j
https://imgur.com/eEtNjns

As a result of verification based on this fact, the following was found out:

(4) Newly placed city industries do not count jobs. Even if it is removed it will not be counted.
(5) It counts twice the number of employment it has when it is reloaded.
(6) Three times employment will be reduced if it is removed.
(7) The newly placed industry does not belong to cities until reloading.
(8) Employment of buildings not belonging to cities is not counted in the city list chart.

Confirmation:

I removed buildings other than the city hall and built a butcher inside the city limit.
(https://i.imgur.com/AOtPelu.png)
This Butcher is included in the city on mini-map, but it seems that it does not belong to the city on the factory detail dialog.
There is only the number of employees of city hall.

(https://i.imgur.com/pwiTc2K.gif)
Upon reloading the city has 424 jobs.
In Butcher's dialog there is an indication of City: Sydston, you can see that you belong correctly to the city.
424 matches 40 + 192 * 2. That is, the number of employees of butcher has been doubled.
Employment of the city became -152 when the butcher was carried out withdrawal. That is, it decreased by 576.
This is three times the number of employment of this building.

In addition to this, I increased the population of the city and confirmed it by increasing the industrial chain, but the same result was obtained.
Title: Re: Seeing odd job numbers in industries
Post by: Ranran on February 26, 2019, 11:36:25 PM
I think this image will help to identify the causes of several bugs that have been reported so far.

Please be aware of changes when the month changes.
(https://i.imgur.com/XktKmjR.gif)
Title: Re: Seeing odd job numbers in industries
Post by: Ranran on February 27, 2019, 10:11:52 AM
I think I caught the bug. (´・ω・`)
I think that this is the same kind as dividing commuters.

When the factory belongs to a city, demand is counted twice.
Code: [Select]
city->add_city_factory(this);
city->update_city_stats_with_building(get_building(), false);
Since "update_city_stats_with_building" is executed in "add_city_factory", it is executing "update_city_stats_with_building" twice as a result.

And when the factory is removed, it subtracts three times.
If factory already belong to a city, simtool.cc will subtracts its data.


I threw a pull request (https://github.com/jamespetts/simutrans-extended/pull/118).

The demand for electricity is influenced by the number of city job. So, this fix will fix wrong electricity demand bug (https://forum.simutrans.com/index.php/topic,18741.0.html) as well.
Please confirm, just to be sure.
Title: Re: Seeing odd job numbers in industries
Post by: jamespetts on March 10, 2019, 11:52:49 AM
Thank you - now incorporated.
Title: Re: Seeing odd job numbers in industries
Post by: Ranran on March 11, 2019, 11:19:27 AM
The city hall of the initial placement still has been counted twice. (´・ω・`)
I think it counts correctly other than that .
Title: Re: Seeing odd job numbers in industries
Post by: jamespetts on March 11, 2019, 11:21:14 AM
I wonder whether there might similarly be redundant code in counting the jobs in the town halls? I will have to investigate when I have time.