To get started we need some frames for the base graphics first: road.png
The orientation follows a specific order. For your own road it's sufficient to use this graphic as template. You have to provide 16 frames here.
As we want to have a bridge we also have to provide graphics for it: bridge.png The ordering is important
The number of frames must be a multiple of frames per bridge type. If you have 12 frames per bridge type (the default) and provide 24 frames for example, your road will have two types of bridges. You can set a higher frames per bridge type value by using
Code: Select all
"frames per bridge":X
Code: Select all
At least 12 frames per bridge
16 to provide ramp graphics which will be used for bridges starting from ground
18 to support "mid" pile frames
20 to support top pile frames
Frame usage:
0-3: slopes
4-7: small railings
8-9: piles
10-11: piles on water (only used on lowest part)
12-13: pile frames for mid part (and top if not provided) (if frames >= 18)
14-15: pile frames for top part (if frames >= 20)
last 4 frames: ramp under road for bridge slopes starting at level 0 (if frames >= 16)
If we use traffic lights, we also have to provide more information about phase lengths.
Our json code may now look like
Code: Select all
[
{
"id":"$testroad00",
"type":"road",
"level":1,
"speed":2.0,
"frames":[{"bmp":"road.png","w":32,"h":16,"count":16}],
"bridge frames":[{"bmp":"bridge.png","w":32,"h":48,"count":12}],
"frames per bridge":12,
"traffic lights":[{"bmp":"tf.png","w":32,"h":32,"count":4}],
"green phase":3000,
"yellow phase":500,
"price":50,
"bridge price":200,
"monthly price":2
}
]
The value level determines whether this road overrides other road types. Every road has it's own level and can only override roads which have a lower level. Value speed determines how fast cars will drive on this road. For reference, the slowest road has speed 1.0, the fastest road has speed 5.0 (natively in the game).
If you don't provide any frames for traffic lights your road won't have any. The values green phase and yellow phase indicate phase length in milliseconds (1000ms = 1s).
For recent versions please note that the road on the ramp needs one additional line of pixels on the top end to cover specific transitions between slopes and none slopes. The ramps in the image above have already been fixed.
Since terrain was added you can now specify your own frames that will be used for road that is placed directly onto slopes:
Code: Select all
"slope frames":[
{"x":120,"y":311,"w":32,"h":32,"count":4,"offset x":2048,"offset y":1024}
],
See here for how to support pedestrians on your road: viewtopic.php?f=41&t=14155
For diagonal roads see here: viewtopic.php?p=171988#p171988