CityBuilder Release Topic

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
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: CityBuilder Release Topic

Post by Zuu »

From the looks of it, you probably got SuperLib 39 installed as dependency. (otherwise it should have had an error about that)

The line that triggers the error looks like this:

Code: Select all

    constructor() {	
        GSLog.Info("Loading Economy ", Log.LVL_WARNING)     // <------------ Line 36 in econ/econ.nut
    }
One problem I see here is that it mix GSLog with Log which is not going to go well. However the error is about LVL_WARNING not existing which is also true.

SuperLib.Log has these levels defined:

Code: Select all

	/* Log levels: */
	static LVL_INFO = 1;           // main info. eg what it is doing
	static LVL_SUB_DECISIONS = 2;  // sub decisions - eg. reasons for not doing certain things etc.
	static LVL_DEBUG = 3;          // debug prints - debug prints during carrying out actions

Users of SuperLib can call SetIsLevelAcceptedFunction to inject a different function to decide if a log message should be outputed or not if they like to introduce more levels. Or create your own constants with value 1, 2 and 3, as I would very unlikely change these values as too much code depend upon the log system.

stinkyfax:As you probably understood, this is an error in the script code. So you'll have to wait for the author to upload a fixed version.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Aphid
Traffic Manager
Traffic Manager
Posts: 168
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid »

I believe the correct thing to do would be to replace said line of code with just:

Code: Select all

GSLog.Info("Loading Economy");
stinkyfax
Engineer
Engineer
Posts: 28
Joined: 28 Mar 2013 20:12

Re: CityBuilder Release Topic

Post by stinkyfax »

Still waiting for the update of a script, thank you.
ST2
Engineer
Engineer
Posts: 63
Joined: 07 Apr 2011 14:17

Re: CityBuilder Release Topic

Post by ST2 »

noticed that when town still have 0 demands, the Next demand line wasn't shown correctly so, in Towngrowth.nut, line 495
(only change is from "GSTown.SetText(id, GSText(GSText.STR_CITYBUILDER_CONCAT01," to "GSTown.SetText(id, GSText(GSText.STR_CITYBUILDER_CONCAT02,")

Code: Select all

			    if(next != -1) {
					    GSTown.SetText(id, GSText(GSText.STR_CITYBUILDER_CONCAT01, 
						    GSText(GSText.STR_CITYBUILDER_TW_HAMLET), 
						    GSText(GSText.STR_CITYBUILDER_TW_NEXT, 1 << econ.enable_order[next], econ.enable_populations[next])));
				    } else {
must be

Code: Select all

			    if(next != -1) {
					    GSTown.SetText(id, GSText(GSText.STR_CITYBUILDER_CONCAT02, 
						    GSText(GSText.STR_CITYBUILDER_TW_HAMLET), 
						    GSText(GSText.STR_CITYBUILDER_TW_NEXT, 1 << econ.enable_order[next], econ.enable_populations[next])));
				    } else {
Well, at least this way started showing correct values (cargo and population). No idea if there's other cases (only found this ^^), this Concat strings are heavy stuff :D
Aphid
Traffic Manager
Traffic Manager
Posts: 168
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid »

That's a nice observation; I'll push it to the repository. The whole CONCAT_xyz thing is a bit of an ugly workaround to be able to 'build' a custom string in the town window while still having access to nice features such as translation and coloured text, yet one needs to know the exact amount of parameters in each string used in the concatenation to be able to concatenate them this way, it's a bit cumbersome to use.

The script currently also dumps the same information to the story book by the way; that can support larger amounts of information more readily since a page can contain multiple strings. Each town gets its own page, and it just updates monthly like the town windows do.
marhex
Engineer
Engineer
Posts: 8
Joined: 09 Jul 2015 10:44

Re: CityBuilder Release Topic

Post by marhex »

i have a bug when i load a saved game with version 117:
Attachments
Capture.PNG
Capture.PNG (7.22 KiB) Viewed 9649 times
Last edited by marhex on 07 Jul 2016 16:23, edited 1 time in total.
clausqr
Engineer
Engineer
Posts: 1
Joined: 07 Jul 2016 03:32

Re: CityBuilder Release Topic

Post by clausqr »

fix:

in Towngrowth.nut line 694 there is a missing + between Assim and GSTown.xxxxx:

Code: Select all

--- Towngrowth.nut	2016-07-07 00:36:56.000000000 -0300
+++ Towngrowth.nut	2016-07-06 19:40:17.000000000 -0300
@@ -691,7 +691,7 @@
 				    if(f2 < 0){f2 = 0;}
 				    local c = f1 + f2; // + sqrt(f1) * sqrt(f2) * 2 << Removed for optimization...
 				    if(GSController.GetSetting("debug_level") > 6) {
-				        GSLog.Info("Assim: " GSTown.GetName(tid) + " and "+ GSTown.GetName(this.id) + "req " + c);
+				        GSLog.Info("Assim: " + GSTown.GetName(tid) + " and "+ GSTown.GetName(this.id) + "req " + c);
 				    }
 	// optimization: reuse f1
 				    f1 = GSTown.GetDistanceSquareToTile(tid,loc);
Nezerin
Engineer
Engineer
Posts: 1
Joined: 05 Aug 2016 04:29

Re: CityBuilder Release Topic

Post by Nezerin »

I'm likely doing something very wrong as I'm trying to setup a single player game using CityBuilder for fun and practice. In doing so no matter what settings I select I'm ending up with the following error:
Error message received a couple months into every game.
Error message received a couple months into every game.
CityBuilderError.png (24.89 KiB) Viewed 9491 times
Can anyone help me with what I'm doing wrong? It looks like it's running into trouble while trying to calculate a score of some sort for the individual towns.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: CityBuilder Release Topic

Post by planetmaker »

So... is this still actively maintained? It crashed on me, shortly after start
Attachments
Unnamed, 18th May 1971.png
(526.9 KiB) Not downloaded yet
kryters
Engineer
Engineer
Posts: 1
Joined: 28 Apr 2019 10:39

Re: CityBuilder Release Topic

Post by kryters »

marhex wrote:i have a bug when i load a saved game with version 117:
I appreciate that it's been almost 3 years since this comment, but I also have this issue with CityBuilder v117 installed through the Online Content interface. Currently running OpenTTD 1.9.1.

Game runs perfectly until I save then load a CityBuilder game. The following error message appears:

Code: Select all

Your script made an error: the index 'num_cargos' does not exist
*FUNCTION [constructor()] citybuilder-117\Towngrowth.nut line [134]
*FUNCTION [Second_Load()] citybuilder-117\main.nut line [218]
*FUNCTION {Start()] citybuilder-117\main.nut line [473]
Image
aidamina
Engineer
Engineer
Posts: 1
Joined: 15 Jan 2020 19:42

Re: CityBuilder Release Topic

Post by aidamina »

Hey guys,

I was unable to find a way to send updates/pull requests to the repository of Aphid's City Builder, so i attached an updated version of their trunk.

Fixes:

* Loading of save games (num_cargos does not exist)
* wrong number of parameters (which was fixed by Aphid already in the latest commit)
* some of the other fixes suggested in the last few replies in this topic

Just unzip the archive and move the CityBuilder folder into the %OpenTTD%\game folder and select the game script in the main menu.

Have fun!

Regards,

TJ
Attachments
CityBuilder.zip
(76.89 KiB) Downloaded 333 times
quadat
Engineer
Engineer
Posts: 65
Joined: 05 Aug 2008 17:04
Location: Granby (Quebec), Canada

Re: CityBuilder Release Topic

Post by quadat »

I had a problem when loading my game this morning. See picture attached.
Attachments
Error_City_builder_cropped.png
Cropped version by Chrill
(512 KiB) Not downloaded yet
User avatar
jfs
Tycoon
Tycoon
Posts: 1743
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: CityBuilder Release Topic

Post by jfs »

quadat wrote: 09 Dec 2020 20:06 I had a problem when loading my game this morning. See picture attached.
I think you accidentally included windows with sensitive information on your screenshot.

You should probably delete that attachment and make a new one cropped to only show OpenTTD and nothing else.
User avatar
Chrill
Moderator
Moderator
Posts: 15972
Joined: 18 Dec 2004 17:35
Location: Stockholm, Sweden
Contact:

Re: CityBuilder Release Topic

Post by Chrill »

I cropped the photo for you, quadat. PM me if you have any questions.
Image
My Scenarios:
Archipiélago Hermoso (Latest Release: Version 3.2)
Turnpike Falls (Latest Release: Version 0.91)
quadat
Engineer
Engineer
Posts: 65
Joined: 05 Aug 2008 17:04
Location: Granby (Quebec), Canada

Re: CityBuilder Release Topic

Post by quadat »

Thank you !
User avatar
MightyGooga
Engineer
Engineer
Posts: 11
Joined: 26 Jan 2009 14:52
Location: Brasil

Re: CityBuilder Release Topic

Post by MightyGooga »

Hello,

Do you guys have problems loading a singleplayer game with this script? My game loads, and its locked on pause for over 40 minutes.

Is there a solution to this?
User avatar
jfs
Tycoon
Tycoon
Posts: 1743
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: CityBuilder Release Topic

Post by jfs »

MightyGooga wrote: 14 May 2021 22:25 Hello,

Do you guys have problems loading a singleplayer game with this script? My game loads, and its locked on pause for over 40 minutes.

Is there a solution to this?
Are you using a gigantic map, or a normal sized one?
Try with a 512x512 size map or smaller, if you're using a large one.
User avatar
MightyGooga
Engineer
Engineer
Posts: 11
Joined: 26 Jan 2009 14:52
Location: Brasil

Re: CityBuilder Release Topic

Post by MightyGooga »

jfs wrote: 15 May 2021 06:40
MightyGooga wrote: 14 May 2021 22:25 Hello,

Do you guys have problems loading a singleplayer game with this script? My game loads, and its locked on pause for over 40 minutes.

Is there a solution to this?
Are you using a gigantic map, or a normal sized one?
Try with a 512x512 size map or smaller, if you're using a large one.
Hello! Im using a 4k x 2k map.

It should work right? I even get the blue popo up screen, but the games keep locking on pause.
User avatar
jfs
Tycoon
Tycoon
Posts: 1743
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: CityBuilder Release Topic

Post by jfs »

MightyGooga wrote: 15 May 2021 19:40 Hello! Im using a 4k x 2k map.

It should work right? I even get the blue popo up screen, but the games keep locking on pause.
A gigantic map size like that will have a huge number of towns, potentially several thousand, and a huge number of towns will take a very long time for the GS to process at start. While the GS is doing that the game will appear frozen.
Argus
Tycoon
Tycoon
Posts: 1203
Joined: 16 Oct 2018 08:31
Location: Heart of the Highlands. Not Scottish. Czech.

Re: CityBuilder Release Topic

Post by Argus »

I'm trying this script with XIS.
1. The cargo requirement is acid.
Apparently a bug, CityBuilder is not compatible with XIS?
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: Google Adsense [Bot] and 8 guests