[GS] CityController v8
Moderator: OpenTTD Developers
[GS] CityController v8
Hello,
I would like to present you my Game Script : City Controller (CTCT)
Main behaviors
- Town growth based on cargo delivered. non-linear, dynamic rate (logarithm alike)
- Simple display on town screen (don't flood user with many figures, just highlight levels)
- Automatic and progressive cargo acceptance, based on installed newGRF, tested with ECS and FIRS (any economy mode)
- Two game types : collaborative or competitive [new V4]
- Town stabilizer (rebuild user buldozed town tile to avoid decreasing) [new V6]
Download
download in game
Version history
Version 8 (March 2023) Back in the game !!!
compatibility release, stay tune for better release...
- fix crash when no cargo recognized for unlocking, prevent future cases.
- fix do not rely on old cargo id anymore to recognize cargo
- town effect is not used by FIRS and ECS, better use cargo code
- recognize 2 new cargos : vehicle and farm supply
- display completion year for cargo unlock goals
- add "quick Achievement" option to make goals faster to achieve (divide goals quantities from 2 to 5)
Version 7 (May 2015 : rev 164)
- fix a small issue with town increase indicator when town no cargo are delivered.
Version 6 (August 2014 : rev 162)
- add city stabilizer : new option
- fix loading big map issue
Version 5 (May 2014 : rev 147)
- fix a bug at industry sign
- fix a bug at town funding
- change text color
Version 4 (April 2014 : rev 141)
- new game type : competition (claimed city)
- display company or manager name at claimed city
- add company goal for claimed city
- add leader notes on global goals
- fix a bug at industry sign
Version 3 (April 2014 : rev 127)
- new cargo mode : start with few cargo, unlock others.
- display town thresholds as global goals, show goal progress (checked twice a year)
- town goal scales on number of accepted cargos
- yearly update of map inhab/house.
Version 2 (April 2014 : rev 115)
- fix : avoid unwanted house creation on gameload
- better inhab per house computation
- smoother town growing
- now on bananas !
Version 1 (March 2014 : rev 103)
- non linear growing rate
- only 1 game type for now : "Every towns are free, Collaborative Town growing", other types will come later...
- compatible FIRS, ECS and builtin economies
- town cago acceptance : 3 modes
- display industry name option
- cargo bonus when all cargo types are delivered
- two languages : EN, FR
- based on Minimal GS 2 from Zuu
Notes
- non linear growing
see next post for picture.
we can have different kind of curves depending on cargo classes.
- town acceptance.
the script does not change cargo town acceptance,
it just change how it's took into account.
in normal mode, town will took into account only basic cargos (depending on newGRF)
when your town is growing it will took into account more and more cargo.
the number of accepted cargo depends on town size.
- unlocking cargos.
depending on mode you choose, you can play with every cargo unlocked from the begining, or with a progressive approach.
on progressive mode, cargos are unlock when a given number of town reach a given size.
- bonus.
by delivering all expected cargo type to a town, a growing bonus is given.
you can reach higher bonus by unlocking cargo to deliver.
- delivered cargo
Picked up cargo is not took into account, but only delivered to town does count.
in multiplayer, in collaborative mode (other mode aren't developed yet) : every player cargos are summed up for each town.
- stabilizer.
when user buldoze town tiles, city is decreasing, this script has option to avoid it.
if script detect the number of house difference and trigger an house creation.
Compatibility
- no dependancy required.
- scripts tested with each 4 builtin climats, FIRS (any economy), ECS vectors, and it will be compatible with upcoming ones, because it take towneffect cargo indicator.
- multiplayer compatible.
- savegame compatible.
- It's compatible with openttd v1.3 and higher : 1.4, 1.5, trunk...
note : if you play without economy newGRF, you will at least enjoy impact for valuable cargo.
Thank you.
I would like to present you my Game Script : City Controller (CTCT)
Main behaviors
- Town growth based on cargo delivered. non-linear, dynamic rate (logarithm alike)
- Simple display on town screen (don't flood user with many figures, just highlight levels)
- Automatic and progressive cargo acceptance, based on installed newGRF, tested with ECS and FIRS (any economy mode)
- Two game types : collaborative or competitive [new V4]
- Town stabilizer (rebuild user buldozed town tile to avoid decreasing) [new V6]
Download
download in game
Version history
Version 8 (March 2023) Back in the game !!!
compatibility release, stay tune for better release...
- fix crash when no cargo recognized for unlocking, prevent future cases.
- fix do not rely on old cargo id anymore to recognize cargo
- town effect is not used by FIRS and ECS, better use cargo code
- recognize 2 new cargos : vehicle and farm supply
- display completion year for cargo unlock goals
- add "quick Achievement" option to make goals faster to achieve (divide goals quantities from 2 to 5)
Version 7 (May 2015 : rev 164)
- fix a small issue with town increase indicator when town no cargo are delivered.
Version 6 (August 2014 : rev 162)
- add city stabilizer : new option
- fix loading big map issue
Version 5 (May 2014 : rev 147)
- fix a bug at industry sign
- fix a bug at town funding
- change text color
Version 4 (April 2014 : rev 141)
- new game type : competition (claimed city)
- display company or manager name at claimed city
- add company goal for claimed city
- add leader notes on global goals
- fix a bug at industry sign
Version 3 (April 2014 : rev 127)
- new cargo mode : start with few cargo, unlock others.
- display town thresholds as global goals, show goal progress (checked twice a year)
- town goal scales on number of accepted cargos
- yearly update of map inhab/house.
Version 2 (April 2014 : rev 115)
- fix : avoid unwanted house creation on gameload
- better inhab per house computation
- smoother town growing
- now on bananas !
Version 1 (March 2014 : rev 103)
- non linear growing rate
- only 1 game type for now : "Every towns are free, Collaborative Town growing", other types will come later...
- compatible FIRS, ECS and builtin economies
- town cago acceptance : 3 modes
- display industry name option
- cargo bonus when all cargo types are delivered
- two languages : EN, FR
- based on Minimal GS 2 from Zuu
Notes
- non linear growing
see next post for picture.
we can have different kind of curves depending on cargo classes.
- town acceptance.
the script does not change cargo town acceptance,
it just change how it's took into account.
in normal mode, town will took into account only basic cargos (depending on newGRF)
when your town is growing it will took into account more and more cargo.
the number of accepted cargo depends on town size.
- unlocking cargos.
depending on mode you choose, you can play with every cargo unlocked from the begining, or with a progressive approach.
on progressive mode, cargos are unlock when a given number of town reach a given size.
- bonus.
by delivering all expected cargo type to a town, a growing bonus is given.
you can reach higher bonus by unlocking cargo to deliver.
- delivered cargo
Picked up cargo is not took into account, but only delivered to town does count.
in multiplayer, in collaborative mode (other mode aren't developed yet) : every player cargos are summed up for each town.
- stabilizer.
when user buldoze town tiles, city is decreasing, this script has option to avoid it.
if script detect the number of house difference and trigger an house creation.
Compatibility
- no dependancy required.
- scripts tested with each 4 builtin climats, FIRS (any economy), ECS vectors, and it will be compatible with upcoming ones, because it take towneffect cargo indicator.
- multiplayer compatible.
- savegame compatible.
- It's compatible with openttd v1.3 and higher : 1.4, 1.5, trunk...
note : if you play without economy newGRF, you will at least enjoy impact for valuable cargo.
Thank you.
- Attachments
-
- ctct-v7.zip
- ctct-v7
- (26.5 KiB) Downloaded 663 times
Last edited by hpfx on 21 Mar 2023 22:11, edited 28 times in total.
Re: [GS] CityControl
Non linear growing rate graph :
Re: [GS] CityController v4
Pretty cool Gs you have there : ]
Btw, would future builds allow for editing the None liniar grow rate curve?
Btw, would future builds allow for editing the None liniar grow rate curve?
Re: [GS] CityController v4
Hi, gave this a try and it looks really nice. However, i couldn't quite figure what exactly happens when i change the difficulty. Second, is there a bonus for delivering more than one cargo?
thx
thx
Re: [GS] CityController v4
Hello,
there is a bonus when town is expecting 3 cargos for example, and if you delivers 3 cargo a bonus is provided.
But not more, I think you have to unlock new cargo first.
there is a bonus when town is expecting 3 cargos for example, and if you delivers 3 cargo a bonus is provided.
But not more, I think you have to unlock new cargo first.
Re: [GS] CityController v4
Hi,
thank you for your post,
By the way it took months of playing to adjust rate and curve : it make passenger interresting to start with, but you need to focus on goods to have your town growing more... and so on. (depends on ecs-vector/firs...)
setting to very hard will require you to deliver much more to allow your town growing.
And btw, as it's non linear it's even harder when your town is getting bigger.
you must first unlock cargo, that's the chalange of this script.
Bonus is given on delivering all expected cargos (at medium level).
thank you for your post,
Not at the moment, maybe later, but that's not easy.Damrus wrote:Btw, would future builds allow for editing the None liniar grow rate curve?
By the way it took months of playing to adjust rate and curve : it make passenger interresting to start with, but you need to focus on goods to have your town growing more... and so on. (depends on ecs-vector/firs...)
Changing difficulty makes harder/easier to make your towns growing.Mojhave wrote:Hi, gave this a try and it looks really nice. However, i couldn't quite figure what exactly happens when i change the difficulty.
setting to very hard will require you to deliver much more to allow your town growing.
And btw, as it's non linear it's even harder when your town is getting bigger.
If you deliver cargo that is not (yet) required, there are no bonus.Mojhave wrote: Second, is there a bonus for delivering more than one cargo?
you must first unlock cargo, that's the chalange of this script.
Bonus is given on delivering all expected cargos (at medium level).
Re: [GS] CityController v7
I seem to have found a bug:
More information and/or savegame available upon request.
Code: Select all
dbg: [script] [18] [S] Your script made an error: wrong number of parameters
dbg: [script] [18] [S]
dbg: [script] [18] [S] *FUNCTION [extendWithCargo()] city_controller-7/towns.nut line [371]
dbg: [script] [18] [S] *FUNCTION [checkNextCargo()] city_controller-7/towns.nut line [337]
dbg: [script] [18] [S] *FUNCTION [HalfAYear()] city_controller-7/main.nut line [222]
dbg: [script] [18] [S] *FUNCTION [Start()] city_controller-7/main.nut line [86]
dbg: [script] [18] [S]
dbg: [script] [18] [S] [info] INSTANCE
dbg: [script] [18] [S] [user] true
dbg: [script] [18] [S] [type] 3
dbg: [script] [18] [S] [rate] 5
dbg: [script] [18] [S] [nbtown] 30
dbg: [script] [18] [S] [limite] 21000
dbg: [script] [18] [S] [cargo] 29
dbg: [script] [18] [S] [this] INSTANCE
dbg: [script] [18] [S] [added] TABLE
dbg: [script] [18] [S] [nbtown] 30
dbg: [script] [18] [S] [all_towns] INSTANCE
dbg: [script] [18] [S] [nbtoreach] 1
dbg: [script] [18] [S] [limite] 21000
dbg: [script] [18] [S] [this] INSTANCE
dbg: [script] [18] [S] [this] INSTANCE
dbg: [script] [18] [S] [month] 1
dbg: [script] [18] [S] [year] 2036
dbg: [script] [18] [S] [current_date] 743637
dbg: [script] [18] [S] [loop_start_tick] 1482
dbg: [script] [18] [S] [last_loop_date] 743632
dbg: [script] [18] [S] [this] INSTANCE
dbg: [script] The script died unexpectedly.
Re: [GS] CityController v7
lcd_47
when API change, a compatiblity script is use to let "older" script/ai running with "old" api feature.
so if you lack the compatibility script file, the needed changes aren't set, and script will use new api feature using old style, and crash.
you should seen at start (in console log) a "missing compatibility version 1.x" message, way to fix that is make sure your package is using the needed file.
look for game/compat_1.x.nut files (take it from any packages, well, take it from a linux version or source as windows version may have an installer and may have its files pack into some installer exe)
Where these files should be put depend on your arch, so i couldn't tell you (i think the openttd wiki have an entry telling you per arch directory/location).
If you are totally lost : if the script allow you to disable news (in its options), ask the script to stop trigger a news item to avoid the crash ; or wait for hpfx to add support 1.5 gs api.
when API change, a compatiblity script is use to let "older" script/ai running with "old" api feature.
so if you lack the compatibility script file, the needed changes aren't set, and script will use new api feature using old style, and crash.
you should seen at start (in console log) a "missing compatibility version 1.x" message, way to fix that is make sure your package is using the needed file.
look for game/compat_1.x.nut files (take it from any packages, well, take it from a linux version or source as windows version may have an installer and may have its files pack into some installer exe)
Where these files should be put depend on your arch, so i couldn't tell you (i think the openttd wiki have an entry telling you per arch directory/location).
If you are totally lost : if the script allow you to disable news (in its options), ask the script to stop trigger a news item to avoid the crash ; or wait for hpfx to add support 1.5 gs api.
Re: [GS] CityController v7
@krinn There seems to be an installation problem with one of the patches I'm using, but your post pointed me in the right direction. Thank you for the hints!
Re: [GS] CityController v7
Furthermore you should not grab the compat files from a random OpenTTD version, but the same one as you installed. Both a newer and an older may cause trouble. This is why these files must not be placed in the shared script directory in Docements\OpenTTD (or equivalent in your OS). But should reside in the installation folder of that OpenTTD version.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: [GS] CityController v7
@Zuu Sadly, they are not installed on Linux. For what it's worth: make install creates a folder bundle that contains, among other things, ai/compat_*.nut and game/compat_*.nut, but only ai/compat_*.nut are actually installed. Copying bundle/game to /usr/local/share/games/openttd solves the problem.
Re: [GS] CityController v7
That would be for http://bugs.openttd.org/ thenlcd_47 wrote:@Zuu Sadly, they are not installed on Linux. For what it's worth: make install creates a folder bundle that contains, among other things, ai/compat_*.nut and game/compat_*.nut, but only ai/compat_*.nut are actually installed. Copying bundle/game to /usr/local/share/games/openttd solves the problem.
But last time i check the provide linux binaries was having it, must be distro specific, something for their own bugzilla so
Re: [GS] CityController v7
@krinn I'm compiling from sources, thus no distro to whine at. 

- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: [GS] CityController v7
Excellent find, it went unnoticed for years. r27399 should fix this. The 'install' target indeed never ever seemed to install the game dir. Distros probably do their own stuff there anyway, using the pre-built bundle and not caring about our own install target.lcd_47 wrote:@krinn I'm compiling from sources, thus no distro to whine at.
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: [GS] CityController v7
It does, thank you!planetmaker wrote:r27399 should fix this.
Re: [GS] CityController v7
Interesting and challenging script.
Maybe a little bit to much challenging (maybe it is my fault, playing with ECS without ECS town - no tourist available in town but counted).
It is hard to get four 11k towns, because there are often 'deadlocks' - town is not growing because there is no sufficient pass/mail,
there is no sufficient pass/mail because town is too small.
Is 'fund buildings' option working? Maybe funding buildings would decrease temporarily amount of required cargo, for example 50% less?
If town (or cluster of towns) is 'deadlocked', it would be the option to jump off.
Another question concern goal window - one town reach 11k, but there is still [0%] of goal reached: Is it a bug?
Save game is attached, all newgrfs are available online.
EDIT: not a bug, it was not refreshed or smth.
Maybe a little bit to much challenging (maybe it is my fault, playing with ECS without ECS town - no tourist available in town but counted).
It is hard to get four 11k towns, because there are often 'deadlocks' - town is not growing because there is no sufficient pass/mail,
there is no sufficient pass/mail because town is too small.
Is 'fund buildings' option working? Maybe funding buildings would decrease temporarily amount of required cargo, for example 50% less?
If town (or cluster of towns) is 'deadlocked', it would be the option to jump off.
Another question concern goal window - one town reach 11k, but there is still [0%] of goal reached: Is it a bug?
Save game is attached, all newgrfs are available online.
EDIT: not a bug, it was not refreshed or smth.
- Attachments
-
- McTest59, 15th Sep 1963.sav
- (1.53 MiB) Downloaded 235 times
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.
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.
Re: [GS] CityController v4
I found, that even on very easy level it is hard to initialise town growth, in case of small townshpfx wrote: Changing difficulty makes harder/easier to make your towns growing.
...
And btw, as it's non linear it's even harder when your town is getting bigger.
(not sufficient to grow with pax/mail generated itself).
Maybe there should be a minimal offset of impact to help small towns growing?
Another issue - in arctic climate there is disambiguation - town above snow line, without food, display 'no growth', but is growing.
I propose to fix it in towns.nut:
Code: Select all
if ( (GSTile.GetTerrainType(GSTown.GetLocation(town)) == GSTile.TERRAIN_SNOW) && (GSTown.GetLastMonthReceived(town, GSCargo.TE_FOOD)==0) ) /* snow line, food req */
{
impact/=10;
}
Another proposal is to give player opportunity to make pulse growth, if town is stalled.
My first idea was to use 'fund buildings', but have no idea how to check it on GS level.
Currently I'm using 'fund local road reconstruction':
Code: Select all
impact*=(3+GSTown.GetRoadReworkDuration(town))/3;
At least this silly option is use-able

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.
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.
Re: [GS] CityController v7
I think I found a bug, running your script on multiplayer server:hpfx wrote: Version 7
Code: Select all
dbg: [script] [18] [S] Your script made an error: the index '2' does not exist
dbg: [script] [18] [S]
dbg: [script] [18] [S] *FUNCTION [endorse_RemoveHQ()] .openttd/game/TileLabel-CityCotroller/companies.nut line [140]
dbg: [script] [18] [S] *FUNCTION [DelCompany()] .openttd/game/TileLabel-CityCotroller/companies.nut line [33]
dbg: [script] [18] [S] *FUNCTION [HandleEvents()] .openttd/game/TileLabel-CityCotroller/main.nut line [213]
dbg: [script] [18] [S] *FUNCTION [Start()] .openttd/game/TileLabel-CityCotroller/main.nut line [116]
dbg: [script] [18] [S]
dbg: [script] [18] [S] [cid] 2
dbg: [script] [18] [S] [this] INSTANCE
dbg: [script] [18] [S] [cid] 2
dbg: [script] [18] [S] [this] INSTANCE
dbg: [script] [18] [S] [deadcompany] 2
dbg: [script] [18] [S] [ev_type] 11
dbg: [script] [18] [S] [ev] INSTANCE
dbg: [script] [18] [S] [this] INSTANCE
dbg: [script] [18] [S] [loop_start_tick] 39361
dbg: [script] [18] [S] [last_loop_date] 713953
dbg: [script] [18] [S] [this] INSTANCE
any idea, how to fix it?
Re: [GS] CityController v7
Hello,
I play with your script and I really apprciate it, thanks
I recently tried the "WIRES" and "FIRS" grf but when I deliver electricity (produce like 4MW with alcool), the city grwoth too much. With only electricity of an powerplant, the city growth up to 15 000 pop. It's really too easy to growth a city with this kind of ratio.
I don't know if it's a problem from your grf, WIRES or FIRS one but the mix of this three break the growth city system.
Thanks again for your work !
I play with your script and I really apprciate it, thanks

I recently tried the "WIRES" and "FIRS" grf but when I deliver electricity (produce like 4MW with alcool), the city grwoth too much. With only electricity of an powerplant, the city growth up to 15 000 pop. It's really too easy to growth a city with this kind of ratio.
I don't know if it's a problem from your grf, WIRES or FIRS one but the mix of this three break the growth city system.
Thanks again for your work !
Re: [GS] CityController v7
Is this still compatible with 1.7.1? Cause I used to play with it in 1.6 and had no problems afaik.
Who is online
Users browsing this forum: No registered users and 1 guest