[GS] Renewed Village Growth 9.3 (RVG)

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

Post Reply

How would you rate this game script?

5★ Lev4 'Chimaera'
26
90%
4★ "AsiaStar"
2
7%
3★ Floss "47"
1
3%
2★ Ploddyphut Choo-Choo
0
No votes
1★ Kirby Paul Tank
0
No votes
 
Total votes: 29

User avatar
Slippy
Engineer
Engineer
Posts: 9
Joined: 13 May 2021 21:13

Re: [GS] Renewed Village Growth 6.2 (RVG)

Post by Slippy »

Understood! Thank you for taking the time to explain and of course it’s your work (which I am looking forward to using in the game :)
User avatar
pankratz
Engineer
Engineer
Posts: 20
Joined: 15 Sep 2017 07:46

Re: [GS] Renewed Village Growth 6.2 (RVG)

Post by pankratz »

Mh, according to the prior posts shouldn't this town grow?

Image
User avatar
Firrel
Engineer
Engineer
Posts: 118
Joined: 13 Aug 2019 17:06

Re: [GS] Renewed Village Growth 6.2 (RVG)

Post by Firrel »

pankratz wrote: 17 May 2021 10:41 Mh, according to the prior posts shouldn't this town grow?
From what I see, yes, it should grow. I remember there was this issue of not enabling town monitoring for some towns in an older version of the GS. Could you please specify which version are you using and provide a save game file?
User avatar
pankratz
Engineer
Engineer
Posts: 20
Joined: 15 Sep 2017 07:46

Re: [GS] Renewed Village Growth 6.2 (RVG)

Post by pankratz »

Thank you. Version 6.2 (OpenTTD is still on 1.11.1)
Attachments
Cuba-up.sav
(901.11 KiB) Downloaded 137 times
ugmo
Engineer
Engineer
Posts: 4
Joined: 08 Jun 2021 08:59

Re: [GS] Renewed Village Growth 6.2 (RVG)

Post by ugmo »

Hello. I'm having an issue with running RVG 6.2 on a dedicated server. The script stays paused indefinitely when the server loads up. I've left the server running for 30 minutes and it still hasn't unpaused or loaded the storybook/goals.

It's on a dual core Ubuntu 20.04 VPS with 2GB of Ram. The map size is 2048x2048 with 350 towns. This takes about 20 seconds to load the script on my local machine, and the VPS doesn't seem so slow that it would take hours.

I don't know how to configure scripts through the linux terminal, so I copied the [game_scripts] section of my PC's openttd.cfg to the one on the server. Maybe I missed an important step.

Here is the console with -d script=9 enabled:

Code: Select all

dbg: [script] [18] [I] 1.10 API compatibility in effect.
dbg: [net] Map generation percentage complete: 95
dbg: [net] Map generated, starting game
dbg: [net] [udp] received new session key from master server (IPv4)                                                  ‎
*** Game paused (number of players)
dbg: [script] SetLastCommand company=18 tile=000000 p1=00000020 p2=00000001 cmd=61                                   ‎
*** Game still paused (game script, number of players)
dbg: [script] CheckLastCommand company=18 tile=000000 p1=00000020 p2=00000001 cmd=317
dbg: [script] SetLastCommand company=18 tile=ffffffff p1=00000000 p2=00000000 cmd=128
dbg: [script] [18] [I] [1950-01-01]  Script initialisation...
dbg: [script] [18] [I] Script Communcation Protocol: version: 45 - API: 1.2 - CompanyID: 16 - GS mode - AIAIProtocol: disable Script name: GSTL Script version: 1
dbg: [script] [18] [I] You can get the source code here : http://dev.openttdcoop.org/projects/scriptlib-scp
dbg: [script] [18] [I] Reserved commands : 4
dbg: [script] SetLastCommand company=18 tile=000000 p1=00000080 p2=00000002 cmd=105
dbg: [script] CheckLastCommand company=18 tile=000000 p1=00000080 p2=00000002 cmd=361
dbg: [script] SetLastCommand company=18 tile=ffffffff p1=00000000 p2=00000000 cmd=128
dbg: [script] SetLastCommand company=18 tile=000000 p1=00000072 p2=00000000 cmd=105
dbg: [script] CheckLastCommand company=18 tile=000000 p1=00000072 p2=00000000 cmd=361
dbg: [script] SetLastCommand company=18 tile=ffffffff p1=00000000 p2=00000000 cmd=128
dbg: [script] [18] [I] [1950-01-01]  Economy: predefined 25
dbg: [script] [18] [I] [1950-01-01]  Creating company list ...
dbg: [script] [18] [I] [1950-01-01]  Creating town list ... (can take a while on large maps)
dbg: [script] SetLastCommand company=18 tile=2822a8 p1=0000015d p2=0000ffff cmd=69
dbg: [net] [udp] advertising to master server
It seems to get stuck on creating the town list.

Later, while still paused, it said:

Code: Select all

dbg: [script] [18] [I] [1950-01-01]  Saving data... 
The script seems to work fine on the server if I load up a save I created on my PC with all the same settings and newGRFs, where the town list has already been generated. This isn't ideal though as I'd like the game to reset at 2050 automatically and generate a new map.
User avatar
Firrel
Engineer
Engineer
Posts: 118
Joined: 13 Aug 2019 17:06

Re: [GS] Renewed Village Growth 6.2 (RVG)

Post by Firrel »

ugmo wrote: 08 Jun 2021 09:56 Hello. I'm having an issue with running RVG 6.2 on a dedicated server. The script stays paused indefinitely when the server loads up. I've left the server running for 30 minutes and it still hasn't unpaused or loaded the storybook/goals.
Hey ugmo,

I dont have much experience with dedicated servers, so there might be some other problem that I am not aware of. The GS is running on the server and gets stuck on the town list creation. The town list creation is a slow process, where it has to loop through each town and set it up, so that it can do less processing during the game. During the initialization, GS pauses the game so that the inputs cant change during that time and it can be only unpaused by the GS. The story book and goals are also created after towns initialization.

Could you please try to launch the game script with Debug: Log level parameter to Cargo or Debug? In Cargo mode, it will print the cargo table as well as selected cargo for each town. This way you can see if the initialization just takes too long or it gets stuck. Below you can see a sample output from the Cargo debug level when the script is correctly initialized. Tried it by setting the GS in the game and then starting a dedicated server on my PC.

You can also try increasing a parameter in openttd.cfg under [script] called script_max_opcode_till_suspend = 10000. It will allow the script to take more processing time in each tick if I understand it correctly.

Code: Select all

dbg: [net] Generating map, please wait...
dbg: [net] Map generation percentage complete: 5
dbg: [net] Map generation percentage complete: 10
dbg: [net] Map generation percentage complete: 15
dbg: [net] Map generation percentage complete: 20
dbg: [net] Map generation percentage complete: 26
dbg: [net] Map generation percentage complete: 30
dbg: [net] Map generation percentage complete: 36
dbg: [net] Map generation percentage complete: 60
dbg: [net] Map generation percentage complete: 65
dbg: [net] Map generation percentage complete: 70
dbg: [net] Map generation percentage complete: 75
dbg: [net] Map generation percentage complete: 80
dbg: [net] Map generation percentage complete: 85
dbg: [net] Map generation percentage complete: 90
dbg: [script] [18] [I] 1.10 API compatibility in effect.
dbg: [net] Map generation percentage complete: 95
dbg: [net] Map generated, starting game
dbg: [net] [udp] received new session key from master server (IPv4)
ÔÇÄ*** Game paused (manual)
ÔÇÄ*** Game still paused (manual, game script)
dbg: [script] [18] [I] [1990-01-01]  Script initialisation...
dbg: [script] [18] [I] Script Communcation Protocol: version: 45 - API: 1.2 - CompanyID: 16 - GS mode - AIAIProtocol: disable Script name: GSTL Script version: 1
dbg: [script] [18] [I] You can get the source code here : http://dev.openttdcoop.org/projects/scriptlib-scp
dbg: [script] [18] [I] Reserved commands : 4
dbg: [script] [18] [I] [1990-01-01]  Cargo 0: PASS
dbg: [script] [18] [I] [1990-01-01]  Cargo 1: BEER
dbg: [script] [18] [I] [1990-01-01]  Cargo 2: MAIL
dbg: [script] [18] [I] [1990-01-01]  Cargo 3: BDMT
dbg: [script] [18] [I] [1990-01-01]  Cargo 4: CASS
dbg: [script] [18] [I] [1990-01-01]  Cargo 5: GOOD
dbg: [script] [18] [I] [1990-01-01]  Cargo 6: RFPR
dbg: [script] [18] [I] [1990-01-01]  Cargo 7: CLAY
dbg: [script] [18] [I] [1990-01-01]  Cargo 8: JAVA
dbg: [script] [18] [I] [1990-01-01]  Cargo 9: COPR
dbg: [script] [18] [I] [1990-01-01]  Cargo 10: CORE
dbg: [script] [18] [I] [1990-01-01]  Cargo 11: FOOD
dbg: [script] [18] [I] [1990-01-01]  Cargo 12: DIAM
dbg: [script] [18] [I] [1990-01-01]  Cargo 13: EOIL
dbg: [script] [18] [I] [1990-01-01]  Cargo 14: ENSP
dbg: [script] [18] [I] [1990-01-01]  Cargo 15: FMSP
dbg: [script] [18] [I] [1990-01-01]  Cargo 16: FRUT
dbg: [script] [18] [I] [1990-01-01]  Cargo 17: LVST
dbg: [script] [18] [I] [1990-01-01]  Cargo 18: WDPR
dbg: [script] [18] [I] [1990-01-01]  Cargo 19: MAIZ
dbg: [script] [18] [I] [1990-01-01]  Cargo 20: MNO2
dbg: [script] [18] [I] [1990-01-01]  Cargo 21: NUTS
dbg: [script] [18] [I] [1990-01-01]  Cargo 22: OIL_
dbg: [script] [18] [I] [1990-01-01]  Cargo 23: PETR
dbg: [script] [18] [I] [1990-01-01]  Cargo 24: PHOS
dbg: [script] [18] [I] [1990-01-01]  Cargo 25: RUBR
dbg: [script] [18] [I] [1990-01-01]  Cargo 26: SAND
dbg: [script] [18] [I] [1990-01-01]  Cargo 27: GRVL
dbg: [script] [18] [I] [1990-01-01]  Cargo 28: WOOD
dbg: [script] [18] [I] [1990-01-01]  Cargo 29: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 30: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 31: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 32: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 33: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 34: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 35: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 36: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 37: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 38: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 39: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 40: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 41: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 42: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 43: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 44: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 45: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 46: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 47: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 48: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 49: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 50: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 51: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 52: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 53: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 54: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 55: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 56: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 57: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 58: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 59: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 60: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 61: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 62: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Cargo 63: (null : 0x0000000000000000)
dbg: [script] [18] [I] [1990-01-01]  Economy: predefined 21
dbg: [script] [18] [I] [1990-01-01]  Creating company list ...
dbg: [script] [18] [I] [1990-01-01]  Creating town list ... (can take a while on large maps)
dbg: [script] [18] [I] [1990-01-01]  Standchurch:   1: PASS,MAIL,  2: FRUT,LVST,MAIZ,  3: WOOD,RUBR,MNO2,  4: RFPR,FMSP,ENSP,  5: BDMT,BEER,GOOD,
dbg: [script] [18] [I] [1990-01-01]  Beaby:   1: PASS,MAIL,  2: JAVA,LVST,FRUT,  3: GRVL,OIL_,  4: ENSP,FMSP,  5: GOOD,FOOD,
dbg: [script] [18] [I] [1990-01-01]  Sesstable:   1: PASS,MAIL,  2: JAVA,CASS,  3: OIL_,RUBR,  4: FMSP,WDPR,RFPR,  5: GOOD,COPR,
dbg: [script] [18] [I] [1990-01-01]  Treborough:   1: PASS,MAIL,  2: MAIZ,JAVA,  3: RUBR,PHOS,SAND,  4: FMSP,ENSP,RFPR,  5: BDMT,BEER,
dbg: [script] [18] [I] [1990-01-01]  Tadingbury:   1: PASS,MAIL,  2: MAIZ,FRUT,CASS,  3: PHOS,OIL_,  4: RFPR,WDPR,PETR,  5: GOOD,FOOD,
dbg: [script] [18] [I] [1990-01-01]  New Rudtown:   1: PASS,MAIL,  2: FRUT,LVST,  3: CORE,OIL_,PHOS,  4: ENSP,PETR,EOIL,  5: GOOD,BDMT,
dbg: [script] [18] [I] [1990-01-01]  Pedingway:   1: PASS,MAIL,  2: JAVA,CASS,NUTS,  3: DIAM,PHOS,  4: EOIL,PETR,  5: GOOD,COPR,BEER,
dbg: [script] [18] [I] [1990-01-01]  Godwich:   1: PASS,MAIL,  2: FRUT,MAIZ,  3: GRVL,CLAY,DIAM,  4: EOIL,PETR,  5: BEER,GOOD,
dbg: [script] [18] [I] [1990-01-01]  Bonningville:   1: PASS,MAIL,  2: JAVA,MAIZ,NUTS,  3: PHOS,GRVL,CLAY,  4: WDPR,FMSP,PETR,  5: BDMT,COPR,
dbg: [script] [18] [I] [1990-01-01]  Marningdon Green:   1: PASS,MAIL,  2: CASS,NUTS,MAIZ,  3: RUBR,DIAM,  4: EOIL,ENSP,  5: COPR,BEER,
dbg: [script] [18] [I] [1990-01-01]  Prospecting raw industries ... (can take a while on large maps)
dbg: [script] [18] [I] [1990-01-01]  Prospected 8 raw industries up to total number of 8
ÔÇÄ*** Game still paused (manual)
dbg: [script] [18] [I] [1990-01-01]  Game setup done.
dbg: [script] [18] [I] [1990-01-01]  Happy playing !
ugmo
Engineer
Engineer
Posts: 4
Joined: 08 Jun 2021 08:59

Re: [GS] Renewed Village Growth 6.2 (RVG)

Post by ugmo »

Firrel wrote: 08 Jun 2021 16:22 Could you please try to launch the game script with Debug: Log level parameter to Cargo or Debug? In Cargo mode, it will print the cargo table as well as selected cargo for each town. This way you can see if the initialization just takes too long or it gets stuck. Below you can see a sample output from the Cargo debug level when the script is correctly initialized. Tried it by setting the GS in the game and then starting a dedicated server on my PC.

You can also try increasing a parameter in openttd.cfg under [script] called script_max_opcode_till_suspend = 10000. It will allow the script to take more processing time in each tick if I understand it correctly.
Hi, thanks for the response.
Here is the output with Debug: Level set to Debug:

Code: Select all

dbg: [script] [18] [I] [1950-01-01]  Cargo 9: FRUT
dbg: [script] [18] [I] [1950-01-01]  Cargo 10: IORE
dbg: [script] [18] [I] [1950-01-01]  Cargo 11: FOOD
dbg: [script] [18] [I] [1950-01-01]  Cargo 12: KAOL
dbg: [script] [18] [I] [1950-01-01]  Cargo 13: LVST
dbg: [script] [18] [I] [1950-01-01]  Cargo 14: MILK
dbg: [script] [18] [I] [1950-01-01]  Cargo 15: SAND
dbg: [script] [18] [I] [1950-01-01]  Cargo 16: SCMT
dbg: [script] [18] [I] [1950-01-01]  Cargo 17: STEL
dbg: [script] [18] [I] [1950-01-01]  Cargo 18: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 19: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 20: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 21: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 22: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 23: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 24: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 25: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 26: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 27: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 28: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 29: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 30: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 31: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 32: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 33: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 34: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 35: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 36: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 37: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 38: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 39: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 40: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 41: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 42: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 43: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 44: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 45: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 46: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 47: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 48: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 49: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 50: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 51: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 52: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 53: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 54: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 55: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 56: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 57: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 58: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 59: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 60: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 61: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 62: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Cargo 63: (null : 0x(nil))
dbg: [script] [18] [I] [1950-01-01]  Economy: predefined 25
dbg: [script] [18] [I] [1950-01-01]  Creating company list ...
dbg: [script] [18] [I] [1950-01-01]  Creating town list ... (can take a while on large maps)
dbg: [script] [18] [I] [1950-01-01]  Endmoor:   1: PASS,MAIL,  2: FISH,FRUT,LVST,MILK,  3: COAL,IORE,KAOL,SAND,SCMT,  4: RFPR,ENSP,FMSP,STEL,  5: BEER,GOOD,FOOD,
dbg: [script] SetLastCommand company=18 tile=046340 p1=00000063 p2=0000ffff cmd=69
It gets stuck on the first town it seems.

I logged a full debug on a separate attempt to start it, and found these lines:

Code: Select all

dbg: [script] [18] [I] 1.10 API compatibility in effect.
dbg: [script] [18] [I] [1950-01-01]  Saving data...
dbg: [script] [18] [S] Your script made an error: the index 'use_town_sign' does not exist
dbg: [script] [18] [S] 
dbg: [script] [18] [S] *FUNCTION [Save()] renewed_village_growth-6.2/main.nut line [223]
dbg: [script] [18] [S] *FUNCTION [Start()] renewed_village_growth-6.2/main.nut line [70]
dbg: [script] [18] [S] 
dbg: [script] [18] [S] [save_table] TABLE
dbg: [script] [18] [S] [this] INSTANCE
dbg: [script] [18] [S] [sysdate] 23
dbg: [script] [18] [S] [this] INSTANCE
dbg: [script] The script died unexpectedly.
One of the running scripts crashed. Please report this to the script author with a screenshot of the AI/Game Script Debug Window
dbg: [script] [18] [I] Please report the error to the following URL:
dbg: [script] [18] [I] https://www.tt-forums.net/viewtopic.php?f=65&t=87052

:!:
Edit: I've managed to get the script working! I generated a fresh openttd.cfg on the server and then compared the two, removing anything different in my server.cfg that I didn't need. Hopefully my debug notes are still helpful to you in some way, although I have no idea what setting was causing the issue.
Lt_Joker
Engineer
Engineer
Posts: 23
Joined: 12 Jun 2021 11:13

Re: [GS] Renewed Village Growth 6.2 (RVG)

Post by Lt_Joker »

Would it be too much to ask to be able to set a randomized upper limit for the size of villages? :)
Like the setting from "Villages is Villages"? :)
PointLuck
Engineer
Engineer
Posts: 11
Joined: 27 May 2021 11:17

Re: [GS] Renewed Village Growth 6.2 (RVG)

Post by PointLuck »

Hello RVGs,

first off, thanks for this game script, I enjoy playing it.

I was wondering if I misunderstand part of the readme or if it's maybe outdated:

Code: Select all

If you delivery more cargo than necessary, the surplus is
stockpiled to be consumed next month (towns can stockpile a quantity
of 10 * cargotype requirement).
I read it as: I dont have to deliver very regularly, like every 30 days or so, instead I can bring larger loads in longer intervals because they will be stockpiled. However, I feel like that's not happening. I often see required/delivered as unsatisfied. Is there a way to see what's stockpiled? Or is that mechanics obsolete?

cheers, Daniel.
User avatar
Firrel
Engineer
Engineer
Posts: 118
Joined: 13 Aug 2019 17:06

Re: [GS] Renewed Village Growth 6.2 (RVG)

Post by Firrel »

ugmo wrote: 09 Jun 2021 07:09 Edit: I've managed to get the script working! I generated a fresh openttd.cfg on the server and then compared the two, removing anything different in my server.cfg that I didn't need. Hopefully my debug notes are still helpful to you in some way, although I have no idea what setting was causing the issue.
Great to hear that you managed to get it working. Are you going to host it as a public server or a private one? Might be interested in joining for a game. :)
Lt_Joker wrote: 12 Jun 2021 11:14 Would it be too much to ask to be able to set a randomized upper limit for the size of villages? :)
Like the setting from "Villages is Villages"? :)
The two scripts have different types of handling town growth. If I understand the ViV well enough, it sets a population number for each town and providing cargo to that town can increase that number to some extend. So each town has set limit of how much it can grow. But the speed of growth is not changed.

RVG mainly modifies the speed of growth, so that providing more cargo to the town increases the speed of growth, so it does not consider the size of the town. Both scripts contain a growth limiter based on the percentage of passangers and mails, which will stop the growth of towns. This I consider in the RVG as the stopping feature of the growth. When the town outgrows the provided services, it will stop growing. You can fine tune this number based on your preferences, for a normal game, I would suggest 50%. With that you must cater to each town so that it can grow.

While it is rather easy to set a random number for each town and stop the growth after reaching it, there would be no mechanism to alter that number, making it a rather flat feature. Another problem is that I have used up all parameters (20) that I can add to the town info box, so I cannot add another parameter stating the maximum size of the town. So I am not completely oposed to that feature, but does not seem to add that much to the gameplay. If you have some arguments to support this feature, let me know.
PointLuck wrote: 12 Jun 2021 13:57 I was wondering if I misunderstand part of the readme or if it's maybe outdated:

Code: Select all

If you delivery more cargo than necessary, the surplus is
stockpiled to be consumed next month (towns can stockpile a quantity
of 10 * cargotype requirement).
I read it as: I dont have to deliver very regularly, like every 30 days or so, instead I can bring larger loads in longer intervals because they will be stockpiled. However, I feel like that's not happening. I often see required/delivered as unsatisfied. Is there a way to see what's stockpiled? Or is that mechanics obsolete?
The feature is still there and works correctly (hopefully). With version 6, the town info box was changed so that the contributor and largest population could be displayed. For that I had to reduce other parameters (20 parameters are supported in total), so the stockpiled number is hidden now. You can still see the stockpiled numbers in the GS console when you enable debug logging in the script settings, but that is more for debugging purposes.
Snímka.PNG
Snímka.PNG (6.48 KiB) Viewed 10933 times
But it is true that it is a bit misleading. The supplied number specifies only what you delivered during the month, so the category still might be fulfilled from the stockpile, but it is not shown. Maybe combining the two numbers together, so that you see the total number of available cargo for the category for that month from which the town will take its cut. This way you can know that the category is fulfilled correctly.

But take in account that each category has a set decay percentage, so the stockpile is reduced every month based on that decay. It changes based on economy, for example FIRS 4 Temperate basic has 40% decay for the first category. Supplying big chunks can get less attractive because of that. You can see this number in the Story Book.
PointLuck
Engineer
Engineer
Posts: 11
Joined: 27 May 2021 11:17

Re: [GS] Renewed Village Growth 6.2 (RVG)

Post by PointLuck »

But take in account that each category has a set decay percentage, so the stockpile is reduced every month based on that decay. It changes based on economy, for example FIRS 4 Temperate basic has 40% decay for the first category. Supplying big chunks can get less attractive because of that. You can see this number in the Story Book.
Ah I missed that part. Ok makes all sense to me. Plus many shorter trains look more busy and fun :).
Lt_Joker
Engineer
Engineer
Posts: 23
Joined: 12 Jun 2021 11:13

Re: [GS] Renewed Village Growth 6.2 (RVG)

Post by Lt_Joker »

Firrel wrote: 12 Jun 2021 15:08
Lt_Joker wrote: 12 Jun 2021 11:14 Would it be too much to ask to be able to set a randomized upper limit for the size of villages? :)
Like the setting from "Villages is Villages"? :)
RVG mainly modifies the speed of growth, so that providing more cargo to the town increases the speed of growth, so it does not consider the size of the town. Both scripts contain a growth limiter based on the percentage of passangers and mails, which will stop the growth of towns. This I consider in the RVG as the stopping feature of the growth. When the town outgrows the provided services, it will stop growing.
The small problem with this is that I cannot really control 100% how much I service a town since it takes it industries into account as well. there might be the only processing industry of its kind in that sector of the map around and this town owns it. Now I don't want to increase growth rate of this town but I need to service the industries. If it was just the passengers, that'd be indeed easy to control.

Maybe the percentage of passengers/main transported should always be the maximum percentage instead of just one category like the others which will average out?

Like factor_percentage = Min(Percentage_PAX, Average(Percentage_All_Other_Categories))

something like that? I'm planning a game with a friend where he most likely will do PAX and I'll do cargo. We want a couple metropolises and also have a few small towns that he services with just a one track branch line. However if I keep servicing indutries that I might need for their output product, I might still push that town into too much unwanted growth.

I know the passenger cargo is usually the biggest number so we can keep that percentage low, but if other categories are served at 100% that'll still cause good growth won't it?

The code does "if (sum_transported / ::CargoLimiter.len() < min_transported)" That's basically the average over all cargo. If I set the percentage for growth at 50% and we service a minimal amount of passengers.. will that still prevent the growth going too high if the other categories are at 100%?

Edit: Btw there's a typo in the settings ;) : Limit Growth: Minimun percentage
User avatar
Firrel
Engineer
Engineer
Posts: 118
Joined: 13 Aug 2019 17:06

Re: [GS] Renewed Village Growth 6.2 (RVG)

Post by Firrel »

Lt_Joker wrote: 12 Jun 2021 17:54
Firrel wrote: 12 Jun 2021 15:08
Lt_Joker wrote: 12 Jun 2021 11:14 Would it be too much to ask to be able to set a randomized upper limit for the size of villages? :)
Like the setting from "Villages is Villages"? :)
RVG mainly modifies the speed of growth, so that providing more cargo to the town increases the speed of growth, so it does not consider the size of the town. Both scripts contain a growth limiter based on the percentage of passangers and mails, which will stop the growth of towns. This I consider in the RVG as the stopping feature of the growth. When the town outgrows the provided services, it will stop growing.
The small problem with this is that I cannot really control 100% how much I service a town since it takes it industries into account as well. there might be the only processing industry of its kind in that sector of the map around and this town owns it. Now I don't want to increase growth rate of this town but I need to service the industries. If it was just the passengers, that'd be indeed easy to control.

Maybe the percentage of passengers/main transported should always be the maximum percentage instead of just one category like the others which will average out?

Like factor_percentage = Min(Percentage_PAX, Average(Percentage_All_Other_Categories))

something like that? I'm planning a game with a friend where he most likely will do PAX and I'll do cargo. We want a couple metropolises and also have a few small towns that he services with just a one track branch line. However if I keep servicing indutries that I might need for their output product, I might still push that town into too much unwanted growth.

I know the passenger cargo is usually the biggest number so we can keep that percentage low, but if other categories are served at 100% that'll still cause good growth won't it?

The code does "if (sum_transported / ::CargoLimiter.len() < min_transported)" That's basically the average over all cargo. If I set the percentage for growth at 50% and we service a minimal amount of passengers.. will that still prevent the growth going too high if the other categories are at 100%?

Edit: Btw there's a typo in the settings ;) : Limit Growth: Minimun percentage
There are two features. One is cargo categories, which modify how fast the towns grow. This is the 3-5 categories which each contain a set of cargo types and providing any of them will contribute to that category in order to increase the growth rate. This however never stops the growth, only slows it down to minimum when categories are not fulfilled to some extend.

The other feature is a growth limiter, which takes in account in most economies only passangers and mails, but for example ITI also checks waste, that is in the parameter ::CargoLimiter. In the default part of the town box, there is number of transported to number of max generated passangers and mails by that town. When the percentage is above the limiter number, the growth is enabled, otherwise the growth is completely stopped.

So if you want to keep the towns small, dont transport enough of pax and mail out of those towns. When you set the limiter to 65%, you need to have almost every house of the town covered by stations in order to fulfill it. That is because you need to consider the station ratings, which are around 65 - 70% in most cases when the service is very good. With 50%, you might achieve some metropolis, but still most towns will be small. With 30%, the feature is almost turned off. You can change the parameter at any time.

On top of that, you must start the towns monitoring by providing some passangers or mails (any cargo type from first category). Without monitoring, the towns cant grow.

Thanks for the typo discovery, will fix it if I remember it :D
Lt_Joker
Engineer
Engineer
Posts: 23
Joined: 12 Jun 2021 11:13

Re: [GS] Renewed Village Growth 6.2 (RVG)

Post by Lt_Joker »

I looked into the code and it seems the cargo limit factor is measured against ALL cargo not just passengers. Am I missreading that? I'll have to look at it again but at first glance it summed up all cargo across all categories.
User avatar
Firrel
Engineer
Engineer
Posts: 118
Joined: 13 Aug 2019 17:06

Re: [GS] Renewed Village Growth 6.2 (RVG)

Post by Firrel »

Lt_Joker wrote: 13 Jun 2021 18:24 I looked into the code and it seems the cargo limit factor is measured against ALL cargo not just passengers. Am I missreading that? I'll have to look at it again but at first glance it summed up all cargo across all categories.
The limiter is measured against ALL cargos in the ::CargoLimiter array, which is in most economies pax and mail. From what I see it works as intended, stopping the growth of towns when the average of pax and mail transported is less than the threshold. You can check it by yourself, here is the code with some additional notes.

Here is an economy definition, for example baseset temperate. The cargo indexes are used for defining the limiter and categories with 0 = PAX, 2 = MAIL.

Code: Select all

case(Economies.BASESET__TEMPERATE): // Base temperate
            ::CargoLimiter <- [0,2]; // used for the limiter for stopping the growth
            ::CargoCat <- [[0,2], // category 1
                       [1,3,4,6,7,8], // category 2
                       [5,9,10]]; // category 3
            ::CargoCatList <- [CatLabels.PUBLIC_SERVICES,CatLabels.RAW_MATERIALS,CatLabels.PRODUCTS]; // names of categories
            ::CargoMinPopDemand <- [0,1000,4000]; // population for the category to kick in
            ::CargoPermille <- [60,45,25]; // base increase of cargo demand per 1000 residents
            ::CargoDecay <- [0.4,0.2,0.1]; // monthly decay of stockpiled cargo
            break;
And here is the limiter function:

Code: Select all

function GoalTown::ManageTownLimiting(threshold_setting, min_transported) {
    // if the town limiting is turned off or the size of the town is below the threshold, set requirements to zero
    local townPopulation = GSTown.GetPopulation(this.id);

    // if the limiter is disabled or town is too small, allow growth and return
    if (townPopulation <= threshold_setting || min_transported == 0) {
        this.limit_transported = 0;
        this.allowGrowth = true;
        this.limit_delay = 0;
        return;
    }

    // sum up all transported percentages in the ::CargoLimiter array
    // if a cargo is below the threshold, add it to this.limit_transported, so that it can be displayed in the town box
    local sum_transported = 0;
    this.limit_transported = 0;
    foreach (index, cargo in ::CargoLimiter) {
        local transported = GSTown.GetLastMonthTransportedPercentage(this.id, cargo);
        sum_transported += transported;
        if (transported < min_transported)
            this.limit_transported += 1 << cargo;
    }

    // compare the average of all limited cargos to the threshold
    // disalow growth when the threshold is not met and the limit delay is zeroed
    if (sum_transported / ::CargoLimiter.len() < min_transported) {
        ++this.limit_delay;
        if (this.limit_delay > GSController.GetSetting("limiter_delay")) {
            this.limit_delay = 0;
            this.allowGrowth = false;
        }
    } else {
        this.allowGrowth = true;
        this.limit_delay = 0;
    }
}
Lt_Joker
Engineer
Engineer
Posts: 23
Joined: 12 Jun 2021 11:13

Re: [GS] Renewed Village Growth 6.2 (RVG)

Post by Lt_Joker »

Ah sorry, missunderstood that this array had only those cargoes in it. That's fine then :)
ugmo
Engineer
Engineer
Posts: 4
Joined: 08 Jun 2021 08:59

Re: [GS] Renewed Village Growth 6.2 (RVG)

Post by ugmo »

I think I'm having the same issue as pankratz

I'm wondering why this town isn't growing. The game difficulty is set to medium, and the 'minimum percentage of transported cargo from town' = 50. Using 6.2.

Image
User avatar
Firrel
Engineer
Engineer
Posts: 118
Joined: 13 Aug 2019 17:06

Re: [GS] Renewed Village Growth 6.2 (RVG)

Post by Firrel »

ugmo wrote: 17 Jun 2021 18:35 I think I'm having the same issue as pankratz

I'm wondering why this town isn't growing. The game difficulty is set to medium, and the 'minimum percentage of transported cargo from town' = 50. Using 6.2.
You are correct this town should be growing, the mail and pax numbers in the town box are above the 50% threshold. Could you please send me your save file? Maybe some variable overflow or something like that has occured.

Pankratz had a different problem that the game was generated on his local machine and he started the save in a dedicated server and the game script was not started. There seem to be some problem when moving the save file with the GS to another PC, but dont know much about it.
ugmo
Engineer
Engineer
Posts: 4
Joined: 08 Jun 2021 08:59

Re: [GS] Renewed Village Growth 6.2 (RVG)

Post by ugmo »

Firrel wrote: 17 Jun 2021 19:11 Pankratz had a different problem that the game was generated on his local machine and he started the save in a dedicated server and the game script was not started. There seem to be some problem when moving the save file with the GS to another PC, but dont know much about it.
Ah I see, and this was exactly what I did, too. I took the save offline to fix an issue with another newGRF, then loaded it back up on the server. I know for next time, now. Thank you.
KeepinItRail
Engineer
Engineer
Posts: 18
Joined: 07 Sep 2020 15:14

Re: [GS] Renewed Village Growth 6.2 (RVG)

Post by KeepinItRail »

Hey

I started a new game, this time with FIRS 4 In A Hot Country and the Story Book looks a bit off with regards to the categories. Normally they have names and Cat 2 has no cargo types.

Same thing isn't happening with Steeltown

Image
Attachments
FIRS4IAHC.png
FIRS4IAHC.png (20.1 KiB) Viewed 7361 times
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 3 guests