[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
Lafiir
Engineer
Engineer
Posts: 8
Joined: 05 Feb 2015 11:44

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

Post by Lafiir »

You don't really need to download it from the forums.
The best way to install everything correctly is to run OTTD, click CheckOnlineContent, search for renewed and click Download.
After that, open GameScriptSettings, select the script and configure it to your liking.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

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

Post by Alberth »

Reichsbahn wrote:I dont know at all what I must do with this " Renewed_City_Growth-5.tar.gz " file !
Throw it into your archive unpacker program. You can convert it either to a .tar file, or unfold it fully to a directory ( .tar is easier, as it's a single file, instead of a directory with a lot of stuff in it).
That result must be put in your 'script' directory for game scripts. Consult the 'readme.txt' file that you got with OpenTTD where that is (I don't know where Windows stores that, so I cannot tell you.)
Being a retired OpenTTD developer does not mean I know what I am doing.
Reichsbahn
Engineer
Engineer
Posts: 28
Joined: 26 Dec 2007 16:20

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

Post by Reichsbahn »

Thanks to Lafiir for the answer, this helped me! :bow:
User avatar
Eli Barracuda
Engineer
Engineer
Posts: 5
Joined: 28 May 2015 17:13

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

Post by Eli Barracuda »

Hello, Im new to the fourms and I just wanted to ask if it would be feesable to add industry labels to each industry. I've seen this in other scripts and it helps with finding industries amongs other ground scatter. Such as FIRS's stores(grocery store is the biggest offender) Which can be hidden behind buildings a such.
Wahazar
Tycoon
Tycoon
Posts: 1451
Joined: 18 Jan 2014 18:10

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

Post by Wahazar »

Hello, seems that there is bug:
sometimes city is shrinking despite of huge amounts of cargo delivered - town sign claims high growth rate, but instead this, population slowly drops and more and more empty spaces appears.
For example:
Image
and 30 years later:
Image

I suspect, that there is counter overflow, if large amount of cargo is supplied to the town.
Formerly known as: McZapkie
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, wired, ECS industry extension, V4 CEE train set, HotHut.
Another favorite games: freeciv longturn, OHOL/2HOL.
User avatar
supermop
Tycoon
Tycoon
Posts: 1104
Joined: 21 Feb 2010 00:15
Location: Fitzroy North - 96

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

Post by supermop »

I've had the same thing happen in a recent game with manpower industries and RCG. One city is getting 1000s of units every month and says grows every 9 days, but is being surpassed by other cities receiving 10s of units...
Attachments
Järvelä Transport, 1997-06-22.sav
(206.56 KiB) Downloaded 162 times
Wahazar
Tycoon
Tycoon
Posts: 1451
Joined: 18 Jan 2014 18:10

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

Post by Wahazar »

supermop, this city is Jarvela?

Interestingly, town is stuck even without game script (I checked local save from network game).
User avatar
supermop
Tycoon
Tycoon
Posts: 1104
Joined: 21 Feb 2010 00:15
Location: Fitzroy North - 96

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

Post by supermop »

Yes, Jarvela, It grew very briefly in first few years of the game but since then has not expanded along any provided road stumps, whereas Salo grows voraciously.
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 »

Looks there's some stuff to solve.

Sorry guys, I was completely stuck with my work and somehow forgot OTTD for a while.

Summer being here, I'll try to come back on this. Step by step. :wink:
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.
paulicus25
Engineer
Engineer
Posts: 102
Joined: 13 Sep 2007 14:26

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

Post by paulicus25 »

I have a couple of questions I would like to ask about how the intricacies of this script work for game play reasons.

Firstly, i congratulate you on such an amazing script. I am playing with this script for the first time whilst also making my début foray into FIRS as well as Cargo Destinations (passengers and mail only) and the combination of the three completely redefine and refresh playing openttd.

The main question I wish to ask is how to work out whether or not delivering a cargo will count towards the towns limits before actually trying to deliver it. I.e. how does the town define whether or not it counts the cargo as growth benefiting.

Take for example a small town with a FIRS brewery nearby. This brewery accepts fruit, which counts as 'general food', and makes food. How do I know whether the brewery/station I build is close enough to the town for the fruit which would be delivered to the industry to count towards the towns general food requirements and therefore not need to link the town up with a food route from the brewery? And is this distance fixed? Do I just have to deliver to an industry named after the town? Do I need to be in catchment area of a minimum of one house from the town? Do I need to be in catchment area of the square with the town name on? Is there a set number of squares distance? If so does this change as the town grows? Does it work by having the station on land owned by the town? How does this work?

Secondly, when a town gets big enough to accept a new category of cargo, does all town growth cease until this category is fulfilled or is this simply an extra opportunity to fuel growth even further? Is maximum town population capped unless you deliver specific cargoes or can it continue to grow at the same rate no matter if you fail to deliver the new categories?

If you could give guidance on how to make judgements on this that would be great, as it makes a difference on the decisions that I make during the course of the game. Thanks
arikover
Route Supervisor
Route Supervisor
Posts: 466
Joined: 15 Jun 2007 09:27
Skype: madchimiste
Location: Berlin, Deutschland

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

Post by arikover »

Amazing Game Script, I always play with it.

I'd like to report a bug, even though it's not the script's fault: with recent updates of FIRS, a lot of cargos changed in Basic Economies (Beans instead of Grain in Tropic climate, for instance). Of course Renewed City Growth doesn't recognize those cargos, so they don't help grow the cities anymore. It's not really a big problem, because there are a lot of cargo in FIRS, so the script is playable, but it is still a bug, isn't it?
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 »

arikover wrote:Amazing Game Script, I always play with it.

I'd like to report a bug, even though it's not the script's fault: with recent updates of FIRS, a lot of cargos changed in Basic Economies (Beans instead of Grain in Tropic climate, for instance). Of course Renewed City Growth doesn't recognize those cargos, so they don't help grow the cities anymore. It's not really a big problem, because there are a lot of cargo in FIRS, so the script is playable, but it is still a bug, isn't it?
Well, I would more speak of a sort of "missconduct" (does this word exists in english ?) or "compatibility problem". RCG is built against some industry sets, in the state they are at some point of their development. If the sets changes their cargo labels, RCG should theorically be updated. And since I can't find time ATM to work on this, the script maybee sticks on some old versions.

Though, it's not a big deal to change the code to adapt to industry sets changes. It just needs some looks in the code and minor changes. Maybee I find time to that.
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
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 »

paulicus25 wrote:Firstly, i congratulate you on such an amazing script. I am playing with this script for the first time whilst also making my début foray into FIRS as well as Cargo Destinations (passengers and mail only) and the combination of the three completely redefine and refresh playing openttd.
Glad you like it. :D
paulicus25 wrote:The main question I wish to ask is how to work out whether or not delivering a cargo will count towards the towns limits before actually trying to deliver it. I.e. how does the town define whether or not it counts the cargo as growth benefiting.
Each town has requirements for each cargo category. If the cargo you bring there fits to the requirements, it counts for growth. If the cargo exceeds requirements, the exceeding part is not taken in count.
paulicus25 wrote:Take for example a small town with a FIRS brewery nearby. This brewery accepts fruit, which counts as 'general food', and makes food. How do I know whether the brewery/station I build is close enough to the town for the fruit which would be delivered to the industry to count towards the towns general food requirements and therefore not need to link the town up with a food route from the brewery?
Actually, I never asked myself the question that way. For what I understand the code, each industry "belongs" to a town, which can be known by just cheking its name, like: "Paris brewery", "London's Livestock yard". I assume that this is enough to consider that the deliveries to such industry can be considered as a delivery to the town, and when I were working on the code, this conception was never contradicted by my observation. That's the best I can tell on this.
paulicus25 wrote:And is this distance fixed? Do I just have to deliver to an industry named after the town? Do I need to be in catchment area of a minimum of one house from the town? Do I need to be in catchment area of the square with the town name on? Is there a set number of squares distance? If so does this change as the town grows? Does it work by having the station on land owned by the town? How does this work?
That's to many questions, which let's me think you're to nervous. Did you have observations that contradicted the intuitive way of playing ? ;)

paulicus25 wrote:Secondly, when a town gets big enough to accept a new category of cargo, does all town growth cease until this category is fulfilled or is this simply an extra opportunity to fuel growth even further? Is maximum town population capped unless you deliver specific cargoes or can it continue to grow at the same rate no matter if you fail to deliver the new categories?
No, growth doesn't stop. Each cargo category counts only for a part of growing potential, so that if a new cargo category type is needed, and you don't deliver it, growth will just start decreasing in respect to its best potential growth rate, but still grow. But, more it grows, more the new cargo type is needed, and so with time ongoing and the town growing, grow will finally stop (which means: be extremely low).
paulicus25 wrote:If you could give guidance on how to make judgements on this that would be great, as it makes a difference on the decisions that I make during the course of the game. Thanks
[/quote]

I hope I answered to most of your questions. If something still isn't clear, just tell me. ;)
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.
paulicus25
Engineer
Engineer
Posts: 102
Joined: 13 Sep 2007 14:26

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

Post by paulicus25 »

Thanks for the info. Its rather useful.

However the main thing I really wanted to know most out of the whole list of questions was the bit about how whether or not delivering something to a specific location is determined to be delivering it to the town.

Since posting I have taken a risk in my game (something which my instinctive gut feeling tells me never to do - risks are bad!) and decided to terminate the food supply to the town adjacent to the brewery in the hope that the fruit being dropped off at the brewery counts towards the food count. To my surprise after a long while, it does, even though said fruit is not consumed by the town but is turned into food which I can subsequently take somewhere else...which I did. My surprise is mainly since the brewery is a whopping 26 squares way from the town centre square (y'know the one with the name over it) and the station is 28! That's quite a distance! See Below! Sorry about the image. Still havent perfected turning it into a link yet. Please advise.

Image

The overall picture is clear in this case - delivering to that station was enough. BUT by that point the town had expanded so that it had almost encompassed the brewery. So is the acceptance due to the fruit being supplied to the brewery, the nearness of the station to the town centre, by delivering within catchment range of a house which was built and owned by the town, or simply by the station being on a square of land owned by the town? Or is it some other reason that I have yet to notice? Summary: I still have not worked out how the game works out whether a delivery counts to the target or not.

Which, considering I play Openttd with a 'plan the entire network out before laying any pieces of track' agenda (normally pretty easy since I've been playing since OTT), is somewhat of an unwanted unknown factor. Kind of like rolling a dice to find out whether you make a profit or not.

Guess atm I just have to take those risks and hope the rest of my network can prop up my wild unrestrained spending! Now I just have to somehow figure out how to get a company rating of more than 900 whilst using cargo destinations without scrapping all my road vehicles, but that's not really a question for this 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 »

Industries effectively 'belong' to the closest town and, if cargo is delivered to an industry 'belonging' to a specific town, then it counts. It does not matter how far it is from the town centre as long as it is the closest town. Even delivering something to an industry at the opposite corner of a 4096x4096 map will count if there is only one town
bouchacha
Engineer
Engineer
Posts: 14
Joined: 04 Dec 2015 03:47

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

Post by bouchacha »

McZapkie wrote:Hello, seems that there is bug:
sometimes city is shrinking despite of huge amounts of cargo delivered - town sign claims high growth rate, but instead this, population slowly drops and more and more empty spaces appears.
For example:
[snip]
I suspect, that there is counter overflow, if large amount of cargo is supplied to the town.
Does anyone know which version of FIRS this overflow bug happens 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 »

bouchacha wrote:Does anyone know which version of FIRS this overflow bug happens on?
I don't think this is related to FIRS. If it's an integer overflow in the supplies made to towns, that would be a game script issue.
And I think I see ECS industries in the screen shots in the quoted post.
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 »

Since v2.0 FIRS economies use dynamic cargo id assigment.

To avoid supplying cities with wood as food :) and other oddly behaviour, I modified code like this:
[+] Spoiler
/* returns integer id of cargo with given tag. If no such cargo tag in (0..31 range) returns 0 and writes to log. */
function CargoIdByLabel(label)
{
local i=0;
while ((GSCargo.GetCargoLabel(i)!=label)&&(i<32))
++i;
if (i<32)
return i;
else
{
Log.Info("Warning: game's cargo list differ from settings.", Log.LVL_INFO);
return 0;
}
}
function DefineCargosBySettings()
{
[skipped]
case(5): // FIRS - Firs Economy
::CargoCat <- [
// Pass&Mail
[
CargoIdByLabel("PASS"),
CargoIdByLabel("MAIL")
],
// Generic Food
[
CargoIdByLabel("BEER"),
CargoIdByLabel("FOOD"),
CargoIdByLabel("FRUT")
],
// Generic Goods
[
CargoIdByLabel("BDMT"),
CargoIdByLabel("GOOD"),
CargoIdByLabel("PETR")
],
// Raw Materials
[
CargoIdByLabel("AORE"),
CargoIdByLabel("CLAY"),
CargoIdByLabel("COAL"),
CargoIdByLabel("FISH"),
CargoIdByLabel("GRAI"),
CargoIdByLabel("IORE"),
CargoIdByLabel("LVST"),
CargoIdByLabel("MILK"),
CargoIdByLabel("OIL_"),
CargoIdByLabel("SCMT"),
CargoIdByLabel("FICR"),
CargoIdByLabel("SAND"),
CargoIdByLabel("GRVL"),
CargoIdByLabel("SGBT"),
CargoIdByLabel("WOOD"),
CargoIdByLabel("WOOL")
],
// Transformed Materials
[
CargoIdByLabel("RFPR"),
CargoIdByLabel("ENSP"),
CargoIdByLabel("FMSP"),
CargoIdByLabel("MNSP"),
CargoIdByLabel("STEL"),
CargoIdByLabel("RCYC"),
CargoIdByLabel("WDPR")
]];
This absolutely isn't a programming masterpiece, everythig done in a very straightforward way, and definitly there should be some way to do it right. But it looks to work fine :)
Lechuza
Engineer
Engineer
Posts: 16
Joined: 30 Oct 2014 01:33

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

Post by Lechuza »

My cities keep shrinking no matter what I do, is there an easy way to make it so towns never lose population? even if you stop supplying them?
Matze!
Engineer
Engineer
Posts: 3
Joined: 29 Feb 2016 00:32

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

Post by Matze! »

good Work
German Version Please :bow:
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: Michiel and 5 guests