[GS] RCG - A city growth GameScript for OTTD

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

borninussr
Engineer
Engineer
Posts: 6
Joined: 13 Dec 2017 05:48

Re: [GS] RCG - A city growth GameScript for OTTD

Post by borninussr »

Does it work with ECS? and I'm not understand how to set up it, can I download it NewGRF Settings?
User avatar
piratescooby
Route Supervisor
Route Supervisor
Posts: 449
Joined: 21 Nov 2014 12:39
Location: The Granite City.

Re: [GS] RCG - A city growth GameScript for OTTD

Post by piratescooby »

borninussr wrote:Does it work with ECS? and I'm not understand how to set up it, can I download it NewGRF Settings?
viewtopic.php?t=69827 , works well with ECS .Set up and useage well explained in the first part of topic .Agreat script have fun and enjoy .
German_RLI
Engineer
Engineer
Posts: 8
Joined: 07 Apr 2013 16:01

Re: [GS] RCG - A city growth GameScript for OTTD

Post by German_RLI »

Hi all!
I have updated the RCG-6 by Monty_Montana to work with FIRS3 economies (this option will probably work for earlier FIRS versions but I didn't test that).
But I get some strange messages in debug.
[+] Spoiler

Code: Select all

dbg: [script] spanish:1: warning: STR_TOWNBOX_0: Param idx #0 'STRING' doesn't match with template command 'STRING3'
dbg: [script] spanish:2: warning: STR_TOWNBOX_1: Param idx #0 'STRING' doesn't match with template command 'STRING3'
dbg: [script] spanish:2: warning: STR_TOWNBOX_1: Param idx #1 'STRING' doesn't match with template command 'STRING3'
dbg: [script] spanish:3: warning: STR_TOWNBOX_2: Param idx #0 'STRING' doesn't match with template command 'STRING3'
dbg: [script] spanish:3: warning: STR_TOWNBOX_2: Param idx #1 'STRING' doesn't match with template command 'STRING3'
dbg: [script] spanish:3: warning: STR_TOWNBOX_2: Param idx #2 'STRING' doesn't match with template command 'STRING3'
dbg: [script] spanish:4: warning: STR_TOWNBOX_3: Param idx #0 'STRING' doesn't match with template command 'STRING3'
dbg: [script] spanish:4: warning: STR_TOWNBOX_3: Param idx #1 'STRING' doesn't match with template command 'STRING3'
dbg: [script] spanish:4: warning: STR_TOWNBOX_3: Param idx #2 'STRING' doesn't match with template command 'STRING3'
dbg: [script] spanish:4: warning: STR_TOWNBOX_3: Param idx #3 'STRING' doesn't match with template command 'STRING3'
dbg: [script] spanish:5: warning: STR_TOWNBOX_4: Param idx #0 'STRING' doesn't match with template command 'STRING3'
dbg: [script] spanish:5: warning: STR_TOWNBOX_4: Param idx #1 'STRING' doesn't match with template command 'STRING3'
dbg: [script] spanish:5: warning: STR_TOWNBOX_4: Param idx #2 'STRING' doesn't match with template command 'STRING3'
dbg: [script] spanish:5: warning: STR_TOWNBOX_4: Param idx #3 'STRING' doesn't match with template command 'STRING3'
dbg: [script] spanish:5: warning: STR_TOWNBOX_4: Param idx #4 'STRING' doesn't match with template command 'STRING3'
And my tar isn't recognized as tar :(
[+] Spoiler

Code: Select all

dbg: [misc] The file '/home/german/.openttd/content_download/game/Renewed_City_Growth-7.tar' isn't a valid tar-file
Attachments
Renewed_City_Growth-7.tar
Renewed City Growth for FIRS3
(93 KiB) Downloaded 285 times
tttron
Engineer
Engineer
Posts: 4
Joined: 19 Jun 2005 15:56
Location: Germany

Re: [GS] RCG - A city growth GameScript for OTTD

Post by tttron »

Hi German_RLI,

I think I managed to fix your file. In info.nut, line 46 reads:

Code: Select all

_12 = "FIRS3: All economies", });
But as there are no more entries after this last one, this should read:

Code: Select all

_12 = "FIRS3: All economies"});
After packing all files up into a .tar again with 7-zip, the script seemingly works, i.e. it can be selected in the AI/Game Script Configuration and I can also select "FIRS3: All economies" in the script configuration.

I'm a complete noob with OpenTTD customization, hopefully I did this right. :mrgreen: I attached my fixed version of your archive.
Attachments
Renewed_City_Growth-7.tar
(93 KiB) Downloaded 549 times
lucj@n
Engineer
Engineer
Posts: 10
Joined: 21 Jul 2008 16:11
Location: Polska/Poland

Re: [GS] RCG - A city growth GameScript for OTTD

Post by lucj@n »

I can't get it work with FIRS 3.0.10. I tried the above and still I got a warning that industrial set from GS doesn't match the initial cargo list from the game. The same happened when I tried to do it manually as indicated here.
Does it work for you? Do you guys have any ideas what can I do to make this script work well with the newest FIRS3?
srschacher
Engineer
Engineer
Posts: 41
Joined: 15 May 2017 12:48

Re: [GS] RCG - A city growth GameScript for OTTD

Post by srschacher »

If you start the script with debug turned on, then look at the debug log and you will see the order that the commodities were loaded into the array. Make sure the order in your list in the script matches this order in the log.

If you need to change the order, be sure to change the relative position numbers in the lower part of the script that matches the commodities to the groupings.

Steve
User avatar
PET
Engineer
Engineer
Posts: 17
Joined: 12 Jul 2004 19:10
Location: Timisoara/Romania
Contact:

Re: [GS] RCG - A city growth GameScript for OTTD

Post by PET »

I have a stupid question. How do I enable this?

I downloaded the script & the dependency ... yet I don't see any target / goals for a city.

Image

EDIT: I'm trying this with no other NewGRF activated.
User avatar
piratescooby
Route Supervisor
Route Supervisor
Posts: 449
Joined: 21 Nov 2014 12:39
Location: The Granite City.

Re: [GS] RCG - A city growth GameScript for OTTD

Post by piratescooby »

Activating Gamescripts
1. In the main menu, click "AI/Gamescript Settings".

2. Select the text in the box under "Gamescript"

3. Click the top-left-most button in the bottom menu labeled "Select Gamescript"

4. Pick a gamescript of your choice from the pop-up menu.

Setting Gamescript parameters
1. In the main menu, click "AI/Gamescript Settings".

2. Select the text in the box under "Gamescript"

3. Click the 'Configure' button.

4. A row of parameters defined by the gamescript will show up. Change the desired parameters and click the 'Close' button to implement the changes. Use the 'Reset' button to set all parameters back to default values.

I hope this will help you .
User avatar
PET
Engineer
Engineer
Posts: 17
Joined: 12 Jul 2004 19:10
Location: Timisoara/Romania
Contact:

Re: [GS] RCG - A city growth GameScript for OTTD

Post by PET »

Ah thanks. So that's how you do it :)

Someone should write that in the readme.txt.


EDIT:

Image

Is this behavior normal? I'm bringing in both Goods & Passengers/Mail.
German_RLI
Engineer
Engineer
Posts: 8
Joined: 07 Apr 2013 16:01

Re: [GS] RCG - A city growth GameScript for OTTD

Post by German_RLI »

tttron wrote:Hi German_RLI,

I think I managed to fix your file. In info.nut, line 46 reads:

Code: Select all

_12 = "FIRS3: All economies", });
But as there are no more entries after this last one, this should read:

Code: Select all

_12 = "FIRS3: All economies"});
After packing all files up into a .tar again with 7-zip, the script seemingly works, i.e. it can be selected in the AI/Game Script Configuration and I can also select "FIRS3: All economies" in the script configuration.

I'm a complete noob with OpenTTD customization, hopefully I did this right. :mrgreen: I attached my fixed version of your archive.
Thanks a lot it really works!
Also complete noob for that, and cannot figure why tar generates errors while uncompressed dcript doesn't.
WalenTheBlue
Engineer
Engineer
Posts: 4
Joined: 06 Apr 2017 19:48

Re: [GS] RCG - A city growth GameScript for OTTD

Post by WalenTheBlue »

Is there any particular reason the script does not work under 1.9.0/1.9.1 version? It works just fine under 1.8 line.

Running RCGv5 from online content on win32 zip install.
Brumi
President
President
Posts: 920
Joined: 18 Jul 2009 17:54

Re: [GS] RCG - A city growth GameScript for OTTD

Post by Brumi »

What do you mean by the script not working? Are you getting an error message?
WalenTheBlue
Engineer
Engineer
Posts: 4
Joined: 06 Apr 2017 19:48

Re: [GS] RCG - A city growth GameScript for OTTD

Post by WalenTheBlue »

Brumi wrote:What do you mean by the script not working? Are you getting an error message?
Well, I kept the game running for an extra year and the growth appears to kick in at last. Its just that there is something fishy with the growth parameters. Minimum TGR of 10000 is ignored and 65535 days is displayed instead on the label under city name. Minimum supply for TGR growth of 50% does not work as expected either (or at least how I am used to it working in previous releases). Now the growth starts way after the destination is overflowed with passengers.

May it be only an information display/communication issue, with all the relevant mechanics under the hood working like they always did? I am running OTTD on what is basicly a toaster.
randomallfront
Engineer
Engineer
Posts: 5
Joined: 29 Jul 2018 17:39

Re: [GS] RCG - A city growth GameScript for OTTD

Post by randomallfront »

Walen, have a look here: viewtopic.php?f=33&t=73469&start=1520#p1210358

I raised this question with JGR who pointed to the change made to set_town_growth. Basically, any growth rates slower than 880 days will result in an integer overflow (65535).
Hanselmault
Engineer
Engineer
Posts: 2
Joined: 30 Nov 2014 14:00

Re: [GS] RCG - A city growth GameScript for OTTD

Post by Hanselmault »

I try this script with base industry => no problem it works and it's fine.
It try it with Yeti units, and city growth not work: it ask to transport Yeti Workmens. Ok, i found a map with industry and yeti worker in the same city. city growth never find movements. With worker from other city same problem. I miss something? it bug? i try 3 different map, and my cities never growth :(
help please
Diesel Power
Traffic Manager
Traffic Manager
Posts: 222
Joined: 18 Jun 2016 19:05

Re: [GS] RCG - A city growth GameScript for OTTD

Post by Diesel Power »

I'm playing on a large desert map and none of my towns a growing. I've been using this GS for ages on smaller maps with no issue. The trains are covering a long distance so there is a long gap between pick ups but I'm using the day length patch in JGRs (set to 3) to mitigate this. The town windows are showing the Pax and Mail leaving the town each month (see sreenie) but no growth. Can someone take a look at the save and let me know which setting I need to change to get them growing?
Thanks in advance.
Attachments
Shiftin' Sands Trans, 23rd Nov 1968.png
(224.71 KiB) Not downloaded yet
Desert.sav
(3.44 MiB) Downloaded 163 times
Diesel Power
Traffic Manager
Traffic Manager
Posts: 222
Joined: 18 Jun 2016 19:05

Re: [GS] RCG - A city growth GameScript for OTTD

Post by Diesel Power »

**can't edit prevous post. please merge**

Also in a seperate game I have a town with a population of 58 which doesn't accept PAX or mail and therfore isn't growing. I tried funding new buildings but that doesn't work. I assume the GS prevents this. I am transporting from this town but can't deliver to it. There needs to be a population below which towns grow on thier own up to, say, 100? this should get them to the point where they can accept passengers and can grow using the GS.
User avatar
Firrel
Engineer
Engineer
Posts: 118
Joined: 13 Aug 2019 17:06

Re: [GS] RCG - A city growth GameScript for OTTD

Post by Firrel »

Hey all,

I have created a branch of this game script called Renewed Village Growth. It is a combination of Renewed City Growth 5 and City Growth Limiter 6. You can find it in the fruit store.
Renewed_Village_Growth-1.tar
(101 KiB) Downloaded 402 times
readme.txt
(10.38 KiB) Downloaded 262 times
Additions:
- FIRS 3.0.14 and NAIS support
- city growth is completely stopped when a percentage of passangers and mails generated from that town in the last month is not transported
- eternal love - each month the local authorities rating for all cities will go up
- towns under 100 population will always grow as normal

Requires OpenTTD 1.10 and newer.

I dont think it requires a new thread as the gameplay mostly stays the same, but if you think otherwise, or you encounter any bugs, please let me know.
abadger1999
Engineer
Engineer
Posts: 2
Joined: 02 Apr 2020 01:07

Re: [GS] RCG - A city growth GameScript for OTTD

Post by abadger1999 »

I encountered an error in the RVG game script. It may simply be that my game is too big, though. It is a 4096x4096 FIRS extreme economy map with the number of ships bumped way up because I started in the 1700s and have had time to grow out a shipping network. (1,278 ships)

The crash report is that the script took too long to save itself. I think I loaded the game at the start of January, then when it tried to autosave in February, the game script crashed. Note that I have had the game paused for many real-life hours (Since last night so more than 12 hours). If the game script runs while paused, it might be something in the game script that could be optimized. I'll attach a screenshot of the ai/gamescript log.

One further note about my bug.... I switched game scripts mid-game. I started this game using the migrations game script but after getting a century into play, I found that it crashes during initialization so it wasn't doing anything. In fact, my world population was shrinking. I tried to switch back to the default town growth (gamescript (None)) but that crashed the scenario editor when I attempted to save. So I discovered that RVG works and have been trying to use that.

Edit: I turned autosave interval up to 12 months. I was then able to see that after a while, RCG successfully starts managing city growth. Towns with passenger service start reporting whether they'll grow or not and the cargos which are needed to make them grow. Once the 12 months are up and an autosave is triggered, the script crashes with the message that saving took too long.

I also notice that many of my ships now report that they are lost. A few of those ships (Navigating through barrier islands next to a coast) actually do get lost (placing extra bouys fixes their route) but most of the ships are proceeding to their destination just fine by the time the notification that they are lost appears. This seems like RCG is competing for available CPU cycles with the ships' pathfinding but I don't know openttd's internals so I can't say for certain. I also don't know if this is related to the saving issue or separate.
Attachments
openttd-gamescript-crash.png
(204.49 KiB) Not downloaded yet
User avatar
Firrel
Engineer
Engineer
Posts: 118
Joined: 13 Aug 2019 17:06

Re: [GS] RCG - A city growth GameScript for OTTD

Post by Firrel »

The game script saves bunch of information about every town on the map, so it may be that it gets overwhelmed. The error you encountered is some timeout from saving gamescript data managed by the core program, so there is not much I can do. You could post it to openttd github as a new issue if you see it as a bug.

What you could try is to disable saving and loading of any data by the game script. This means the initial setup will be done every time you load the game, but it may at least make it functional.
  • Go to Documents/OpenTTD/content_download/game and extract Renewed_Village_Growth-1.tar into the same folder
  • Backup main.nut file (i.e. main.nut.back)
  • Replace main.nut with
    main.nut
    (7.66 KiB) Downloaded 194 times
  • Try if it works, if not, send me your save game and I may give it a try
The problem with your ships might not be game script related. In openttd version 1.10, there were some changes made to ship pathfinding, mostly to remove max distance limits on ship pathfinding to remove the need to use buoys. But it may have increased the strain on the pathfinding algorithm, resulting in lost ships. Also there were some changes on how the warnings are displayed, so that may have also caused the delayed lost ship messages.
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: Michiel and 5 guests