[NoGo] Neighbours are important

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

Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: [NoGo] Neighbours are important

Post by Transportman »

Zuu wrote:You can set cargo requirement difficulty to 1%. This gives quite low requirements. However, you can probably not set it to 0 % due to a constraint in the script.
Thanks, that gives indeed very low requirements and that is good enough for my needs.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
HGus
Engineer
Engineer
Posts: 121
Joined: 12 May 2013 22:28
Location: Argentina

Re: [NoGo] Neighbours are important

Post by HGus »

Hi. I like the script.

Anyway, using FIRS on early games (1700) makes some cities to require Fueloil, wich is not available until late 19th century, so those are stuck. I tried to workaround disabling the script on early eras to allow those cities to grow a little until that, but I found that after OTTD takes control of cities, ALL of them show 16k-days to grow. Is it a bug in the script or the text is wrong and OTTD is working fine behind?

Note: In Spanish, periods are used to separate thousands.
Attachments
Example screenshot, starting at 1700 and disabling the script, 16k days to grow...
Example screenshot, starting at 1700 and disabling the script, 16k days to grow...
Sin nombre, 1700-01-23.png (136.67 KiB) Viewed 1025 times
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: [NoGo] Neighbours are important

Post by Zuu »

As you see in the debug log, and there should also be a blue information window, probably hidden behind the AI Debug window, with some help text telling you that you need to give OpenTTD some time to take back control, especially if you are using 1.3 or older (which it looks like by looking at your screenshot).

In 1.3 and older, the script can not actively restore towns to OpenTTD defaults with just one command. Instead I set growth rate very high on all towns, then I tell OpenTTD to take back control over towns by altering an anvanced setting in the game. This will not update all towns in one go. Instead, at next time that OpenTTD process each town for town growth, it will then set the growth rate according to the built in growth rate algorithm. The argument why using a very high growth rate is to not over-grow any town during the pass-back-control process.

In 1.4 and newer, there exist a script API so that I can tell OpenTTD "take back control of this town", and it will reset growth rate instantly.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
MrRB
Engineer
Engineer
Posts: 43
Joined: 12 Aug 2012 13:58

Re: [NoGo] Neighbours are important

Post by MrRB »

Hi Zuu/Anyone reading,

Is it possible to set more cargos for cities to grow? Before I continue, I have to mention, that I use FIRS.


Now, for instance, my cities require passengers, mail and petrol. However, I'd like to see it also requiring building materials, textile, goods, food, alcohol etc... Is there a setting that controls this. Have I missed it maybe?

Thanks for any help! And thanks to Zuu for the great effort in making this GS.
HGus
Engineer
Engineer
Posts: 121
Joined: 12 May 2013 22:28
Location: Argentina

Re: [NoGo] Neighbours are important

Post by HGus »

MrRB wrote:Hi Zuu/Anyone reading,

Is it possible to set more cargos for cities to grow? Before I continue, I have to mention, that I use FIRS.


Now, for instance, my cities require passengers, mail and petrol. However, I'd like to see it also requiring building materials, textile, goods, food, alcohol etc... Is there a setting that controls this. Have I missed it maybe?

Thanks for any help! And thanks to Zuu for the great effort in making this GS.
Reading a few pages back, I found that there is a limitation in OpenTTD that only permits up to 5 cargo categories to be delivered to cities, and those categories are filled by industry GRFs (or default PAX, MAIL, GOODS, FOOD, WATER). They cannot be controlled by script.
MrRB
Engineer
Engineer
Posts: 43
Joined: 12 Aug 2012 13:58

Re: [NoGo] Neighbours are important

Post by MrRB »

HGus wrote:
MrRB wrote:Hi Zuu/Anyone reading,

Is it possible to set more cargos for cities to grow? Before I continue, I have to mention, that I use FIRS.


Now, for instance, my cities require passengers, mail and petrol. However, I'd like to see it also requiring building materials, textile, goods, food, alcohol etc... Is there a setting that controls this. Have I missed it maybe?

Thanks for any help! And thanks to Zuu for the great effort in making this GS.
Reading a few pages back, I found that there is a limitation in OpenTTD that only permits up to 5 cargo categories to be delivered to cities, and those categories are filled by industry GRFs (or default PAX, MAIL, GOODS, FOOD, WATER). They cannot be controlled by script.
Thanks HGus for your clarification. That may just be true, I'll check on that in a sec. However then my cities, still only require 3 sorts of cargo to grow. That could be made 5 sorts of cargo, if I understand you correctly.

Now my cities require Passengers, mail and petrol, but that could be complemented by 2 more. As petrol falls in the same category as water (I guess), than that leaves (any) Goods and (any) Food. Which both could be specified or not... But at least those categories could be required for a city to grow, right?

For example:

1). A city could require: Passengers, mail, petrol, goods and food. --> We should be great here, because they're still within the 5 categories.

Or even more specified:

2). A city could require: Passengers, mail, petrol, alcohol (also in the category water I think), goods, building materials (in category goods I think) and food, maybe even fruit in subtropical maps...
Even though specifying would mean that cities would require a hardware store and/or a builders yard to even be able to accept the building materials for instance. That would add a whole new dynamic in my opinion.


The fact that cities can only accept cargo from (within) these 5 categories and that that can't be controlled by a script, doesn't mean that the GS can't require cities to be supplied (from within) all these categories, specified or not. Am I thinking correctly here?

Personally I'd rather see it specified as much as possible, like in example 2.


Greatly appreciate you thinking with me here, HGus! Thanks for your time :)!


That was a lot. Maybe I'm thinking totally wrong here or you can't make any sense of what I just wrote. Either way, just let me know and I'll gladly explain myself!
HGus
Engineer
Engineer
Posts: 121
Joined: 12 May 2013 22:28
Location: Argentina

Re: [NoGo] Neighbours are important

Post by HGus »

What are you asking for is a script that could control what is called "town industries", and take account of what is delivered to them.

As far as I know, this script doesnt deal with industries. You can check other scripts about that matter, like Industry Constructor or Industry Stabilizer ones, wich I didnt try yet. And I dont know if a script can control placement of industries close enough to towns to add to accounting of growth.

Anyway, I am just a player and bare tester, the last word will come from Zuu, the programmer... :bow:
MrRB
Engineer
Engineer
Posts: 43
Joined: 12 Aug 2012 13:58

Re: [NoGo] Neighbours are important

Post by MrRB »

HGus wrote:What are you asking for is a script that could control what is called "town industries", and take account of what is delivered to them.

As far as I know, this script doesnt deal with industries. You can check other scripts about that matter, like Industry Constructor or Industry Stabilizer ones, wich I didnt try yet. And I dont know if a script can control placement of industries close enough to towns to add to accounting of growth.

Anyway, I am just a player and bare tester, the last word will come from Zuu, the programmer... :bow:

Hi HGus,

True, if you would specifiy each category (Pax, mail, liquids, goods and food) further, indeed you have to track for example, how much building materials you'd have delivered to for instance: a Builders Yard of town "X".

Just as sure as the GS now has to track how much goods or food or petrol or whatever is delivered to town "X". Would that mean that tracking spefically a Builders Yard from town "X" wouldn't be possible?


On the other hand, the other part of the question still stands:

If not all of the main categories are required for a town to grow (like in my case only: Pax, mail and petrol), could the other 2 categories be added? Even without further specifying each category into more detailed sorts of cargo.


Thanks again for you thinking with me. I guess we indeed have to await some light to be shed on this by Zuu him-/herself. :wink:
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: [NoGo] Neighbours are important

Post by Zuu »

Hello,

Sorry for making you wait, but I'm somewhat limited in time for the moment.

Neighbours are important use a mechanism to set growth goals that is called GSTown.SetCargoGoal. When a script uses this method, OpenTTD cares to track amount of delivered cargo, decide to grow or not to grow, display information in the GUI etc. This API uses these five town effect classes.

It is possible for a script to say, "hey I want more control", and not use this API. Instead it can use GSCargoMonitor to monitor cargo delivered to the town. However that will for example if you take coal include cargo delivered to any power plant that belongs to this town. Industries that belong to a town doesn't need to be near as all industries belong to some town and some industries are far apart from any town. Eg. you will get a lot of interesting pit falls that you need to handle. You also need to turn on/off town growth manually and update GUI accordingly. Keep also in mind that Game Scripts run in a fairly asynchronous way in the sense that with a large map you will have no way to even be sure that you can keep up to manage all towns on a monthly basis. Now with 4 times even larger maps than 2048*2048 that will kill any script that expect to have enough time to manage all towns on a monthly basis without failing.

So, well, there are other town growth scripts that take the more complicated path and do more work themselves and thus can provide more goals. It has however never been the intention from my side to do that work (including finding and fixing bugs) on this script. If others want to fork it and do that, well it's GPLv2 so you can do that. You can also write patches for Neighbours are important. For example the stockpile feature was contributed this way.


Regarding using all town effects, I recommend you to use a different climate where all five categories are in use with the default industries. This GS doesn't yet have logic to realize if a NewGRF supply cargoes for town effects that are not in use by base industries for the given climate. IIRC desert is the most complicated climate when it comes to town effects.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
ljhsquall
Engineer
Engineer
Posts: 1
Joined: 11 Apr 2014 04:41

Re: [NoGo] Neighbours are important

Post by ljhsquall »

Does all of the requirement need to be fullfilled in a month else the requirement will be reset? It will be good it can roll over to next month. Not sure if this actually happens because I do not know if there is an interval whereby the cargo requirement is updated with the deliveries?

I monitor the requirement and it does not update even after my trains and trucks make many deliveries, sometime it just changed one of the cargo requirement to delivered with others not yet then everything reset again.
Mihalich
Engineer
Engineer
Posts: 1
Joined: 12 Apr 2014 02:09

Re: [NoGo] Neighbours are important

Post by Mihalich »

I have been a fan of your script "Neighbors are important" for a long time.
The algorithm of city growth is more realistic and original in openttd in the meantime, besides, it is more interesting for playing the game. An old friend of mine, Oldbook, told me that it would be great to make city growth dependent on its electricity requirement. Firstly, it would give a playing sense to existence of power station and coal mine in the game. Secondly, it would enrich the game with a transport chain of a new type. To my mind, your script is the most appropriate for it. Of course, additionally, module New GRF would be necessary.
P. S. Also, it would be absolutely great to add a possibility of changing the distance to the neighboring city in configurations.
HGus
Engineer
Engineer
Posts: 121
Joined: 12 May 2013 22:28
Location: Argentina

Re: [NoGo] Neighbours are important

Post by HGus »

Mihalich wrote: P. S. Also, it would be absolutely great to add a possibility of changing the distance to the neighboring city in configurations.
That is controlled with a global constant in towndirectory.nut, at first line:

Code: Select all

MAX_NEIGHBOUR_DISTANCE <- 100;
I don't know yet if that can be changed using GSController.GetSetting() from main.nut or elsewhere.

BTW, the growth town system and town creation in OpenTTD is unrealistic. In real world isolated cities are located at inhospitable sites, like Siberia, the Sahara, the Patagonia or Alaska, some are isolated islands. Then it is usual that those cities grow very slow or not grow at all. On the other hand, fertile lands incentive grow of cities, then those sites usually have many cities, making one of them grow faster, becoming metropolis or capital city. Only cities that doesnt depend on local resources can grow isolated beyond their natural limits, the only example that I can think now in modern world is Las Vegas.
But in OpenTTD you can find some isolated cities at the coast, surrounded by green plains and some farms, and large clusters in top of snowy mountains or in middle of desert. And the growth algorytm can make any of those cities grow very large, while the one at the fertile country stay just like a little town.
So I think this NAI script is better than nothing, replacing the original algorythm, besides the unrealistic map generator...
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: [NoGo] Neighbours are important

Post by Zuu »

HGus wrote:
Mihalich wrote: P. S. Also, it would be absolutely great to add a possibility of changing the distance to the neighboring city in configurations.
That is controlled with a global constant in towndirectory.nut, at first line:

Code: Select all

MAX_NEIGHBOUR_DISTANCE <- 100;
I don't know yet if that can be changed using GSController.GetSetting() from main.nut or elsewhere.
It wouldn't be very hard to replace that constant with calls to read a setting. The setting would need to be marked as read-only in-game since neighbours are cached. Re-calculating neighbours is not impossible, but takes quite a bit in-game time. You don't see that when you start a new game as Game Scripts got a special setup instructions budget which is large compared to what you have in a running game.
HGus wrote:BTW, the growth town system and town creation in OpenTTD is unrealistic. In real world isolated cities are located at inhospitable sites, like Siberia, the Sahara, the Patagonia or Alaska, some are isolated islands. Then it is usual that those cities grow very slow or not grow at all. On the other hand, fertile lands incentive grow of cities, then those sites usually have many cities, making one of them grow faster, becoming metropolis or capital city. Only cities that doesnt depend on local resources can grow isolated beyond their natural limits, the only example that I can think now in modern world is Las Vegas.
But in OpenTTD you can find some isolated cities at the coast, surrounded by green plains and some farms, and large clusters in top of snowy mountains or in middle of desert. And the growth algorytm can make any of those cities grow very large, while the one at the fertile country stay just like a little town.
So I think this NAI script is better than nothing, replacing the original algorythm, besides the unrealistic map generator...
The neighbours thing in NAI is there for game play reasons. Not for reasons on what is realistic or not.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: [NoGo] Neighbours are important

Post by Zuu »

Mihalich wrote:I have been a fan of your script "Neighbors are important" for a long time.
The algorithm of city growth is more realistic and original in openttd in the meantime, besides, it is more interesting for playing the game. An old friend of mine, Oldbook, told me that it would be great to make city growth dependent on its electricity requirement. Firstly, it would give a playing sense to existence of power station and coal mine in the game. Secondly, it would enrich the game with a transport chain of a new type. To my mind, your script is the most appropriate for it. Of course, additionally, module New GRF would be necessary.
P. S. Also, it would be absolutely great to add a possibility of changing the distance to the neighboring city in configurations.
The script could track delivery of Coal to [power plant] near town and use that along with town rating as a growth rate modifier. It will need to identify what industry type is exactly a power plant by other means than its name. For example it could at first try to get industry types that accept COAL but doesn't produce anything. If this give at least one industry type, use this. If not, then use the industry types that accept COAL independent of if they produce anything. You then have the case of games when there is no COAL cargo type.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Blackworth
Engineer
Engineer
Posts: 2
Joined: 15 May 2014 00:33

Re: [NoGo] Neighbours are important

Post by Blackworth »

I have a Big Problem!

My friends and I were playing a game and now we saved and tried to continue the game. However there was a big issue, the stockpiles did not work any more. The goods and demands worked well, but the stockpiles remained where they were.

I do not know if anyone had the same issue, it is just really annoying. as we can not see anything.

For example the city i have is frozen at 87% passengers. Never moving, EVER!

any help would be nice!
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: [NoGo] Neighbours are important

Post by Zuu »

Please upload trunk compatible save game that reproduce your problem.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Blackworth
Engineer
Engineer
Posts: 2
Joined: 15 May 2014 00:33

Re: [NoGo] Neighbours are important

Post by Blackworth »

I looked it up and it is not exactly my problem, the only thing not working with the neighbours are important thing is the stockpiles after loading. I was just wondering if there is a fix for that as i looked at what you sent me and it seems that it is broken? if you need more details i will give them to you.
User avatar
FLHerne
Tycoon
Tycoon
Posts: 1543
Joined: 12 Jul 2011 12:09
Location: St Ives, Cambs, UK

Re: [NoGo] Neighbours are important

Post by FLHerne »

Zuu wrote:The script could track delivery of Coal to [power plant] near town and use that along with town rating as a growth rate modifier. It will need to identify what industry type is exactly a power plant by other means than its name. For example it could at first try to get industry types that accept COAL but doesn't produce anything. If this give at least one industry type, use this. If not, then use the industry types that accept COAL independent of if they produce anything. You then have the case of games when there is no COAL cargo type.
Why not just use all industries where nothing is produced? FIRS has its Builders' Yards and {Hardware, General} Stores. That seems more plausible than measuring input of a brickworks.
Temporary Permanent signature filling text. Content coming soon delayed indefinitely! Oh, and I have had a screenshot thread.
Linux user (XMonad DWM/KDE, Arch), IRC obsessive and rail enthusiast. No longer building robots; now I ring church bells.
Author of an incredibly boring stickied post about NewGRFs.
Telk
Engineer
Engineer
Posts: 64
Joined: 05 May 2008 14:04
Location: Seoul, South Korea
Contact:

Re: [NoGo] Neighbours are important

Post by Telk »

Hi, could you please add Korean translation of this gamescript?
I already done of korean translation of Neighbours are important (at http://translator.openttdcoop.org)

Thanks for convenient game script :)
Image
- OpenTTD/OpenRCT2/Parkitect Korean Translator
- TELKLAND site manager, the korean website of OpenRCT2/OpenTTD (https://telk.kr)
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: [NoGo] Neighbours are important

Post by Zuu »

Thanks for informing me. I see there have been many translation updates since last release:
http://dev.openttdcoop.org/projects/gs- ... /revisions

So I'll soon make a new version with all those translation updates.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 7 guests