[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

Post Reply
Kev
Engineer
Engineer
Posts: 14
Joined: 13 Feb 2015 14:19

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

Post by Kev »

Would it be possible to get the script to write a comment in the debug screen when it has finished its monthly updates so i can see how long it takes please?
User avatar
Lafiir
Engineer
Engineer
Posts: 8
Joined: 05 Feb 2015 11:44

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

Post by Lafiir »

If you turn on the Debug-Log (GS-Settings > Log level: 3) you can see how many Ticks something takes and a bunch of other useful information.

As for 'script took too long to save'; I took a look at the source-code and Google to find out what's going on:
- Scripts have a very limited amount of time to do their save-routine and RCG simply exceeds this limit.
- The number of towns this happens at is not dependent on map-size or processor speed, but on the number of operations in the source code.
- This problem can be circumvented by pre-caching the town save-data (the Neighbours-GS had a similar problem/solution).
- RCG does that with r127 (but not with v5), but still recollects all the data on save again anyway, ignoring the cache and causing the crash.
- I believe this to be an oversight (the existing cache should be valid and exceptions to it can be found otherwise), but I am not 100% certain.
- If fixed, you should be able to save 10k towns and more :)

Also, I found one more bug:
- If you load from an auto-save, RCG will skip this month's calculations.
User avatar
keoz
Transport Coordinator
Transport Coordinator
Posts: 321
Joined: 16 Jul 2009 10:04

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

Post by keoz »

Lafiir wrote:If you turn on the Debug-Log (GS-Settings > Log level: 3) you can see how many Ticks something takes and a bunch of other useful information.

As for 'script took too long to save'; I took a look at the source-code and Google to find out what's going on:
- Scripts have a very limited amount of time to do their save-routine and RCG simply exceeds this limit.
- The number of towns this happens at is not dependent on map-size or processor speed, but on the number of operations in the source code.
- This problem can be circumvented by pre-caching the town save-data (the Neighbours-GS had a similar problem/solution).
- RCG does that with r127 (but not with v5), but still recollects all the data on save again anyway, ignoring the cache and causing the crash.
- I believe this to be an oversight (the existing cache should be valid and exceptions to it can be found otherwise), but I am not 100% certain.
- If fixed, you should be able to save 10k towns and more :)

Also, I found one more bug:
- If you load from an auto-save, RCG will skip this month's calculations.
Mmh... You have a good sight on the code and your comments are very useful. ;)

For the "too long to save" problem (which I never had but which was already reported at least once), it is, indeed, dependent on the number of operations in the source code, but since the operations are (about) the same for all towns, as first thought I consider it is dependent on the number of towns.

Going to watch on all of this.
Patch - Let's timetable depot waiting time with the Wait in depot patch.
GameScript - Searching a new way to make your cities growing ? Try the Renewed City Growth GameScript.
My screenshots thread.
User avatar
bvoice360
Traffic Manager
Traffic Manager
Posts: 192
Joined: 22 Sep 2013 12:51
Location: Somewhere in Kent

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

Post by bvoice360 »

Oh dear.
RCG Error.JPG
RCG Error.JPG (51.63 KiB) Viewed 9072 times
I reloaded one of my earlier savegames, but it always crashes on the dot of 01/05/1973
User avatar
bvoice360
Traffic Manager
Traffic Manager
Posts: 192
Joined: 22 Sep 2013 12:51
Location: Somewhere in Kent

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

Post by bvoice360 »

I am going to have to switch to another game script, because this bug reoccurs again and again and again across multiple savegames

It says that the cargo set doesn't match the config, even though I am using Full FIRS and have configured it as such. Apparently my savegame is too large to post and test whether it works for you or not.
Wahazar
Tycoon
Tycoon
Posts: 1451
Joined: 18 Jan 2014 18:10

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

Post by Wahazar »

bvoice360 wrote: It says that the cargo set doesn't match the config, even though I am using Full FIRS and have configured it as such.
Maybe you are using nopt only FIRS but also other industry, or just NARS or other vehicle set with additional GEAR cargo?
User avatar
bvoice360
Traffic Manager
Traffic Manager
Posts: 192
Joined: 22 Sep 2013 12:51
Location: Somewhere in Kent

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

Post by bvoice360 »

Only using FIRS, though the vehicle/train sets I use are compatible with ECS/YETI as well, but cannot be refitted unless the mods are installed. This has only been a problem since I updated to 1.5, so I may downdate to my more familiar and seemingly bug-free 1.4.4, though perhaps updating from FIRS v1.3 to v1.4.4 would solve the problem, as possibly it would not recognise a possibly antiquated version of FIRS.
Antaguana
Engineer
Engineer
Posts: 10
Joined: 05 Oct 2013 08:58

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

Post by Antaguana »

Hello,

Just to let you know I am also having the "took to long to save" error. I don't know how to count the number of towns so I am going to give an estimation.

map size is 4096x4096
Number of towns was set to Low
Total Population is 1,139,889
Largest town is 1000
Median town looks about 350

Thus number of towns > 1,139
Based on median number of towns approx. 3256

For now I will start a new game with number of towns set to very low. I would be really very happy to see a bug fix.

I have included a save file but had to doctor the files so they would upload. I have split it into 2 with 7 zip to keep under the 10 meg rule and renamed them as the forum doesnt like the .001 extension.
Rename "Antaguana Global Transport, 1840-01-01-1.zip" to "Antaguana Global Transport, 1840-01-01.zip.001" and "Antaguana Global Transport, 1840-01-01-2.zip" to "Antaguana Global Transport, 1840-01-01.zip.002"
Attachments
Antaguana Global Transport, 1840-01-01-1.zip
save game with "too long to save" crash part1
(10 MiB) Downloaded 200 times
Antaguana Global Transport, 1840-01-01-2.zip
save game with "too long to save" crash part2
(5.42 MiB) Downloaded 201 times
User avatar
bvoice360
Traffic Manager
Traffic Manager
Posts: 192
Joined: 22 Sep 2013 12:51
Location: Somewhere in Kent

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

Post by bvoice360 »

Nope, even updating FIRS and reinstalling the game script does not help and it STILL says 'cargo set does not match'-what is going on???
User avatar
Sylf
President
President
Posts: 957
Joined: 23 Nov 2010 21:25
Location: ::1

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

Post by Sylf »

bvoice360 wrote:Nope, even updating FIRS and reinstalling the game script does not help and it STILL says 'cargo set does not match'-what is going on???
FIRS is not at fault. The script isn't new enough to keep up with the NewGRF.
User avatar
bvoice360
Traffic Manager
Traffic Manager
Posts: 192
Joined: 22 Sep 2013 12:51
Location: Somewhere in Kent

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

Post by bvoice360 »

Do I need to downdate or something, then? FIRS worked fine with the script in 1.4.4, but it kept cutting off at a certain point every game.
User avatar
Lafiir
Engineer
Engineer
Posts: 8
Joined: 05 Feb 2015 11:44

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

Post by Lafiir »

bvoice360 wrote:Oh dear.
- Have you tried using the latest version of RCG? Your screenshot shows V4, but current stable version is V5!
- Your image doesn't show the actual error message (scroll a bit upwards), so we can't even see what went wrong.
- Please check again your Game Script Parameters, to make sure it still uses the same industry set as specifed by the FIRS settings.
- Warning: saved games from FIRS 1.3 are not compatible with 1.4. So that upgrade will not work.
- Finally, RCG only supports FIRS 1.3 so far. But 1.4 Full & Temperate will still work regardless.
User avatar
bvoice360
Traffic Manager
Traffic Manager
Posts: 192
Joined: 22 Sep 2013 12:51
Location: Somewhere in Kent

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

Post by bvoice360 »

Yes I am using v.5. Yes, it is configured to Full FIRS. No, I am not using savegames from another version. I had this bug in FIRS 1.3 as well. Also, I can't seem to find the error again, and I think I restarted the savegame without saving it, so there is no way to replicate it (at least without hours of playing time)
User avatar
Lafiir
Engineer
Engineer
Posts: 8
Joined: 05 Feb 2015 11:44

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

Post by Lafiir »

Out of curiosity, I looked over the source-code of RCG V4 again, and it seems the crash you first mentioned happened when a Town that previously received passengers stopped doing so. But without the complete error message or without the save-game it's probably futile to try and divine what exactly went wrong there.

Now, I am assuming you upgraded RCG after the crash and reloaded your save-game with V5 and got the "cargo set does not match" messages. Which is not a bug. It's just a warning that you have installed some other GRF that changes the available cargoes somehow. With RCG V5, when trying the Full or Temperate option from FIRS 1.3 and FIRS 1.4, in both OpenTTD 1.4 and 1.5, I never get any warnings. keoz posted an image of the cargo-categories on page one using FIRS and if yours looks just like it, with no entries missing or at the wrong place, then you can probably just ignore it.
FIRS worked fine with the script in 1.4.4, but it kept cutting off at a certain point every game.
Please explain that in more detail.
User avatar
bvoice360
Traffic Manager
Traffic Manager
Posts: 192
Joined: 22 Sep 2013 12:51
Location: Somewhere in Kent

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

Post by bvoice360 »

As in, it displays the cargo categories fine in the Storybook, but still says that the cargo set doesn't match. I can still use the broken save, but the town GUI freezes and stays on whatever value it had when the script broke i.e. it had 200t food in storage, then it would keep on displaying 200t and never refresh.

What I meant by my second statement was that the script would work fine up until a certain point and then either say the set doesn't match or give me the error. For example, one of my games worked fine up until 13/04/1973, and then the cargoset warning window popped up. However, upon reloading a save I made just before it happened, it gives me the error immediately instead of on the date it happened first time. I would attach the save but it absolutely refuses to let me, saying '10MB file limit exceeded', even though it it only ~11KB-could it be be a coincidence that both of the glitch files are ~11KB?
User avatar
Lafiir
Engineer
Engineer
Posts: 8
Joined: 05 Feb 2015 11:44

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

Post by Lafiir »

Like I said, a correct display of the Storybook, but with a cargo-warning, should be ignorable. You can go to GameScriptParameters and set Log-level to 3:Debug then load your game and open ?->AI/ScriptDebug and post a screenshot of the cargo-list (from 0=PASS to 31=RCYC), then we will know for certain.
A frozen GUI is weird and sounds like cargo-monitoring broke somehow. Try out RCG Revision 127. That should reset any active cargo-monitoring and stored amounts, hopefully fixing what went wrong.
However the second part makes no sense. As far as I can tell RCG V5 (and later versions) only display the warning when you load/start of a game. Never during regular play. Sorry; maybe keoz can explain this one.
User avatar
bvoice360
Traffic Manager
Traffic Manager
Posts: 192
Joined: 22 Sep 2013 12:51
Location: Somewhere in Kent

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

Post by bvoice360 »

Aha, Cargo No. 30 is missing, replaced by '(null:0x0000000000000000)'-all other cargoes like BEER, SAND and OIL_ are displayed correctly. I think the missing one is Plant Fibres, because I cannot find the relevant entry for it (the Balanced City Growth script says this as well, but does seem to find a workaround as it manages fine). I tried the version you suggested and it worked fine, but popped up a new window warning me that the autosave is interfering with the towndata and forcing it to use the previous month's data, which could explain the frozen GUI. Also, the new version seems to make the fast-forward function go absolutely crazy, with a whole year now lasting only ~60s, when I am used to FF being 2x speed 8o

EDIT: It still pops up the cargo-does-not-match window, but the script works now anyway and the bonkers fast-forward seems to have been just a fluke. However, it does merge the two industrial categories into one, even though I have set that to 'off'
User avatar
Lafiir
Engineer
Engineer
Posts: 8
Joined: 05 Feb 2015 11:44

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

Post by Lafiir »

No, Cargo 30 is supposed to be empty and I think PlantFibres is 22=FICR. If another script says you have missing cargo as well, then obviously your FIRS version is at fault.
User avatar
bvoice360
Traffic Manager
Traffic Manager
Posts: 192
Joined: 22 Sep 2013 12:51
Location: Somewhere in Kent

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

Post by bvoice360 »

Well there is one cargo that is not listed in the GS, because there are 31 cargoes contained in FIRS but only 30 slots in the debug menu.



Also, my only gripe with this one is that it merges the two industrial categories together, even though it is set not to do that
Reichsbahn
Engineer
Engineer
Posts: 28
Joined: 26 Dec 2007 16:20

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

Post by Reichsbahn »

Hello,

maybe this is a noob question, but I cannot find the answer anywhere:
I dont know at all what I must do with this " Renewed_City_Growth-5.tar.gz " file !

Can somebody help me? I am not a programmer!
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: thesasgeek and 10 guests