Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Wed Dec 12, 2018 1:24 pm

All times are UTC




Post new topic  Reply to topic  [ 208 posts ]  Go to page 1 2 3 4 511 Next
Author Message
PostPosted: Mon Oct 08, 2012 12:51 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Fri Dec 16, 2011 5:08 pm
Posts: 166
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)!


Attachments:
Readme.txt [40.95 KiB]
Downloaded 3492 times
CityBuilder.tar.gz [63.44 KiB]
Downloaded 664 times


Last edited by Aphid on Mon Jan 25, 2016 9:12 pm, edited 102 times in total.
Top
   
PostPosted: Mon Oct 08, 2012 1:13 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Wed Nov 07, 2007 10:44 pm
Posts: 9062
Location: Sol d
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.

_________________
Image
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


Top
   
PostPosted: Mon Oct 08, 2012 1:32 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Fri Dec 16, 2011 5:08 pm
Posts: 166
Citybuilder is now also available on bananas.
(Note: it requires a nightly version of OTTD above 24573 to run.)


Top
   
PostPosted: Tue Oct 09, 2012 10:49 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Tue Dec 03, 2002 10:36 am
Posts: 13179
Location: The Netherlands
Aphid wrote:
Citybuilder is now also available on bananas.
(Note: it requires a nightly version of OTTD above 24573 to run.)

And may I suggest you copy a description of what it does to your original post?

The old topic will stay open, over time it'll sink down far away enough for people to forget about it.

_________________
Image
Dutch Trainset for OpenTTD | Dutch Trainset Topic | Combined Roadset v0.10


Top
   
PostPosted: Fri Oct 12, 2012 10:35 am 
Offline
Traffic Manager
Traffic Manager

Joined: Fri Dec 16, 2011 5:08 pm
Posts: 166
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
Code:
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 Fri Oct 12, 2012 11:14 am, edited 1 time in total.

Top
   
PostPosted: Fri Oct 12, 2012 10:53 am 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4538
Location: /home/sweden
You need
Code:
Log.Info(GSText(GSText.STR_HELLO), Log.LVL_INFO); 


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.

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
PostPosted: Fri Oct 12, 2012 10:58 am 
Offline
Traffic Manager
Traffic Manager

Joined: Fri Dec 16, 2011 5:08 pm
Posts: 166
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)?


Top
   
PostPosted: Fri Oct 12, 2012 12:01 pm 
Offline
Tycoon
Tycoon

Joined: Thu Dec 20, 2007 12:49 pm
Posts: 3653
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.
GSText is not a function, it's a class. What you see as a function call is in fact it's constructor.

Quote:
Then how to concatenate a Text object?
Use something like GSText(GSText.STR_TWO_STRINGS, text1, text2) where STR_TWO_STRINGS is "{STRING}{STRING}" or something like that.

Quote:
Or get a raw string from one? (<< the latter would probably be a good thing to do from a programming perspective.)
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.


Top
   
PostPosted: Fri Oct 12, 2012 12:12 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Fri Dec 16, 2011 5:08 pm
Posts: 166
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 :roll:

A text box pops up with

Quote:
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


See the crash log for more details.

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:
File comment: crash log
crash.log.txt [9.12 KiB]
Downloaded 345 times


Last edited by Aphid on Fri Oct 12, 2012 12:19 pm, edited 1 time in total.
Top
   
PostPosted: Fri Oct 12, 2012 12:15 pm 
Offline
Tycoon
Tycoon

Joined: Thu Dec 20, 2007 12:49 pm
Posts: 3653
Aphid wrote:
I may be mistaken but a game script probably should not be capable of causing crashes under any circumstances :roll:
You're correct, it should not be possible. Could you please upload the script used to reproduce this crash to bugs.openttd.org?


Top
   
PostPosted: Fri Oct 12, 2012 12:58 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Fri Dec 16, 2011 5:08 pm
Posts: 166
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

Quote:
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


Instead it crashes.

Note: Not posting the news message (just creating the string) does not cause a crash.


Attachments:
File comment: Example script that causes crash
StringCrash.tar [7.5 KiB]
Downloaded 181 times
Top
   
PostPosted: Sat Oct 13, 2012 10:33 am 
Offline
Traffic Manager
Traffic Manager

Joined: Fri Dec 16, 2011 5:08 pm
Posts: 166
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.


Top
   
PostPosted: Sun Oct 14, 2012 3:21 pm 
Offline
Tycoon
Tycoon

Joined: Thu Dec 20, 2007 12:49 pm
Posts: 3653
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.


Top
   
PostPosted: Tue Oct 16, 2012 10:43 am 
Offline
Traffic Manager
Traffic Manager

Joined: Fri Dec 16, 2011 5:08 pm
Posts: 166
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.


Top
   
PostPosted: Tue Oct 16, 2012 12:52 pm 
Offline
Tycoon
Tycoon

Joined: Wed Aug 26, 2009 6:33 am
Posts: 2493
Location: Poland
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!


Attachments:
Przechwytywanie.PNG
Przechwytywanie.PNG [ 36.3 KiB | Viewed 37971 times ]

_________________
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Top
   
PostPosted: Tue Oct 16, 2012 1:15 pm 
Offline
Tycoon
Tycoon

Joined: Wed Aug 26, 2009 6:33 am
Posts: 2493
Location: Poland
After discovering readmes in first post

Readme testing:

Quote:
I don't want someone claiming a town halfway into the game.

Why not?

Quote:
Cargo requirement variation

I really see no point of this.

Quote:
The script crashes inexplicably when it ends without an error message


The same happens with AIs, to hide this you may instead do something like while(true)Sleep(111111111)

Quote:
In the current nightly build, signs are not built in single-player mode.


Is it an OpenTTD problem? I ask as I am unable to remember ticket about this on bugtracker.

Readme settings:

Quote:
reqruiement


Misspelling.

And I am still confused about MTR.

_________________
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD


Top
   
PostPosted: Wed Oct 17, 2012 6:48 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Fri Dec 16, 2011 5:08 pm
Posts: 166
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.

Quote:
In metropolis mode you may get town larger than 200 what makes impossible to build HQ there without demolishing houses.


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).


Top
   
PostPosted: Thu Oct 18, 2012 11:47 am 
Offline
Tycoon
Tycoon

Joined: Wed Aug 26, 2009 6:33 am
Posts: 2493
Location: Poland
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.

_________________
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD


Top
   
PostPosted: Mon Oct 22, 2012 10:22 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4538
Location: /home/sweden
Readme_Testing.txt wrote:
- Extra primary industry

Again due to NoGo limitations, I can't spawn extra primary industry at the start.


Check out next nightly. :-D
r24623 wrote:
-Feature: Allow GameScripts to construct and prospect industries without having a sponsor


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)

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
PostPosted: Wed Oct 24, 2012 2:18 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Fri Dec 16, 2011 5:08 pm
Posts: 166
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)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 208 posts ]  Go to page 1 2 3 4 511 Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2018 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2018.
Hosted by Zernebok Hosting.