News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

Attraction Groups

Started by The Hood, January 01, 2012, 08:10:37 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

The Hood

One of the great things in the latest pak128.Britain release is the load of new attractions by wlindley e.g. castles and cathedrals.  However, there is a slight gameplay/realism problem here as noted by erem (http://forum.simutrans.com/index.php?topic=4454.msg82273#msg82273).  This picture shows it well:



As you can see Exeter has created three cathedrals and two castles (all coded as monuments rather than curiosities, but this isn't particularly relevent for what I propose I don't think).  While some cities do have more than one cathedral or castle this is pretty rare, but in testing I found that it was very common in simutrans for one city to "hog" all the monuments while most other cities got none (even if size was comparable). 

In order to prevent this I propose a new parameter for attraction (cur and mon) dat files - the attraction group.  Cities would be forbidden from building more than one object in the same group.  In this case all cathedrals would have, say, attraction_group=1 and all castles attraction_group=2.  The citybuilding routine would check for existing attractions in a group and would not place new attractions in the same groups, therefore limiting to 1 cathedral and 1 castle per city (and any other types as defined).

Hopefully this won't be too hard to do and will help spread out attractions in a more realistic way.

prissi

Cities are currently grown one after the other. Thus the first is more likely to catch the monuments ... That could of cousre be easily changed.

wlindley

#2
Would this work for the city generation code?

       
  • Find the earliest introduction date for buildings in the current pak. (Example: 1750)
  • Subtract from the map's start date to find the number of years between "then" and the start date (example: 1950 start date - 1750 = 200 years)
  • Set the map's Year to the earliest building introduction date.
  • Using code similar to Bresenham's Line Algorithm, using Years as the X axis, and the Number of Cities as the Y axis, step along the line just like drawing pixels, founding a city with each step up the Y axis, and advancing the Game's Year by 1 with each step along the X axis.  This means older cities, the ones that grow larger, will have a mix of older (obsolete by the time the play begins) and newer buildings.
  • At each "pixel" step (which is either along X or Y axis, depending on slope greater or less than 45 degrees), enlarge existing cities by a factor related to the "desired average city size" divided by "the number of year steps"
  • In parallel to the above, with each "pixel" step along differently-sloped lines which instead of the number of cities as the Y axis have as Y axis: the number of monuments, the number of curiosities, the number of factories... add those elements, also based on the current Year.
  • Stepping the city construction like this will also cause larger, older cities to have a more realistic distribution of curiosities and monuments.  Furthermore, it means that if a City Wall monument has an end date of 1800, then cities founded after that won't have one.  It also would produce a mix of newer and older factories and shops.
Furthermore, the city generation code could also keep a factor related to the introduction dates of sail versus engine-powered ships, that would indicate the increased preference for cities to locate along rivers and oceans in the earlier years.

If the above were implemented, would we still need the Attraction Groups?

prissi

Older cities will not get a core of old buildings. If there are newer buildings those get replaced. Old buildings are today also only in cities, that never saw any big expansion after their buildings. Like Quedlingvurg, where they raun out of silver ore or regensburg, which became less important for salt trade.

However, something like this is easily possible, and was though on for a long time. However, as soon as you grow the cities, those will be altered of course.

Fabio

Not necessarily. Buildings with highest levels in pakset (e.g. 60 in pak 128) won't be replaced at all. Nor would monuments or attractions.

prissi

In old ages transport was also with less capacity. Thus you need to cap old buildigns at lower levels or your game will become unplayable. For instance in pak64 the highest level was 13 until 1871 and then gradually increases to 27 in 1990.

Fabio

I understand, I never thought of this. So, it would be good to have a new entry in dats can_be_upgraded (=1 by default).
0 is meant for top level/top notch buildings whatever the actual level. These won't ever be upgraded.
Also upgrading constraints could be good for city appearance.

prissi

Well until 1950 old buildings even in central europe got torn down and only after that large scale preservation became an issue.

The Hood

Whatever the detailed process, I think any system resulting in (a) at least some older buildings in cities in maps generated in e.g. 1930 (especially attractions as these never get destroyed in game and are also representative of the buildings least likely to get destroyed in town reconstructions, e.g. churches, museums, major civic buildings) and (b) some way of spreading out buildings of the same type as described in my original post would be an improvement on current behaviour. 

Fabio

Quote from: prissi on January 02, 2012, 12:28:32 PM
Well until 1950 old buildings even in central europe got torn down and only after that large scale preservation became an issue.

well, most were torn down by WW2, which thankfully we don't simulate in ST. Also an upgrade constraint would be totally pakset-dependant.

prissi

Ok, gradual town growth will appear in next nghtly. Looked decent with pak64, pak128 and pak128.britain.

The Hood

That sounds great.  Does that include spacing out attractions too?

prissi

Could you be more specific what you mean by that? City attractions are build the same way than before, only lower level attractions can be built even if the retire year is before 1900.

The Hood

As per the first post - the fact that some cities get all the monuments and end up with 4 cathedrals.

Fabio


prissi

The year when the gradual growth occurs is first_town_year + difference*(2^n-1), and the first step will be at 32 inhabitant. THis will double at each step.

First growth is at the found ing year of the first townhall/road (1400 in pak64) by +32 people.
Next growth is +64 at 1400 + (starting_year-1400)/2 (= 1667 for 1930).
Next growth step is +128 at 1400 + (starting_year*3-1400)/4 (=1801).
Next is +256 at 1868 then 512 at 1901 and so on until the target level is reached.

Thus a 1000 inhabitants will not be reached until 1901 in the above example.

About protected buildings: One could imagine, that buildings, which are already retired are not replaced in later game (as pakset option). This will automatically generate some heritage buildings, especially when old villages grew to big towns.

Combuijs

Very, very, very nice addition!
Bob Marley: No woman, no cry

Programmer: No user, no bugs



MHD

I used to protect old buildings in the center by buing them. Would that influence this calculation?

Fabio

Quote from: prissi on January 03, 2012, 10:26:13 AM
About protected buildings: One could imagine, that buildings, which are already retired are not replaced in later game (as pakset option). This will automatically generate some heritage buildings, especially when old villages grew to big towns.

This would be great, altough it would be even better, if possible, at level of single building...

wlindley

The gradual city construction looks GREAT, in case no-one mentioned it, especially starting pak128.Britain in 1930 -- which always was a nasty edge case before -- you now get a wonderful mix of new and old, which is a huge upgrade from the old algorithm.  Three cheers!

jamespetts

Splendid! Shall look forward to merging this into Experimental when I get the time.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

The Hood

About this, the citybuildings mix is much better now. However with r5126 I still don't get retired attractions on map creation with timeline on. If anything, it's more important these are built on creation, as these represent the buildings (e.g. cathedrals, castles etc) which are least likely to get knocked down and replaced...

prissi

Set them to be founded at relatively lower levels like 500 or so.

The Hood

OK I see. HAving done this I get the occasional old attraction but the effect still seems too small. Perhaps the algorithm could be tweaked to make it more likely?