Transport Tycoon Forums
https://www.tt-forums.net/

[GS] Think globally, act locally
https://www.tt-forums.net/viewtopic.php?f=65&t=77335
Page 1 of 1

Author:  McZapkie [ Thu Nov 23, 2017 11:58 pm ]
Post subject:  [GS] Think globally, act locally

I found interesting script on bananas: Town_and_Industry_Control-3.1, which was created for limiting random growth of industry: it require to serve certain percentage of industry to have chance of new industry to be built.
Very clever idea, I hate map cluttered by insane amount of industries (especially when grfs such FIRS are active and industry is not limited by town number).
Unfortunately, script have some bugs (author forgot to change fraction to percentage) and seems that it is unfinished, no impact of served towns was taken into account, and there was some other issues, for example sharp conditions.

Therefore I decided to rewrote it.

Now there is something like macroeconomic index, which depend on:
[*]ratio of served towns to total number of towns
[*]ratio of served industries to total number of industries
[*]amount of game years.
Both served towns and industries can increase this index, but elapse time make it harder.
New industry would be appear if macroeconomic index is high enough to be considered as indices f wealth economy, or if number of served industries meets predefined criteria.
If option "Try to keep the number of industries on map" is checked, new industries would also replace closed ones, if economy index is not utterly negative.

Additionally, small towns require passenger and mail service for growth, medium (population threshold depend on economy index) require food and/or good cargo delivered, and large towns require fuel and building materials (it is possible to omit this by setting zero requirements). Any grf which use FOOD, GOOD, PETR and BDMT cargo designators should be compatible with this script.
Town growth is very slow, if global economy index is utterly negative.

I uploaded this script to Bananas.

Author:  sevenfm [ Fri Dec 01, 2017 8:39 am ]
Post subject:  Re: [GS] Think globally, act locally

Very interesting script! I tested it in a quick game and I have some questions:
1. How the transported percentage is calculated? I can understand it for pass/mail - the town produces passengers and mail so the game calculates amount of produced/transported, but how it calculates percentage of other goods? How much food/goods/etc I need to deliver to a town, does it depend on town size?
2. In my test the town with population of about 1300 had high passenger transport percent so the town window showed 'growing', but the town population was actually decreasing, probably because of low economy index (like -30). Other towns that had no passenger service did not change population.
3. It seems you don't need to deliver mail, just transporting passengers is enough for very high percentage (like 96%), is there a way to change it so the town would need both pass and mail transport, for example 70% pass and 30% mail percentage is taken into account, so to achieve high percentage you will need to transport both high percentages of pass and mail, but pass is more important?
4. Using slow vehicles to transport passengers (like horse busses from PolRoad set) results in pass percentage jumping from very high to very low in some months, probably because travel time is greater than month (like 43 days).
5. You don't need to connect towns, just local service is enough to grow town, is there a way to change it so the town will also/only take into account pass/mail transported from other towns?
6. Amount of game years making game more complex seems too artificial for me, just like inflation that I never use - I don't like that game becomes harder just because time passes and not because something happens in a game world. Is there a way to change it, for example use total number of industries as a limiting factor, so every new industry on the map makes raising economy index a bit harder? I also like to start early like in 1700 or 1800 and don't want the game to became too hard in 1900 or so just because I like to start with horses and sails.
7. Maybe take into account total town population on map, so even if you serve all industries on map and all towns and the economy index is still too low for new industries to open, you can grow population and it will allow new industries.

Thank you!

I am using Spring 2013, ECS, TTRS Early Mod, started test in 1830, started script with default settings.

Author:  McZapkie [ Sun Dec 03, 2017 1:18 pm ]
Post subject:  Re: [GS] Think globally, act locally

Thanks for review! I want to emphasise, that I'm not a original author, it is just remake of James work.

Some issues were fixed, v.6 is here: http://openttd-polska.pl/attachment.php?aid=1069
The most important change is, that there are now following modes of town growth:
1. below 5k citizens, pass+mail must be fulfilled to enable typical openttd mode of growht,
above 5k, growth depend on pass, mail and consumer goods have impact on town growth rate (the lattero nes with higher weight), above 10k additionally industry goods must to be delivered
(it is still possible to grow without these but much harder).
1.
Quote:
How the transported percentage is calculated?
It was not calculated properly, it is fixed now.
2. Economy mood have no impact on small towns (currently I even removed this feature). Shrinking occurs when one building is replaced by another smaller (or in construction stage), it is openttd feature.
BTW, this script protect small towns, if town is below 35, it will regrow itself.
3. I prefer general categories in contrary to specific cargo, which can be or cannot be accepted.
4. in case of larger towns (above 5k), growth speed is now calculated as an average of current and previous growth value, it should give more smooth model.
5. No idea how to handle this, but maybe it can be done by creating some subsidies from/to given town and checking if they are fulfilled?
6. Original script had hard limit of served industry limit. Feature with economy depend on game years is for give possibility of creating additional industries short after start of the game. It is just easier to fulfil requirements at the start, but don't mind if you can't - requirement is not scaled linearly, but asymptotically to the number defined by script settings.
7. Good idea. Some kind of average town population.

Author:  sevenfm [ Mon Dec 04, 2017 11:18 pm ]
Post subject:  Re: [GS] Think globally, act locally

sevenfm wrote:
4. Using slow vehicles to transport passengers (like horse busses from PolRoad set) results in pass percentage jumping from very high to very low in some months, probably because travel time is greater than month (like 43 days).

Found that it was a bug in Spring2013 which incorrectly calculates supplied cargo, and as a result GetLastMonthTransportedPercentage returns garbage if supplied+received cargo exceeds town production last month, so it's not a problem of script.
In OpenTTD 1.6.1 GetLastMonthTransportedPercentage works fine.

McZapkie wrote:
5. No idea how to handle this, but maybe it can be done by creating some subsidies from/to given town and checking if they are fulfilled?

Should be possible using something like GSStationList_CargoPlannedByFrom, by analyzing town stations and cargo flow.
Quote:
Creates a list of origin stations of cargo planned to pass a station, with the monthly amounts of cargo planned for each of those origin stations as values.

https://nogo.openttd.org/docs/trunk/cla ... l#_details

Author:  McZapkie [ Fri Dec 08, 2017 7:17 pm ]
Post subject:  Re: [GS] Think globally, act locally

New version 7 is available on bananas (and tested on my JGRPP server).

I'd rewritten town growth mechanism, using town goals for smaller towns, rules are now as follows, depending on population
below 25: town will regrow itself
below 250: standard growth
below 2500: standard growth with passenger goal threshold
below 5000: standard growth with passenger and mail threshold (+food if not temperate, regardless of town location)
below 10000: growth depend on passenger and mail transport (above goals still apply)
below 20000: growth depend on passenger, mail and consumer goods transport (ibidem)
above 20000: growth depend on passenger, mail consumer good and industry resources transport (ibidem).

Additionally, if town is well served, there is chance to create subsidy from this town to another one, no matter if other one is already served or not, distance is not limited (but probability is lower). It works fine with cargodist, however I recommend to diminish subsidy announcements (there is lot of them).

Author:  McZapkie [ Thu Jan 18, 2018 8:02 pm ]
Post subject:  Re: [GS] Think globally, act locally

Version 12 was uploaded to bananas.
Town growth model was tweaked. There are three cargo groups: consumer goods, raw energy and farm resources, industry supplies - which are required when town exceed 5k, 10k and 20k inhabitants, accordingly.

Beside of passenger subsidies, mail subsidies are generated as well, but are rare - occurs only between large towns and if economy index is positive.

Author:  McZapkie [ Wed Apr 11, 2018 5:40 pm ]
Post subject:  Re: [GS] Think globally, act locally

New version 13 is available, subsidy generation is tweaked to avoid multiple subsidies for given town pair, and town growth is tweaked.

Author:  McZapkie [ Fri Jun 08, 2018 8:59 am ]
Post subject:  Re: [GS] Think globally, act locally

Version 14 was released.
I decided to make stockpiles for raw and energy goods, thus town growth is more smooth now in case of irregular supplies.
It doesn't apply to consumer supplies such food, goods etc, they should be supplied often, but usually it is not an issue, industry grfs such FIRS or ECS usually are spawning such industries near town, thus one can supply batch of raw products and gain stable stream of consumer goods using local delivery vehicles.

Author:  dol422 [ Sun Jun 10, 2018 7:49 pm ]
Post subject:  Re: [GS] Think globally, act locally

It seems the script crashes upon game load. Index 'TE_GOOD' is non-existant.

Screenshot below

Attachments:
Think Globally, Act Locally Crash.png [247.19 KiB]
Not downloaded yet

Author:  McZapkie [ Mon Jun 11, 2018 9:04 am ]
Post subject:  Re: [GS] Think globally, act locally

Thanks for report, my typo, should be TE_GOODS, I was testing it only in winter climate and didn't notice it.

Author:  romazoon [ Wed Jan 16, 2019 4:24 pm ]
Post subject:  Re: [GS] Think globally, act locally

Very nice work with this script, i like it a lot.

Though i just experienced a script crash, i was bulldozing a few unserviced industries before it happened.

Attachments:
Baan Baa Railways, 12_02_2000.png [79.15 KiB]
Not downloaded yet

Author:  McZapkie [ Sun Feb 10, 2019 6:47 pm ]
Post subject:  Re: [GS] Think globally, act locally

Thanks for testing. I added two null assertions in v.17, it should help.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000-2019 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2019.