[NoGo] Neighbours are important
Moderator: OpenTTD Developers
[NoGo] Neighbours are important
As there were no scripts uploaded yet that set town goals, I came up with the idea of uploading a variant of of the script that TrueBrain wrote for NoGo and was used on the #openttdcoop test server.
The basis is that towns has a requirement of passengers, mail, goods, food etc. When the town size grows, the requirement grows. Thus you have to deliver more and more in order to keep growing the town.
What this variant also adds is a neighbour factor. If a town is smaller than its closest neighbours, it will have a neighbour factor < 1. If the town on the other hand is larger than its neighbours the factor will be > 1. Thus, to grow a large town to become even larger, you might want to consider growing its neighbours too, especially if they are small.
Since the script has to find out the neighbours of all towns, it takes quite some opcodes to initialize. Thankfully OpenTTD gives GameScripts 2500 ticks in the map generation process which is enough for most maps. But if you play 1024x1024 or larger with high town density, you might need to run the game in fast forward before the goals are set up.
Download
Via online content or through the bananas website
Currently no libraries are required.
The basis is that towns has a requirement of passengers, mail, goods, food etc. When the town size grows, the requirement grows. Thus you have to deliver more and more in order to keep growing the town.
What this variant also adds is a neighbour factor. If a town is smaller than its closest neighbours, it will have a neighbour factor < 1. If the town on the other hand is larger than its neighbours the factor will be > 1. Thus, to grow a large town to become even larger, you might want to consider growing its neighbours too, especially if they are small.
Since the script has to find out the neighbours of all towns, it takes quite some opcodes to initialize. Thankfully OpenTTD gives GameScripts 2500 ticks in the map generation process which is enough for most maps. But if you play 1024x1024 or larger with high town density, you might need to run the game in fast forward before the goals are set up.
Download
Via online content or through the bananas website
Currently no libraries are required.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: [NoGo] Neighbours are important
This script is a lot of fun to play with! Though I was wondering, is it possible to make the supply requirements lower, or set some sort of difficulty parameter? I'd like to be able to have my cities grow a little bit faster!
Re: [NoGo] Neighbours are important
Sure, I was also thinking about adding a parameter to disable the neighbours parameter, which will make it easier and allow playing that style too.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: [NoGo] Neighbours are important
How many ticks do you need in the generation to find out the neighbour graph? (the current value is set as a: this-should-never-be-reached-but-I-have-to-input-some-value)
The only thing necessary for the triumph of evil is for good men to do nothing.
Re: [NoGo] Neighbours are important
With a 2048x2048 map that have high density the setup took 29510 ticks. On a different map of the size 2048x1024 it took 11079 ticks.
These measures were made with about the same amount of setup as in version 1. In version 2 there will be a new feature that will eat a few more ticks but it doesn't have any expansive neighbour lookup but a tile scanner so it is not completely free.
With the new features for version 2 enabled, the setup for a 2048x2048 map took 38863 ticks.
On IRC Eddi mentioned that the amount of towns possible is limited by the town generator. So for the record, I've used the Swedish town names that are included in OpenTTD.
Edit: And for comparison, a 512x512 with the version 2 features enabled took 156 ticks.
These measures were made with about the same amount of setup as in version 1. In version 2 there will be a new feature that will eat a few more ticks but it doesn't have any expansive neighbour lookup but a tile scanner so it is not completely free.
With the new features for version 2 enabled, the setup for a 2048x2048 map took 38863 ticks.
On IRC Eddi mentioned that the amount of towns possible is limited by the town generator. So for the record, I've used the Swedish town names that are included in OpenTTD.
Edit: And for comparison, a 512x512 with the version 2 features enabled took 156 ticks.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: [NoGo] Neighbours are important
Update - Version 2
Changes:
I've not actually playtested the congestion feature, only by ether manually jamming towns with buses or using the TownCars AI.
The idea is that when you play against the cargo goals it can give some extra challenge on how you distribute your cargo from feeder stations to the towns. Currently it only consider road vehicles so I guess it could make for some interesting decisions if rail, ships and air is a bit expansive compared to road vehicles.
Changes:
- Towns growth can get reduced/stopped when they get congested
- When a town gets congested, a news message is sent to all companies with road vehicles in the town area that is tested for congestion. A sign is also placed on the town tile to note that the town is congested.
- Global goals are created for each congested town to reduce the congestion there. At the moment there is no award, not even a news message for accomplished goals. Only way to tell is that the congestion sign in the town centre is removed.
- Settings:
- You can now disable that neighbours town sizes affect growth goals
- The cargo delivery goals can now be scaled by a factor.
- What happens with congested towns: [no effect, towns grow slower, towns stop grow]
- A scale factor to scale the limit of number of vehicles in the town centre at which point the town is considered to be congested. The actual limit depends also on the town population.
I've not actually playtested the congestion feature, only by ether manually jamming towns with buses or using the TownCars AI.
The idea is that when you play against the cargo goals it can give some extra challenge on how you distribute your cargo from feeder stations to the towns. Currently it only consider road vehicles so I guess it could make for some interesting decisions if rail, ships and air is a bit expansive compared to road vehicles.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: [NoGo] Neighbours are important
I am now playing this but after a while my town asks for water. The only problem is that the town has not build a watertower. and i can't fund one myself because when i try it says "can't construct this industry type here... ...can only be built in towns."
My parameters are set as followed:
Cargo req. depends on : Size of current town size
Cargo goal factor (in%): 150
Congested towns: disabled
2nd thing: Cargo goal is @ hard however my town has now a population of 3.626 Goal for cargo = 5 passengers, 1.000 liters of water and 2 tonnes of food i think those values are a bit low for the size of the town.
Edit 1: Now started at a town close to it that already had a watertower.
My parameters are set as followed:
Cargo req. depends on : Size of current town size
Cargo goal factor (in%): 150
Congested towns: disabled
2nd thing: Cargo goal is @ hard however my town has now a population of 3.626 Goal for cargo = 5 passengers, 1.000 liters of water and 2 tonnes of food i think those values are a bit low for the size of the town.
Edit 1: Now started at a town close to it that already had a watertower.
Re: [NoGo] Neighbours are important
I believe the water towers must be built on top of a town house. Did you try that?nalyu wrote:I am now playing this but after a while my town asks for water. The only problem is that the town has not build a watertower. and i can't fund one myself because when i try it says "can't construct this industry type here... ...can only be built in towns."
Re: [NoGo] Neighbours are important
That worked but it was not needed because started with a town close to it that had a watertower and that one is now much bigger.AndersI wrote:I believe the water towers must be built on top of a town house. Did you try that?nalyu wrote:I am now playing this but after a while my town asks for water. The only problem is that the town has not build a watertower. and i can't fund one myself because when i try it says "can't construct this industry type here... ...can only be built in towns."
Thanks anyway.
Re: [NoGo] Neighbours are important
Those low numbers are clearly a bug. I've confirmed that when you set cargo requirement to depend only on town size, you get the goals 1/100 compared to what they should be. Soon there will be a new version that fixes this issue.nalyu wrote:My parameters are set as followed:
Cargo req. depends on : Size of current town size
Cargo goal factor (in%): 150
Congested towns: disabled
2nd thing: Cargo goal is @ hard however my town has now a population of 3.626 Goal for cargo = 5 passengers, 1.000 liters of water and 2 tonnes of food i think those values are a bit low for the size of the town.
Unfortunately the only way to fix your current game is to hack your version 2 of this game script so that it contains the fix that will be in version 3. For that purpose I've attached both a patch that can be applied to town.nut and a new town.nut that you can replace the old one with. To do so, find the tar file with this GameScript. Probably located in OpenTTD/content_download/game. Move that one up to OpenTTD/game. untar and preferable remove the tar file to not have two different version 2 in the search path. Then either replace town.nut or apply the attached patch.
- Attachments
-
- town.nut
- Replacement town.nut for version 2. Only required if you need to apply the fix in a running game with version 2 of Neighbours are important. For all others, there will shortly be a version 3 that contains this fix.
- (8.94 KiB) Downloaded 923 times
-
- factor-fix.patch
- Patch to fix bug in town.nut for version 2. Only required if you need to apply the fix in a running game with version 2 of Neighbours are important. For all others, there will shortly be a version 3 that contains this fix.
- (3.58 KiB) Downloaded 906 times
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: [NoGo] Neighbours are important
Update - Version 3
Changes:
Changes:
- Fixed bug that caused the goals to be 1/100 of the intended values when the neighbours factor was turned off.
- Reduced the maximum neighbour factor from 800% to 500%. That is large towns with small neighbours can now at maximum get their goals raised by 500% compared to 800% before. Perhaps this will still give a high penalty if you don't also grow the neighbours, but not as extremely high
- Added a readme.txt
- Attachments
-
- goal - neighbors-v3.tar
- (22 KiB) Downloaded 991 times
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: [NoGo] Neighbours are important
As that town had only a population of about 4k it was easier for me to start over but thanks anyway.Zuu wrote:Those low numbers are clearly a bug. I've confirmed that when you set cargo requirement to depend only on town size, you get the goals 1/100 compared to what they should be. Soon there will be a new version that fixes this issue.nalyu wrote:My parameters are set as followed:
Cargo req. depends on : Size of current town size
Cargo goal factor (in%): 150
Congested towns: disabled
2nd thing: Cargo goal is @ hard however my town has now a population of 3.626 Goal for cargo = 5 passengers, 1.000 liters of water and 2 tonnes of food i think those values are a bit low for the size of the town.
Unfortunately the only way to fix your current game is to hack your version 2 of this game script so that it contains the fix that will be in version 3. For that purpose I've attached both a patch that can be applied to town.nut and a new town.nut that you can replace the old one with. To do so, find the tar file with this GameScript. Probably located in OpenTTD/content_download/game. Move that one up to OpenTTD/game. untar and preferable remove the tar file to not have two different version 2 in the search path. Then either replace town.nut or apply the attached patch.
Re: [NoGo] Neighbours are important
Hello,
I am trying to run this script on a dedicated linux server with a certain scenario but i am having problems figuring out how to start.
My config has
I see it is running on my local windows machine when i generate a game but script is not running when i am loading this scenario.
Is there a trick for running the script with scenarios?
Thanks
Mihai
I am trying to run this script on a dedicated linux server with a certain scenario but i am having problems figuring out how to start.
My config has
Code: Select all
[game_scripts]
"Neighbours are important" = enable_neighbours=0
Is there a trick for running the script with scenarios?
Thanks
Mihai
Re: [NoGo] Neighbours are important
You will have the same problem trying to bind a save game to a Game Script after the game has been created. A scenario is basically a savegame with a different extension. To solve your problem without modifications to OpenTTD, you need create a new scenario where you set in your main menu to use this Game Script before clicking on the scenario editor button to create a new scenario.
If you find this too constraining, then that is a feature request for the NoGo framework and OpenTTD itself. For the development of the Tutorial I hope there will be a solution to be able to bind a scenario to a Game Script after the scenario has been created. But that is unfortunately not the case at the moment.
If you find this too constraining, then that is a feature request for the NoGo framework and OpenTTD itself. For the development of the Tutorial I hope there will be a solution to be able to bind a scenario to a Game Script after the scenario has been created. But that is unfortunately not the case at the moment.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: [NoGo] Neighbours are important
Aloha Zuu 
As proclaimed in http://www.tt-forums.net/viewtopic.php?f=33&t=57431 i've extended your script a little bit and wanted to ask you if your interested in the changes. Some of your code still remains within so ofc i won't release it to the public without your review and permission. Anyway these are the changes i've implemented so far...
List o' changes
- Cities now show who their neighbouring cities are within the town GUI.
- Congestion now actually happens (rebalanced values to the point where "Hard" means hard and Easy means easy)
- Added lots of new Settings (and updated others with appropriate descriptions)
- Lots of Balancing for CargoGoals
- Implementing a CacheClass (Tables are great!) for reoccuring calculations all over the place
- Added Periodic Expansion of Cities even while their CargoGoals are not reached (very slow growth, but still ;P)
- Added Option to adjust the TimeSpan between each Periodic Expansion
- Added Option to have Cities benefit from Periodic Expansion more then Towns.
- Replaced integer (percentage) values for difficulties with named Settings. There are always quite a lot, but people wont tell the difference between 50 and 52 ingame anyway, so i think this is more intuitive.
- Added Option to switch between simple (Passengers/Mail) and complex cargoGoals.
- CargoGoals (except for Passengers) now have an offset within their calculation so they form a nice curve instead of a line ;P
- Added a small CargoGoal handicap for Cities without a neighbour if neighbours are enabled.
- Added a Compatiblity Mode for FIRS newGRF (as i love it!). Up to 5 different Goals in the normal Landscape (Passengers->Mail->CratesOfWarez->Food->Fuel)
- Added Translation for German
- Added an Option for changing the maximum amount of neighbours a town may have
- In lack of a better alternative introduced an ugly and primitive way to sort GSSettings into Categories
NextUp:
- Quality of Service: Have a town get a Expand()-boost if the Towns PercentageTransported Values stay above a certain value for at least X months.... for the perfectionist
- Properly Save important values when the Game issues a save.
- Evolving Neighbourhood: Towns pick new neighbours as they grow in size.

As proclaimed in http://www.tt-forums.net/viewtopic.php?f=33&t=57431 i've extended your script a little bit and wanted to ask you if your interested in the changes. Some of your code still remains within so ofc i won't release it to the public without your review and permission. Anyway these are the changes i've implemented so far...
List o' changes
- Cities now show who their neighbouring cities are within the town GUI.
- Congestion now actually happens (rebalanced values to the point where "Hard" means hard and Easy means easy)
- Added lots of new Settings (and updated others with appropriate descriptions)
- Lots of Balancing for CargoGoals
- Implementing a CacheClass (Tables are great!) for reoccuring calculations all over the place
- Added Periodic Expansion of Cities even while their CargoGoals are not reached (very slow growth, but still ;P)
- Added Option to adjust the TimeSpan between each Periodic Expansion
- Added Option to have Cities benefit from Periodic Expansion more then Towns.
- Replaced integer (percentage) values for difficulties with named Settings. There are always quite a lot, but people wont tell the difference between 50 and 52 ingame anyway, so i think this is more intuitive.
- Added Option to switch between simple (Passengers/Mail) and complex cargoGoals.
- CargoGoals (except for Passengers) now have an offset within their calculation so they form a nice curve instead of a line ;P
- Added a small CargoGoal handicap for Cities without a neighbour if neighbours are enabled.
- Added a Compatiblity Mode for FIRS newGRF (as i love it!). Up to 5 different Goals in the normal Landscape (Passengers->Mail->CratesOfWarez->Food->Fuel)
- Added Translation for German
- Added an Option for changing the maximum amount of neighbours a town may have
- In lack of a better alternative introduced an ugly and primitive way to sort GSSettings into Categories
NextUp:
- Quality of Service: Have a town get a Expand()-boost if the Towns PercentageTransported Values stay above a certain value for at least X months.... for the perfectionist

- Properly Save important values when the Game issues a save.
- Evolving Neighbourhood: Towns pick new neighbours as they grow in size.
Re: [NoGo] Neighbours are important
Looks good to me. I haven't been playing with the game script much since I created it. The reason why I had percetange settings and not a few labled values was that I didn't want to spend my time playing it through several times to figure out what settings to pick. Instead I opened it up for players to test and hopefully report back what they found as good settings.
So, I very much welcome that you have taken your time and refine the script based on your experience with it. If you look around, you'll see that I've created more AI/GS projects than that I can possible improve all of them to higher standard very quickly.Zuu wrote:I would be happy if those of you who play with this GameScript reports back what kind of values on the two scale factors that you find good. That way I can see if I need to adjust the baseline or the recommended easy/medium/hard values.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: [NoGo] Neighbours are important
Very fun script, it certainly adds a certain sense of realism and challenge to the game.
Growing a town starts to become a challenge once it reaches a certain size. In my current game I have practically every large city on the map "feeding" my target city (it started as a size 75 and has grown into a size 10000+). The problem I have now is that I can't send anymore passengers and goods to my target city because the feeder cities are already at maximum production, thus the target city has stopped growing. And even if I managed to grow these feeder cities, I am already producing the maximum amount of goods possible on the map, so I have no extra goods to spare to send to extra cities.
Have I reached the "end game"?
Growing a town starts to become a challenge once it reaches a certain size. In my current game I have practically every large city on the map "feeding" my target city (it started as a size 75 and has grown into a size 10000+). The problem I have now is that I can't send anymore passengers and goods to my target city because the feeder cities are already at maximum production, thus the target city has stopped growing. And even if I managed to grow these feeder cities, I am already producing the maximum amount of goods possible on the map, so I have no extra goods to spare to send to extra cities.
Have I reached the "end game"?
Re: [NoGo] Neighbours are important
If your advanced setting allows, you can fund new industries and also fund new towns.
You could possible also re-direct your passengers and cargo to another town B to grow that. Then when town B has grown you can go back to growing your original town and now have more passengers and mail from B to send.
Also, unless you have disabled the neighbours part of "neighbours are important", then it is beneficial to grow the 5 or so closest towns in relation to the town you try to grow. That will reduce the cargo requirements of your town.
You could possible also re-direct your passengers and cargo to another town B to grow that. Then when town B has grown you can go back to growing your original town and now have more passengers and mail from B to send.
Also, unless you have disabled the neighbours part of "neighbours are important", then it is beneficial to grow the 5 or so closest towns in relation to the town you try to grow. That will reduce the cargo requirements of your town.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: [NoGo] Neighbours are important
Fanatik wrote:Aloha Zuu
As proclaimed in http://www.tt-forums.net/viewtopic.php?f=33&t=57431 i've extended your script a little bit and wanted to ask you if your interested in the changes. Some of your code still remains within so ofc i won't release it to the public without your review and permission. Anyway these are the changes i've implemented so far...
List o' changes
- Cities now show who their neighbouring cities are within the town GUI.
- Congestion now actually happens (rebalanced values to the point where "Hard" means hard and Easy means easy)
- Added lots of new Settings (and updated others with appropriate descriptions)
- Lots of Balancing for CargoGoals
- Implementing a CacheClass (Tables are great!) for reoccuring calculations all over the place
- Added Periodic Expansion of Cities even while their CargoGoals are not reached (very slow growth, but still ;P)
- Added Option to adjust the TimeSpan between each Periodic Expansion
- Added Option to have Cities benefit from Periodic Expansion more then Towns.
- Replaced integer (percentage) values for difficulties with named Settings. There are always quite a lot, but people wont tell the difference between 50 and 52 ingame anyway, so i think this is more intuitive.
- Added Option to switch between simple (Passengers/Mail) and complex cargoGoals.
- CargoGoals (except for Passengers) now have an offset within their calculation so they form a nice curve instead of a line ;P
- Added a small CargoGoal handicap for Cities without a neighbour if neighbours are enabled.
- Added a Compatiblity Mode for FIRS newGRF (as i love it!). Up to 5 different Goals in the normal Landscape (Passengers->Mail->CratesOfWarez->Food->Fuel)
- Added Translation for German
- Added an Option for changing the maximum amount of neighbours a town may have
- In lack of a better alternative introduced an ugly and primitive way to sort GSSettings into Categories
NextUp:
- Quality of Service: Have a town get a Expand()-boost if the Towns PercentageTransported Values stay above a certain value for at least X months.... for the perfectionist
- Properly Save important values when the Game issues a save.
- Evolving Neighbourhood: Towns pick new neighbours as they grow in size.Zuu wrote:Looks good to me. I haven't been playing with the game script much since I created it. The reason why I had percetange settings and not a few labled values was that I didn't want to spend my time playing it through several times to figure out what settings to pick. Instead I opened it up for players to test and hopefully report back what they found as good settings.
So, I very much welcome that you have taken your time and refine the script based on your experience with it. If you look around, you'll see that I've created more AI/GS projects than that I can possible improve all of them to higher standard very quickly.Zuu wrote:I would be happy if those of you who play with this GameScript reports back what kind of values on the two scale factors that you find good. That way I can see if I need to adjust the baseline or the recommended easy/medium/hard values.
Did you ever share this?

- V453000 :)
- President
- Posts: 946
- Joined: 01 Feb 2011 11:22
- Location: Beer
Re: [NoGo] Neighbours are important
The towns funded in game seem not influenced by this script. 
[15:30] <Zuu_> V453000, IIRC it should handle that event but it might not be working. You could try to save + load. Also report it in the thread and I'll tke a look at he code when possible (at a train at the moment)
Here you go.

[15:30] <Zuu_> V453000, IIRC it should handle that event but it might not be working. You could try to save + load. Also report it in the thread and I'll tke a look at he code when possible (at a train at the moment)
Here you go.
Who is online
Users browsing this forum: No registered users and 7 guests