[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

User avatar
Erik1984
Traffic Manager
Traffic Manager
Posts: 151
Joined: 13 Sep 2006 15:54
Location: $HOME

Re: [NoGo] Neighbours are important

Post by Erik1984 »

Thanks for this amazing script, it's like playing a whole new game!

I have a question about this script on tropical maps though: Like mentioned in this thread towns require water to grow but some don't have a water tower and towns in the 'jungle' can't even get a water tower. Would it be possible to combine this gamescript with a patch to allow construction of water towers in non-desert towns?
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 »

I could change the script so that non-desert towns do not need water, but in turn could have higher requirements of some of the other cargoes.

Or you could look for (or try to make) a NewGRF that allows constructing water towers in non-desert areas. A first point to look at would be the OpenGFX+ Industry set.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
Erik1984
Traffic Manager
Traffic Manager
Posts: 151
Joined: 13 Sep 2006 15:54
Location: $HOME

Re: [NoGo] Neighbours are important

Post by Erik1984 »

The 2nd option would be better imo, that would make the tropical maps really challenging in the beginning (because water towers are expensive) but still posisble to make eacht town grow in the end. You have to carefully pick the jungle towns that you give a water tower initially, .

Looked at the 'online content' and I couldn't find a newgrf for building water towers in non-desert areas. Would not mind making it myself but I never made a newgrf, any development tutorials I could look at?
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: [NoGo] Neighbours are important

Post by planetmaker »

Zuu wrote:I could change the script so that non-desert towns do not need water, but in turn could have higher requirements of some of the other cargoes.

Or you could look for (or try to make) a NewGRF that allows constructing water towers in non-desert areas. A first point to look at would be the OpenGFX+ Industry set.
I'd vote for the first option unless you can be sure that the players can construct water towers in jungle towns. IIRC you can't check the presence of NewGRFs, though?
User avatar
Erik1984
Traffic Manager
Traffic Manager
Posts: 151
Joined: 13 Sep 2006 15:54
Location: $HOME

Re: [NoGo] Neighbours are important

Post by Erik1984 »

Another question: Is it possible to apply this script (or any gamescripts) on previously created (and saved) scenarios?
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 »

OpenTTDHooligan wrote:Another question: Is it possible to apply this script (or any gamescripts) on previously created (and saved) scenarios?
No, not currently.

It might be possible to implement a GUI/console command for the scenario editor to add a game script to a scenario that does not previously have one. At the moment I don't see any reason why that would fail. At least as long as the script is allowed to initialize before you save the scenario after having added the script.
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 »

Update - Version 4
  • Feature: Show neighbours in town window
  • Fix: Non-desert towns on tropic maps do not require water to grow. Instead their food requirement grow quicker than desert towns.
  • Add: Changelog
  • Add: Swedish translation

Uses SuperLib for Nogo, version 26
Neighbours-are-important-v4.tar
(50 KiB) Downloaded 143 times
Want to translate this script?
If you want to contribute a translation of this script to your language, download english.txt and translate the strings. For help on the language file format you may want to read this wiki article: http://wiki.openttd.org/FormatOfLangfiles
english.txt
(1.48 KiB) Downloaded 191 times
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
ziond
Engineer
Engineer
Posts: 50
Joined: 04 Mar 2009 10:55
Location: Moscow, Russia

Re: [NoGo] Neighbours are important

Post by ziond »

Script crashes all the time when I start to play in subtropical climate :(
1.png
1.png (63.23 KiB) Viewed 5529 times
Would it be nice for different localizations to also put script options strings into lang file if possible?
Attachments
russian.txt
russian localization
(1.92 KiB) Downloaded 134 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 »

ziond wrote:Script crashes all the time when I start to play in subtropical climate :(
Note to self: Testing tropic features on tropic may be a good idea ;-)

ziond wrote:Would it be nice for different localizations to also put script options strings into lang file if possible?
Sure, I've added it to the new version:


Update - Version 5
- Fixed tropic bug as reported above
- Added Russian translation

Available via bananas.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
ziond
Engineer
Engineer
Posts: 50
Joined: 04 Mar 2009 10:55
Location: Moscow, Russia

Re: [NoGo] Neighbours are important

Post by ziond »

Zuu wrote:
ziond wrote:Would it be nice for different localizations to also put script options strings into lang file if possible?
Sure, I've added it to the new version:
Sorry if it was my bad english :oops: but i meant adding of that strings into english.txt
1.png
1.png (18.38 KiB) Viewed 5493 times
PS. Thanks for awesome work on this gamescript :))
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: [NoGo] Neighbours are important

Post by Yexo »

OpenTTD doesn't support that currently, but it's a good suggestion.
Guvnor
Engineer
Engineer
Posts: 10
Joined: 01 Nov 2012 01:03

Re: [NoGo] Neighbours are important

Post by Guvnor »

Zuu,

Thanks for making this awesome script! I think I may have found a bug?... I have two towns, one sized 1950, the other 1387. Each requires goods to expand but there's just one problem; the towns will not accept goods. I've moused over every tile searching for "accepts goods" and alas, they simply will not take them. It seems these two towns are permanently stuck? Unless the "slow growth" algorithm eventually rescues them.

Thanks for your help,

Guvnor

EDIT: Figured out that it was because I was using "Japanese Building Set v2.0." Some towns simply did not accept goods at all. Removing that GRF and making a new map solved the issue.
User avatar
Sylf
President
President
Posts: 957
Joined: 23 Nov 2010 21:25
Location: ::1

Re: [NoGo] Neighbours are important

Post by Sylf »

Guvnor wrote:EDIT: Figured out that it was because I was using "Japanese Building Set v2.0." Some towns simply did not accept goods at all. Removing that GRF and making a new map solved the issue.
Japanese buildings has higher population density per square. The town needs to be bigger than "normal" before it starts spawning buildings that accepts goods.
You can accomodate it by adjusting the game script's parameters and lower the cargo requirement difficulty. And/or you can adjust Japanese building set's parameters (docs here).
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 »

I have considered to make the script check the acceptance of cargoes before adding a requirement for it. However, my feeling was that it could possible introduce more problems than it solves unless a lot of time is put in to calibrate the area of which it checks coverage. All at the cost of making the script react slower especially on 1024x1024+ with normal or high amount of towns.

If you figure out good settings to use with the japan set and post them back here, I could include them in the readme (which is available in-game using the readme-button). Or possible an on/off switch in the settings window that reduce only the goods cargo, but let passengers/mail/food/water/etc. remain at the usual level.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
supermop
Tycoon
Tycoon
Posts: 1104
Joined: 21 Feb 2010 00:15
Location: Fitzroy North - 96

Re: [NoGo] Neighbours are important

Post by supermop »

I didn't catch if there was explicitly an answer to this question, but it seems even on a temperate map towns can easily get stuck. I am playing on a map where some towns were generated with only 1-3 houses at map creation. These all have a goal of only one passenger a month, however, they do not have enough houses to generate an acceptance of passengers regardless of station placement. Will these towns ever grow on their own?

Best,


Edit: In the meantime I am trying to break these towns out by 'touring' my headquarters to them, giving them passenger acceptance for just long enough to build a few more houses. Unfortunatley, most of the towns are so tiny because they are in mountainous terrain without the clear space for the HQ to be placed.
ziond
Engineer
Engineer
Posts: 50
Joined: 04 Mar 2009 10:55
Location: Moscow, Russia

Re: [NoGo] Neighbours are important

Post by ziond »

It seems that in tropic climate still present some bugs. Town in desert that even have water tower still do not require water to grow. Screenshot in russian but requirement translates as passangers, mail and food.

Also there is no translation when GS downloaded from bananas. But it works when I untar file and copy contens into game dir (Seems it is OpenTTD bug :roll: )
Без имени, 14-е янв 1950 г..png
Без имени, 14-е янв 1950 г..png (142.06 KiB) Viewed 5273 times
Zuu wrote:I have considered to make the script check the acceptance of cargoes before adding a requirement for it. However, my feeling was that it could possible introduce more problems than it solves unless a lot of time is put in to calibrate the area of which it checks coverage. All at the cost of making the script react slower especially on 1024x1024+ with normal or high amount of towns.

If you figure out good settings to use with the japan set and post them back here, I could include them in the readme (which is available in-game using the readme-button). Or possible an on/off switch in the settings window that reduce only the goods cargo, but let passengers/mail/food/water/etc. remain at the usual level.
I do not think that is necessary because even in original game you have to provide water tower in town to grow. By the way may it be possible to introduce separate switches in options for each cargo (pax/mail/food/goods/water)? Because in my games I do not like to care about mail. :rolleyes:
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 »

ziond wrote:It seems that in tropic climate still present some bugs. Town in desert that even have water tower still do not require water to grow. Screenshot in russian but requirement translates as passangers, mail and food.
Some investigation have shown that GSTile.IsDesertTile(GSTown.GetLocation(town_id)) returns false for all towns on a random test game. Both those clearly in dessert and those clearly in non-dessert areas. When using the query tool, I see that it will show "Desert" on empty tiles but not on town road tiles. A look into the OpenTTD code is however required to see if it is just an oversight in the API or if there is a limitation in OpenTTD why IsDesertTile doesn't return true for the town center tile. Maybe a GSTown.IsDesertTown(town_id) in that case is needed.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: [NoGo] Neighbours are important

Post by Yexo »

GSTile.IsDesertTile checks if the tile is empty and desert. This is most likely an oversight.
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 988
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: [NoGo] Neighbours are important

Post by frosch »

IsSnowTile also checks for empty tile. Looks like these are plain translations of the "clear" tile type.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
Guvnor
Engineer
Engineer
Posts: 10
Joined: 01 Nov 2012 01:03

Re: [NoGo] Neighbours are important

Post by Guvnor »

Sylf wrote:
Guvnor wrote:EDIT: Figured out that it was because I was using "Japanese Building Set v2.0." Some towns simply did not accept goods at all. Removing that GRF and making a new map solved the issue.
Japanese buildings has higher population density per square. The town needs to be bigger than "normal" before it starts spawning buildings that accepts goods.
You can accomodate it by adjusting the game script's parameters and lower the cargo requirement difficulty. And/or you can adjust Japanese building set's parameters (docs here).
Sylf,

Thanks for the reply. From what I see, NAI's parameters will not allow what you suggest. The only relevant setting is difficulty, whose lowest allowed setting is '1', which would still require goods. And if it could be set to zero it would effectively render the script inactive. As for the Japanese GRF's parameters, the lowest setting (aside from zero) is 'new buildings appear at pop 1500.' The problem exists well before that and the towns cannot grow to 1500.

I still believe the best course of action at this point is to simply not play with the Japanese set.

Guvnor
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 33 guests