News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

cityrules.tab and Metroland

Started by jamespetts, February 05, 2012, 01:51:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jamespetts

Forgive me for my ignorance on the topic: I am trying to understand cityrules.tab rather more thoroughly, and the help file here seems a little incomplete. In particular, I am interested to know exactly how "t" ("must be a stop" in the comments in the version of the file that I have) works, and how it fits in with the structure of the rest of the file.

What I am after doing is increasing the chances of a town constructing buildings within the catchment area of stops as opposed to elsewhere, and to make that preference quite strong. The idea is to reproduce the effects of "Metroland", where the spread of railway lines shaped housing development. Is this possible (to a limited extent, at least) using the current code? If not, I should be grateful for any pointers on where in the code to look to make changes such as to make it possible.

Thank you in advance!
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

On a similar note it would be worth exploring the balance between building up and building out.  In the 1930s, building out along new suburban rail routes was the predominant mode of London's expansion; in more recent times (after the green belt) we've concentrated on building up, and especially in the vicinity of rail stations - take a look at the massive regeneration around St Pancras, Stratford and Ebbsfleet in response to HS1, and indeed the plans for Crossrail are quite heavily reliant on revenues from increased property prices and new development around stations.  I wonder if there's a way of detecting servicve level/connectivity as well and focusing building upwards near stations with many routes.

Whatever else though I do support the idea that development should be focused around stations/stops.

jamespetts

Certainly, taking into account the characteristics of stops, including their service level, would require code changes. A slightly tricky question then arises as to precisely how one measures the service level: perhaps the proportion of "happy" to "unhappy" and "no route" (and, in Experimental, "too slow") passengers multiplied by the total number of passengers divided by the size of the city...?
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.

Fabio

A use of t parameter is done in Pak 128 city rules. With a high chance (lower number) it favours cityroad building near a railways station, and consequently housing as well.
Note: in Pak 128 road rules are very complex, house rules are not. If streets are built, houses will pop out fast.

jamespetts

Fabio,

that is helpful, thank you. May I ask, as I am not familiar with the format of the cityrules.tab file - which of the great many numbers correlates with the probability of roads appearing near stops?

For reference, the Pak128.Britain cityrules.tab file is as follows:


# cityrules.tab
#
###############################################
##   C I T Y   B U I L D I N G   R U L E S   ##
###############################################
#
# ver. 5.02
#
# author: Hj. Malthaner <hansjoerg.malthaner@gmx.de>
# date:   25-Nov-03
# update: 22-Aug-04
# update: 05-Jan-05
# update: 08-Mar-08
# update: 10-Oct-08 by Fabio Gonella <fabio@gonella.eu>
# Adapted April 2010 by James E. Petts for Pak128.Britain-Experimental


# how far cities should be minimum apart (default 16)
minimum_city_distance = 12


# at which number of inhabitants we need a new market?
industry_increase_every = 7500

# chance for renovation versus new building (bigger number => less sprawling)
# Note: the rougher the desired landscape, the lower that this number should be.
# Note: this value is automatically reduced by a factor of three if quick_city_growth
# is enabled in simuconf.tab.
renovation_percentage = 43

# cities will not growth further along exiting roads, if the buildings density is lower (in percent)
minimum_building_desity = 28


#
# relative affinities for certain building types which can lead to clustering of certain building types
#

# avoid building next to industry
res_start_score = 0
res_near_ind = -8
res_near_com = 0
res_near_res = 8

# everywhere is good, next to com best
com_start_score = -10
com_near_ind = 1
com_near_com = 8
com_near_res = 1

# next to res means expensive filters and no truck after 10 pm => avoid this ...
ind_start_score = 0
ind_near_ind = 8
ind_near_com = 0
ind_near_res = -8


#
# now the actual building rules. They can be up to 7x7.
# allowed sizes are 3x3 5x5 and 7x7!
#

#
# Symbols in rules:
# S = must not be road
# s = must be road
# n = must be bare land
# H = must not be house
# h = must be house
# T = must not be a stop
# t = must be a stop
# . = anything matches
# SPACE = next row
#
# Each row must have EXACTLY the same number of members!
#

#### H O U S E S ####

### House at the corner
##
# . . . . . . .
# . . . . . . .
# . . . . . . .
# . . . n s . .
# . . . s s . .
# . . . . . . .
# . . . . . . .
#
house_1 = ....... ....... ....... ...ns.. ...ss.. ....... .......
house_1.chance = -2
house_2 = ....... ....... ....... ..sn... ..ss... ....... .......
house_2.chance = -2

### House one tile from the corner
##
# . . . . . . .
# . . . . . . .
# . . . . . . .
# . . . n h s .
# . . . s s s .
# . . . . . . .
# . . . . . . .
#
house_3 = ....... ....... ....... ...nhs. ...sss. ....... .......
house_3.chance = -2
house_4 = ....... ....... ....... .shn... .sss... ....... .......
house_4.chance = -2

### House three tiles from the corner
##
# . . . . . . .
# . . . . . . .
# . . . . . . .
# . . . n h h s
# . . . s s s s
# . . . . . . .
# . . . . . . .
#
house_5 = ....... ....... ....... ...nhhs ...ssss ....... .......
house_5.chance = -2
house_6 = ....... ....... ....... shhn... ssss... ....... .......
house_6.chance = -2

### House between other two
##
# . . . . . . .
# . . . . . . .
# . . . S . . .
# . . h n h . .
# . . s s s . .
# . . . . . . .
# . . . . . . .
#
house_7 = ....... ....... ...S... ..hnh.. ..sss.. ....... .......
house_7.chance = -2

### House at a dead end
##
# . . . . . . .
# . . . . . . .
# . . . h . . .
# . . . n . . .
# . . . s . . .
# . . . . . . .
# . . . . . . .
#
house_8 = ....... ....... ...h... ...n... ...s... ....... .......
house_8.chance = -2
##
# . . . . . . .
# . . S h S . .
# . . S S S . .
# . . S n S . .
# . . S s S . .
# . . s s s . .
# . . . . . . .
#
house_9 = ....... ....... ..ShS.. ..SnS.. ..SsS.. ..sss.. .......
house_9.chance = -2

### House near an end
##
# . . . . . . .
# . . . . . . .
# . . S S . . .
# . . S n . . .
# . S s S . . .
# . s s s . . .
# . . . . . . .
house_10 = ....... ....... ..SS... ..Sn... .SsS... .sss... .......
house_10.chance = -2
house_11 = ....... ....... ...SS.. ...nS.. ...SsS. ...sss. .......
house_11.chance = -2

## House near a stop
##
# . . . . . . .
# . . . . . . .
# . . . . . . .
# . . . n . . .
# . . s t s . .
# . . . . . . .
# . . . . . . .
#
house_12 = ....... ....... ....... ...n... ..sts.. ....... .......
house_12.chance = -2
##
# . . . . . . .
# . . . . . . .
# . . . . . . .
# . . . n . . .
# . s t s . . .
# . . . . . . .
# . . . . . . .
#
house_13 = ....... ....... ....... ...n... .sts... ....... .......
house_13.chance = -2
house_14 = ....... ....... ....... ...n... ...sts. ....... .......
house_14.chance = -2
##
# . . . . . . .
# . . . . . . .
# . . . . . . .
# . . . n . . .
# s t s . . . .
# . . . . . . .
# . . . . . . .
#
house_15 = ....... ....... ....... ...n... sts.... ....... .......
house_15.chance = -2
house_16 = ....... ....... ....... ...n... ....sts ....... .......
house_16.chance = -2


#### R O A D S ####

### Straight Road
##
# . . . . . . .
# . . . . . . .
# . . . S . . .
# . s s n H H H
# . . . S . . .
# . . . . . . .
# . . . . . . .
#
road_1 = ....... ....... ...S... .ssnHHH ...S... ....... .......
road_1.chance = -4

### T Crossing
##
# . . . . . . .
# . . . H . . .
# . S S H S S .
# . S S n S S .
# . . . s s H .
# . S S . S S .
# . S S . S S .
#
road_2 = ....... ...H... .SSHSS. .SSnSS. ...ssH. .SS.SS. .SS.SS.
road_2.chance = -2
road_3 = ....... ...H... .SSHSS. .SSnSS. .Hss... .SS.SS. .SS.SS.
road_3.chance = -2

### Z Crossing
##
# . . . . . . .
# . . . H . . .
# . S S H S S .
# . S S n S S .
# . H H s s s .
# . . S S S s .
# . . S S S H .
#
road_4 = ....... ...H... .SSHSS. .SSnSS. .HHsss. ..SSSs. ..SSSH.
road_4.chance = -4
road_5 = ....... ...H... .SSHSS. .SSnSS. .sssHH. .sSSS.. .HSSS..
road_5.chance = -4

### Links
##
# . . . . . . .
# . S S s S S .
# . S S s S S .
# . s s n s s .
# . . S . S . .
# . . S . S . .
# . . . . . . .
#
road_6 = ....... ..SsS.. ..SsS.. .ssnss. ..S.S.. ..S.S.. .......
road_6.chance = -4
##
# . . . . . . .
# . . S S S . .
# . . S S S . .
# . s s n s s .
# . . S S S . .
# . . S S S . .
# . . . . . . .
#
road_7 = ....... ..SSS.. ..SSS.. .ssnss. ..SSS.. ..SSS.. .......
road_7.chance = -4
##
# . . . . . . .
# . . . . . . .
# . . S . S . .
# . s s n . . .
# . . S s S . .
# . . . s . . .
# . . . . . . .
#
road_8 = ....... ....... ..S.S.. .ssn... ..SsS.. ...s... .......
road_8.chance = -4
road_9 = ....... ....... ..S.S.. ...nss. ..SsS.. ...s... .......
road_9.chance = -4
##
# . . . . . . .
# . . . . . . .
# . . S S s S .
# . s s n s . .
# . . S S s S .
# . . . . . . .
# . . . . . . .
#
road_10 = ....... ....... ..SSsS. .ssns.. ..SSsS. ....... .......
road_10.chance = -4
road_11 = ....... ....... .SSsS.. ..snss. .SSsS.. ....... .......
road_11.chance = -4
##
# . . . . . . .
# . . . . . . .
# . . . h s h .
# . . . n s . .
# . . h s h . .
# . . S s S . .
# . . . . . . .
#
road_12 = ....... ....... ...hsh. ...ns.. ..hsh.. ..SsS.. .......
road_12.chance = -4
road_13 = ....... ....... .hsh... ..sn... ..hsh.. ..SsS.. .......
road_13.chance = -4
##
# . . . . . . .
# . . . . . . .
# . . . s s s s
# . . . n . . .
# . . . s . . .
# . . . s . . .
# . . . s . . .
#
road_14 = ....... ....... ...ssss ...n... ...s... ...s... ...s...
road_14.chance = -4
road_15 = ....... ....... ssss... ...n... ...s... ...s... ...s...
road_15.chance = -4
road_16 = ....... ....... ....... sssn... ...s... ...s... ...s...
road_16.chance = -4
##
# . . . . . . .
# . . . . . . .
# . S S s s s s
# . S S n S S .
# s s s H S S .
# . . . . . . .
# . . . . . . .
#
road_17 = ....... ....... .SSssss .SSnSS. sssHSS. ....... .......
road_17.chance = -4
road_18 = ....... ....... ssssSS. .SSnSS. .SSHsss ....... .......
road_18.chance = -4


### Cutting diagonals
##
# . . . H . . .
# . . S H S S .
# . S S H S s s
# H H H n s s S
# . S S s s S .
# . S s s S . .
# . . s . . . .
#
road_19 = ....... ..S.SS. .SS.Sss HHHnssS .SSssS. .SssS.. ..s....
road_19.chance = -4
road_20 = ....... .SS.S.. ssS.SS. SssnHHH .SssSS. ..SssS. ....s..
road_20.chance = -4
road_21 = ...H... ..SHSS. .SSHSss ...nssS .SSssS. .SssS.. ..s....
road_21.chance = -4
road_22 = ...H... .SSHS.. ssSHSS. Sssn... .SssSS. ..SssS. ....s..
road_22.chance = -4
road_23 = ....... ....... ....... sssnss. .SSssS. .SssS.. ..s....
road_23.chance = -8
road_24 = ....... ....... ....... .ssnsss .SssSS. ..SssS. ....s..
road_24.chance = -8
road_25 = ...s... ....... ....... ...nss. .SSssS. .SssS.. ..s....
road_25.chance = -8
road_26 = ...s... ....... ....... .ssn... .SssSS. ..SssS. ....s..
road_26.chance = -8
##
# . . . . . . .
# . . . S . . .
# . . S S . S .
# . H H n s s s
# . . S S s s .
# . . S s s . .
# . . . s . . .
#
road_27 = ....... ...S... ..SS.S. .HHnsss ..SSss. ..Sss.. ...s...
road_27.chance = -4
road_28 = ....... ...S... .S.SS.. sssnHH. .ssSS.. ..ssS.. ...s...
road_28.chance = -4

### End of file
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.

Fabio

Glad to see yours are based on mine too!

Road_1.chance is the chance number. The lower the number (also negative) the better chance IIRC.

jamespetts

Hmm - and forgive me for being possibly a little ignorant here - where would I change the chance figure? road_1 is defined thus:


road_1 = ....... ....... ...S... .ssnHHH ...S... ....... .......


and so makes no reference to "t". None of the other road definitions make reference to "t". The format of this file seems rather fiendish - where would one go about adding a definition with a "t"?
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.

VS

Station is used in rules for houses 13-16. Road rules do not contain this at all.

As to format:

There are tuples of house_N and house_N.chance (or road). Each of these pairs is a single rule.

What you see on right hand side for house_N= is a serialized representation of a square. If you break line at every space, you will see the square (needs proportional font). The contents of this square are in fact a mask. The individual characters correspond to tile contents; there is a legend for that somewhere at the top. A rule is valid for a given tile only if the mask fits the map surrounding that tile. (I guess each to-be-construction tile is checked against all rules and then a random one selected according to weights, but look that up in the code for a definite answer.)

Each rule is rotated to all 4 variants, so for non-symmetrical ones you need also a reverse variant.

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

jamespetts

Hmm... so, am I right in inferring that the "house" (do I read that as city building generally?) is always built on the "n" tile(s) specified in these files, rather than on the .s or the other letters?
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.

Fabio

Yes, buildings and roads are respectively always built on the central n

Sorry about the previous confusion, my memory betrayed me...

jamespetts

So, the "n" always has to be in the centre? Also, do all of the sets have to be the same size (i.e., all 3x3, 5x5 or 7x7), or can there be a mix?

Thank you all for your help so far!
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.

VS

The centre is the tile, for which the rules are being tested. It makes no sense to have it non-empty and result in OK for construction. So, yes, the "n" there is a must (you could get some material for bug reports though :D ).

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

jamespetts

Thank you - that is helpful. What about mixed grid sizes?
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.

Fabio


jamespetts

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.

Dwachs

Quote from: VS on February 05, 2012, 08:36:41 PM
The centre is the tile, for which the rules are being tested. It makes no sense to have it non-empty and result in OK for construction. So, yes, the "n" there is a must (you could get some material for bug reports though :D ).
The center 'n' is ignored ;)
Parsley, sage, rosemary, and maggikraut.

jameskuyper

Quote from: VS on February 05, 2012, 08:36:41 PM
The centre is the tile, for which the rules are being tested. It makes no sense to have it non-empty and result in OK for construction. So, yes, the "n" there is a must (you could get some material for bug reports though :D ).
It could make sense, and until I located this message, I thought it might be allowed. Specifically, I thought (and was hoping) that if I place an 'h' in the center of a road rule, the rule would be triggered only if there was a house in the specified location, and it would replace that house with a road. I have rules that should build a road network the way I want it built, and rules that place houses, but modifying the house rules to NOT place them in locations where I want to have roads would get significantly more complicated. Creating two forms of every road rule, one with an 'n' in the center, and one with an 'h' in the center, would be simpler than the required modifications to the house rules.