The International Simutrans Forum

 

Author Topic: Growth scenario  (Read 25061 times)

0 Members and 1 Guest are viewing this topic.

Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Growth scenario
« on: January 07, 2014, 01:24:54 AM »
I would like to try the scenario feature of ST.  My idea is quite different from the examples given and I don't know if it is ever possible.  The public service would play an important role and make strategic decisions on where to build new industries/attractions and make cities grow:
  • I'd like to use pak128.Britain and start from 1750
  • The goal is to reach a certain global population as soon as possible
  • At the beginning the map is empty
  • The public service can found new cities at will
  • Each city has building points.  Each building/factory/attraction belonging to the city subtracts building points.  A city can earn building points when it has any pak.128Britain's Building yards and they consume bricks, clay, stone, ...
  • The public service can build new industries for a city: 1) if they are available in that date, 2) if it has the relevant building points (that depends on the type on industry and the intended max production for it), 3) if the max production of the new industry is not too high for the type of industry/date and 4) if, in the case that the new industry produces certain raw materials (e.g. coal, stone, clay, oil), the place has that raw material available
  • The public service can build new attractions/buildings for a city provided it has enough building points (those depend on the pass/mail level of the new building
  • At the beginning of each month, the population of a city can grow +100 or shrink -100 (up to a limit), depending on how well its people is served with food and clothes.  For each inhabitant and month, the city needs a level of protein (fish, meat or milk), carbohydrates (flour or milk), fruit+vegetables, and clothes.  The consumption of fishmongers, butchers, etc. belonging to that city is measured and if all levels are fulfilled and "allow city growth" is on, the city grows.  If any of the levels is below, the city shrinks
  • The previous levels can be lower if the city is provided in this order with enough amount of: first, furniture, then energy (coal yard, not power stations for this), then medicines.  This way, there are fewer deaths.
  • Alcohol, hardware and china consumption only generates cash.
  • I would like to include a rule regarding oil, petrol stations and car dealerships (something like you can't buy certain lorries/cars if the city is not provided with enough petrol), but I guess that is not possible...
  • I would also like to include certain rules about consuming industries: a dairy will provide protein levels for a city not only if it consumes milk but also if provided with passengers (but I guess that this is difficult)...
  • Power stations and electricity follow the usual rules, although the rules for building them are the same as for any other industry.
What do yo think?

About the technical issues:
  • I've seen that the squirrel function start() is called at the beginning of the scenario.  Is there another function that is called at the beginning of each month and after all industry/city statistics are computed?
  • I've also seen that certain buttons of the gui can be turned on and off.  Moreover, when the player builds something, it can be prevented with a message or allowed.  Does the latter apply to the public service as well?  Does the relevant function receive the data of the item that the player wants to build (for instance, the production/consumption of a new factory)?
  • Any other pitfalls that make this impossible?

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4555
  • Languages: EN, DE, AT
Re: Growth scenario
« Reply #1 on: January 07, 2014, 02:27:18 PM »
What do yo think?
This is a great idea! I would really like to see this taking off!

Now to answer your questions:
Quote
I would also like to include certain rules about consuming industries: a dairy will provide protein levels for a city not only if it consumes milk but also if provided with passengers (but I guess that this is difficult)...
The script can query most of the in-game statistics, among them consumption and passenger support of factories, http://dwachs.github.io/simutrans-sqapi-doc/classfactory__x.html
Quote
  • I've seen that the squirrel function start() is called at the beginning of the scenario.  Is there another function that is called at the beginning of each month and after all industry/city statistics are computed?
Not yet, can be added with ease.
Quote
  • I've also seen that certain buttons of the gui can be turned on and off.  Moreover, when the player builds something, it can be prevented with a message or allowed.  Does the latter apply to the public service as well?  Does the relevant function receive the data of the item that the player wants to build (for instance, the production/consumption of a new factory)?
The checks happen on the script side, see http://dwachs.github.io/simutrans-sqapi-doc/classrules.html and http://dwachs.github.io/simutrans-sqapi-doc/api__skeleton_8cc.html#a67f167f50ac44e2affeec9b47fd76093 . This means, the script can be adjusted to allow everything for public player but restricting the human players.

These methods cannot check for the precise item (which type of road, building etc).
Quote
  • Any other pitfalls that make this impossible?
Scripts cannot built anything yet. Which should not restrict you now in planning your scenario. Any serious effort on  scenarios also is a *big* motivation to work on the scripting interface. Adding functions to build factories and attractions at/near particular spots is not that difficult, the functionality is in the code already, only the interface is missing.

Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #2 on: January 08, 2014, 01:19:06 AM »
Thanks, Dwachs.

I've working on it a bit, and it is quite nice and I think that it opens a lot of possibilities for not-so-expert programmers to adapt the game to their preferences.

The main limitation I can see so far for my scenario to come true is that of knowing in advance the properties of the "thing" the player wants to build.  Apart from that, the feature would also be interesting for preventing to build certain factories away from rivers or similar questions posed in other threads that would not need to be hard-coded in the main exe, but could be solved in the scripting side.

But let's see where I can get...

At the moment, there seems to be a bug in file script/api_param.cc, lines 305 and 306:
Code: [Select]
                        i = param<sint16>::get(vm, -1);
                        sq_pop(vm, 1);
 

Squirrel kept on giving me errors whenever I asked a factory about the consumed amount of an input product.  If I deleted those two lines, everything seemed to go fine.  But I don't know for sure if it is a bug since I don't know anything about the Squirrel interface...


Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4555
  • Languages: EN, DE, AT
Re: Growth scenario
« Reply #3 on: January 08, 2014, 07:58:34 AM »
This is indeed a bug! Thanks for spotting this.

In which ways would you like to limit payers to build certain things? You can password-protect public player, forbid building of industries, for instance.

Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #4 on: January 08, 2014, 04:44:01 PM »
You're welcome.

I'd like to be able to be more selective: whenever the (public) player builds an industry, attraction, etc. now I can know the coordinates and general type of building (industry, attraction,...) and can allow or deny it.  What would be great is to have some extra information about the specific kind of industry, attraction, etc. and its max. production the (public) player intends to build.  That way, I can selectively allow or deny certain kinds of industries.  Or some of them near others, or near certain places, or in some periods (for example in a historical war)...

This way it is not necessary for the scripts to be able to build things themselves, but suffices to allow/deny the player's initiative based on certain rules.


Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9414
  • Languages: De,EN,JP
Re: Growth scenario
« Reply #5 on: January 08, 2014, 11:20:09 PM »
While implementation is possible, such a behaviour is extremely frustrating. Do not build here but five tile to the left ... Then I would rather go for skripted building. Actually, the code for this is almost there (the command system was build with also this in mind, even though no scripting existed back then). In principle the type of command, the number of the command and the command string (which can be obtianed also from -log 3 messages) are the only input parameter needed.

Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #6 on: January 09, 2014, 12:10:05 AM »
In the scenario I proposed I need to selectively allow/deny certain buildings due to their size, for instance.  For example, a city may have enough materials to build a church, but not so many to build a cathedral.  A message like: "you don't have enough materials to build this building" would appear whenever the (public) player wants to build the cathedral in that city.

Up to know, the progress is quite straight forward although I have to play the game while designing to see the effects and it takes time.  BTW, thanks Dwachs for implementing the new month and new year callbacks.

I have encountered two problems so far: 1) when loading a game with an scenario back, there appears an error, something about a userdefinedstring problem.  I guess it has to do with a wrong use of the persistent table. 2) I don't know why, today it didn't allow me to switch players back and forth again.  I had to temporarily use the brute-force...  :police:

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4555
  • Languages: EN, DE, AT
Re: Growth scenario
« Reply #7 on: January 09, 2014, 06:50:41 AM »
Your proposal sounds like you want to limit only the public player to build attractions, factories etc. This can certainly be done. The hooks have to be placed in different routines, as cities build things directly without using the tool-framework (simwerkz.cc).

I have encountered two problems so far: 1) when loading a game with an scenario back, there appears an error, something about a userdefinedstring problem.  I guess it has to do with a wrong use of the persistent table. 2) I don't know why, today it didn't allow me to switch players back and forth again.  I had to temporarily use the brute-force...  :police:
1) If you upload script + savegame I can help with debugging. There is still the chance that something is wrong in the code.

2) Switching players is disallowed by default, see lines 34-51 in script/scenario_base.nut

Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #8 on: January 10, 2014, 12:19:01 AM »
Not quite.  What I intend to do is that the player, switching to the public service and using its map editing tools, is the one building the factories and linking them.  And that the script be able to control what is allowed and what is denied and why.

This way, the player has to develop not only a good and profitable traffic network, but alto take strategic decisions about how to develop the map (where to place factories, new cities and attractions).

1) If you upload script + savegame I can help with debugging. There is still the chance that something is wrong in the code.

At the moment, I'm focused in seeing what is available and what can be done.  When the script has something more mature to show, I'll upload it and try to deal with those other problems.

BTW, is there a way I can show text in colors (specially red and green) in the Progress tab?


Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4555
  • Languages: EN, DE, AT
Re: Growth scenario
« Reply #9 on: January 10, 2014, 06:24:33 AM »
BTW, is there a way I can show text in colors (specially red and green) in the Progress tab?
You can use all the pseudo-html tags simutrans uses to display in-game help text:
http://dwachs.github.io/simutrans-sqapi-doc/api__skeleton_8cc.html#a706b5bd21f80fc116a158dc964a5cfed

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4555
  • Languages: EN, DE, AT
Re: Growth scenario
« Reply #10 on: January 10, 2014, 09:10:53 AM »
Sorry for double-post:

Regarding debugging: I am curious how you managed to find the bug in api_param.cc above, I could not trigger an error with my nut scripts.

Not quite.  What I intend to do is that the player, switching to the public service and using its map editing tools, is the one building the factories and linking them.  And that the script be able to control what is allowed and what is denied and why.
I see. This would require to map parts of the werkzeug_t class hierarchy to squirrel classes. Quite some bit of work. It is possible. And may pay-off in the long-run (as enabling scripting for AI is still a long-term goal).

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9414
  • Languages: De,EN,JP
Re: Growth scenario
« Reply #11 on: January 10, 2014, 11:53:06 PM »
To built something a squirrel script would only need three functions for general tools, one click tools and dialoge tools, and then a position and a string. That should be quite easy and straight forward. Or did I misunderstood something?

However, to allow or deny something, almost any tool needs to be filtered by squirrel. That seems indeed like an effort.

Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #12 on: January 11, 2014, 01:54:40 AM »
@Dwachs: thanks for the tip.  Now I have red to mark a deficit.
Regarding debugging: I am curious how you managed to find the bug in api_param.cc above, I could not trigger an error with my nut scripts.

I am trying first to get the maximum information available.  I made a loop to show each factory information.  Something like: theFactory.input.["bricks"].get_consumed()[0].  I run the script and got the error.  Looked for the possible places where the error could come and set a breakpoint there and looked at the variables stepping line by line.  Before those two lines, the variable was correct.  After them, incorrect.  I tried and erased the lines and everything seemed to work alright (checked with the information given in the dialogue of factory information).

Quote
I see. This would require to map parts of the werkzeug_t class hierarchy to squirrel classes. Quite some bit of work. It is possible. And may pay-off in the long-run (as enabling scripting for AI is still a long-term goal).

The ability of a script to build something may be interesting in general, but not so for my script (as far as I understand it).

Now I have more or less all the information I need from the objects.  I know now how many building points and food and clothes a given city has.  Now I need to restrict what the player can build with the public player tool.  I can see two options:
  • If a fourth parameter were added to is_work_allowed_here() telling the description of the object the player is trying to build (building_desc_x or similar), I could easily restrict that.  But if complicated, only the name of the object in the pak (e.g. BuildingYard1750) would suffice, since that information is static and can be included in the script.  If apart from that I could also have the production value input by the player in the factory builder dialog, that would be great.
  • The other possibility I'm exploring is more time consuming, error prone an inexact: allow to build anything in that city while the building points are positive.  But I have to cycle all the time tile by tile around the city accounting for how many buildings are already built.  I've tried and in fact the CPU time goes up.  Besides, since the player has one building he can build with no immediate cost, he can cheat and build a big stadium the first time...  Nevertheless, I think I'll keep on trying this possibility.
I'll keep you informed of my progress here and eventually show the code, when there is something worth to be shown.


Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #13 on: January 13, 2014, 12:33:12 AM »
I've nearly achieved the first part of the scenario:  building construction limitation.  However, I've stumped into a small problem: attractions.

In the squirrel's API, there are factory_list_x and the corresponding factory_x that allows you to easily iterate over all factories.  But there is not an attraction_list_x and the corresponding attraction_x to do the same.  Although I have tried to iterate over all tiles in the map and get the information, the thing gets complicated with multi-tile attractions.  Would it be possible to have that information available directly from the game engine, à la factory style?


Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4555
  • Languages: EN, DE, AT
Re: Growth scenario
« Reply #14 on: January 13, 2014, 11:06:33 AM »
It is possible to export a list of all build attractions. The list would contain all tiles of an attraction individually (instances of building_x). This is due to the fact that simutrans internally has no abstraction for multi-tile buildings. All tiles of buildings are treated individually, each tile knows that is is a sub-tile of a multi-tile building. But the is no multi-tile building has no representation itself.

Edit: I guess you would then need a function to decide whether two given building tiles actually belong to the same multi-tile building?

Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #15 on: January 13, 2014, 04:02:30 PM »
Not really.  It is better to have the proper list attraction_list_x and the proper object attraction_x.  Just the same that happens with factories.  And I guess that that behavior is inside the engine since if you press the lists button and, then, list of tourist destinations, there appears one entry for each attraction.

Moreover, if you click on any of the tiles of an attraction with the information tool, the window that appears have the same coordinates no matter what tile of the attraction you press.  This behavior is just like with factories.

To know if two building tiles belong to the same attraction, in this case, I could do the same I do with factories:  ask for the get_pos() method of factory_x and compare the values.


Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4555
  • Languages: EN, DE, AT
Re: Growth scenario
« Reply #16 on: January 13, 2014, 07:40:50 PM »
Here is a patch.

Usage:
Code: [Select]
local attraction_list = get_attraction_list()
foreach(att in attraction_list ) {
...
}
Is this what you wanted?

Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #17 on: January 13, 2014, 11:53:31 PM »
Thank you indeed!  It works like charm.

Only to get a taste of the WIP, I attach the present state.  You need a nightly of Pak128.Britain and a savegame named "test.sve".  Better if it has some Building Yards well provided.  You can see the building materials accumulate in the relevant city.

Comments and guidelines are welcome.


Offline Yona-TYT ve

  • Devotee
  • *
  • Posts: 1174
    • Simutrans-BLOG
  • Languages: ES
Re: Growth scenario
« Reply #18 on: January 14, 2014, 03:30:38 AM »

Big ..! the first scenario for pak128.Britain  ;D


Just have time I test.. :thumbsup:

Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #19 on: January 15, 2014, 12:01:36 AM »
In fact, it is just work in progress.  Nothing really playable yet.  I'll post more versions when some progress is made.


Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4555
  • Languages: EN, DE, AT
Re: Growth scenario
« Reply #20 on: January 17, 2014, 08:21:55 PM »
Implemented the attraction list slightly different:
Code: [Select]
local list = world.get_attraction_list()
 // list is now of type attraction_list_x
 foreach(att in list) {
     ... // att is an instance of the building_x class
 }

To know if two building tiles belong to the same attraction, in this case, I could do the same I do with factories:  ask for the get_pos() method of factory_x and compare the values.
No, get_pos will return the position of the individual tile, thus it will differ for different tiles of the same multi-tile building. I added building_x::is_same_building for this purpose.

Moreover
Code: [Select]
a.get_pos() == b.get_pos()
wont work, as squirrel does not check the members of instances/arrays/tables. It only checks whether the references (or pointers) to these objects are the same.

Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #21 on: January 18, 2014, 01:37:39 AM »
Thanks again, Dwachs for the inclusion of get_attraction_list.

Attached is the current state of the scenario.  I solved the multi-tile building issue by checking the relevant object (factory, attraction, etc.) instead.  In order to check for equality, I was aware of the issue you mention about coord and check the components instead, as you can see in the code.

Now the first issue I have is that I can check building of factories with tool_build_factory, building of houses with tool_build_house, but I don't have the equivalent: tool_build_attraction

In the scenario attached, there is a lot of debug information, but the main items of the first parts (building materials) is more or less done.

If anyone wants to check it, a nightly nightly of ST and pak128.Britain are needed.  But no serious game can be played now.

Please comment.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4555
  • Languages: EN, DE, AT
Re: Growth scenario
« Reply #22 on: January 18, 2014, 09:15:54 AM »
There is no separate tool to build attractions, it is included in tool_build_house.

If you set
Code: [Select]
map.file = "<attach>"
then the scenario can be started in an already existing game.

You record calls to tool_remover. However, the removing may fail even if the scenario allows it. In this case you need to check that the building is indeed deleted.

Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #23 on: January 19, 2014, 02:02:36 AM »
Thanks.  I have corrected that and now the tool_build_house also triggers "possible construction of attractions".

Regarding your remark about the tool_remover, there is no problem with the false positives, since that only triggers the update of the data cached to speed up presentation.  Some extra calculations are done, but nothing that really alters the final outcome.

Now, I'll go for the food+clothes issue.  When I have that part done, I'll post the scenario file again.

Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #24 on: January 26, 2014, 12:33:43 AM »
Self-reply.  ;)
I feel like John the Baptist preaching in the desert...  This time food is nearly done.  Next, clothes.

One question: is it possible to know in what fraction of the month the game is?

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4555
  • Languages: EN, DE, AT

Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #26 on: January 27, 2014, 12:43:43 AM »
Thanks, Dwachs.  I plan to use it to give a better estimate of present state in the progress window.

In this version, clothes are more or less included.  Some interface polish too.  You can see now your cities grow or shrink depending on whether you adequately supply them or not.

Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #27 on: January 27, 2014, 11:52:47 PM »
I would like to make the demand of clothes depend on climate, so that in colder places more clothes are needed.

But I don't understand very well the climate system.  In the map I am using (double heights), the settings were that winter snowline was height 7 and summer snowline was height 10.  When I run the game, those figures are not followed and have a summer snowline at -11...


Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2269
Re: Growth scenario
« Reply #28 on: January 31, 2014, 07:07:08 PM »
That shouldn't happen...

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9414
  • Languages: De,EN,JP
Re: Growth scenario
« Reply #29 on: January 31, 2014, 09:10:35 PM »
What is the groundwater level? If this is at 4 then 11 is equal to 7 ...

Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #30 on: February 01, 2014, 12:36:56 AM »
That's certainly the reason.  Thanks, prissi.

Here's a new version.  In this one, natural resources and factory production depends on location on the map and date.  Unfortunately, with today's Squirrel interface I haven't been able to enforce that and the player is asked to follow that rule.

A function that made possible to change the maximum production of an industry from Squirrel would alleviate that somewhat.

Please comment.


Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #31 on: February 03, 2014, 12:24:20 AM »
In this version, a bug is mended.  A custom map, based on the Swiss scenario, is also included.  In order to try it, please use a nightly both of simutrans and pak128.Britain.  Make a directory named scenario in the directory of the pak and unzip the growth directory inside it.

http://simutrans-germany.com/files/upload/growth.zip

I've been playing with it for some time and, although quite difficult to manage, I like the dynamics...

Comments, bugs, etc. are welcome.

Offline Yona-TYT ve

  • Devotee
  • *
  • Posts: 1174
    • Simutrans-BLOG
  • Languages: ES
Re: Growth scenario
« Reply #32 on: February 03, 2014, 12:36:35 AM »
Very nice... ;D

Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #33 on: February 03, 2014, 11:21:37 PM »
I'm glad you like it!  Here is my attempt to start with it.  I started to develop three zones where iron and coal were readily available:
  • Seaham region: that was my first attempt and made some mistakes.  For example, except for Helmsley, every other village has no building yard => no more buildings.  Seaham is now well provided and you can see the population grow.  Helmsley is too, but has no drinks.  Although it consumes milk!  Milk will be part drink in the next version of the scenario.  Note that Downham had to dig some tiles in order to find clay.
  • Alsager region: my second attempt.  Although not so well developped yet, no mistakes with building materials.  All villages either have a building yard or have credit for a new industry.
  • Lynmouth region: an attempt to make advantage of river Lyn, most of it navigable.  Developping.
http://simutrans-germany.com/files/upload/utopia07.sve


I would like to try and polish the scenario before considering how to improve it.  One thing would be a minimum separation between cities and a range for vehicles, so that they cannot travel forever but has to stop at intermediate halts.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4555
  • Languages: EN, DE, AT

Offline Yona-TYT ve

  • Devotee
  • *
  • Posts: 1174
    • Simutrans-BLOG
  • Languages: ES
Re: Growth scenario
« Reply #35 on: February 07, 2014, 07:46:18 PM »

Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #36 on: February 10, 2014, 01:05:51 AM »
I've been away all weekend.  Before leaving, when syncing my laptop, all the scenario files and versions vanished (my fault).  I could get growth.zip back from simutrans.germany.com, fortunately.  Not everything was lost!

I was lucky in my misfortune, since now the file is gone.  I wonder why it is gone.  Isn't the default time to stay there 60 days?

Offline Yona-TYT ve

  • Devotee
  • *
  • Posts: 1174
    • Simutrans-BLOG
  • Languages: ES
Re: Growth scenario
« Reply #37 on: February 10, 2014, 01:32:21 AM »
That is why I trust mediafire... ;)

Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #38 on: February 11, 2014, 01:27:51 AM »
Thanx for uploading again.

Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #39 on: February 16, 2014, 11:40:16 PM »
This is version 0.6.  It now includes furniture and hardware, which are demanded when the towns grow to a certain size.

I hope the link work.  I would use mediafire, but you have to sign up:
http://simutrans-germany.com/files/upload/growth.zip

Just in case, I also attach the .nut file.


Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #40 on: February 23, 2014, 01:52:10 AM »
This is the state of the game I'm playing with the current version of the scenario:
http://simutrans-germany.com/files/upload/utopia19.sve

Up to this point, even with all the industries needed for each town, the game is behaving quite well in my computer and keeping up with the load.

Regarding the state of the game itself (year 1759):
  • The initial zone of Seaham and Helmsley has solved some of the problems with towns with no Building yard, though some of them persist.  Seaham had problems with furniture supply, but now it is recovering.  Helmsley, on the other hand, has become a very beautiful town, although its growth has been stopped because it decided to build a "Castle Keep" that requires a huge amount of building materials (Clay: 340,  Wrought Iron: 340, Stone: 1777, Planks: 1323).  It will take some time for it to recover
  • The Lynmouth/Bradford/Boughton area is developping well in the meeting point of several rivers, the real advantage for transportation in these early years.  Teignmouth, down by the river side, is trying to get fish from the nearby lake, but it is short of Wrought Iron, which is also a problem for these area.  Since near Lynmouth, there is a source of coal, a new Ironworks industry is planned for the area
  • The Alsager area is the most active one.  Not for Alsager itself, that is short of Wrought Iron and grain to cope with its needs but because it has spawned two colonies: Wotton-under-edge in the north and, the best: Clare, at the other side of the Alps.  The sea near Clare is a very good opportunity for all those towns there to develop.
The game seems interesting to me, but maybe it has some micro management, but the growth is very organic and well organized.  The cities develop near rivers and other water ways, since water transportation has no direct competitor at this time, which seem natural and realistic to me.

Since I'm building all infrastructure with the public service, some strategy is missing.  Specially since you can always build canals to reach everywhere and ships don't occupy space and don't have traffic jams (they are perfect).  Nonetheless, I play to have fun and don't abuse of canals: I only build them on preexisting rivers or on short segments.

To play/see the game, you need a nightly of pak128.Britain, the scenario .nut file in a folder name scenario inside the pak directory and the savegame itself.


Offline IgorEliezer br

  • Devotee
  • Administrator
  • *
  • Posts: 4082
  • Cake recipes are cool... REALLY!
    • Igor Eliezer Architect and Urban Planner/Arquiteto e Urbanista
  • Languages: PT, EN, AutoLISP, Python
Re: Growth scenario
« Reply #41 on: February 23, 2014, 01:54:49 AM »
The file already vanished :(
The file won't vanish if the uploaded set 0 in "Days valid".
« Last Edit: February 23, 2014, 02:03:47 AM by IgorEliezer »

Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #42 on: February 23, 2014, 01:59:40 AM »
The strange thing is that I left the default (60 days), but it vanished much before.  My only guess is that I didn't password protect it and anyone can have deleted it.  Is that possible?

But if it is, I wouldn't understand the reason...


Offline IgorEliezer br

  • Devotee
  • Administrator
  • *
  • Posts: 4082
  • Cake recipes are cool... REALLY!
    • Igor Eliezer Architect and Urban Planner/Arquiteto e Urbanista
  • Languages: PT, EN, AutoLISP, Python
Re: Growth scenario
« Reply #43 on: February 23, 2014, 02:05:34 AM »
But if it is, I wouldn't understand the reason...
I always upload with password and set 0 if I don't want it to be deleted.

Hmm, something might have changed. Now I see there's a 3 years limit, but still I can find some old files with no expiration date. ???

Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #44 on: October 17, 2014, 10:46:37 PM »
Version 0.6.3 of the scenario.  Nothing important new, but starting date is now 1800, instead of 1750.

http://simutrans-germany.com/files/upload/growth.0.6.3.zip

Offline ny911

  • Web Team
  • *
  • Posts: 142
    • Simutrans Scenarios
  • Languages: EN, DE
Re: Growth scenario
« Reply #45 on: October 18, 2014, 08:06:31 PM »
Thanks ididoro, that's a great scenario script.

I was so free to change (look to source):
- version number is now a number and not part of the translation text
- moved text to files to enable translation
- create en.tab and filled up width text for translation
- add function get_about_text() ; for translation
- used include() to split script in files (just to get a overview)

Hopefully I didn't make an big error finding all text parts in the script.

Version 0.6.04 : http://simutrans-germany.com/files/upload/growth.0.6.4.zip

What kind of image do you like to have for your scenario to be placed at the scenarios on http://scenarios.simutrans.com ? Making a image from the Stonehenge at xy? Or just a minimap picture?


Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #46 on: October 19, 2014, 12:36:16 AM »
I'd rather say that the Stonehenge image.  Reason is that those attractions were placed in suitable places to start new cities (near rivers and natural resources).

Thanks.


Offline ny911

  • Web Team
  • *
  • Posts: 142
    • Simutrans Scenarios
  • Languages: EN, DE
Re: Growth scenario
« Reply #47 on: October 19, 2014, 08:59:00 PM »
The scenario is now also online at the scenario page.
Direct link:
http://scenarios.simutrans.com/scenario/pak128_britain/growth

Offline Aquin

  • *
  • Posts: 91
Re: Growth scenario
« Reply #48 on: November 12, 2014, 06:10:43 PM »
I just tried out your scenario, and I really liked it.

Yet there are some problems:
One the first try I started with creating a city and then placed a Building Yard and after that all material counters were negative, so I coudn't build even a simple sawmill.
On the next try I started with building all the building materials industry plus some food chains before founding the first city. I don't know if this is the intended way.

Even without that being allowed, well actually forced to, place all factories yourself made me place them in a fashion that optimizes the transportation routes. It somewhat inverts the idea of finding a nice network to service the industries.
It also invites to do all the infrastructure work with the public service, eliminating the maintenance burden.

At some point it happened that something was built that consumed steel before I was able to even build a steel mill, effectively preventing all future building.

Also I would like to make some suggestions for future improvements:
I would group the building materials in 3 groups:
Beams: Planks, Wrought Iron and Steel
Stone: Stone, Brick
Mortar: Clay, Cement
Where planks would give less "Beams" points than steel.

The food section is really nice.

All the other products I would group into 3 groups "Energie", "Essentials" and "Luxuries"
Energie would be coal to coal merchants or gasworks, or petrol to gasstations. Maybe also stuff delivered to power plants.
Essentials would be stuff like clothes, newpapers, medicine,...
Luxuries is the rest.
Or there could also be percentages to divide stuff between essentials and luxuries.
And all this sutff should be consumed in the same fashion as food.

I think 1800 is still a very early start, there is not so much land based transportation available at that time. If you call the land "Utopia" I don't expect a map of swiss and north italy.

I would suggest a artificial map, with some premade cities that already have some industry for building materials and a few food chains. Such that it is possible to get a some towns growing using factories nearby, other towns should require some longer distance transportation before they become independent.
Ideally future growth could be scripted such that manual placement of industries can be avoided. A town that reaches the trigger for industry growth would spawn or extend a chain for any resource, food, energy or other good.


Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #49 on: November 13, 2014, 11:49:18 PM »
Thank you, Aquin.  Your comments are much appreciated.

Note that some of the features of the scenario are planned that way on purpose, but some are the result of the limited interface that is available to script programmers.  Changing it is out of my reach, since it would involve to change the source code of the game.

For instance, the maximum amount of products a new factory can produce I want to be dependant on date and location, but that feature is not available from the script interface.  The only solution I envisioned was to "ask" the player to follow that limitation.

I'll try to answer some of your questions:

One the first try I started with creating a city and then placed a Building Yard and after that all material counters were negative, so I coudn't build even a simple sawmill.
On the next try I started with building all the building materials industry plus some food chains before founding the first city. I don't know if this is the intended way.

Yes.  That is intended.  You need building materials to produce building materials.  One way is as you said.  Another is to found cities for the only purpose of producing iron, and with no growth.  Also notice that each new city, besides having "credit" for the first industry, also adopts other cities industries that are nearer at no cost.

Quote
Even without that being allowed, well actually forced to, place all factories yourself made me place them in a fashion that optimizes the transportation routes. It somewhat inverts the idea of finding a nice network to service the industries.
It also invites to do all the infrastructure work with the public service, eliminating the maintenance burden.

I'm sorry, but that is intended.  It all depends where you place the border of the simulation.  In real life, transportation is built to serve preexisting industries, but some times, industries are built near preexisting transport infrastructure.

I don't know if you realize that you cannot build industries wherever you like.  You have to first check the scenario information for the production at that site (even it can be zero and you are forbidden to build it at that place).  But, as I said before, unfortunately, that can't be enforced.

Quote
At some point it happened that something was built that consumed steel before I was able to even build a steel mill, effectively preventing all future building.

That is certainly a bug.  My main concern there is that the first steel mill would require steel to be built, but I have not been able to check it.  I played till 1800 more or less.

Quote
Also I would like to make some suggestions for future improvements:
I would group the building materials in 3 groups:
Beams: Planks, Wrought Iron and Steel
Stone: Stone, Brick
Mortar: Clay, Cement
Where planks would give less "Beams" points than steel.

That is not intended in the scenario.  The idea is that new buildings would require steel so that the player is forced to build steel mills.  If we group them, you would be able to build the newest buildings with no steel...

Quote
All the other products I would group into 3 groups "Energie", "Essentials" and "Luxuries"
Energie would be coal to coal merchants or gasworks, or petrol to gasstations. Maybe also stuff delivered to power plants.
Essentials would be stuff like clothes, newpapers, medicine,...
Luxuries is the rest.
Or there could also be percentages to divide stuff between essentials and luxuries.
And all this sutff should be consumed in the same fashion as food.

The idea here was for these goods to be required only when a city reaches a certain size.  But it is something I left for later work.

Quote
I think 1800 is still a very early start, there is not so much land based transportation available at that time.

That is exactly the point!  The idea is to force the player to found industries and cities near rivers and sea, even to build canals, in the early times.  And see how the railroad changes the scene, just as it happened in real life.  The Stonehenge monuments in the initial map are placed in suitable sites to build in early times.  But playability can be an issue here in all this.

Quote
If you call the land "Utopia" I don't expect a map of swiss and north italy.

That was simply because it was a very nice map at hand.  You have a lot of sea and rivers and a natural wall that splits the map in two.  Only when technology is good enough, that natural barrier would be overcome.

Quote
I would suggest a artificial map, with some premade cities that already have some industry for building materials and a few food chains. Such that it is possible to get a some towns growing using factories nearby, other towns should require some longer distance transportation before they become independent.
Ideally future growth could be scripted such that manual placement of industries can be avoided. A town that reaches the trigger for industry growth would spawn or extend a chain for any resource, food, energy or other good.

That is nice, but it will be certainly another scenario.  One of the main features intended is that the player "develops" the whole map: transportation, but also resources.  But if you know programming, feel free to write your own, based on mine.

anp

  • Guest
Re: Growth scenario
« Reply #50 on: November 14, 2014, 06:21:29 PM »
Hello!

Long time lurker here. I play mostly Simutrans Experimental with pak128 Britain exp.

I am interested in this scenario but i cannot seem to get it to work. I have installed latest simutrans nightly (120.0-7371) and pak128 Britain (1493), created a scenario folder in the pak128 britain directory, but when i try to load the scenario from the main menu i get script errors.
[class tile_object_list_x not found]

Loading the utopia.sve as a save worked but i can't seem to find any information about scenario goals/rules anywhere and as Public Service player i seems to be able to found and grow cities as much as i want.

I am not sure how this scenario is supposed to work other than that you can only found new industries in, or grow cities when you have supplied enough building materials to that citys Builder's Yard.

Is there anywhere else i can find information about this scenario and how to get it to work?

Offline ny911

  • Web Team
  • *
  • Posts: 142
    • Simutrans Scenarios
  • Languages: EN, DE
Re: Growth scenario
« Reply #51 on: November 14, 2014, 10:32:30 PM »
Quote
I am interested in this scenario but i cannot seem to get it to work. I have installed latest simutrans nightly (120.0-7371) and pak128 Britain (1493), created a scenario folder in the pak128 britain directory, but when i try to load the scenario from the main menu i get script errors.
[class tile_object_list_x not found]
use directory ../pak128.britain/scenario/growth
inside the folder "growth" the scenario has 5 files and one subfolder "en"
don't use a subfolder like ../scenario/growth/growth

Quote
Loading the utopia.sve as a save worked but
well that's only the savefile without any scenario script, so you can't find anything

Quote
Is there anywhere else i can find information about this scenario and how to get it to work?
If you load the scenario correct it shows up all informations. Also possible, but not
use able if you like to play, are all the txt files in the subfolder "en" and the en.tab file in the main scenario folder. Just use a simple text editor to open.

anp

  • Guest
Re: Growth scenario
« Reply #52 on: November 15, 2014, 06:41:31 AM »
I got it to work by reinstalling simutrans. I think it might have conflicted with some simutrans experimental config files.

I'm not sure i understand the production limitations for industries. I just started a game (1800) and it says "production per tile 20" in the goal tab of the scenario window. Does that mean i can only set a Builder's Yard to demand 40 per month? Or have i understood it wrong? Is it possible to alter the production/demand of industries as the production limitations decreases?
Also i can't find places for quarries and clay pits. The only raw materials spots that are defined seem to be for coal and iron.

Offline isidoro

  • Devotee
  • *
  • Posts: 1128
Re: Growth scenario
« Reply #53 on: November 16, 2014, 01:51:06 AM »
The limitation per tile is a general one.  It means that in 1800, if an industry has four tiles, when you build it with the public player, you have to manually set the max production to 80.  But that general limitation can be more restrictive for some products.  In that case, that is also indicated in the scenario information.

Once the industry is built, the production can be changed by the game, but not by you (public service).  Some of the industry will grow on demand and won't respect the initial limitation (wood plantation, for instance), but that is done by the game, not the script and cannot be prevented.

Clay pits and quarries are very dependant on height.  For quarries, just look for rocky places, near the snowline.  For clay pits, look for sandy places near rivers.  In this case, you can even have to dig.

Hope it helps.