CityBuilder Release Topic
Moderator: OpenTTD Developers
CityBuilder Release Topic
I am proud to present Citybuilder!
The current release version is 114
Requires Nightly >= 24624 or Stable >= 1.5.
Current bug status is <One game-breaking bug remains>
The script is not yet complete
Current approximate progress is <94%>
I will try to keep the current version attached to this post.
Please test this script. Read the included readme file before you do though.
If you have suggestions or commentary, please use this thread.
For bug reports, contributions, and translations, use the openttdcoop project page.
You can always get the latest version at http://bananas.openttd.org/en/gs/
You can also get a (less tested) snapshot of the latest source code from the repository at openttdcoop.
Edit:
Description (short): Modifies the game's towns so that their growth depends on cargo delivered to them.
Adds a time limit after which the game's companies are rated. 4 game modes. Highly customiseable.
Can now also support fixed game goals (a company wins after it achieves a certain score)!
The current release version is 114
Requires Nightly >= 24624 or Stable >= 1.5.
Current bug status is <One game-breaking bug remains>
The script is not yet complete
Current approximate progress is <94%>
I will try to keep the current version attached to this post.
Please test this script. Read the included readme file before you do though.
If you have suggestions or commentary, please use this thread.
For bug reports, contributions, and translations, use the openttdcoop project page.
You can always get the latest version at http://bananas.openttd.org/en/gs/
You can also get a (less tested) snapshot of the latest source code from the repository at openttdcoop.
Edit:
Description (short): Modifies the game's towns so that their growth depends on cargo delivered to them.
Adds a time limit after which the game's companies are rated. 4 game modes. Highly customiseable.
Can now also support fixed game goals (a company wins after it achieves a certain score)!
- Attachments
-
- Readme.txt
- (40.95 KiB) Downloaded 5072 times
-
- CityBuilder.tar.gz
- (63.44 KiB) Downloaded 1621 times
Last edited by Aphid on 25 Jan 2016 21:12, edited 102 times in total.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: CityBuilder Release Topic
In order to increase your test audience and chance for quality feedback I suggest to
- upload your GS to bananas
- make available the readmes you want people to read online (e.g. by attaching them here) instead of asking them to download and unpack a tar and then open the enclosed readmes; especially as unpacking the tar is not even required for playing with the GS.
- upload your GS to bananas
- make available the readmes you want people to read online (e.g. by attaching them here) instead of asking them to download and unpack a tar and then open the enclosed readmes; especially as unpacking the tar is not even required for playing with the GS.
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: CityBuilder Release Topic
Citybuilder is now also available on bananas.
(Note: it requires a nightly version of OTTD above 24573 to run.)
(Note: it requires a nightly version of OTTD above 24573 to run.)
Re: CityBuilder Release Topic
And may I suggest you copy a description of what it does to your original post?Aphid wrote:Citybuilder is now also available on bananas.
(Note: it requires a nightly version of OTTD above 24573 to run.)
The old topic will stay open, over time it'll sink down far away enough for people to forget about it.
Re: CityBuilder Release Topic
I seem to need more information regarding the inner workings of GSText().
I've investigated for hours now and found some things.
For some unexplained reason, all calls of GSText in one specific code file seem to return the string "(instance: 0x00000000yyyyyyyy)", where each y is a hexadecimal, a 64-bit address. I've started commenting out random sections of code and changing variable names but the behaviour stays the same.The interesting fact is that, suppose I made a string called STR_HELLO, with the text "hello world", and then added the line.
Somewhere in the Start() function of GSController.
The program will, as expected, print out "hello world". However, if the same String is somehow present in a Log.Info call in the afronnemented file, "towngrowth.nut", the return value is "(instance: 0x00000000yyyyyyyy)". It does not matter which call happens first.
With a 32-bit OTTD version the return value should be (instance: 0xyyyyyyyy) instead.
Note: Different strings will, in fact, return different instance values.
I'm just wondering what could cause this?
Edit: Updated the code example. I should copy from the file, not my memory
I've investigated for hours now and found some things.
For some unexplained reason, all calls of GSText in one specific code file seem to return the string "(instance: 0x00000000yyyyyyyy)", where each y is a hexadecimal, a 64-bit address. I've started commenting out random sections of code and changing variable names but the behaviour stays the same.The interesting fact is that, suppose I made a string called STR_HELLO, with the text "hello world", and then added the line
Code: Select all
Log.Info(GSText(GSText.STR_HELLO), Log.LVL_INFO);
Somewhere in the Start() function of GSController.
The program will, as expected, print out "hello world". However, if the same String is somehow present in a Log.Info call in the afronnemented file, "towngrowth.nut", the return value is "(instance: 0x00000000yyyyyyyy)". It does not matter which call happens first.
With a 32-bit OTTD version the return value should be (instance: 0xyyyyyyyy) instead.
Note: Different strings will, in fact, return different instance values.
I'm just wondering what could cause this?
Edit: Updated the code example. I should copy from the file, not my memory
Last edited by Aphid on 12 Oct 2012 11:14, edited 1 time in total.
Re: CityBuilder Release Topic
You need
However, that uses GSLog.Info in the backend and IIRC, the log system doesn't support translated messages.
You can however pass GSText(GSText.STR_HELLO) as argument to a news message or GSGoal.Question.
Code: Select all
Log.Info(GSText(GSText.STR_HELLO), Log.LVL_INFO);
You can however pass GSText(GSText.STR_HELLO) as argument to a news message or GSGoal.Question.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: CityBuilder Release Topic
Edit: I think I figured it out.
The same behaviour is seen, but the situations are different.
If GSText returns a Text object, and GSLog will not interpret Text objects, then an attempt at logging a GSText returned object will not work.
Furthermore, if I take an empty string and try to concatenate a Text object, it will not work, with the exact same error message.
So the way to do it would be to GSText.AddParam(obj_2)?
The same behaviour is seen, but the situations are different.
If GSText returns a Text object, and GSLog will not interpret Text objects, then an attempt at logging a GSText returned object will not work.
Furthermore, if I take an empty string and try to concatenate a Text object, it will not work, with the exact same error message.
So the way to do it would be to GSText.AddParam(obj_2)?
Re: CityBuilder Release Topic
GSText is not a function, it's a class. What you see as a function call is in fact it's constructor.Aphid wrote:If GSText returns a Text object, and GSLog will not interpret Text objects, then an attempt at logging a GSText returned object will not work.
Use something like GSText(GSText.STR_TWO_STRINGS, text1, text2) where STR_TWO_STRINGS is "{STRING}{STRING}" or something like that.Then how to concatenate a Text object?
You don't. If you need raw strings you use normal strings and not GSText. GSText is only useful for those cases where the API explicitly expects a GSText object.Or get a raw string from one? (<< the latter would probably be a good thing to do from a programming perspective.)
Re: CityBuilder Release Topic
I was hoping this was not the proper solution, as there's a tiny problem that occurs.
It seems that you can add together GSText objects obj_1 and obj_2 via obj_1.AddParam(obj_2). There is also some limit to the amount of parameters present in a GSText object. (20?). So when I concatenate 7 objects with 3 params together this might cause a problem.
I may be mistaken but a game script probably should not be capable of causing crashes under any circumstances
A text box pops up with
Edit: I will switch to the method in the post above for concatenating GSText objects. The above problem in this post is thus not relevant to me anymore. However, it's probably for the best if the NoGo framework doesn't allow me to crash the game.
It seems that you can add together GSText objects obj_1 and obj_2 via obj_1.AddParam(obj_2). There is also some limit to the amount of parameters present in a GSText object. (20?). So when I concatenate 7 objects with 3 params together this might cause a problem.
I may be mistaken but a game script probably should not be capable of causing crashes under any circumstances

A text box pops up with
See the crash log for more details.Assertion failed at line 127 of c:\bamboo-agent-home\xml-data\build-dir\ottd-nightly-w64bit\src\strings_func.h: n < this->num_param
Edit: I will switch to the method in the post above for concatenating GSText objects. The above problem in this post is thus not relevant to me anymore. However, it's probably for the best if the NoGo framework doesn't allow me to crash the game.
- Attachments
-
- crash.log.txt
- crash log
- (9.12 KiB) Downloaded 878 times
Last edited by Aphid on 12 Oct 2012 12:19, edited 1 time in total.
Re: CityBuilder Release Topic
You're correct, it should not be possible. Could you please upload the script used to reproduce this crash to bugs.openttd.org?Aphid wrote:I may be mistaken but a game script probably should not be capable of causing crashes under any circumstances![]()
Re: CityBuilder Release Topic
Doing it the way you suggested using GSText constructors instead of GSText.AddParam(), causes the exact same crash.
I've made a minimal example script which will reproduce the crash. Instructions are; just let the game run 10 days with at least one active valid company ID. The crash then happens.
http://bugs.openttd.org/task/5333
The attached example script (identical to the example in the flyspray) should post a news message saying
Note: Not posting the news message (just creating the string) does not cause a crash.
I've made a minimal example script which will reproduce the crash. Instructions are; just let the game run 10 days with at least one active valid company ID. The crash then happens.
http://bugs.openttd.org/task/5333
The attached example script (identical to the example in the flyspray) should post a news message saying
Instead it crashes.Hello World! 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
Note: Not posting the news message (just creating the string) does not cause a crash.
- Attachments
-
- StringCrash.tar
- Example script that causes crash
- (7.5 KiB) Downloaded 550 times
Re: CityBuilder Release Topic
Version 5 has been uploaded.
You can now have more gradual introduction of requirements.
E.g. instead of a town needing 0 passengers at 499 and 125 passengers at 500 pop, it now needs, with 250/500/1000/500 settings:
0 at 499
0 at 500
125 at 750
250 at 1000
25% above 1000.
Edit: By the way, I avoided the above crash by simply ignoring the entire GSText and using normal strings for the monthly news message. It might mean it isn't translatable but it at least works.
You can now have more gradual introduction of requirements.
E.g. instead of a town needing 0 passengers at 499 and 125 passengers at 500 pop, it now needs, with 250/500/1000/500 settings:
0 at 499
0 at 500
125 at 750
250 at 1000
25% above 1000.
Edit: By the way, I avoided the above crash by simply ignoring the entire GSText and using normal strings for the monthly news message. It might mean it isn't translatable but it at least works.
Re: CityBuilder Release Topic
Thanks for your very clear testcases. The crash has been solved in r24593. I do have to warn you it still won't work like you expected. A substring included with {STRING} is not allowed to use any parameters, you'd have to change it to {STRING3}. That also means that you can't use strings like your STR_CONCAT recursively. You have to decide when you write you code how many strings you want to include.
Re: CityBuilder Release Topic
I've updated another number of times.
Current version is 9.
Added a feature that allows cities to grow when sufficient % passengers transported is reached. This is nice behaviour for citybuilder mode, allowing people to grow their towns to a much greater extent, without requiring you to connect too many cities.
note: cities in the desert require you to transport at least one unit of water and food. Cities above the snowline require at least one unit of food, even with this new setting. (this is default TTD behaviour)
Normal setting is 70%, range 50-95.
Current version is 9.
Added a feature that allows cities to grow when sufficient % passengers transported is reached. This is nice behaviour for citybuilder mode, allowing people to grow their towns to a much greater extent, without requiring you to connect too many cities.
note: cities in the desert require you to transport at least one unit of water and food. Cities above the snowline require at least one unit of food, even with this new setting. (this is default TTD behaviour)
Normal setting is 70%, range 50-95.
Re: CityBuilder Release Topic
Please, attach readme to this script.
After downloading and checking settings I am confused - what is difference between game types? "# of cargo reqs to jumble" (???), how I am supposed to guess what is mysterious MTR?
BTW, you may add as option to cargo ids like water, mail, passengers, goods and food to use autodetection using GSCargo::GetTownEffect ( CargoID cargo_type ) ( http://nogo.openttd.org/api/trunk/class ... a1a47fba2d ) [it may be especially useful in ECS where there are multiple passenger cargos]
In metropolis mode you may get town larger than 200 what makes impossible to build HQ there without demolishing houses.
EDIT: And it crashed.
I am really happy that somebody decided to start this project!
After downloading and checking settings I am confused - what is difference between game types? "# of cargo reqs to jumble" (???), how I am supposed to guess what is mysterious MTR?
BTW, you may add as option to cargo ids like water, mail, passengers, goods and food to use autodetection using GSCargo::GetTownEffect ( CargoID cargo_type ) ( http://nogo.openttd.org/api/trunk/class ... a1a47fba2d ) [it may be especially useful in ECS where there are multiple passenger cargos]
In metropolis mode you may get town larger than 200 what makes impossible to build HQ there without demolishing houses.
EDIT: And it crashed.
I am really happy that somebody decided to start this project!
- Attachments
-
- Przechwytywanie.PNG (36.3 KiB) Viewed 60926 times
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: CityBuilder Release Topic
After discovering readmes in first post
Readme testing:
Readme settings:
And I am still confused about MTR.
Readme testing:
Why not?I don't want someone claiming a town halfway into the game.
I really see no point of this.Cargo requirement variation
The same happens with AIs, to hide this you may instead do something like while(true)Sleep(111111111)The script crashes inexplicably when it ends without an error message
Is it an OpenTTD problem? I ask as I am unable to remember ticket about this on bugtracker.In the current nightly build, signs are not built in single-player mode.
Readme settings:
Misspelling.reqruiement
And I am still confused about MTR.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: CityBuilder Release Topic
First of all,
Thanks for your error report. I will look into the crash and an update should be up tomorrow.
Now I'll try answering your questions:
1) On allowing claims later on:
Suppose we're halfway into a citybuilder game. There's 5 companies present, with 5 sprawling railway networks. If the 6th company claims a town that's literally on another person's railroads, this would be very bad for the game. (the person would not be able to expand/modify his infrastructure).
You did make me think though, perhaps an even better solution would be to check for any company owned tiles within a town to be claimed's local authority. If all of these tiles belong to either invalid or the claiming company's property, then the claim is valid. (otherwise, it isn't).
This way, you can't claim towns when:
- someone else has claimed
- someone else has built infrastructure there.
What's your opinion on this?
2) On cargo req variation
The point of cargo requirement variation is mostly for co-op games. If the different towns have different tastes in how much stuff they want, it may be strategic growing towns to different extent(s) for maximum population.
3) MTR is metro requirement. Basically with this option on, cities only need their cargo taken away to grow, instead of you delivering anything to them. It's ideal for a multiplayer server, where there might be a problem where there just aren't enough cities on the map. The cities tend to grow rather rapidly as long as you take away enough passengers from them with this on. (Luukland solved this problem by making towns require less than they produce but that isn't really a solution).
Edit: Uploaded v10, which should fix the specific crash. If you still get a crash this time due to the script taking too long to save, try disabling autosave.
Thanks for your error report. I will look into the crash and an update should be up tomorrow.
Now I'll try answering your questions:
1) On allowing claims later on:
Suppose we're halfway into a citybuilder game. There's 5 companies present, with 5 sprawling railway networks. If the 6th company claims a town that's literally on another person's railroads, this would be very bad for the game. (the person would not be able to expand/modify his infrastructure).
You did make me think though, perhaps an even better solution would be to check for any company owned tiles within a town to be claimed's local authority. If all of these tiles belong to either invalid or the claiming company's property, then the claim is valid. (otherwise, it isn't).
This way, you can't claim towns when:
- someone else has claimed
- someone else has built infrastructure there.
What's your opinion on this?
2) On cargo req variation
The point of cargo requirement variation is mostly for co-op games. If the different towns have different tastes in how much stuff they want, it may be strategic growing towns to different extent(s) for maximum population.
3) MTR is metro requirement. Basically with this option on, cities only need their cargo taken away to grow, instead of you delivering anything to them. It's ideal for a multiplayer server, where there might be a problem where there just aren't enough cities on the map. The cities tend to grow rather rapidly as long as you take away enough passengers from them with this on. (Luukland solved this problem by making towns require less than they produce but that isn't really a solution).
Edit: Uploaded v10, which should fix the specific crash. If you still get a crash this time due to the script taking too long to save, try disabling autosave.
This is working as intended. Default setting for max claim is 200. If you change it to 0 (infinite), you can claim any town. Note: The claim in metropolis mode is meant to claim a town other than the metropolis to get benefits there to grow it better. (I'm still testing what works best here so this isn't implemented yet, you're welcome to supply ideas).In metropolis mode you may get town larger than 200 what makes impossible to build HQ there without demolishing houses.
Re: CityBuilder Release Topic
ad 1 - I see this and I think that with additional requirement everything should be OK
ad 3 - then it is extremely cryptic it may be a good idea to change to something more user friendly
ad reames - what about bundling readmes? - according to GUI of OpenTTD it should be possible.
ad 3 - then it is extremely cryptic it may be a good idea to change to something more user friendly
ad reames - what about bundling readmes? - according to GUI of OpenTTD it should be possible.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: CityBuilder Release Topic
Check out next nightly.Readme_Testing.txt wrote: - Extra primary industry
Again due to NoGo limitations, I can't spawn extra primary industry at the start.

Basically you will be allowed to call GSIndustryType.BuildIndustry and GSIndustryType.ProspectIndustry outside of GSCompanyMode scope. In this case no company will pay for the industry. Additionally, ProspectIndustry will only fail if OpenTTD fails to find a location to place the industry. The general chance that prospect fails doesn't apply for GSs when executing as deity. If you want to know the location of the built industry you still need to build it using BuildIndustry as ProspectIndustry doesn't return the construction tile. (you could of course crawl the industry list or wait for event to work around this limitation, but then using BuildIndustry might just be easier and warp it in a loop - just be warned that some NewGRFs have restrictive placement rules)r24623 wrote:-Feature: Allow GameScripts to construct and prospect industries without having a sponsor
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: CityBuilder Release Topic
I downloaded the nightly, and added the functionality to the script.
It works great. (and it's funny when I set it to 64, you get a map choked with industries).
Version 12 thus requires the current nightly (24624)
It works great. (and it's funny when I set it to 64, you get a map choked with industries).
Version 12 thus requires the current nightly (24624)
Who is online
Users browsing this forum: No registered users and 6 guests