CityBuilder Release Topic

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

Post Reply
MisterX
Engineer
Engineer
Posts: 36
Joined: 25 Mar 2013 18:24

Re: CityBuilder Release Topic

Post by MisterX »

stinkyfax wrote:And another issue:
Image

There are dozen of busses around, Also already supplying water.
Town stays same population for two years, yet it says "grows", I would really appreciate some help in figuring out what is wrong.
"The town is failed to place 1 house! Try placing roads and removing obstructions"

So the town will grown, but can't found a place for the new houses. Add more roads. Also to the north/west, where is water on this moment.
stinkyfax
Engineer
Engineer
Posts: 28
Joined: 28 Mar 2013 20:12

Re: CityBuilder Release Topic

Post by stinkyfax »

MisterX wrote:
Small city's will always grows to some level (with you can determine yourself if i am right). Therefore your city grows.
it is set to 150, but we had a game session of 4 people today for ~4 hours and it seemed not to be a problem (in few months they stop growing by themselves)


The issue I have got is another, the Cities (not towns) we connect to do not grow.
In setting we set it so if 65% of passangers are transferred (from the city, not to the city. Right?) then it grows.

But for many many game-years it always shown 0% eventhough we transferred around 70%. Here is the screenshot example attached to the post.

Any idea what can we do to solve the issue?
The script is amazing and are looking forward to play it more!
Attachments
2013_03_29_23_05_01_OpenTTD_1.3.0_RC3.png
(2.88 MiB) Downloaded 6 times
Aphid
Traffic Manager
Traffic Manager
Posts: 168
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid »

The issue I have got is another, the Cities (not towns) we connect to do not grow.
In setting we set it so if 65% of passangers are transferred (from the city, not to the city. Right?) then it grows.
Ah, that is a bug with the UI part of the script, I'll look into fixing it. The city should grow.

When a city is below starting population the UI would report that it doesnt' grow with regrowth enabled.
stinkyfax
Engineer
Engineer
Posts: 28
Joined: 28 Mar 2013 20:12

Re: CityBuilder Release Topic

Post by stinkyfax »

Aphid wrote:
The issue I have got is another, the Cities (not towns) we connect to do not grow.
In setting we set it so if 65% of passangers are transferred (from the city, not to the city. Right?) then it grows.
Ah, that is a bug with the UI part of the script, I'll look into fixing it. The city should grow.

When a city is below starting population the UI would report that it doesnt' grow with regrowth enabled.
I have a strong suspicion that is not just graphical bug, that city went up from 1.3k to 1.6k in 5 hours by just improving existing houses, it definitely seemed to be as not growing.
Aphid
Traffic Manager
Traffic Manager
Posts: 168
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid »

That could certainly be a bug.

Could you supply the following, to help me see where the problem lies?:
  • - A screenshot of the city in question.
    - A screenshot of the upper part of the CityBuilder config settings window (everything except the cargoxx, decayxx, and so on settings), OR A copy of the openttd.cfg file used; specifically the part - where the citybuilder settings are.
    - A screenshot of the script debug window when the city first did not grow correctly.
Attachments
example.jpg
(243.53 KiB) Downloaded 5 times
stinkyfax
Engineer
Engineer
Posts: 28
Joined: 28 Mar 2013 20:12

Re: CityBuilder Release Topic

Post by stinkyfax »

Aphid wrote:That could certainly be a bug.

Could you supply the following, to help me see where the problem lies?:
  • - A screenshot of the city in question.
    - A screenshot of the upper part of the CityBuilder config settings window (everything except the cargoxx, decayxx, and so on settings), OR A copy of the openttd.cfg file used; specifically the part - where the citybuilder settings are.
    - A screenshot of the script debug window when the city first did not grow correctly.
More than happy to be useful in narrowing down a bug.

Screenshot: http://josh.c-servers.com/web/2013_03_2 ... .0_RC3.png
Upper Config: http://josh.c-servers.com/web/2013_03_3 ... .0_RC3.png
Complete Config: http://josh.c-servers.com/web/openttd.cfg
Save Game: http://josh.c-servers.com/web/cb_save_debug.sav

I am uncertain about debug window, for instance I don't have a save game for a "first" failure to grow, nor I know when was that first failure.
Debug window at the end of a month, spotted nothing interesting (but is not a first month): http://josh.c-servers.com/web/2013_03_3 ... .0_RC3.png

Oh just noticed your example, give me few minutes I'll try to do similar in a new game.


I loaded starting point of our game and recreated the situation:
Screenshot: http://josh.c-servers.com/web/2013_03_3 ... .0_RC3.png
Aphid
Traffic Manager
Traffic Manager
Posts: 168
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid »

While I try to recreate the problem, here's one thing I'm observing you could try out;

See the red circles. That's a lot of dead-end roads the town has. These may cause it to fail to place houses correctly. I believe that town has the 'default' growth algorithm, which may fail in this way. What happens if you manually extended the roads so the town had a bunch of free squares where it could place a house?

A 'free square' is a square where:

- There is no company-owned infrastructure on it.
- There is no water on it
- There is no roads on it
- there is no roads on the tile next to it so that this road leads into said tile.

The example picture has 6 free squares. If for whatever reason it can't find one of those it will not grow.
I will look into adding the message about this to the GUI so it's easier to spot. (Check whether the houses ordered to build are also built like I do for normal towns)
Attachments
2013_03_29_23_05_01_OpenTTD_1.3.0_RC3.jpg
(491.76 KiB) Downloaded 5 times
stinkyfax
Engineer
Engineer
Posts: 28
Joined: 28 Mar 2013 20:12

Re: CityBuilder Release Topic

Post by stinkyfax »

Excellent, I tried v73 and it works. Not only I can see in the UI that city grows but it clearly places new roads and houses each month start.

Thank you for an amazing work and quick fix :)

The town has become larger in 1 month with v73 than in ~15 years in v72 :) Now we can enjoy some epic games.
http://josh.c-servers.com/web/2013_03_3 ... .0_RC3.png

P.S. Just found out that it is v74 but with not updated verison.nut file.
Aphid
Traffic Manager
Traffic Manager
Posts: 168
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid »

Ye, I fixed that in v75 as well as a related bug I found.

Apparently there was a missing underscore somewhere in the code that made cities of 0 population not grow at all. Now they grow as size 'min_size_max_growth', like they should.
As a test I bulldozed an entire city.

I also added messages for situations in which a city doesn't grow because of roads. It should notify you to 'try placing roads'. Note that if you use 'towns build roads' then this message also appears if a town builds a road instead of a house. This is kind of intended because building a road slows a town's growth rate :)

Edit: I tested and bulldozed an entire map. The population rose back up to the old value in a few decades :wink:
stinkyfax
Engineer
Engineer
Posts: 28
Joined: 28 Mar 2013 20:12

Re: CityBuilder Release Topic

Post by stinkyfax »

Aphid wrote:Ye, I fixed that in v75 as well as a related bug I found.

Apparently there was a missing underscore somewhere in the code that made cities of 0 population not grow at all. Now they grow as size 'min_size_max_growth', like they should.
As a test I bulldozed an entire city.

I also added messages for situations in which a city doesn't grow because of roads. It should notify you to 'try placing roads'. Note that if you use 'towns build roads' then this message also appears if a town builds a road instead of a house. This is kind of intended because building a road slows a town's growth rate :)
Thanks, while we are at it, in the friends-only games we severely lack a nice feature which would make our playing more interesting. (As opposed without admin control it will allow cheating)

Proposed ON/OFF Feature: Not company owned towns grow as cities.

Negatives: someone could grow a town big using megapolis rules, and then allocate his HQ there.

In case there is administration / or people trust each other, there are several Positives:
1. Lack of cities is no longer important.
2. Connecting owned town to other towns makes more sense, currently other towns supply ~30 passengers a month and this value only goes down.
3. Currently any non-city and non-owned town looks more like an obstacle - can't build rails through, nor it provides any resource (~20 passengers a month compared to cities is a neglected fraction)
Aphid
Traffic Manager
Traffic Manager
Posts: 168
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid »

Actually, you can 'kinda' do this already with the current settings. Take for example a temperate map.

Passengers = 0
Mail = 2
Coal = 1
Goods = 5
Valuables = 11

Are the cargo IDs in use.

Now let's say you want to grow other towns to max. ~4000

Then simply setting up the following:

cargo00 = 320
cargo02 = 55

size00 = 500
size02 = 1000

trans00 = 7500
trans02 = 7000

Notice the large transxx values. What this will do is lower the requirements at 4,000 people to only ~16% passengers and ~2.7% mail. That's less than the town itself provides. Whence it becomes possible for two towns to 'feed' eachother until they reach the mark where they can't produce enough anymore. With these values that's about 6000. At that point a town provides enough passengers for it to be 'useful' enough to you, at which point you can change your line to deliver to the town where your HQ is.

Or, alternatively, set the sizes where you first need passengers and mail high enough, like 2000+. That way you can deliver the other cargoes to grow the other small town(s), and then when they are large (enough) switch the supply to your main town.

Meanwhile, I think I found a way of implementing that switch.
stinkyfax
Engineer
Engineer
Posts: 28
Joined: 28 Mar 2013 20:12

Re: CityBuilder Release Topic

Post by stinkyfax »

Aphid wrote:Actually, you can 'kinda' do this already with the current settings. Take for example a temperate map.

Passengers = 0
Mail = 2
Coal = 1
Goods = 5
Valuables = 11

Are the cargo IDs in use.

Now let's say you want to grow other towns to max. ~4000

Then simply setting up the following:

cargo00 = 320
cargo02 = 55

size00 = 500
size02 = 1000

trans00 = 7500
trans02 = 7000

Notice the large transxx values. What this will do is lower the requirements at 4,000 people to only ~16% passengers and ~2.7% mail. That's less than the town itself provides. Whence it becomes possible for two towns to 'feed' eachother until they reach the mark where they can't produce enough anymore. With these values that's about 6000. At that point a town provides enough passengers for it to be 'useful' enough to you, at which point you can change your line to deliver to the town where your HQ is.

Or, alternatively, set the sizes where you first need passengers and mail high enough, like 2000+. That way you can deliver the other cargoes to grow the other small town(s), and then when they are large (enough) switch the supply to your main town.

Meanwhile, I think I found a way of implementing that switch.
that is a workaround and conflicts my heavy requirements with a lot of cargos added from FIRS Industry set. I understand I still can grow small towns, but if I am using them as cities, would be awesome to have an option to let them behave as cities.

Thanks
Aphid
Traffic Manager
Traffic Manager
Posts: 168
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid »

Yep, try the new version. It allows you to do just that. The towns will grow as a city, but without the city multiplier.
Note that when claiming a town with this setting on, it will take until the first day of the next month before the requirements are presented to you.

About exploits regarding this:

- It's not really possible to 'grow your town as a city' and then claim it because claims can only be done up to a certain maximum size (unless you set this to infinite).

One thing that you can do is grow a lot of towns easily and prevent new players from picking a town.

The possibly really major exploit can happen when you allow muncipalities. You can cause a second town to become a muncipality of your main town if this is turned on. That second town then only requires the MTR to grow, which means easy population. I think the muncipality does end when the secondary overtakes the primary in population though, so it's not unlimited. Still not a good idea to use both these together though :mrgreen:
stinkyfax
Engineer
Engineer
Posts: 28
Joined: 28 Mar 2013 20:12

Re: CityBuilder Release Topic

Post by stinkyfax »

Aphid wrote:Yep, try the new version. It allows you to do just that. The towns will grow as a city, but without the city multiplier.
Note that when claiming a town with this setting on, it will take until the first day of the next month before the requirements are presented to you.

About exploits regarding this:

- It's not really possible to 'grow your town as a city' and then claim it because claims can only be done up to a certain maximum size (unless you set this to infinite).

One thing that you can do is grow a lot of towns easily and prevent new players from picking a town.

The possibly really major exploit can happen when you allow muncipalities. You can cause a second town to become a muncipality of your main town if this is turned on. That second town then only requires the MTR to grow, which means easy population. I think the muncipality does end when the secondary overtakes the primary in population though, so it's not unlimited. Still not a good idea to use both these together though :mrgreen:
Thank you, we have scheduled a game for today evening, going to try out with new options!
stinkyfax
Engineer
Engineer
Posts: 28
Joined: 28 Mar 2013 20:12

Re: CityBuilder Release Topic

Post by stinkyfax »

Image
I got a question regardless settings and requirements. Why it seems to require around 40% more than I have set in settings?
Mail is closer to the actual value because the mail is set to be introduced in 500 + transition of 500.

Does it mean I should put values in settings to be around 200 passengers per 1,000 pop if I want it to be 300?


Worse case:
Image
503 population, setting: 200 passengers per 1000 population.
Required: 272 ???
MisterX
Engineer
Engineer
Posts: 36
Joined: 25 Mar 2013 18:24

Re: CityBuilder Release Topic

Post by MisterX »

There's also a settings to add some randomness, if i am right. I think that's on.

I also have a question: I just build a moneyline between 2 city's of 12K. If I at roads to a city, it growns enormously at this moment. 1,5 year later one of the city's is already above the 30K. How can a reduce the growrate of the city's? At time moment, i can't transport more than 50% of the population, so the grow will stuck at 30K. But i can easiely expand my network, so I can transport more passagiers and meet the requirements, and the city will be bigger. Which settings have i to adjust?
stinkyfax
Engineer
Engineer
Posts: 28
Joined: 28 Mar 2013 20:12

Re: CityBuilder Release Topic

Post by stinkyfax »

While trying to debug I found out that cargo_factors can go way too high:
Image
While In settings I got variation in cargo requirements (%): 10

Changed variation to 1%, it is way to sensitive in my opinion. and 1% gives around 20% actual delta, while 10% (setting) was giving factors between 0.5 to 5
Aphid
Traffic Manager
Traffic Manager
Posts: 168
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid »

I will look into the variation algorithm and see if there's a zero off somewhere or a rounding issue, that seems to be the case. I normally don't use it so some new feature might have broken it down the line.
I also have a question: I just build a moneyline between 2 city's of 12K. If I at roads to a city, it growns enormously at this moment. 1,5 year later one of the city's is already above the 30K. How can a reduce the growrate of the city's? At time moment, i can't transport more than 50% of the population, so the grow will stuck at 30K. But i can easiely expand my network, so I can transport more passagiers and meet the requirements, and the city will be bigger. Which settings have i to adjust?
There are two variables that govern the growth rate of cities.
From the readme:

Code: Select all


Setting Name: City growth Multiplier promillage:
Setting Range: 1-65535
Comments: Set to 1,000 for no change. 2,000 is the default game value (cities
grow twice as fast). Has no effect when you set cities to grow 'normally'.\

Setting Name: Slowing factor
Setting Range: 1-65,535
Comments: This is a factor in growth speed. Set it twice as high to make towns
grow twice as slow as normally. The recommended factor is 40. For a faster-paced
game, set this higher, and for a slower-paced game set it slower. This is a very
powerful setting, fine-tuning it for your setup is recommended. A setting of 40
means a town of 4,000 has a max growth speed of one house per ten days.
So setting the multiplier lower will cause cities to build less houses. Setting the slowing factor higher will do so for all cities and towns on the map. As there is an actual three-month delay between the house starting to build and the increase in population, cities tend to grow for three more months after you start failing the transport requirement. So setting these settings somewhat lower/higher respectively would do the trick.

Both are linear by the way, so twice as much slowing factor => cities and towns grow twice as slowly. Twice as much multiplier -> Cities grow twice as fast.

EDIT: Here's something interesting.

The old algorithm used this:

Code: Select all

	while(GSBase.Chance(367879, 1000000) == false)
as a critierion for doing another pass.
That meant it had a 62.3% chance of doing only a single pass (value in range 0.9-1.1 flat distribution), and a 36.7% of a double pass (0.8-1.2) in a triangle curve distribution, and so on. Turns out this is not a good thing because the actual sigma of the distribution increases with sqrt(n) for n passes.

Code: Select all

\sum _{n=1}^{\infty } (.623{}^{\wedge}(n-1) - .623{}^{\wedge}n)*\frac{\sum _{k=1}^n \sqrt{k}}{\sqrt{3}}
This is a LaTeX formula for the limit. Using approximation techniques or by solving you can find that the answer is about sigma = 2.34233 in the limit towards infinity. So the range was about 2.3 times too large. The reason for this rather complicated scheme was that it would effectively net you a very close approximation of the classic normal distribution. I didn't count the compounding variations though which is what caused the fact that it was off.

I've replaced it with a 25 (fixed number) passes with 1/5'th size. That means you get a near-bell-shaped curve. (if the flat distribution with sigma = 1, mu = 0 is F, then lim n->inf of F^n/sqrt(n) is the normal distribution N(0,1).)

Attached file shows some sample towns with the new algorithm at 10%.

EDIT 2: Also, I found a bug with GSBase.Chance(). It doesn't work correctly, so the above point about it being 2.34x off is a bit moot :) . It was off by lots, anyway.
Attachments
Extowns.jpg
Extowns.jpg (223.2 KiB) Viewed 1205 times
MisterX
Engineer
Engineer
Posts: 36
Joined: 25 Mar 2013 18:24

Re: CityBuilder Release Topic

Post by MisterX »

Tnx, a slowing factor of 40 seems okay, but City growth Multiplier promillage was with 3000 much to high. I think 1500 would be better, or maybe a bit lesser. Cities will grown in that case, but not that fast. Starting with some moneyline betwee two cities is a good idea, but then it is easy to transport 50% of the passagiers. Maybe I also have to increase the slowing factor. The cities grow so fast, but still the couldn't place most of the houses. 30-40 house they couldn't place was normal...
Aphid
Traffic Manager
Traffic Manager
Posts: 168
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid »

Did you by any chance turn on 'towns build roads'?

Because with that turned on the amount of roads built every month is added on to the 'couldn't place x houses' number. But thanks for the feedback on the default value for the city multiplier. I'll change it to 2400/2200/2000 instead of 3000/2500/2000.

Note that if you want all towns to have the same max growth rate you can set the city multiplier to 1000. Setting slow factor higher will have an effect on all towns. If you then find that small towns tend to grow too slowly for your taste, try also raising min_size_max_growth, the "below this population growth is linear".

There's a large amount of settings so you can fine-tune the script the way you like it. I appreciate the feedback on defaults, they need to work out of the box.
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 9 guests