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

Post Reply
MisterX
Engineer
Engineer
Posts: 36
Joined: 25 Mar 2013 18:24

Re: CityBuilder Release Topic

Post by MisterX »

Aphid wrote:Did you by any chance turn on 'towns build roads'?
I can't found that setting?!
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: CityBuilder Release Topic

Post by Alberth »

MisterX
Engineer
Engineer
Posts: 36
Joined: 25 Mar 2013 18:24

Re: CityBuilder Release Topic

Post by MisterX »

I also had looked there, but i didn't found it. But now i found it. First, only the basic settings where show, but this setting was hidden. It was on. But with this game script, towns/cities build no roads?
stinkyfax
Engineer
Engineer
Posts: 28
Joined: 28 Mar 2013 20:12

Re: CityBuilder Release Topic

Post by stinkyfax »

Image
v76.
Any chance the same bug you fixed in previous versions got reintroduced? City is growing, but shows 0% :(
stinkyfax
Engineer
Engineer
Posts: 28
Joined: 28 Mar 2013 20:12

Re: CityBuilder Release Topic

Post by stinkyfax »

stinkyfax wrote:Image
v76.
Any chance the same bug you fixed in previous versions got reintroduced? City is growing, but shows 0% :(
To Help you figuring out what is wrong I will give deeper description how it happened: http://josh.c-servers.com/web/example.sav
Here is save-game in which it shows 0%, I have been using it to teach friends some basics. There were just 6 cities and 0 towns, so we did not claim any town. I assume it might have caused the issue.
(In normal play % are shown correctly)

Interestingly that color still worked (0% was green for growing, and red for not growing).
stinkyfax
Engineer
Engineer
Posts: 28
Joined: 28 Mar 2013 20:12

Re: CityBuilder Release Topic

Post by stinkyfax »

Congratulations with Version 78 :) I believe you are coming very close to bug-free version.
stinkyfax
Engineer
Engineer
Posts: 28
Joined: 28 Mar 2013 20:12

Re: CityBuilder Release Topic

Post by stinkyfax »

Have been playing v78 with a friend whole evenign yesterday, and decided to continue the game from the save-file today, though the script won't load up!

When we try to load the game with exactly same config, same version, everything untouched it won't.
Here is a screenshot: http://josh.c-servers.com/web/2013_04_1 ... _1.3.0.png

Here is a saved game: http://josh.c-servers.com/web/aurora_one_company.sav


Downgraded to v76 and savegame works, eventhough it was started with v78. I believe the reason is hidden in the changes done to v77 or v78.

Strangely v76 workaround only worked in a single-player, once I tried doing same on dedicated linux server it would refuse to load saying the SaveGame is for v78.

Am hoping you will pin-point the error soon.
Aphid
Traffic Manager
Traffic Manager
Posts: 168
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid »

Found the bug.

You can fix it by replacing line 193 in main.nut

Code: Select all

if(start_year + game_length >  GSDate.GetYear(GSDate.GetCurrentDate())) go = true;
with this:

Code: Select all

if(start_year + game_length >  GSDate.GetYear(GSDate.GetCurrentDate()) || game_length == 0) go = true;
Game_length = 0 means infinite to the script, except when it loads a game. Just a case of forgetting a detail and not testing a specific scenario.
Hence it will conclude that it has finished.
Next version will have it fixed.

Note that it may be necessary to manually fix it in your version if you want to play that particular savegame. That is because openTTD will automatically run the same version with the same save-game.
stinkyfax
Engineer
Engineer
Posts: 28
Joined: 28 Mar 2013 20:12

Re: CityBuilder Release Topic

Post by stinkyfax »

Aphid wrote:Found the bug.

You can fix it by replacing line 193 in main.nut

Code: Select all

if(start_year + game_length >  GSDate.GetYear(GSDate.GetCurrentDate())) go = true;
with this:

Code: Select all

if(start_year + game_length >  GSDate.GetYear(GSDate.GetCurrentDate()) || game_length == 0) go = true;
Game_length = 0 means infinite to the script, except when it loads a game. Just a case of forgetting a detail and not testing a specific scenario.
Hence it will conclude that it has finished.
Next version will have it fixed.

Note that it may be necessary to manually fix it in your version if you want to play that particular savegame. That is because openTTD will automatically run the same version with the same save-game.
Thank you Aphid :bow:
Aphid
Traffic Manager
Traffic Manager
Posts: 168
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid »

Here's a screenshot of the new things one can do; both towns are from the same game:
Attachments
CB_Newstuff.jpg
CB_Newstuff.jpg (65.37 KiB) Viewed 4956 times
griffin71
Traffic Manager
Traffic Manager
Posts: 142
Joined: 31 Mar 2007 13:11
Location: Amsterdam

Re: CityBuilder Release Topic

Post by griffin71 »

[offtopic]
Hi Aphid,
I notice from your screenshot that you managed to change the game font. How did you do that? I'd like to use a non-proportional gamefont for debugging my AI-under-development.
Thanks!
[/offtopic]
A game worth playing is a game worth modding :-)
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: CityBuilder Release Topic

Post by Alberth »

griffin71
Traffic Manager
Traffic Manager
Posts: 142
Joined: 31 Mar 2007 13:11
Location: Amsterdam

Re: CityBuilder Release Topic

Post by griffin71 »

Thanks, Alberth. I'm happily debugging my code now :)
A game worth playing is a game worth modding :-)
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 »

Regarding debugging: did you know about AIController.Break, introduced in 1.3?
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
griffin71
Traffic Manager
Traffic Manager
Posts: 142
Joined: 31 Mar 2007 13:11
Location: Amsterdam

Re: CityBuilder Release Topic

Post by griffin71 »

No, I didn't. I've been on a "holiday" for quite a while....
Looks useful, thanks.
A game worth playing is a game worth modding :-)
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: CityBuilder Release Topic

Post by Kogut »

Aphid wrote:<One game-breaking bug remains>
What is the problem? Maybe I can help with debugging.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
lugo
Engineer
Engineer
Posts: 100
Joined: 12 Oct 2010 13:55

Re: CityBuilder Release Topic

Post by lugo »

Hi, i'm currently working on a german translation to this Script and stumbled over the following line:
Perhaps delegating important areas might improve your success?
How is one able to delegate areas? Can you explain what is meant here?
Aphid
Traffic Manager
Traffic Manager
Posts: 168
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid »

"Delegating important areas" is a bit of a subtle hint for an idea with co-op gameplay where a company focuses on a particular section of the map, or say a particular cargo, or what have you. Maybe the terminology chosen was a bit vague on purpose here. The idea of the co-op mode is to have multiple companies working together to grow the map or a single town.

So in the sense that it's meant you could translate it also as 'giving a role to the companies'.

For instance, you could have a map with CB metro mode, and YACD or CargoDist with one company that only does inner-city metro transport.
Kogut wrote:
Aphid wrote:<One game-breaking bug remains>
What is the problem? Maybe I can help with debugging.
Well, the major problem is in regards to properly allowing removing of houses. I don't know of a way to remove a house (e.g. 'shrink' a town). Calling Town.ExpandTown with a negative number doesn't work, and the bulldozer requires a company context. I have decided to go without any company contexts because that makes it much more difficult to use this script in single-player. You basically need to setup a scenario or a multi-player server with an infinite-money company to handle housing deletion.

I consider this a game-breaking bug because it makes injections possible even when you turn them off. For example, a player stalls all the entrance stations to their town by stopping the trains or deleting the entrance track tiles. A giant pile of trains will queue up in front of the stations. After 3-6 months the player rebuilds the tiles or uncloggs the stations. The result is a massive influx of goods, 3-6 times the normal amount. By repeatedly doing this trick the user can get their town to grow to a larger size than otherwise possible.

Another way is by using transfers and road vehicles and stopping the road vehicles. The principle remains the same.

If houses were deleted in the months that the town is running dry, the technique would simply stop working because the town is longer dry than it is actually receiving stuff, whence it will shrink when you try to 'cheat' like this.


There's some more minor things like the town UI not working properly in multiplayer when the message is longer than 255 characters, or the message becoming no longer well-formed when it has 4 cargoes. That is related to weird arbitrary string library limits and also outside my control. Last, as with all town grow scripts, 'fund buildings' is a sort of cheat as well as it will circumvent the script and build a house no matter whether the town is growing or not.

Any ideas for better handling of the three bugbears are very welcome :D
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: CityBuilder Release Topic

Post by Kogut »

I remember old citybuilder running thanks to patched server that required 3 months of continuous supply before expanding city. It was still possible to use this exploit but it is far less efficient.

It may be possible to fake negative growth by storing growth value for city and if it is negative - increase it instead of growing the city.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Acol
Engineer
Engineer
Posts: 14
Joined: 21 Jan 2013 13:00

Re: CityBuilder Release Topic

Post by Acol »

Started a new game after a long break from this game. and got this error when loading a new game.
Running 1.3.2 and some newgrfs at the same time. older version didnt have this bug..

Edit: narrowed the bug. it happens even in the older versions also. if i put the game mode Metropolis and timelimit to infinite ihe bug will occur only then.
Attachments
Untitled.png
Untitled.png (22.31 KiB) Viewed 4334 times
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 42 guests