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

Aphid
Traffic Manager
Traffic Manager
Posts: 166
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid » 14 Sep 2014 07:39

The actual problem is that this variable appears to be missing, it's from the setting that dictates 'below this size all towns grow'. It seems logical that would include cities. I've just moved the variable scope one level up the class hierarchy so City also has access to it.

That should fix the problem.

mw48620
Engineer
Engineer
Posts: 1
Joined: 14 Sep 2014 11:52

Re: CityBuilder Release Topic

Post by mw48620 » 14 Sep 2014 12:01

Hello,
I have a noob question, my city require Rubber 0/17 | Storage: 0 - to grow, but I don't know how to get it.
The city doesn't have any factory that produce rubber and city doesn't accept rubber :(

I don't understand what to do :D

Thanks!

Aphid
Traffic Manager
Traffic Manager
Posts: 166
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid » 14 Sep 2014 14:04

Okay, so the first thing you should do is read the readme file included with the script. As you can read there, the script has a separate setting for each of the 32 possible cargoes in the game to determine whether/how much a town demans to be delivered 'to' it. There are also two settings for how much you have to deliver 'away from' a town.
The default settings assume you're playing on the temperate climate. You're trying to play with the 'tropical' climate so you should change the cargo requirements.

The relevant cargoes are;
00: Passengers
02: Mail
05: Goods
09: Water
10: Diamonds
11: Food

Now in order to have a pleasant game experience, you should tailor your relative cargo requirements to the relative density of industries on the map. So you should have a small amount of diamonds required (one industry type, and it's usually low production). After that comes water (only one type but more production and more common). Then food (two types, medium production), and a lot of goods (four types of industries, and oil has high production). I would recommend relative values of about 8:13:25:50. And however much passengers you want. So an example would be (per 1000 people):
150 passengers,
30 mail,
20 diamonds
32 water
65 food
130 goods

You should also set a minimum town size for passengers of at least 100 (4 houses), food at least 250 (8 houses), for mail at least 1000 (4 big houses), diamonds at at least 1200 (a bank), and for goods at least 2000 (4 offices), to prevent getting towns that don't accept these cargoes and still need it to grow. Novapolis used 1500 for goods but I feel that's still a bit too soon; you may get unlucky with low values in the 1000-2000 range.

There's some extra cargoes that can't be taken directly to the town:
01: Rubber
03: Oil
04: Fruit
06: Maize
07: Wood
08: Copper

Now suppose that you configured one of these cargoes. It seems a bit silly to do so because they're raw materials, not finished goods. If you still want to deliver these to a town, you need to construct the relevant industry for that town. So for your case, rubber, build a factory in the town.

Hobbyte
Engineer
Engineer
Posts: 4
Joined: 10 Sep 2014 22:17

Re: CityBuilder Release Topic

Post by Hobbyte » 18 Sep 2014 22:54

Hey, Seems like in the recent versions, .:CITY:. refuse to grow. Towns seem to grow fine however. I have them set to grow above MTR, and the info window says they're growing, but even after 10 years the population doesn't change.

Hobbyte
Engineer
Engineer
Posts: 4
Joined: 10 Sep 2014 22:17

Re: CityBuilder Release Topic

Post by Hobbyte » 25 Sep 2014 21:27

Update: .:CITY:. still refuse to grow, but towns grow uncontrollably whether you meet the growth requirements or not.

wil32
Engineer
Engineer
Posts: 2
Joined: 19 Apr 2014 18:44

Re: CityBuilder Release Topic

Post by wil32 » 01 Jan 2015 23:21

Hi... How I can write the commands? :/
I dont know!! xD

Brumi
President
President
Posts: 904
Joined: 18 Jul 2009 17:54

Re: CityBuilder Release Topic

Post by Brumi » 02 Jan 2015 13:32

What do you mean by writing commands?

Do you want to write your own gamescript or modify the CityBuilder? Or you just want to modify the text appearing on the screen?

spm
Engineer
Engineer
Posts: 2
Joined: 13 Jan 2015 03:56

Re: CityBuilder Release Topic

Post by spm » 13 Jan 2015 04:01

Image
my city need food,but not enough building to accept food,what should i need to do?and how about rubber?thx!

Aphid
Traffic Manager
Traffic Manager
Posts: 166
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid » 20 Jan 2015 20:44

You should look at my post in this topic from Sep. 14. 2014. It applies almost word-for-word here.

Due to the nature of the game, and me wanting you to be able to require 'specific' cargoes and not just the categories the GS designer set up to allow GS authors for towns to require, I had to circumvent part of that logic and make my own. However, there's no easy way for me to figure out what exactly each cargo is when still at the settings screen, because the script at that point isn't aware of any newGRFs. In fact it can't actually be aware of those later on either, only of certain consequences (e.g. engine stats for example) of the player using these.

So I can't actually tell what cargo #05 is, so it's simply labelled cargo #05. You could write a simple script that output each cargo type to the console using a for loop. In fact, I think that if you turn the debug setting on, my script will actually tell you what cargoes there are when it's first fired up at the initialization phase so you can see which number corresponds to what. The work's already been done for the default desert climate, see my post above.

McZapkie
Tycoon
Tycoon
Posts: 1176
Joined: 18 Jan 2014 18:10

Re: CityBuilder Release Topic

Post by McZapkie » 06 Apr 2015 11:36

How PTR and TTR requirements are evaluated?
Is it recommended to apply them in CityBuilder mode?

EDIT: in freebuilder mode, strange negative points value was computed:
cbbug.png
cbbug.png (5.39 KiB) Viewed 2800 times
Additionally, <invalid cargo> is requested from small towns.
Any idea of cause of such bug?

Here is GS configuration:

Code: Select all

[game_scripts]
CityBuilder = Industry_Density=63,Industry_S_Density=63,Industry_Town=100,Town_Labels=1,cargo0=150,cargo1=10,cargo10=0,cargo11=100,cargo12=10,cargo16=15,cargo17=5,cargo2=40,cargo7=20,
  cargo9=0,cargo_sigma=10,cities_setting=1,debug_level=3,decay1=6,decay10=2,decay12=5,decay16=4,decay17=1,decay2=500,decay5=20,decay7=10,gamegoal=100000,gametime=201,gametype=0,
  growascity=0,maxclaimsize=300,metro_cgg=60,metro_mod=25,mgrpct=600,min_size_tr=100,paxTR=60,size0=200,size1=15000,size11=1500,size12=20000,size16=35000,size17=60000,size2=600,
  size5=4000,size7=8000,town_regrow=130
and appropriate manpower industry grf configuration (maybe there are cargo Id issues?):

Code: Select all

4D634D69|C80506F46F922D4C9D1FE78C7A6E8AFC|manpower_ogfxindustries-2.1\manpower-ogfx-industries.grf = 
0 1 3 2 0 0 0 1 1 0 3 1 0 0 7 0 10 50 100 1000 2 0 0 1 1 1
Last edited by planetmaker on 23 Jun 2015 14:22, edited 1 time in total.
Reason: added line breaks to the code block so that it actually becomes readable instead of a GIANTLY lengthy one-liner

Aphid
Traffic Manager
Traffic Manager
Posts: 166
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid » 08 Apr 2015 20:56

That's an interesting value, seems to be -MAX_INT (-2^63+1).

I don't currently have that newGRF, but I'd hazard a guess that you are correct; one of the requirements you put up likely does not exist

Aphid
Traffic Manager
Traffic Manager
Posts: 166
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid » 14 May 2015 17:39

I Should have fixed these issues. Also, It shouldn't be giving you '3' for every requirement, instead some random amount between the required and max growth amount for some random town that isn't getting the required amount.

Minion
Engineer
Engineer
Posts: 3
Joined: 23 Jun 2015 12:45

OpenTTD 1.5.1 Crash Report Citybuilder V113

Post by Minion » 23 Jun 2015 13:11

Here's my capture screen for a game script crash I encountered on 23rd June 2015.



Don't know if I'm missing out on more info to pass on. Don't know if it's an error in the script or error in the new updated version of this game which is v1.5.1.
Perhaps even an error in the installation path now that I've transfered my hard disk to different sequence. I've updated this game just then using the ottd manager. Hope the attached pic's clear enough to read here.
Help required guys. Can't even run a new game. It freezes at 95% world generation and I have to keep closing the program.
Attachments
crashreport230615a.JPG
Crash report 23/06/15
(1.04 MiB) Downloaded 9 times

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 » 23 Jun 2015 16:55

If the CityBuilder crash happen each time you load a particular save game, it may be useful to upload it here.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)

Aphid
Traffic Manager
Traffic Manager
Posts: 166
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid » 25 Jun 2015 08:06

You may have found a bug in my Qsort implementation that depends on the amount of stuff being sorted. I'll try sorting anywhere from 1 to 512 things and see if it fails somewhere.

Code: Select all

function QSortTest() {
	GSLog.Info("Qsort Tests");
	local indexes = [];
	local items = [];
	// Sort anywhere from 0 to 512 elements
	for(local i = 0; i < 513; ++i) {
		GSLog.Info("Qsort with '"+i+"' elements");
		indexes.append(i);
		items.append(GSBase.Rand());
		items = QSort(items, items);
		foreach(i in items) {
			GSLog.Info("i: "+i);
		}
	}
}
I ran this a few times and it came up without errors or crashes. Can you try running that on your config? (Just make an empty GS and include that & QSort.nut or add that function to QSort.nut and call it from main.nut)

Minion
Engineer
Engineer
Posts: 3
Joined: 23 Jun 2015 12:45

Re: CityBuilder Release Topic

Post by Minion » 26 Jun 2015 19:56

Zuu, my saved game is broken now. Here's the screen capture of it.
Savegamebroken270615.JPG
(1.26 MiB) Downloaded 6 times

Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4739
Joined: 09 Sep 2007 05:03
Location: home

Re: CityBuilder Release Topic

Post by Alberth » 26 Jun 2015 20:54

Game scripts don't mess with chunk types.

Are you sure you made the save game with a compatible openttd version (ie not trying to load a save game of a newer openttd into an older one, or trying to load a savegame from a patched openttd version (typically a patchpack) into unpatched openttd)?
Being a OpenTTD developer does not mean I know what I am doing.
Also, other OpenTTD developers may have different opinions.

Minion
Engineer
Engineer
Posts: 3
Joined: 23 Jun 2015 12:45

Re: CityBuilder Release Topic

Post by Minion » 01 Jul 2015 06:54

I used the Open TTD manager to update the game and the openttd.exe is now at version 1.5.0.27217 .
Am i on the right to use the openttd manager to update then? ?(
OpenTTD1.50_Startscreen.jpg
(1.41 MiB) Downloaded 3 times

Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4739
Joined: 09 Sep 2007 05:03
Location: home

Re: CityBuilder Release Topic

Post by Alberth » 01 Jul 2015 10:48

How you update to another version of openttd doesn't seem very relevant to me (assuming the updater doesn't do any magic, I don't know the program).

The question imho is what version of openttd did you use to create the save game.
Being a OpenTTD developer does not mean I know what I am doing.
Also, other OpenTTD developers may have different opinions.

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

Re: CityBuilder Release Topic

Post by planetmaker » 01 Jul 2015 14:50

Alberth wrote:How you update to another version of openttd doesn't seem very relevant to me (assuming the updater doesn't do any magic, I don't know the program).

The question imho is what version of openttd did you use to create the save game.
And possibly where from you got that (old) OpenTTD version (link)?.

Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 4 guests