Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Sat Sep 23, 2017 6:06 pm

All times are UTC




Post new topic  Reply to topic  [ 19 posts ] 
Author Message
 Post subject: [GS] CityController v7
PostPosted: Sun Mar 23, 2014 2:01 pm 
Offline
Engineer
Engineer

Joined: Sat Nov 09, 2013 12:19 am
Posts: 41
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]

Attachment:
File comment: example with goals
exe4.png
exe4.png [ 128.7 KiB | Viewed 9178 times ]

Attachment:
File comment: examples
examples.png
examples.png [ 99.43 KiB | Viewed 9174 times ]



Download
Attachment:
File comment: ctct-v7
ctct-v7.zip [26.5 KiB]
Downloaded 217 times



Version history

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.


Last edited by hpfx on Sun May 24, 2015 12:08 pm, edited 27 times in total.

Top
   
 Post subject: Re: [GS] CityControl
PostPosted: Sun Mar 23, 2014 2:02 pm 
Offline
Engineer
Engineer

Joined: Sat Nov 09, 2013 12:19 am
Posts: 41
Non linear growing rate graph :
Attachment:
File comment: curves example
courbes1.png
courbes1.png [ 12.77 KiB | Viewed 9569 times ]


Top
   
PostPosted: Sat May 17, 2014 10:51 pm 
Offline
Engineer
Engineer

Joined: Wed Apr 23, 2014 2:23 pm
Posts: 21
Pretty cool Gs you have there : ]

Btw, would future builds allow for editing the None liniar grow rate curve?


Top
   
PostPosted: Mon Aug 18, 2014 2:58 pm 
Offline
Engineer
Engineer

Joined: Sat Dec 11, 2010 5:44 pm
Posts: 10
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


Top
   
PostPosted: Fri Aug 22, 2014 11:12 am 
Offline
Transport Coordinator
Transport Coordinator

Joined: Wed Apr 14, 2004 3:18 pm
Posts: 312
Location: Fr
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.


Top
   
PostPosted: Sat Aug 30, 2014 3:33 pm 
Offline
Engineer
Engineer

Joined: Sat Nov 09, 2013 12:19 am
Posts: 41
Hi,
thank you for your post,
Damrus wrote:
Btw, would future builds allow for editing the None liniar grow rate curve?

Not at the moment, maybe later, but that's not easy.
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...)

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.

Changing difficulty makes harder/easier to make your towns growing.
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.

Mojhave wrote:
Second, is there a bonus for delivering more than one cargo?

If you deliver cargo that is not (yet) required, there are no bonus.
you must first unlock cargo, that's the chalange of this script.

Bonus is given on delivering all expected cargos (at medium level).


Top
   
PostPosted: Sun Sep 13, 2015 5:48 am 
Offline
Engineer
Engineer

Joined: Wed Sep 27, 2006 6:04 pm
Posts: 74
I seem to have found a bug:
Code:
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.

More information and/or savegame available upon request.


Top
   
PostPosted: Sun Sep 13, 2015 1:57 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Wed Dec 29, 2010 7:36 pm
Posts: 336
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.


Top
   
PostPosted: Sun Sep 13, 2015 2:50 pm 
Offline
Engineer
Engineer

Joined: Wed Sep 27, 2006 6:04 pm
Posts: 74
@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!


Top
   
PostPosted: Mon Sep 14, 2015 3:28 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4532
Location: /home/sweden
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)


Top
   
PostPosted: Mon Sep 14, 2015 3:58 pm 
Offline
Engineer
Engineer

Joined: Wed Sep 27, 2006 6:04 pm
Posts: 74
@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.


Top
   
PostPosted: Thu Sep 17, 2015 12:40 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Wed Dec 29, 2010 7:36 pm
Posts: 336
lcd_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.


That would be for http://bugs.openttd.org/ then
But last time i check the provide linux binaries was having it, must be distro specific, something for their own bugzilla so


Top
   
PostPosted: Thu Sep 17, 2015 12:46 pm 
Offline
Engineer
Engineer

Joined: Wed Sep 27, 2006 6:04 pm
Posts: 74
@krinn I'm compiling from sources, thus no distro to whine at. :)


Top
   
PostPosted: Thu Sep 17, 2015 1:14 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Wed Nov 07, 2007 10:44 pm
Posts: 9019
Location: Sol d
lcd_47 wrote:
@krinn I'm compiling from sources, thus no distro to whine at. :)

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.

_________________
Image
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


Top
   
PostPosted: Thu Sep 17, 2015 1:36 pm 
Offline
Engineer
Engineer

Joined: Wed Sep 27, 2006 6:04 pm
Posts: 74
planetmaker wrote:
r27399 should fix this.


It does, thank you!


Top
   
PostPosted: Sat Oct 24, 2015 12:55 pm 
Offline
Chairman
Chairman
User avatar

Joined: Sat Jan 18, 2014 6:10 pm
Posts: 883
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:
Attachment:
cityctrl.jpg
cityctrl.jpg [ 131.08 KiB | Viewed 4443 times ]


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 28 times

_________________
My experimental openTTD server: 149.156.194.203:3979 non-standard client, now testing: JGRPP-0.19.0 http://tiny.pl/ggnch
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, preindustrial houses, wired, ECS industry extension.
Top
   
PostPosted: Thu Nov 05, 2015 2:06 pm 
Offline
Chairman
Chairman
User avatar

Joined: Sat Jan 18, 2014 6:10 pm
Posts: 883
hpfx 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.

I found, that even on very easy level it is hard to initialise town growth, in case of small towns
(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:
if ( (GSTile.GetTerrainType(GSTown.GetLocation(town)) == GSTile.TERRAIN_SNOW) && (GSTown.GetLastMonthReceived(town, GSCargo.TE_FOOD)==0) )  /* snow line, food req     */
   {
      impact/=10;
   }

If food is not delivered during winter, regardless to other cargoes level and acceptance, growth will be suppressed (I divided by 10 to estimate, how large is original impact).

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:
impact*=(3+GSTown.GetRoadReworkDuration(town))/3;

If impact factor is just below town population, it would give burst of new houses.
At least this silly option is use-able :)

_________________
My experimental openTTD server: 149.156.194.203:3979 non-standard client, now testing: JGRPP-0.19.0 http://tiny.pl/ggnch
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, preindustrial houses, wired, ECS industry extension.


Top
   
PostPosted: Tue Dec 01, 2015 7:08 pm 
Offline
Chairman
Chairman
User avatar

Joined: Sat Jan 18, 2014 6:10 pm
Posts: 883
hpfx wrote:
Version 7

I think I found a bug, running your script on multiplayer server:
Code:
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

Seems, that it appear after company removal/bankruptcy.

any idea, how to fix it?


Top
   
PostPosted: Tue Sep 05, 2017 8:26 pm 
Offline
Engineer
Engineer

Joined: Sat Jul 22, 2017 9:40 pm
Posts: 7
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 !


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 19 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2017 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2017.
Hosted by Zernebok Hosting.