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: 168
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid »

After idoty's post I decided to also rely on GSCargoMonitor's behaviour for towns (also getting stuff delivered to that town's industries). This greatly improves performance because I no longer have to crawl the entire Industry list each month.

V13 has been made.

This version includes 'muncipalities'. When a town grows so big that another town's center tile is close to the boundary of its inner town zone (where the trees appear on roads in default climates) that other town is considered a muncipality. A Muncipality's population would be added to the company's score (this isn't done yet, you only get the news message). Muncipalities would use signs to communicate their wants/needs. A town can only agglomerate the closest 3 other towns (performance reasons). For now 3 seems enough. If people are having trouble I might consider raising/lowering this limit, 2-8 seems reasonable.

The advantage to the player is that you need to deliver a lesser amount of goods if you manage to get muncipalities. The disadvantage is that a: your exclusive area is smaller, and b: they might hinder building.

To disable the muncipalities setting the multiplier to 0 does the trick.

The multiplier determines how much of a size differential is needed to agglomerate. Setting it to 1 means any two towns can agglomerate. Setting it to 2 means double size is required.

By the way, you can agglomerate another player's town :rolleyes:
User avatar
supermop
Tycoon
Tycoon
Posts: 1104
Joined: 21 Feb 2010 00:15
Location: Fitzroy North - 96

Re: CityBuilder Release Topic

Post by supermop »

Sounds cool!
neuron
Engineer
Engineer
Posts: 19
Joined: 14 Aug 2007 07:47

Re: CityBuilder Release Topic

Post by neuron »

I just tried the latest version of your script now, and I get an error missing the function GetPop

(Refered to in main.nut line 475 / main.nut 311).

Also anyone know any nightly builds of cargodest/yacd that's new enough to work with this script? I rather love cargodest, and I have no problem building packages myself, but I play multiplayer with other people and I dont wanna make a linux build, osx build and a windows build.
Aphid
Traffic Manager
Traffic Manager
Posts: 168
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid »

Updated to V14.

By the way, I discovered something:

GSTile::IsDesertTile seems to always return false, when submitting the center tile of a desert town.
(There is usually a road or building on this tile.). To reproduce, you can write:

Code: Select all

local town_list = GSTownList();
foreach(t, _ in town_list){
if(GSTile.IsDesertTile(GSTown.GetLocation(t)){
Log.Info("Blah", Log.LVL_INFO);
}}
This code usually does not say a lot.

This might not be intended behaviour. If it is, would it be possible to extend the API for GSTown with an equivalent function? There are situations in which it becomes impossible to check otherwise, for example a company that covers the tiles around a town completely with roads/stations/etc. \

Edit: In reply to Neuron:

Because this script depends on some additions to the NoGo framework that were only just implemented, it requires a nightly OTTD version. It will probably also work in 1.3 whenever that is forked. You can however quite easily update CargoDest to the current nightly version by downloading the patch (see the topic) and merging it with the current nightly build, then finally compiling it yourself. Because YACD is much older, compiling that will be more difficult to do.
neuron
Engineer
Engineer
Posts: 19
Joined: 14 Aug 2007 07:47

Re: CityBuilder Release Topic

Post by neuron »

I had a nightly and tested with that, but I guess it wasn't quite updated enough! Thanks for the info :)
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: CityBuilder Release Topic

Post by Kogut »

@GSTile::IsDesertTile
Zuu wrote:Some investigation have shown that GSTile.IsDesertTile(GSTown.GetLocation(town_id)) returns false for all towns on a random test game. Both those clearly in dessert and those clearly in non-dessert areas. When using the query tool, I see that it will show "Desert" on empty tiles but not on town road tiles. A look into the OpenTTD code is however required to see if it is just an oversight in the API or if there is a limitation in OpenTTD why IsDesertTile doesn't return true for the town center tile. Maybe a GSTown.IsDesertTown(town_id) in that case is needed.
from http://www.tt-forums.net/viewtopic.php? ... 8#p1053358
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Aphid
Traffic Manager
Traffic Manager
Posts: 168
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid »

Well, apart from untranslatable news messages, desert town troubles, and one last option, the functional parts of the script are as good as done.
The only real thing that still needs implementing is some way of restricting other companies from building near claimed towns, and granting companies cheaper building in claimed area.
I'm not quite sure on how to do this.

By the way, why exactly is it that a GS can't order an industry to close? The player can do it through cheats -> Magic Bulldozer.
Actually, a magic bulldozer would be a nice addition to GS.

V16 has a dutch translation as well.
I wonder if it's okay if I'm having trouble translating my English into my first language... 8)
\

EDIT: Seems I just have to wait until Frosch finishes area control.
With that the script'll be near complete :arrow:
Unhy
Engineer
Engineer
Posts: 3
Joined: 29 Nov 2012 00:12
Location: Prague
Contact:

Re: CityBuilder Release Topic

Post by Unhy »

Hi guys, I love CityBuilder, I played it last year on the internet. Is it possible to set up my own server with this? I want to play with my friends. Or LAN will be ok too. But how to set this? I can´t find this GS via ingame downloader :-/. I download it from bananas but where I have to put these files? How to set up the game? Thanks a lot for answer - I really enjoy this mod.

BTW this is my old article about Open TTD:)
http://www.freegame.cz/hry-ke-stazeni/z ... luxe/18599


Unhy
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: CityBuilder Release Topic

Post by Kogut »

I guess that you need to use recent nigtly.

It is great that it is almost finished, soon I will start testing :).
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
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 »

Aphid wrote:Citybuilder is now also available on bananas.
(Note: it requires a nightly version of OTTD above 24573 to run.)
If you need a nightly or 1.3 when it comes out, I would recommend to change your info.nut to indicate this by returning the API version 1.3 and not 1.2. Keeping it at 1.2 for now have the benefit that if the 1.3 API get changed so that it breaks, most of your GS will be using 1.2 API calls which will through the compatibility layer still work. If you set it to 1.3, OpenTTD will warn that there is no compatibility layer for 1.3 which is alright as it haven't been created yet.

You might also want to add this information to your first post in this thread.

Unhy wrote:Hi guys, I love CityBuilder, I played it last year on the internet. Is it possible to set up my own server with this? I want to play with my friends. Or LAN will be ok too. But how to set this? I can´t find this GS via ingame downloader :-/. I download it from bananas but where I have to put these files? How to set up the game? Thanks a lot for answer - I really enjoy this mod.

BTW this is my old article about Open TTD:)
http://www.freegame.cz/hry-ke-stazeni/z ... luxe/18599


Unhy
As you probably have guessed if you read what I wrote above, you need a recent nightly to run the CityBuilder script.

That said, if you and your friends run the same nightly version you can set up a server which use the CityBuilder script. Before creating the new game, pick it in the AI/GS window.

If you play a lot and sometimes wish to update the server, there are ways to remotely obtain the nightly version of a server (if required ports to play are open). For the purpose of "hey I want to play on this server, give me the right client version", there exist a custom target in OpenTTD Auto Update. I think there is also another program which is based upon a server list instead of the installations and release target concept used in OpenTTD Auto Update. OpenTTD Updaters

Edit: But if it is just for a single game, just post the download URL for the OpenTTD client for your friends to download. Its possible to have multiple OpenTTD installations.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Dijkstra
Engineer
Engineer
Posts: 2
Joined: 01 Dec 2012 04:36

Re: CityBuilder Release Topic

Post by Dijkstra »

I have CityBuilder v16 and I keep getting errors about not finding library "graph.aystar" version 6. My current OpenTTD version is the 24775 nightly (had the same problems on 1.3).

CityBuilder is contained in ...OpenTTD/game/
Graph.Aystar.6 is contained in ...OpenTTD/game/library

Debug Screen is attached.

Can someone help?
Attachments
Debug Screen...
Debug Screen...
CityBuilder16 error1.JPG (73.8 KiB) Viewed 5273 times
Aphid
Traffic Manager
Traffic Manager
Posts: 168
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid »

This problem is not too hard to solve. There's a difference between Graph.AyStar.6 and Graph.AyStar-6

I think Graph.AyStar.6 is the AI version and Graph.AyStar-6 the GS version. The naming scheme is
perhaps a bit obfuscating. Try installing the other one and see if it works now.
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 »

The AI and GS version have both the same name when downloading from bananas web interface. The one you want for city builder is the one that can be downloaded from the list of GS libraries:
http://bananas.openttd.org/en/gslibrary/

If your problems remains, try to untar the aystar library so that you have a aystar directory in Documents\OpenTTD\game\library
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Dijkstra
Engineer
Engineer
Posts: 2
Joined: 01 Dec 2012 04:36

Re: CityBuilder Release Topic

Post by Dijkstra »

Thanks A LOT! Managed to debug it.
Unhy
Engineer
Engineer
Posts: 3
Joined: 29 Nov 2012 00:12
Location: Prague
Contact:

Re: CityBuilder Release Topic

Post by Unhy »

Hi, thanks for explanation about nightly version. I have newest nightly version, and I downloaded the CityBuilder script via game downloader. Now I have this bug, when I start a new game. Can someone help me?

Unhy
Attachments
bug.JPG
bug.JPG (39.07 KiB) Viewed 5224 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 »

The short term solution for you is to grab SuperLib v26 from the attachment below and put into your Documents\OpenTTD\game\library directory. Or download some random GSes from bananas in hope that some of them depend on SuperLib version 26 and have that set properly in the Bananas manager. (I would guess that NoCarGoal depend on version 26)

The long term solution which only the CityBuilder author can do is to update main.nut of CityBuilder to import the currently last SuperLib version prior to uploading a new CityBuilder version. This is because noone have yet fixed the Bananas web interface to allow specifying old libraries as dependencies. Thus, when I upload a new SuperLib version, all AIs or GSes that use it are required to update to this new version when they decide to upload a new version of their AI or GS. If not, new users who don't have the old version will run into the issue that Unhy got above.
Attachments
NoGoSuperLib-v26.tar
SuperLib for NoGo version 26. GPL v2.
(318 KiB) Downloaded 183 times
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 »

Next version up will have SLib 27.

I didn't know it was actually built this way, that if I don't continue updating my libs it will break for new installs. I thought I'd wait until the Area control thing is finished.
In any case, this bug might happen again if the uploads of the library and main are around the same time, and not otherwise.
Unhy
Engineer
Engineer
Posts: 3
Joined: 29 Nov 2012 00:12
Location: Prague
Contact:

Re: CityBuilder Release Topic

Post by Unhy »

Hi guys,
I made all mentioned above, I have many libraries etc and I have NO errors when I play City Builder. BUT, it don´t work. The image I uploaded explains the situation:

I claim the city.
City have water and food.
City want to grow.
But it says 30 000 day to grow.. ups.

And I miss under the city title that city is claimed by company XY.

Have any ideas or it is just imposibile to set up this mode easily? :-D. I love the game on the internet but you now there are a lot of crazy players, I think it will be really nice to play this mode in single or on LAN party.

Keeping my fingers cross!

Unhy
Attachments
noname-nogrow.JPG
noname-nogrow.JPG (161.17 KiB) Viewed 1099 times
Aphid
Traffic Manager
Traffic Manager
Posts: 168
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid »

That looks just fine.
You can start up the growth by building some busses in that town of yours. One or two bus stations work,for under default settings the town will grow past the 100-200 stage when it gets at least 1 passenger or mail from it transported in a month.
Beyond 200ish by default it will require more cargoes.
The fact that the town requires 30,000 days is normal. That's because I do growth manually, so it'll always state that,the related panel is not part of the scripting UI. Ignore this number. The real growth is usually faster.
By the way, the town will always replace old buildings by new ones, even if it doesn't 'grow' :)

Note: Under the default settings, small villages tend to grow a bit slowly. If you set "Below this population growth is linear" to a higher value they will grow a bit quicker.
The advanced setting "towns don't build roads" might also help you (as a town might build a tile of road instead of a house, go figure).

With the default growth multiplier:
A value of '40,000' for example will give you about 30 houses a month guaranteed.
That's a bit extreme, but the default is only 600. (Which means you get about one house every 2-3 months).
Setting it to 1,350 gives you one house per month as the base grow speed.
4,000 would be about 3 houses per month. Values around 1500-4000 are close to the default grow speed for little towns.

If you're interested in how it works: Growth of towns I do via the town's own 'expand' function, at the start of each month. The amount of houses is equal to the size of the town times a constant, yielding exponential growth. However, the town will always have a certain minimum amount of growth. That's so that it will not grow too slowly when it's really small, for example a town with a pop of '7' in desert.

Edit: You're getting the news message, so you claimed that town succesfully.
User avatar
XfrankX
Engineer
Engineer
Posts: 19
Joined: 08 Aug 2011 09:56
Location: The Netherlands
Contact:

Re: CityBuilder Release Topic

Post by XfrankX »

Hi Aphid,

Normally when a town gets claimed in CB a sign under the townname is created which states that the town is claimed. For example:

Aphidwood (Town Name)
Claimed by: Frank Transport

This way in multiplayer it's obvious that the town is allready claimed by a player and that you can't claim it anymore.

I don't know if maybe you allready had this in mind, it's just a suggestion :-)

Keeping a close eye on your project, waiting for all the NoGo functions get available to support this (which is 1.3.0) until maybe we can setup a BTPro server with your script, will certainly be nice :-)

Anyways, Hope to speak to you soon. Maybe drop into our chat again when you have some time :-)

See ya.

Best regards,

Frank
Server Admin BTPro
http://openttd.btpro.nl
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 19 guests