News:

SimuTranslator
Make Simutrans speak your language.

Explanation of City Config "Building Rules"

Started by sab0t, December 01, 2013, 02:48:03 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sab0t

hello!

if an answer to this question exists already i apologize, i could not find it. i have done many searches, tried using the wikis and other resources but no luck...only some discussion on experimenting with the building rules, but not really an explanation of how they work.

so in the cityrules.tab config file i can see the following:

Quote#
# 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
# U = road may be buildable
# u = unbuildable for road
# t = Stop/extension building
# T = no Stop
# . = anything matches
# SPACE = next row
#
# Each row must have EXACTLY the same number of members!
#

#---3x3 felder entstehen----

# Haus am Strassenrand (20%)
house_1 = ... Hn. sss
house_1.chance = -2

# Haus am Strassenrand (20%)
house_2 = ... .nH sss
house_2.chance = -2

# Haus an der Ecke (10%)
house_3 = ... .ns .ss
house_3.chance = 3

# Haus an der Ecke (10%)
house_4 = ... sn. ss.
house_4.chance = 3

# Haus an Kreuzung (33%)
house_5 = ..... ..... .sn.. sss.. .s...
house_5.chance = -5

# Haus neben Haus an Strasse (immer)
house_6 = ... hn. sss
house_6.chance = -7

# Haus neben Haus an Strasse (immer)
house_7 = ... .nh sss
house_7.chance = -7

# Haus zwischen 2 Häusern (50%)
house_8 = ... hnh ...
house_8 = -6

# Haus in 2ter reihe (12.5%)
house_9 = ..... .SSS. ..n.. .hhh. .sss.
house_9.chance = 1

# Haus in 2ter reihe (auf höhe haltstelle)(20%)
house_10 = ..... .SSS. ..n.. .hhh. .sts.
house_10.chance = -2

# Haus neben Haus in 2ter reihe (20%)
house_11 = ..... .SSS. .hn.. .hhh. .sss.
house_11.chance = -2

# Haus neben Haus in 2ter reihe (20%)
house_12 = ..... .SSS. ..nh. .hhh. .sss.
house_12.chance = -2

# Haus an Kreuzung mit Haltestelle (50%)
house_14 = ..... ..... .sn.. sst.. .s...
house_14.chance = -6

# Haus an Kreuzung mit Haltestelle (50%)
house_15 = ..... ..... .tn.. sss.. .s...
house_15.chance = -6


#Strassenregeln
# Strassenende weiterbauen(chance 50%).
road_1 = ... SnS SsS
road_1.chance = -6

# Abzweig(chance 20%)
road_2 = ....... ....... ...H... SSSnSSS ..sss.. ....... .......
road_2.chance = -2

# Krezung (immer).
road_3 = ....... ....... ...H... SSSnSSS ..sss.. ...s... .......
road_3.chance = -7

# Verbinden, gerade(immer)
road_4 = SsS .n. .s.
road_4.chance = -7

# rechtskurve (12.5%)
road_5 = ....... ....... ..S.... ..sn... ..sSS.. ..sSS.. ..sSS..
road_5.chance = 1

# linkskurve (12.5%)
road_6 = ....... ....... ....S.. ...ns.. ..SSs.. ..SSs.. ..SSs..
road_6.chance = 1

# diagonale1 (25%)
#road_7 = ..... .U... .Un.. ..ss. ...s.
#road_7.chance = -3

# diagonale2 (25%)
#road_8 = ..... ...U. ..nU. .ss.. .s...
#road_8.chance = -3

# verbindung diagonal(50%)
road_7 = s.. sn. hs.
road_7.chance = -6

# verbindung diagonal(50%)
road_8 = ..s .ns .sh
road_8.chance = -6

# Verbindung von Straße vorn links versetzt by sojo (100%)
road_9 = sS. sn. Ss.
road_9.chance = -7

# Verbindung von Straße vorn rechts versetzt by sojo (100%)
road_10 = .Ss .ns .sS
road_10.chance = -7

# Verbindung zweier Straßen die 2 Felder auseinander liegen und sich aneinander vorbei bewegen by sojo (100%)
road_11 = sSS sns SSs
road_11.chance = -7

# Verbindung zweier Straßen die 2 Felder auseinander liegen und sich aneinander vorbei bewegen by sojo (100%)
road_12 = SSs sns sSS
road_12.chance = -7

# Verbindung zweier Straßen die 2 Felder auseinander liegen und sich gemeinsam parallel bewegen by sojo (100%)
# .##+##
# ..#.#.
road_13 = .SsS. .ssS. ..n.. .ssS. .SsS.
road_13.chance = -7

# Verbindung zweier Straßen die 2 Felder auseinander liegen und sich gemeinsam parallel bewegen by sojo (100%)
# ..#.#.
# .##+##
road_14 = .SsS. .Sss. ..n.. .Sss. .SsS.
road_14.chance = -7

# Diagonale mit geringer Fehlerwahrscheinlichkeit by sojo (100%)
road_15 = ..Ss. .SssS .SnS. .SSS. .....
road_15.chance = -4

# Diagonale mit geringer Fehlerwahrscheinlichkeit by sojo (100%)
road_16 = .sS.. SssS. .SnS. .SSS. .....
road_16.chance = -4

# Test für vertikale Straßen by sojo (100%)
#road_15 = ...Ss ...ss .UnsS UUU.. UU...
#road_15.chance = -7

i understand each letter represents a square in a grid, but i do not know which parts in the line represent which part of a grid...this is my GUESS:
using an example: ... Hn. sss represents a grid like this:
[ . ] [ . ] [ . ]
[ H ] [ n ] [ s ]
[ s ] [ s ] [ s ]

if i am correct, how does that translate in game, as in game that grid would be shaped like a diamond.

i am also wondering how the "chance" value is used, as it seems to go into negative integers as well as positive.

does each definition represent some specific configuration, such that there is 15 different layouts for houses and 16 for roads in the quote i posted above?



looking forward to hearing back, thank you in advance!

prissi

First: The grid is quadratic (or rectangular) and not diamond shaped. You translated this into a matrix correctly.

A rule will be taken from above and tested on a random location within the city. If it matches, then action (building of road or houses) will be taken.

isidoro

#2
Yes, the diamond shape is only a matter of perspective.  Just move with your imagination the square grid to the ground of the 3D world.  The grid is valid for all four possible rotations for the purpose prissi stated, namely, where and under what rules should the city expand...  The rules are used so that the city won't grow completely at random, but have some structure.

Checking the code (simcity.cc), it seems at first glance that the formula for the chance is 100/(8+number) %, but in that case some of the comments for certain rules would be wrong:
100/(8-6) % = 50%, but
100/(8-2) % = 17%, not 20%.

Edit: I forgot to mention that that chance refers to the way a rule is chosen.  First, one rule of the list is chosen at random.  Then, the chance of the rule tells whether that rule is tried or not.  If it is not tried or if it didn't match, the same is done with the following rule of the list until, hopefully, one is found.