News:

Simutrans Tools
Know our tools that can help you to create add-ons, install and customize Simutrans.

Cities don't grow

Started by 1993matias, March 31, 2019, 03:00:51 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

1993matias

I have a map with Simutrans-Ext and PakBritain.128. None of the cities grow, city limits don't change and population doesn't seem to change (see attached image) The growth shown is mainly me hand-placing buildings. I've tried to change some options, including the fast city growth option, but that doesn't seem to help. Cities remain static. What to do?

I have plenty of passenger transport set up, I don't want to move goods - although I tried providing electricity to some cities to no avail.

Thanks

jamespetts

Cities are intended to grow realistically slowly, so you may not see much growth immediately. The graph does show growth - if you have been hand placing buildings every year, you would not have any way of knowing what the growth rate would have been had you not done that, so this is not a controlled test. Cities do grow in the online multiplayer games (albeit slowly, as intended), so this does not appear to be a bug.
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.

1993matias

#2
Thank you for clarifying. What should I do to make cities grow faster? I have tried the using public player tool to grow the cities, but that doesn't seem to work...?

Spenk009

When using the public player's growth tool, what at size city are you trying to grow? And how many residential buildings are in the city? I've noticed a refusal to grow player built towns, if they don't feature a residential building (built by the town's natural growth). But this was a while back and I haven't encountered this bug since the last town growth improvement.

1993matias

Some cities seem to grow while others don't. See the attached savefile and try to grow St. Lawrence Budpike. For me that doesn't work, but for example Perminster or Sparrowdean can grow manually. Any particular reason?
Savefile from Google Drive

jamespetts

Quote from: 1993matias on April 01, 2019, 08:31:22 AM
Some cities seem to grow while others don't. See the attached savefile and try to grow St. Lawrence Budpike. For me that doesn't work, but for example Perminster or Sparrowdean can grow manually. Any particular reason?
Savefile from Google Drive

City growth is connected to how much of the local transport demand is fulfilled. Cities where a higher proportion of people and goods are transported will grow more quickly than those in which a lower proportion of people and goods are transported.
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.

1993matias

My problem is that I can't get the cities to grow even with the public player's tools... Some grow, others don't

Spenk009

You are entirely correct. I am encountering the same issue, so this can be replicated. Some towns exhibit growth by Public Player tool (slower than normal), others don't react to the tool in any way. Your savegame is at version 120.4, which is a Standard savegame version rather than Extended. If I try to change the version number into the Extended format, I get the same error as I posted about last week. I'm sorry to say that I can't assist much further. If anyone has the time and interest, they may look into tackling this issue but I think due to the savegame format being wrong it may be ruled out as version errors.

jamespetts

Do I understand, then, that the problem is not organic growth, but that the grow cities tool does not work?
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.

Ranran(retired)

I at least know that this kind of bug already existed last summer.
Please manually place a new city in  1993matias's saved data. Then strange city is created.
Next, use "grow city" tool for that city. Perhaps that won't work.

What I often see is a condition where no city buildings are created when manual placement is done.
Only road segments are created.
That city does not build any city buildings no matter how many population growth tools are used, but only attraction buildings are created.
However, this seems to behave somewhat differently from the 1993matias's bug.
In this map, the "grow city" tool does not extend the road but the city buildings are slightly built.
ひめしという日本人が開発者達の助言を無視して自分好みの機能をextendedに"強引に"実装し、
コードをぐちゃぐちゃにしてメンテナンスを困難にし(とりわけ道路と建物関連)、
挙句にバグを大量に埋め込み、それを知らんぷりして放置し(隠居するなどと言って)別のところに逃げ隠れて自分のフォーク(OTRP)は開発を続けている
その事実と彼の無責任さに日本人プレイヤーは目を向けるべき。らんらんはそれでやる気をなくした(´・ω・`)
他人の振り見て我が振り直せ。ひめしのようにならないために、らんらんが生み出したバグや問題は自分で修正しなくちゃね(´・ω・`)

1993matias

Yes, the issue is that manual city growth doesn't happen in some cities using the 'Grow City' tool.

Why the game is in 120.4 save format I don't know. This save has only be touched by Simutrans-Extended.

ACarlotti

Quote from: 1993matias on April 02, 2019, 05:42:45 AMWhy the game is in 120.4 save format I don't know. This save has only be touched by Simutrans-Extended.

I just downloaded the file and put in my Simutrans saves folder. The load dialogue in Simutrans Extended then reports the version as "v 120.4 e 14" - i.e.  it has the version for Standard features is 120.4, and on top of that it has Extended features up to version 14. This is the same as saves I have made recently myself.

If it were saved using (latest) Standard Simutrans then the save version would be reported as "v 120.7  " - i.e. version 120.7 of Standard with no Extended features included.

Quote from: Spenk009 on April 01, 2019, 05:02:44 PMYour savegame is at version 120.4, which is a Standard savegame version rather than Extended.
This is not true; I think you are misunderstanding something about the versioning.

Spenk009

Quote from: ACarlotti on April 02, 2019, 06:11:51 AM
This is not true; I think you are misunderstanding something about the versioning.

I think you're right. I'm sorry if I've hindered diagnosis with this misinformation.

1993matias

#13
I have noticed that city limits do not extend when growing a city. They used to be extended also when manually placing buildings (at least in Simutrans standard), but not in this savegame. Maybe that's the problem?

EDIT: After having played for a bit it seems like cities grow fast again. Two things changed since last time: A game restart and congestion_density_factor (I made the number higher, I have no idea what it does...)

Phystam

I also found the problem in pak256-Ex. When you put a city on your map, the city do not have any city buildings except for the town hall. It is same when you try to increase the city population.
In my exploration, I found that the failure comes from the code below in simcity.cc:

Where

worker_shortage:= bool ( world_jobs > 1.1*monthly_job_demand_global )
job_shortage:= bool ( monthly_job_demand_global > 1.1*world_jobs )

In this section, it selects a suitable building type, but the conditions are not enough. Because the condition of "worker_shortage&&job_shortage" can be occurred when "world_jobs" and "monthly_job_demand_global" are unbalanced.

jamespetts

Thank you - that is helpful. This will be looked at more comprehensively when town growth is rewritten entirely, but I have added a temporary modification so that a house can be generated even if there is a job shortage so long as there is also a worker shortage. This should help to break the deadlock that you describe.

This change will be in the next nightly build. I should be grateful if anyone could re-test to see whether this braeks the deadlock.
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.

1993matias

#16
It seemed like the problem was solved in yesterdays build, but today's nightly presents the same growth problem. See the city Peterington, I have tried to manually grow the city to no avail and then resorted to manually place the buildings. Notice how the city limit doesn't extend to the new buildings but remains static.
EDIT: Growing Pelminster in the save works - or so it seems. No matter how much you click, the populations decreases, no tall buildings get built. The city limits remain static too.
EDIT2: After closing and opening the game the city limits seem to have been moved accordingly. Don't the city limits adjust immediately to hand-placed buildings?

Savegame here

Nightly version 14.5 #93490b5

Mariculous

I got the same issue with the new map now.
I don't really understand what is going on in the code snippet, so is there any way to fix this?

prissi

That piece of code easily breaks between different plattforms, as MSVC and GCC will generate slightly different code concerning fast floating point operations. Use (x*11)/10 instead x*1.1!

Ranran(retired)

Tips from Phystam's posts
//job_shortage = true;
It turns out that commenting out the code above eliminates the situation where the city does not build anything.
I think the problem is that the town does not build anything when job_shortage = true.


Also from my observation:

1) City placement and manual growth try to maintain job shortage (ratio).
2) Renovation basically increases housing

The map over time will only increase the number of population, but the jobs will not increase. Therefore, if the number of factories does not increase, the world will fall into a job shortage over time. As a result, the newly created city will not build any buildings other than attractions.
ひめしという日本人が開発者達の助言を無視して自分好みの機能をextendedに"強引に"実装し、
コードをぐちゃぐちゃにしてメンテナンスを困難にし(とりわけ道路と建物関連)、
挙句にバグを大量に埋め込み、それを知らんぷりして放置し(隠居するなどと言って)別のところに逃げ隠れて自分のフォーク(OTRP)は開発を続けている
その事実と彼の無責任さに日本人プレイヤーは目を向けるべき。らんらんはそれでやる気をなくした(´・ω・`)
他人の振り見て我が振り直せ。ひめしのようにならないために、らんらんが生み出したバグや問題は自分で修正しなくちゃね(´・ω・`)

Mariculous

#20
That fights the symptoms but not the cause.

The reason why they don't build anything is indeed a combinations of shortage and land being rated to build housings.
An area with many housings will always have a bad industry rating, so there won't spawn any industries in cities at all.

If that behavior is desired, simply comment that line out.

If not, I am currently preparing a commit that makes villages to always ignore shortages but lets other cities found new industrial quartes around the city borders if it didn't find a suitible place to build what is needed.
Essentially, it will build an industry at the least worst rated ground around cities borders.

Quote from: Ranran on April 29, 2020, 07:00:02 PM1) City placement and manual growth try to maintain job shortage (ratio).
2) Renovation basically increases housing
From the codebase, this is not immediately clear. But yes, this is roughly what happens.
It is entirely radomised if we want to renovate at all and which buildings we attempt to rennovate. Rennovation itself re-rates that ground for industry/commercial/residental again.
If there are more housings in a town than industries, it is more likely to rate a ground (with an existing industry) to be suitible for housings, than vice versa. Thus an existing inbalance in housings and industries will get further out of balance until all industries were rennovated-away .

Ranran(retired)

#21
Quote from: Freahk on April 29, 2020, 07:38:17 PMThat fights the symptoms but not the cause.
Yeah, that's just a debugging step. I suppose that the condition for setting that flag may be wrong, or the processing when that flag is set may be incorrect (or lack).


QuoteThe reason why they don't build anything is indeed a combinations of shortage and land being rated to build housings.
An area with many housings will always have a bad industry rating, so there won't spawn any industries in cities at all.
It is double broken. It should be noted that this bug does not create a workplace even in a new city.
There is no house so population is zero and world is job shortage. The city has no housing area at all! However the city does not build the any working place and build only roads and attractions. It just builds an empty parcel.
Why are all new cities still trying to become a residential city when the world lacks work place? The process of creating a workplace first may eliminate it. If the city could't build a house, don't stop the process of building the working place.



And, as I have observed, despite the lack of jobs, cities prioritize refurbishing residential areas rather than increasing workplaces. (Rather, it does not create any IND/COM.)

Results of the new experiment:
1) I rewrote the code and used a build that forced job_shortage to false and built a new city in a extreme job shortage world. (If I do not do this, the new city on the map will always have a population of zero.)
2) Then the new town built only houses.
3) I loaded 2) with a normal build and used grow city tool for it.
4) The city expanded the road but didn't create any new building except attractions. On the other hand, however, all existing houses have been newly renovated. This has made the world's job shortage even more serious.

Oh my pig... Please stop growing population despite the map being job shortage! (´・ω・`)


This city looks weird, but those buildings were not manually placed by me, nor were their roads extended by me.
I'm guessing that due to the lack of jobs in the map, the city did the broken action of renovating res and expanding the road without creating a workplace.


I hope these experiments and observations will help solving this bug.

Thank you.
ひめしという日本人が開発者達の助言を無視して自分好みの機能をextendedに"強引に"実装し、
コードをぐちゃぐちゃにしてメンテナンスを困難にし(とりわけ道路と建物関連)、
挙句にバグを大量に埋め込み、それを知らんぷりして放置し(隠居するなどと言って)別のところに逃げ隠れて自分のフォーク(OTRP)は開発を続けている
その事実と彼の無責任さに日本人プレイヤーは目を向けるべき。らんらんはそれでやる気をなくした(´・ω・`)
他人の振り見て我が振り直せ。ひめしのようにならないために、らんらんが生み出したバグや問題は自分で修正しなくちゃね(´・ω・`)

Mariculous

Quote from: Ranran on April 29, 2020, 10:04:53 PMIt is double broken. It should be noted that this bug does not create a workplace even in a new city.
That's because shortage is a global thing, not local to cities. That's why I want small villages to ignore shortages, so they can grow a little on their own before they start to care about global matters.

I have already debugged it with new cities that don't grow at all, but also with existing cities that slowly turned into pure inhabitant cities without jobs.

Quote from: Ranran on April 29, 2020, 10:04:53 PMWhy are all new cities still trying to become a residential city when the world lacks work place?
Because rating grounds is  a local thing to get some kind of industrial quarters within cities. That rating does never rate tiles near a townhall as "good for industry". If we adjusted that rating to consider global shortages we had industries spawning in the middle of inhabitant quarters.
The problem is that city growth will attempt to build at the firs ttile that was rated good for that type. there might be no good tile for that tile at all in the whole city.


Your image shows exactly what is going on...

The key of it is the follwoing:
First, we randomise if we want to upgrade. In that case, we will pick random buildings until we have reached the number of upgrades we wanted to do or the max try counter exceeded, rate the ground of the picked buildings for industry/commercial/residental suitability and upgrade to what suits best.

If we upgraded at least one building, we will return. (yes, that means if we want to grow by 100 but could only upgrade one, we won't even attempt to build new houses)

If no upgrade was performed, we will now try to build new buildings the following way:
We will iterate the whole city in more-or-less randomised order. Once cityrules found a tile suitable for any building, we will rate it for industry/commercial/residental suitability.
We will now attempt to build the type of building that fits best according to that rating.
The last and final step is to check for shortages. If there is a shortage of that type, we will skip that tile.

That will happen until all tiles within city borders were checked.
If we still didn't build anything, we will grow the city borders (up to 4 times) and attempt to build again. (that's btw. the reason for extended cities always being rectangular)

So, there are 3 main issues causing the city growth bug:
1. The rating function seems to be a little stupid, as it does not judge unused land around the city borders as good for industries.
2. all cities are bound to some global problems that, in fact, are not really global ones as inhabitants won't commute infintitely far to work.
3. upgrades are completely randomised and don't care for shortages at all.
4. If there is no place within (grown) city borders suitable for the type required to solve shortages, we simply cannot build anything. There is no "if nothing was considered good, pick the least bad one"

Yet, I have touched the second point by ignoring any global shortages for small villages, so they can grow as they please up to some point.
Currently, I am working on the 4th point by enforcing to build what is needed at the least bad rated tile if all attempts failed.
The next step will be carefully adjusting the rating function in a way that might rate unused land around city borders as good for industries.
And the very last step is considering shortages when upgrading, although I don't know yet if I really want to dig into the incredibly long and dirty upgrade function.

Once these steps are finished, city growth should work much better.

Vladki

Quote from: Freahk on April 29, 2020, 11:48:05 PMI have already debugged it with new cities that don't grow at all, but also with existing cities that slowly turned into pure inhabitant cities without jobs.

Isn't it a problem that cityhalls, attractions and player buildings (stations, signalboxes), require employees too? So all people work there, and there's no need for industry to keep them busy?

Mariculous

#24
From the code, that should not at all prevent cities from spawning new industries, when a job_shortage was calculated,  which is really only about points 1 and 4.
The job_shortage and worker_shortage considered for city growth are really just as simple as the ratio in between globally available jobs to the number of globally demanded jobs.


The staff shortage issues of individual industries are a different thing, which is likely (that means I didn't investigate that in deep) about some kind of commuter locality.
Workers won't commute too far, whilst maintaining the available jobs/work demand ratio is a global thing, huge industries likely won't be able to get enough workers from nearby cities.
Further, such industries are often out of town, which makes it even less likely for commuters to arrive there.

Ranran(retired)

Yes, I think we should also have a macro perspective, as Freahk says.
In other words, avoiding the situation where nothing is built after considering the balance in the city. IMO, it is more realistic.
For example, when creating a city, the city hall created 40 jobs then it is more natural for some of them to commute from that city. So allow some houses to build even if there are too many houses in the world.
If there was excessive job in the world, the city created only homes. Where do the people who live there go to shop for food? Is it a distant town? Usually a small store will be there. We should allow such things.
When the coal mine once flourished, 5,000 people emigrated to a small uninhabited island. Whenever such a big person moves, the store will be built there. People are not so stupid, so they see business opportunities there.
ひめしという日本人が開発者達の助言を無視して自分好みの機能をextendedに"強引に"実装し、
コードをぐちゃぐちゃにしてメンテナンスを困難にし(とりわけ道路と建物関連)、
挙句にバグを大量に埋め込み、それを知らんぷりして放置し(隠居するなどと言って)別のところに逃げ隠れて自分のフォーク(OTRP)は開発を続けている
その事実と彼の無責任さに日本人プレイヤーは目を向けるべき。らんらんはそれでやる気をなくした(´・ω・`)
他人の振り見て我が振り直せ。ひめしのようにならないために、らんらんが生み出したバグや問題は自分で修正しなくちゃね(´・ω・`)