Page 5 of 11

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

Posted: 26 Sep 2014 16:03
by Sylf
With the script I wrote, I let the player pick the lower threashold before the script takes over the growth control of the towns. I was too lazy to find the optimal number myself for all all different building grfs and their combinations.

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

Posted: 26 Sep 2014 16:09
by keoz
Sylf wrote:With the script I wrote, I let the player pick the lower threashold before the script takes over the growth control of the towns. I was too lazy to find the optimal number myself for all all different building grfs and their combinations.
Indeed, this limit should be configurable. Still having a default though. Something like pop. = 50 looks reasonable and should avoid the problem in most cases. If not enough, configuration would allow to deal with the problem.

Besides this, what I'm asking myself is if with configurations others of the one I use (for example, simply using OpenGFX), the actual scripts with its 10000 lowest town growth rate brings to a real shrink of medium/big towns.

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

Posted: 27 Sep 2014 14:05
by Wahazar
keoz wrote: Also: McZapie, If you have a savegame where a such city-decay is observed I would be interested in having it. If possible, both the savegames of initial and ending situation.
Here you are, save 2 year after beginning of multiplayer session (all cities above 0) and after 120 years - in this case, many towns have 0 or 5 inhabitants).

Probably it happens due to shop appearing and closure, but in older games I observed such shrinking also without shop.

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

Posted: 27 Sep 2014 17:50
by keoz
McZapkie wrote:Here you are, save 2 year after beginning of multiplayer session (all cities above 0) and after 120 years - in this case, many towns have 0 or 5 inhabitants).
Thank you.

I'll have a look in next days. Probably not that fast since I have less time last weeks, having started working again.

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

Posted: 30 Oct 2014 01:35
by Lechuza
Is this still in development? I tried using it with 1.4.4 but the only thing showing up in the Town Window is either if the town is not growing or in how many days it will grow, no other information is showing up. Thanks in advance! and keep up the great work!

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

Posted: 30 Oct 2014 10:18
by keoz
Lechuza wrote:Is this still in development? I tried using it with 1.4.4 but the only thing showing up in the Town Window is either if the town is not growing or in how many days it will grow, no other information is showing up. Thanks in advance! and keep up the great work!
Hi Lechuza. Yes, it is still in development, but atm, I don't have many time to work on it.

May I have a screenshot of your situation ?

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

Posted: 31 Oct 2014 15:43
by Lechuza
Sorry, the error was mine. It is now working as intended with FIRS, although I get a warning whenever I start a new map, but it seems to be working OK. Loving it! Thank you for making this :)

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

Posted: 31 Oct 2014 23:58
by romazoon
experienced a crahs with RCG.

i have just reloaded the game and after like 1 month, script is crashing. but i m not complaining, the script worked perfectly for 150 years :D

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

Posted: 06 Nov 2014 13:11
by keoz
romazoon wrote:experienced a crahs with RCG.

i have just reloaded the game and after like 1 month, script is crashing. but i m not complaining, the script worked perfectly for 150 years :D

Mmh ... i should never be 8, there... Strange. I'll look at that. Thanks for reporting. :)

So, 3 bugs to look on now. I really should go into all of this !

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

Posted: 07 Dec 2014 23:44
by Maddog45353
I'm getting crashes on huge map sizes anyone else encountering this with V4 of this game script it crashes on 4096x4096 map sizes haven't tested smaller than that yet.

Code: Select all

This script took too long to Save.

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

Posted: 08 Dec 2014 17:39
by keoz
Maddog45353 wrote:I'm getting crashes on huge map sizes anyone else encountering this with V4 of this game script it crashes on 4096x4096 map sizes haven't tested smaller than that yet.

Code: Select all

This script took too long to Save.
Well, the message is quite clear. If it takes too long to save, it means that there are to many towns and the necessary time to save datas is bigger than what is allowed by the game. It's the first time I seed this, though.

Note that the recent revisions (downloadable on OT) changed a lot since v4. You could try to use (dont forget to remove your original v4) it but I doubt the problem disappears.

Out of curiosity, how many towns do you have in your game ?

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

Posted: 10 Dec 2014 16:18
by Hafting
I tried this script with FIRS. I thought some of the towns wouldn't grow beyond a certain size - because they don't accept food. (I don't allow funding new industry.)

But even towns that only gets mail & passengers will grow - and grow fast. A size 1372 town grows every 138 days - despite being unable to process food - and I have never sent any goods there either. The town makes aluminium, but the ore & chemicals are neither "general food" nor "general goods".

AI players have grown a town to size 2348 with growth every 150 days - using only buses. No food, no goods. The only industry used there is a forest supplying a sawmill.

Is a difficulty setting of 80 "too easy?"

On the other hand, a size 666 town is hard to grow. It has stockpiled both passengers and food, and still only grow every 2551 days. Sitting on the edge of my world, it sometimes gets no passengers for a while. But when a train arrives, it gets stockpiles that lasts almost till the next train arrives.

It seems to me that the game is very sensitive to the passenger count, and don't care much about the other categories. If the passenger goal is met all the time, the town grows fast - even without any of the food or goods they want. A city that also gets food grows faster, but not much faster. So missing out on food - even completely - is no big deal. Occationally running out of passengers is a disaster.

I had hoped for a game where a complicated transport network was necessary for growth. Shouldn't growth stop when the city is big enough to demand food and don't get any?

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

Posted: 10 Dec 2014 18:03
by Wahazar
Hafting wrote: On the other hand, a size 666 town is hard to grow. It has stockpiled both passengers and food, and still only grow every 2551 days. Sitting on the edge of my world, it sometimes gets no passengers for a while. But when a train arrives, it gets stockpiles that lasts almost till the next train arrives.
[...]
Is a difficulty setting of 80 "too easy?"
[...]
I had hoped for a game where a complicated transport network was necessary for growth. Shouldn't growth stop when the city is big enough to demand food and don't get any?
1. Try to use frequent local buses, not only occasional train service.
Stockpile is not sufficient to count in case of huge but rare delivery.
Cargodist works fine with this script.

2. In my opinion, rather not. Try to expand city above 10000, here is example:
http://149.156.194.203/~mczapkie/Train/ ... S-city.png only 14k after 180 years of (not so intensive at the beginning) feeding.

BTW I'm not sure if city growth speed is taken into account.

3. AFAIK this script takes into account all cargoes with certain weights, therefore general food can be substituted by huge enough quantity other goods. If you want to have food mandatory, use subarctic climate.

BTW Keoz, I would like to tentatively remind about very small cities issue (to growth up to the 100 limit).

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

Posted: 12 Dec 2014 16:57
by Hafting
McZapkie wrote: 1. Try to use frequent local buses, not only occasional train service.
Stockpile is not sufficient to count in case of huge but rare delivery.
Cargodist works fine with this script.
That is ok. Busing are tricky in this case - the city was alone on a large island, the train was fetching passengers from a port on the other side, and ships did not come in that frequently either. But there is always the option of busing a few passengers from one side of town to the other.
McZapkie wrote: 3. AFAIK this script takes into account all cargoes with certain weights, therefore general food can be substituted by huge enough quantity other goods. If you want to have food mandatory, use subarctic climate.
Well, I just started a subarctic game. Some of the cities are above the snow line, and require food. A test city started at about 850. So I started the first train line with mail and passengers only. And my snowy city started to grow - weird. No food in the game yet, and the city grew from the steady supply of passengers. Soon, it passed 900.

Then I added a food train. Once it arrived, the city size jumped down to original size and grew from there. It is now 870.

Is the script compatible with arctic? Or are there now two competing growth mechanisms - the script and the food-driven arctic growth?
I have set the industry set to "FIRS:Arctic basic" in the script settings, in order to match the game wich is arctic with FIRS-arctic industry.

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

Posted: 13 Dec 2014 02:52
by Maddog45353
keoz wrote:
Maddog45353 wrote:I'm getting crashes on huge map sizes anyone else encountering this with V4 of this game script it crashes on 4096x4096 map sizes haven't tested smaller than that yet.

Code: Select all

This script took too long to Save.
Well, the message is quite clear. If it takes too long to save, it means that there are to many towns and the necessary time to save datas is bigger than what is allowed by the game. It's the first time I seed this, though.

Note that the recent revisions (downloadable on OT) changed a lot since v4. You could try to use (dont forget to remove your original v4) it but I doubt the problem disappears.

Out of curiosity, how many towns do you have in your game ?

Its random cause of settings i don't know the amount of citys on High it adds

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

Posted: 23 Dec 2014 11:35
by keoz
Fine.

A new revision (-r114) can be downloaded on the OT or directly from this link. Don't forget to erase all other older revisions in your directory. The gamescript will anyway succesfully load on old savegames.

This revision adresses the problem raised by arikover, about food and water being (originally) required in Tropical and Arctic climate for towns to grow. Those requirements are now disabled, so that town growth is now only managed by RCG and nothing else.

As usual, please address bugs on http://dev.openttdcoop.org/projects/gs-rcg/issues/new

@ romazoon. The source of the problem you raised looks quite clear. If the game is saved while the town-datas are being updated (when a new month is starting), datas are saved in an inconsistent way (old + new datas). This is generally not a big problem, except when the save occurs at one particular moment of data updating. Hence your crash. I'll have to think a way to solve this in a proper way. This might make it necessary some big rewriting of some parts of the code.

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

Posted: 23 Dec 2014 11:46
by romazoon
keoz wrote:This might make it necessary some big rewriting of some parts of the code.
sounds like a lot of work....for relatively little benefit (am i the only one that encoutered that bug?)

anyway, thanks for the last update.

merry christmas to you !

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

Posted: 23 Dec 2014 11:52
by keoz
romazoon wrote:
keoz wrote:This might make it necessary some big rewriting of some parts of the code.
sounds like a lot of work....for relatively little benefit (am i the only one that encoutered that bug?)
It will have to be done. A bug is still a bug and I want this to be bug free.
romazoon wrote:merry christmas to you !
Same to you :)

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

Posted: 23 Dec 2014 19:24
by krinn
It is easier than you think :)

1/ why it bug on index 8 cannot be found

Code: Select all

line 206: while (this.tgr_array[i] > 0)
tgr_array size is 8, so when <i> = 8 the bug is coming, <i> keep getting ++ in the loop, this works because when you reach the 8eme elements (tgr_array[7]) you set it to 0, so <i> couldn't reach 8, but if tgr_array[7] > 0 then <i> could get increment to 8 and bug trigger

2/ how to reproduce?
It is hard to reproduce it (except with a pause in between), but knowning openttd savegame issue, it is easy to guess where this appears.

Code: Select all

line 210 to 213: code tweak the value, so the array can indeed have its last element > 0
line 217-220 : code shift array, so last element is update with 0 (this is what prevent the bug)
Now if a user hit the savegame button in openttd while the code is after line 213 but before line 219 is at iteration number 8 (so the last item of the array), your array will be save as-is, so last element is still != 0
When user then load this game, the bug appears as last element is not 0

3/ Fix (2 ways, option b should fix existing buggy savegame)
a) Use a temp variable to prevent such issue happening
temp_tgr = copy of tgr_arrray
work only on temp_tgr
as soon as your work end, resend tgr_array =copy of temp_tgr
So if anyone save while not everything is done, tgr_array will remains untouch
b) when loading a savegame, set last element of tgr_array to 0 and discard the value of the loaded game.

Now just ask romazoon: do he have this bug after loading a savegame?
Xmas to you guys...

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

Posted: 23 Dec 2014 19:30
by PochyPoch
Hello ;)

This is my first post here but i play TTD since it came out when i was a young boy ! So first i'd like to thank all the people that made this game amazing across the years. And of course thanks to you Keoz for editing/making this script !

I have a few questions if you have time to answer them :
  • I read on the readme file some expert (or not) settings exist that i can't find in the gs config in openTTD. I also tried to read all the code and it seems you don't check those settings, so what about them ? "Merge categories", "Expert Settings", etc.
  • My initial intent was to customize a little your script settings to my likings. For example tuning which cargo goes into which category (i use ECS All Vectors), and maybe if the script allows it even split existing categories into more numerous ones. For example i'd like to have the power plant delivery for power purposes (coal/petrol) in a new category.
  • Also i'd like to remove everything not "final product" from the list of construction materials. Since i use ECS i would like to force players to deliver finished products to the Construction Sites.
  • In the same order of idea i'd like to have more advanced transformed goods cat after the town gets big enough : vehicles, tourists, gold...
So basically what would make me happy is being able to tune the categories number/names/cargos. I NEVER tried to edit/read a script for OpenTTD but i'm an experienced developer so i can tell your script should be very easy to understand if i was familiar with the language & the openTTD APIs. I will try to look into it.

What i am saying here is that i know there is a huge gap between code that would allow a developer to add/edit cargo cat and a finished configuration interface. I don't expect of you to create it for me, but maybe you could tell me if you think i have a chance to successfully edit cargo cats in the code, or if you have some spare time care to explain where i should look into the code to do it ?

I see in code comments you are french (or you forget a french comment from a previous fork ?), and i am too so maybe i can send you a PM ?

---

On a side note i would like talk about gameplay a little bit. I really like the idea of what you did (how you explain you need to cover local industries in first post).

However i am a bit sad, because even if i manage to create a "Power/Energy" category with Petrol/Coal for delivery to the power plant, if you supply a refinery & a GlassMaker in the town it would consider the task done.
So since i get a MegaWatt output from my Power Plants in ECS is there a way to increase the gamescript complexity to take that into account instead of pure cargo delivery ? Meaning actually checking a local industry output for town growth requirement instead of cargo. And having an appropriate UI in bottom of town window ?

On the same level it would also be nice to HAVE to deliver construction materials to the construction shops/industries after a certain town size. To simulate the fact you actually need constructing materials to construct builidings ^^

Is it doable to go into that with a gamescript ?

---

Anyway thanks for your time and your work and i wish you a merry christmas :)

EDIT : i try to alter the cargo list for each category first, by just removing the ones i dont want it cargo.nut around lines 125-130
I managed to create new cargo categories but i have an issue with the town window panel since GSText only allows for 20 parameters per string it stop displaying labels after the 6th category (3 num per cat). Not sure how i can fix this i will keep trying. If i add more than 6 {STRING3} parameters to the label it stop working. I would be happy to construct my string manually but it seems i am forced tu use a GSText object ??


Poch