[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

User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

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

Post by jfs »

OpenTTD aborting a GS that takes longer than some fixed amount of time to generate its savegame data is by design. It's impossible for OpenTTD to know whether the GS just has a lot of data to save, or if it has a bug that causes it to get stuck/infinite loop. Because of that, there has to be a limit somewhere where the GS is just assumed to be stuck. You could argue that the time limit should increase when the map size increases, I don't know if that happens but it could make sense to do.
abadger1999
Engineer
Engineer
Posts: 2
Joined: 02 Apr 2020 01:07

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

Post by abadger1999 »

Yep, commenting out the save and load code does fix the issue. Thanks!
User avatar
Boukev
Engineer
Engineer
Posts: 18
Joined: 13 May 2009 13:47
Location: Hengelo, Netherlands

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

Post by Boukev »

Firrel wrote: 08 Mar 2020 21:48 Hey all,

I have created a branch of this game script called Renewed Village Growth.
Hiya,


I am using your game script combined with FIRS on extreme mode and I am having tons of fun with it!
I do however get a bug on the town information window after population increase beyond 4000 and Raw industrial goods (cat 4) should start showing up on the town information part. it says " (too many parameters):0:0"
I am not sure if it is only a visual bug or also something else.

See the image for the bug.

Thanks anyway for this GameScript combo it is great!

*edit1* After some searching on the forum I found the bug. It is indeed visual with a max of xx number of strings for the town information panel. I'll assume it works as required with just a visual bug. Is there any other way I can track, cargo requirements per town?
Attachments
Bug on town information
Bug on town information
Capture.JPG (131.84 KiB) Viewed 5703 times
It takes either 1 train with 8 carriages or 500 cars to move 1000 people. Simple math.
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 Boukev,

Thank you for pointing it out. The RCG script was using all slots for town information that I did not know, it was limited and I added two new strings to it. So you are correct, it is only visual and all calculations should match. I will need to find a workaround as it cannot be easily fixed. So hopefully in the near future, I will upload a fixed version.

You can check the town requirements when you enable debug logging in game script settings in the game and open AI/Game Script Debug window. But it is not suited for tracking, as you will see.
User avatar
Boukev
Engineer
Engineer
Posts: 18
Joined: 13 May 2009 13:47
Location: Hengelo, Netherlands

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

Post by Boukev »

Thanks for the reply and the tip and all the work for this script. It has given openttd a new challenge which has renewed my joy for it.
It takes either 1 train with 8 carriages or 500 cars to move 1000 people. Simple math.
LaChupacabra
Route Supervisor
Route Supervisor
Posts: 385
Joined: 08 Nov 2019 23:54

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

Post by LaChupacabra »

Firrel wrote: 10 May 2020 16:10 I will need to find a workaround as it cannot be easily fixed. So hopefully in the near future, I will upload a fixed version.
I used to test probably all scripts and the problem with too many parameters I have seen in two of them: Balanced City Growth and City Buildier 111. In both scripts the authors somehow found a solution.

In CB, when the city begins to require more deliveries, the window layout changes.
06.1 Skrypt City Buildier.png
06.1 Skrypt City Buildier.png (70.1 KiB) Viewed 5635 times
In BCG this layout looks like this from the beginning.
04 Skrypt Balanced City Growth.PNG
04 Skrypt Balanced City Growth.PNG (37.41 KiB) Viewed 5635 times
Unfortunately, in both cases it does not look good and is very illegible.

I am not able to do more, but maybe just removing one of the required groups would be the solution? For example, Passengers and Post, whose transport will still be required.
I am sorry for may English. I know is bed.
User avatar
Boukev
Engineer
Engineer
Posts: 18
Joined: 13 May 2009 13:47
Location: Hengelo, Netherlands

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

Post by Boukev »

I assume both those solutions work because they changed all the data into one string thus reducing the amount of strings needed to below the limit.

One data string probably also means no additional formatting (colors etcetera) so that is why it looks that basic.

I have found the bug-report-window to have the required information so I can spot the issues that I don't understand just from playing.

*edit*
Wow! You already made an update! Much appreciated. Will try tonight.

*edit2*
Works like a charm :) Thanks
Last edited by Boukev on 13 May 2020 18:33, edited 2 times in total.
It takes either 1 train with 8 carriages or 500 cars to move 1000 people. Simple math.
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 »

Updated version of Renewed Village Growth v2 (RVG) is here.
Renewed_Village_Growth-2.tar
(95 KiB) Downloaded 344 times
Fixed issue with town text parameter count by scrolling categories.
Image

More information about changes in changelog.
changelog.txt
(925 Bytes) Downloaded 237 times
Attachments
town_scroll.png
town_scroll.png (94.79 KiB) Viewed 1885 times
User avatar
Korenn
Tycoon
Tycoon
Posts: 1735
Joined: 26 Mar 2004 01:27
Location: Netherlands
Contact:

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

Post by Korenn »

how does it scroll? automatically?

also: is there any way to remove the 'passengers' and 'mail ' lines from the default information? it's not very relevant information for 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 »

Korenn wrote: 13 May 2020 14:48 how does it scroll? automatically?
The category lines scroll every 5 game days by shifting by one line. It does not scroll faster because it could hinder the performance on big maps.
Korenn wrote: 13 May 2020 14:48also: is there any way to remove the 'passengers' and 'mail ' lines from the default information? it's not very relevant information for the GS.
It would be great if the default text could be altered. But it is not possible without altering the source code.
LaChupacabra
Route Supervisor
Route Supervisor
Posts: 385
Joined: 08 Nov 2019 23:54

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

Post by LaChupacabra »

Firrel wrote: 12 May 2020 23:02 town text parameter count by scrolling categories.
An interesting solution, but somehow I'm not convinced. This makes it difficult to observe the changes that occur at the beginning of the month. In addition, just when you want to look at something, the view will change.

Would that be difficult? Easy? I do not know, but I think the best option would be to add to the game the ability to show more information in city window. ;)
I am sorry for may English. I know is bed.
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 »

LaChupacabra wrote: 14 May 2020 00:01 An interesting solution, but somehow I'm not convinced. This makes it difficult to observe the changes that occur at the beginning of the month. In addition, just when you want to look at something, the view will change.
I understand it is not the ideal solution. I am opposed to not formatted text, even thought it would be an easier fix. First I want to explore other options. For now the game script is fully functional and can be iterated upon.

These are my other ideas:
1. Make the scrolling faster and independent of game days. This would require lot of testing, because the whole town info text is rewritten each time. This could lead to lower performance on high town count maps.
2. Switch between pax/mail transported and cargo categories. You will still not get all of the information at first glance, but you can check all categories at once.
3. Put pax/mail transported to town sign. But it would clutter the town sign. If you turn off the sign in gs parameters, we are back at the same problem.
4. Invest time into checking source code and modifying the parameter count / possibility to change default data. If got the time and successful, the earliest it would be in 1.11.
LaChupacabra wrote: 14 May 2020 00:01 Would that be difficult? Easy? I do not know, but I think the best option would be to add to the game the ability to show more information in city window. ;)
It was already discussed here:
Zuu wrote: 17 Aug 2014 22:26
Now it was some time ago I looked on this, but as far as I remember, raising this limit is non-trivial. Some script authors have worked this around by adding up strings and number as a raw text string and sending that to OpenTTD. That is not very pretty as you lose the capability to get translated strings by sending the data as parameter. Another way is to stay below the limit and if you need to display more, put that in in a story book page, a monthly news message or even as signs next to the town.

It have been suggested to allow a Town window to refer to a story page (click to show page) or add something similar as story page elements to the town window to work around the 20 parameter limit. There is also a limit on how long a string can be. I'm not really against these ideas, I even got some other ideas on related things, I just haven't had time to work on it more than the time I have put into creating the story book.
User avatar
Korenn
Tycoon
Tycoon
Posts: 1735
Joined: 26 Mar 2004 01:27
Location: Netherlands
Contact:

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

Post by Korenn »

Hi Firrel, I have a feature request. If it's too much work I'll fork and try and do it myself :)

I really like the generic way you've approached the cargo categories, but it results in all towns being the same-old same-old. I would love to see an option where for each town it picks a random *specific* cargo from each cargo category to request. This means each town will have its own 'personality' because they all want slightly different subsets of cargo to grow. You could try and hunt for the ideal town on the map for the local industries, or pick one that's much more of a challenge because it wants stuff you can only get from the other side of the map.

This selection could be done by explicitly storing the randomised choice per town, or by using a hash on relevant town data so it can be reconstructed on load.
As an added bonus, if there's only one cargo possible in a category it would default to displaying that instead of the cargo category.
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 forum thread for Renewed Village Growth (RVG) is moved to its specific page.

The latest release is version 3, which changes once again the way the town information is displayed and some minor tweaks. You can find it on BaNaNaS. Please let me know about bugs/tweaks in the new thread.
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 9 guests