After a long wait, I am writing another tutorial again. This time, we will discuss about the layout file for transportation. I will assume that you have some basic knowledge regarding modding. If not, please read the Modders lesson one
for the introduction. If you found any mistake on this tutorial, please do point it out. Thanks
Today, we will see the file called r_road_40x15 which can be found in data\design\layout\road\r_road_40x15. This is a layout file for the small road.
In that file, you will see there is a lot of <LayoutEntry>tag. Those layout entries are the item you will see in the game. This tutorial will basically introduce some important layout entries and tell you what are those entries represent in the game.
Code:<LayoutEntry> <ID>Plug</ID> <Type>PLUG</Type> <PrototypeFile>data\design\editor\plug.class</PrototypeFile> <Rotation>0,-0.7070693374,0,0.7071441412</Rotation> <Scale>0.9999946952,1,0.9999946952</Scale> <Control>HERIT</Control> </LayoutEntry>
As you can see in the picture above, a plug is the red box at the end of the road. It acts like a connection that connect one layout file to the other. The traffic that flows out the plug will flow into the plug of the other piece of road. Therefore, you must ensure all the tracks in your layout file is connected to the plug directly or indirectly.
There are several child tags under the layout menu.
- <ID>Plug</ID> This is the name of this layout entry. This name is used in other entries to refer to this entry.
- <Type>PLUG</Type> This is the entry type. Obviously this entry is a plug.
- <PrototypeFile>data\design\editor\plug.class</PrototypeFile> This link to the file that define the layout entry. You could take a lot at the files underdata\design\editor\. Those are layout entries that you can use in the .layout file.
- <Rotation>0,-0.7070693374,0,0.7071441412</Rotation> The rotation angle. This thing is a bit complicated and I will explain it in later section.
- <Scale>0.9999946952,1,0.9999946952</Scale> The scale of the layout entry. It is the ratio of the model and the item appearing in the game in x, y and z direction. I need to mention, scale is not working in some models. You need to test it out which model uses the scale parameter.
- <Control>HERIT</Control> Info needed
Next, we will see a layout entry called track. The following code is taken somewhere at the top quarter of the page.
Code:<LayoutEntry> <ID>Track002</ID> <Type>TRACK</Type> <PrototypeFile>data/design/editor/track_road.class</PrototypeFile> <Position>10.24999714,-2.499999285,0.499999851</Position> <Rotation>0,0,0,0.9999999404</Rotation> <Scale>0.9999994636,0.9999994636,0.9999994636</Scale> <JunctionStart>Junction001</JunctionStart> <JunctionEnd>Junction04</JunctionEnd> </LayoutEntry>
A track is basically the road for the car/pedestrian to move. It is normally invisible. However, you could see the track if you turn on the traffic congestion mode as show in the image above. The track is basically the green line in the image above.
I will discuss the child tags of this layout entry that isn't mentioned before.
- <PrototypeFile>data/design/editor/track_road.class</PrototypeFile> There are basically two types of track, one is for vehicles, another is for the pedestrian, which is defined in this parameter
- <Position>10.24999714,-2.499999285,0.499999851</Position> This define the position of the layout entry relative to one corner of the model. However, the position entry is not used in the track layout entry. So basically we don't need to worry much about the position here.
- <JunctionStart>Junction001</JunctionStart> and <JunctionEnd>Junction04</JunctionEnd> This is where the track is connected to. A junction (will be introduced next) is a connector that connect layout entries. Also, this two parameter defines the direction of the traffic flow (it is only used in vehicle track). The cars will drive from the JunctionStart to the JunctionEnd.
- <Track></Track> This parameter define the behaviour of the track. There are a few known items under these tags: - <Orientation>REVERT</Orientation> Change the direction of the traffic. The cars will flow from JunctionEnd to JunctionStart
- More items will be added
The next important item is the junction
Code:<LayoutEntry> <ID>Junction001</ID> <Type>JUNCTION</Type> <PrototypeFile>data/design/editor/track/trackjunctionroad.class</PrototypeFile> <Position>0,-2.499999285,0.4999998808</Position> <Scale>0.9999995232,0.9999995232,0.9999995232</Scale> <Junction> <PlugID>Plug</PlugID> </Junction> </LayoutEntry>
First, I must say, this junction is not the road intersection. Don't mess up this layout entry with the road intersection.
A junction is just a layout entry connecting plug to track or track to track. In the image above, the junction is those item that are circled. I hope it is obvious to see the junction is located at the end of the track.
It is important to have the whole network connected. We must ensure that all the junction, track and plug are interconnected. You can go from a plug to another plug by following the trail.
The only child tag that is new in this section is the <Junction></Junction> tags. The following sub-tags are found:
- <PlugID>Plug</PlugID> This define the plug this junction is connected to. For the junction that connecting track to track, this parameter is not required.
- <Type>TRAFFICGATE</Type>Info needed
After introduction to those layout entries that are not really visible or obvious, we will now see something concrete. A linear layout entry is the road/pavement you see in the game.
The code about is the pedestrian path. Of course, you could change the pedestrian path of this road if by changing the <PrototypeFile>. Also, you could make a new texture for pedestrian path and add the path to the file here. Similarly, this layout entry is used to define a road used by vehicle. Be creative and create your own road!Code:<LayoutEntry> <ID>Pavement</ID> <Type>LINEAR</Type> <PrototypeFile>data/design/editor/lane/lane_pavement_south_05x40.class</PrototypeFile> <Rotation>0,-0.7070733309,0,0.7071401477</Rotation> <Scale>0.9999946952,1,0.9999946952</Scale> <Control>HERIT</Control> </LayoutEntry>
A note to mention is, although rotation and scale is found under this entry, they are not used. You can't rotate a linear entry nor scale them. I wonder why FHI include those items here. Probably somebody who want to increase the game performance could delete these tags?
Furniture? Yes, a furniture is those trees, benches, road sign and lamp post you see in the game. In another word, a furniture is the decoration item you found in the game.Code:<LayoutEntry> <ID>Furniture</ID> <Type>FURNITURE</Type> <PrototypeFile>data/design/decoration/furniture/allam/f_all_streetlight01.class</PrototypeFile> <Position>5.999998093,-6.999998093,0.4999998808</Position> <Rotation>0,0,0,0.9999999404</Rotation> <CollisionBox> <Type>FROMMESH</Type> <Min>-0.3938789964,-0.4223459959,0.2996230125</Min> <Max>0.396430999,0.4305660427,0.6635419726</Max> </CollisionBox> </LayoutEntry>
A special item in this layout entry is the <CollisionBox></CollisionBox>. I guess you probably understand what it means.
Again, this is the collision box. It defines the dimension of the road. If you build two roads one over another, the collision box collide. You will then get the annoying message saying not enough room. My Collision Box Remover mod removes this layout entry.Code:<LayoutEntry> <ID>CollisionBox</ID> <Type>COLLISIONBOX</Type> <PrototypeFile>data/design/editor/collisionbox.class</PrototypeFile> <Control>HERIT</Control> </LayoutEntry>
This is a code for the arrow on the one-way road. I think it is helpful to include them here.Code:<LayoutEntry> <ID>SubLayout</ID> <Type>SUBLAYOUT</Type> <PrototypeFile>data/design/editor/sublayout.class</PrototypeFile> <Position>13.99999809,2.204051908e-039,-0.4999998808</Position> <Scale>0.9999980927,0.9999980927,0.9999980927</Scale> <SubLayout> <Filename>data/design/layout/road/sublayout/trafficarrow/2samesense_large.sublayout.layout</Filename> </SubLayout> </LayoutEntry>
This entry is something more complex and will discuss it next time
The game uses a rotation method called "Quaternions and spatial rotation". This is the rotation scheme used in 3ds max. It consists of 4 numbers, which, in my opinion, quite confusing to calculate. However, I found a tool over the internet that is very convenient to be used. You can find more info here: http://www.steve-m.com/downloads/tools/rotcalc/.
I must tell you that, rotation doesn't work for linear item such as road. However, it does work on non-linear item like the arrows on the road.
If you are going to register on XLNation, please make sure you do not use a proxy server.Dismiss Notice
If you use a proxy server your registration will most likely get blocked due to spammers and hackers using proxy servers to hide their real IP address.
If your using your home or work IP address and have not received your registration email, check your spam folder.
PLEASE DO NOT ASK TO HAVE YOUR ACCOUNT DELETED IF YOU HAVE POSTED IN THE FORUM! If so we do not delete accounts due to the mess it can make on the forum.Its becoming harder each month to keep this site floating on the web. As Adsense money is now four months apart, I'm covering the rest of the monthly bills.Dismiss Notice
There's been a handful of donations which help a little but more regular donations are needed if this site is to stay alive.
I know it's tough for everyone but if you can spare a little it would be awesome.
P.S. Big huge thanks to the last donations. It was a big help for this month.
Tutorial Road Layout File
What are those items in the .layout file? Check it out here.