1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. If you are going to register on XLNation, please make sure you do not use a proxy server.
    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.
    Dismiss Notice

Tutorial Road Layout File

What are those items in the .layout file? Check it out here.

  1. XL Nation Staff
    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 [​IMG]

    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.



    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.
    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

    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!

    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.

    A special item in this layout entry is the <CollisionBox></CollisionBox>. I guess you probably understand what it means.

    Collision Box

    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.

    Traffic arrow

    This is a code for the arrow on the one-way road. I think it is helpful to include them here.


    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.

    moran likes this.