[GS] Simple City Builder game script

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

Honza_
Engineer
Engineer
Posts: 109
Joined: 29 Aug 2010 10:29

[GS] Simple City Builder game script

Post by Honza_ » 20 Oct 2013 16:26

Novapolis team presenting:

Simple City Builder script

1. Claim a town by placing company headquaters
2. Deliver cargos and grow the town to the biggest population ever seen

Features
- When configured towns will require more cargos to grow
- Displays requirements in Town window and Goal window
- simulates the original OpenTTD growth mechanism

Settings
- spawning of some industries
- storage of delivered cargos
- Requirements, population at which cargo is required and storage decay of each cargo (up to 32 if defined, ECS and FIRS supported of course)
- pausing game on start in multiplayer
- place signs to mark cities
- place signs to mark claimed towns
- dynamic change of town growth
- limiting cities size

Future plans
- add more growth mechanics


== OVERVIEW ==
simplecb_settings.png
Settings
(42.98 KiB) Downloaded 1 time
simplecb_gui.png
Various gui details
(540.4 KiB) Downloaded 1 time
simplecb_town.png
Various gui details
(365.92 KiB) Downloaded 1 time

Available via game content or here for manual install http://bananas.openttd.org/en/gs/

Enjoy


== TRANSLATIONS ==
Global access for translations is enabled in openttdcoop Web translator. If anyone wishes kindly to contribute translation in any language, you can do so at:

https://translator.openttdcoop.org/proj ... builder-gs

If it does not let you, you will probably need to sign up as traslator here

https://translator.openttdcoop.org/



== UPDATES ==
On 04.10.2015 - new version
Language updates.

On 12.01.2015 - new version
Setting for limiting City population to maximum twice the biggest town
Maximum Goal Progress lines limited to 24
New languages
Added YETI cargos description to settings menu
Dynamic growth interval is changeable now and disabling it works
Fixes plural forms in english and czech language

On 11.05.2014 - new version
Fixed missing declaration
Fixed some bad calculations
Fixed some bad conditions
Fixed misspells in czech.lng

On 07.05.2014 - new version
Town::Service function is no more in bad scope, causing troubles.

On 27.04.2014 - new version
On bananas - changelog included
- Fixed save load crash bug

On 26.04.2014 - new version
On bananas - changelog included
- New growth style, funding buildings, storybook and more

On 08.11.2013 - new version
On bananas - changelog included

On 10.11.2013 - new version
Fixes some silly things of previous version
Last edited by Honza_ on 04 Oct 2015 12:25, edited 11 times in total.

User avatar
Phreeze
Route Supervisor
Route Supervisor
Posts: 506
Joined: 12 Feb 2010 14:30
Location: Luxembourg

Re: [GS] Simple City Builder game script

Post by Phreeze » 04 Nov 2013 15:35

does it work on single player too ?

(can't test atm, so i'm asking ;) )

fabca2
Transport Coordinator
Transport Coordinator
Posts: 312
Joined: 14 Apr 2004 15:18
Location: Fr

Re: [GS] Simple City Builder game script

Post by fabca2 » 04 Nov 2013 21:11

Hello,
I translated this nice script into french.
I could not perform any test, once I place french.txt on lang folder I have a message telling me that STR_GLOBAL_GOAL_CB does not exist, which is wrong of course.

This is well known when translated file is not in UTF8 format (see for example http://www.tt-forums.net/viewtopic.php? ... e#p1069046)

But this is not the case, file is UTF8 encoded.
And even worth, if I just copy english.txt into whatever.txt without even opening the file, I got exactly the same message!

It looks strange to me, I suppose it's not a bug (I'm using stable 1.3.2) it's probably something I didn't understood...
That's a little bit frustrating, it's my first translation attempt, if someone can help me.
Thank you.

whatever, I attached the file, it may works for you ?
Attachments
french.txt
the translated file (utf8)
(5.67 KiB) Downloaded 334 times

Honza_
Engineer
Engineer
Posts: 109
Joined: 29 Aug 2010 10:29

Re: [GS] Simple City Builder game script

Post by Honza_ » 04 Nov 2013 23:19

hi,
most likely you have some mistake in the file. When you remove the french.txt from lang folder, the script works. Unforunately AI console is not very helpful when looking for language file problem as far as I know.

You can locate the problem by removing some lines randomly and see if the error still appears.

fabca2
Transport Coordinator
Transport Coordinator
Posts: 312
Joined: 14 Apr 2004 15:18
Location: Fr

Re: [GS] Simple City Builder game script

Post by fabca2 » 04 Nov 2013 23:24

hi,
Honza_ wrote:hi,
most likely you have some mistake in the file. When you remove the french.txt from lang folder, the script works....
it could be, but I think you didn't paid attention to this :
fabca2 wrote:And even worth, if I just copy english.txt into whatever.txt without even opening the file, I got exactly the same message!
Which means, the file itself is probably not the only one culpit.
The test I made (after ruining 2 hours) : I totally remove my file, I just copy your english.txt into another file name (give the name you want, italian.txt french.txt dutch.txt or whatever.txt) run the game, create a new game.. crash.

Can you check on our PC if it behave the same ?
Thanks.

Honza_
Engineer
Engineer
Posts: 109
Joined: 29 Aug 2010 10:29

Re: [GS] Simple City Builder game script

Post by Honza_ » 05 Nov 2013 07:52

the script as it is on bananas works well. When I add your french.txt it crashes. => fix your french.txt

If you rename english.txt so there is no english.txt, I guess it wont work since english.txt is likely required always

fabca2
Transport Coordinator
Transport Coordinator
Posts: 312
Joined: 14 Apr 2004 15:18
Location: Fr

Re: [GS] Simple City Builder game script

Post by fabca2 » 05 Nov 2013 08:31

Honza_ wrote:If you rename english.txt so there is no english.txt, I guess it wont work since english.txt is likely required always
But did you try to COPY your english.txt into another language (without even opening it) ?

Honza_
Engineer
Engineer
Posts: 109
Joined: 29 Aug 2010 10:29

Re: [GS] Simple City Builder game script

Post by Honza_ » 05 Nov 2013 10:59

Problem is in your translation with STRINGx formats.
Study those

http://wiki.openttd.org/OpenTTDDevBlack ... al_strings

http://wiki.openttd.org/Format_of_langfiles

Honza_
Engineer
Engineer
Posts: 109
Joined: 29 Aug 2010 10:29

Re: [GS] Simple City Builder game script

Post by Honza_ » 12 Nov 2013 19:36

New version.
See first post.

juhawp
Engineer
Engineer
Posts: 1
Joined: 18 Nov 2013 15:02

Re: [GS] Simple City Builder game script

Post by juhawp » 18 Nov 2013 15:32

HI!

Sorry I'm new to this so these questions might sound stupid.

How can I deliver for example coal to the city (it doesn't accept it).

And what does "ECS and FIRS" mean?

User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9293
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: [GS] Simple City Builder game script

Post by planetmaker » 18 Nov 2013 15:40

juhawp wrote:HI!

Sorry I'm new to this so these questions might sound stupid.

How can I deliver for example coal to the city (it doesn't accept it).

And what does "ECS and FIRS" mean?
You deliver coal to a city by delivering it to a power plant (or other industry) in the city's influence area which accepts it
ECS and FIRS are both NewGRFs which change industries (quite a lot).

Honza_
Engineer
Engineer
Posts: 109
Joined: 29 Aug 2010 10:29

Re: [GS] Simple City Builder game script

Post by Honza_ » 26 Apr 2014 14:38

New version with new 1.4 features.
See first post.

User avatar
dirace
Engineer
Engineer
Posts: 27
Joined: 29 Jan 2010 11:39

Re: [GS] Simple City Builder game script

Post by dirace » 05 May 2014 11:33

hi,
I load the GS in a multiplayer server, and I feed the town all the requirments, but the town did not grow at all, do I miss some configuration?
and at the same time, the storage page shows different info for different player, only the 1st player show complete info for town growing.
problem.png
(236.02 KiB) Downloaded 9 times
problem2.png
(50.95 KiB) Downloaded 9 times

acabin
Engineer
Engineer
Posts: 27
Joined: 05 Mar 2009 18:40

Re: [GS] Simple City Builder game script

Post by acabin » 05 May 2014 15:09

dirace wrote:hi,
I load the GS in a multiplayer server, and I feed the town all the requirments, but the town did not grow at all, do I miss some configuration?
and at the same time, the storage page shows different info for different player, only the 1st player show complete info for town growing.
problem.png
problem2.png
It seems there is something wrong with town.nut:

function Town::Service() is included by function Town::Grow(growmech)

move Service() out from Grow() will fix the problem.
I speak Chinglish...

Honza_
Engineer
Engineer
Posts: 109
Joined: 29 Aug 2010 10:29

Re: [GS] Simple City Builder game script

Post by Honza_ » 05 May 2014 21:20

Hi,
thanks for info. The Town::Service definition should indeed be outside the other function.

Even so, there is one known OpenTTD problem, when Normal grow mechanism is selected, in cases when town does not grow because of missing transport service, the script will make false statement that town grows even when town is not, because there is no API in game script to recongnize this.

But I guess this was not your problem.

acabin
Engineer
Engineer
Posts: 27
Joined: 05 Mar 2009 18:40

Re: [GS] Simple City Builder game script

Post by acabin » 08 May 2014 05:59

There is another bug:

When a player got the goal, the script will hang up at goalprogress.nut:29:

Code: Select all

			if(checkgamelength >= this.game_length) txt = GSText.STR_WINNER_TIME;
And it should be:

Code: Select all

			local txt;
			if(checkgamelength >= this.game_length) txt = GSText.STR_WINNER_TIME;
I speak Chinglish...

Honza_
Engineer
Engineer
Posts: 109
Joined: 29 Aug 2010 10:29

Re: [GS] Simple City Builder game script

Post by Honza_ » 11 May 2014 15:43

Thanks. It should be ok. Looking forward for next bug report :-)

Ozgarb
Engineer
Engineer
Posts: 4
Joined: 15 May 2014 13:57

Re: [GS] Simple City Builder game script

Post by Ozgarb » 15 May 2014 14:12

World creator has a problem. Towns are very close together and less populated town is city.
Attachments
Ekran Alıntısı.PNG
Example...
(386.29 KiB) Downloaded 5 times

User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9293
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: [GS] Simple City Builder game script

Post by planetmaker » 15 May 2014 14:25

Ozgarb wrote:World creator has a problem. Towns are very close together and less populated town is city.
Honestly, I see no issue here, just randomness at work:

Both, placement and size is randomly distributed. Distance to other towns has a minimum value as does the town or city size in terms of houses which are *tried* to be generated. Cities are not necessarily the biggest towns around at the start of map creation, they can have a *tendency* to be bigger, but again, that multiplicator is applied to the random size, thus the end result may still be small. However, cities will grow faster later on, if they receive an equal level of service compared to a 'normal' town.

Also, your issue most likely is unrelated to the game script here most likely.

Honza_
Engineer
Engineer
Posts: 109
Joined: 29 Aug 2010 10:29

Re: [GS] Simple City Builder game script

Post by Honza_ » 16 May 2014 16:34

Indeed, nothing GS can do abou that.

Ozgarb, if you want map generator with more possibilities, suggest new feature on flyspray ;-)

Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 3 guests