Compositions are a way to combine buildings, roads, road decorations and trees as a building. An important property of compositions is the support of a non square ground size. Therefore it could be used to make up non squared buildings for example

Compositions are used for example for the pre-built train stations

Definition
Technically compositions are defined as buildings that contain a list of the "things" they are built up with. The user can build it like a regular building, the preview displays the actual contents of the building. However, once the player issues to build the building the actual contents of the building will be built instead.
Basic structure (here for the train station as an example)

Code: Select all
[
{
"id": "$somerandomid00",
"type": "decoration",
"width": 4,
"height": 2,
"composition": [
{"id": "$trainplatform03","x": 0,"y": 0,"frame": 1}, // A platform
...
{"id": "$rails00","x0": 0,"y0": 1,"x1": 3,"y1": 1}, // Rails/road
...
{"id": "$railroof01","x": 1,"y": 1}, // Road decoration (for the rail)
...
]
}
]
Code: Select all
[{
"id": "$compositionexample00",
"type": "decoration",
"width": 4,
"height": 2,
"composition": [] -- We will put something in here
}]
Code: Select all
{"id": "$park00", "x": 0, "y": 1, "frame": 0}
Code: Select all
{"id": "$road01", "x0": 0, "y0": 0, "x1": 3, "y1": 0}
Last but not least we want to put a crossing on the road. For that we will use the road decoration of id $roaddeco_crosswalk00. Similar to buildings it's sufficient to provide the id as well as a position x, y:
Code: Select all
{"id": "$roaddeco_crosswalk00", "x": 1, "y": 0}
Let's insert these objects into the composition array above and we get

Code: Select all
[{
"id": "$compositionexample00",
"type": "decoration",
"width": 4,
"height": 2,
"composition": [
{"id": "$park01", "x": 0, "y": 1, "frame": 0},
{"id": "$road01", "x0": 0, "y0": 0, "x1": 3, "y1": 0},
{"id": "$roaddeco_crosswalk00", "x": 1, "y": 0}
]
}]


Code: Select all
[{
"id": "$compositionexample01",
"type": "decoration",
"width": 3,
"height": 3,
"composition": [
{"id": "$road01", "x0": 0, "y0": 0, "x1": 2, "y1": 0,"l0":0,"l1":1},
{"id": "$road01", "x0": 2, "y0": 0, "x1": 2, "y1": 2,"l0":1,"l1":2},
{"id": "$road01", "x0": 2, "y0": 2, "x1": 0, "y1": 2,"l0":2,"l1":3},
{"id": "$road01", "x0": 0, "y0": 1, "x1": 2, "y1": 1,"join":false}
]
}]
New attributes were added for roads in compositions, namely:
Since version 1.10.62 you can also include bus stops in your compositions. Lines for bus stops will look like that:
Code: Select all
{"id": "$busstop00", "x":1, "y":0, "level":0}
Tool
To make building up a composition easier there's a tool to convert a selected rectangle from a city to corresponding json code. It's part of the Plugin Creator Tools that you may find in the Plugin Store (you may find it via search function or listed in Categories->Tools).
Once you have installed the tool(s) you can select it from the toolbar. After that mark the area you want to create a json composition code for. The code will be copied into your clipboard then. This may look like:
Code: Select all
{
"width":4,"height":2,
"composition":[
{"y0":0,"x0":0,"y1":0,"x1":3,"id":"$road01"},
{"level":0,"x":1,"y":0,"id":"$roaddeco_crosswalk00"},
{"x":0,"y":1,"id":"$park01","frame":0}
]
}
Known issues:
-The tool does not always handle road curves correctly.
-Road levels aren't supported, yet.