TrainDocumentation

From Rigs of Rods Wiki Archive
Jump to: navigation, search


Basic Principle

The tracks are simple meshes that are placed on the map. They have a collision mesh on which all rail vehicles drive. The track gauge is approximately 1435mm, which is the most common in the world. In reality train wheels have flanges. In RoR wheels can’t have such a geometry, so we use nodes with low friction to keep everything on the rail (we call them guidance nodes). Propulsed rail vehicles use standard wheels spanning the two rails. The result is a quite long wheel what may be odd on the first sight, but if you think about it real train wheels are basically the same. This also helps to keep the nodecount down. See Figure 1.
Fig.1: Basic concept 1
The wagons use low friction nodes instead of wheels. Main reason is the nodecount, e.g. on a 4 axle wagon we can save approx. 120 nodes by doing this, what will give you a much better framerate. See Figure 2.
Fig.2: Basic concept 2

Basic node and beam principles

To make your rail vehicle working well, you need to obtain certain principles.

  • First of all your bogie geometry needs to be exactly as shown in Figure 3
    Fig.3:Train geometry
    . If you make a wagon without wheels, the low friction nodes running on the rail need to be exactly where the wheel in the picture would touch the rail.
  • Your guidance nodes (those running on the inner side of the rail) need to be contacters. Give them a mass of 50 kilos. Give them low friction using set_node_defaults. If you don't use a wheel, the nodes sliding on top of the rail also need low friction.
  • Node 0 needs to be exactly in the middle of your vehicle and 0.5 meters below the rail. Otherwise it won't spawn correctly in the train spawner. Don't forget to flag it with "c": don't detect ground contact.
  • Make your wheels very hard using the spring and damping options.
  • Make the bogie node and beam very stiff using set_beam_defaults.

Building a railway line

There are two ways to place the tracks on a map

1. Placing tracks using RoRToolkit

Beware: Due to a bug in RoR Toolkit you can't build train tracks going up- or downhill properly...

First copy everything from this zip over to your map zip: Download. IMPORTANT: Always tell the people that the map "Train Valley" is required for all other train maps

Download RoRToolkit 0.37. Since RoR 0.38 the Toolkit will only work after you renamed the RoR Content folder in my documents from "Rigs of Rods 0.38" to "Rigs of Rods". Start RoRToolkit, choose your map and start placing the tracks, Fig. 4.
Fig.4:Toolkit placing
If you need help on using the toolkit, search the forums. When finished with placing, save the terrain file and put it into your map zip. Open the terrn file with your text editor and search for lines containing a switch (rail1tPnt190r634dL/R, rail1tPnt190r634dLe/Re). Copy the line and paste it in a new line right below. Add "truck2" before and a ".fixed" after the object name. When you use a rail1tPnt190r634dLe/Re (FPS switches), change it to rail1tPnt190r634dLi/Ri in that second line (only there!):
Fig.5:Terrn file modifications

This will add the node and beam of the switch so you can actually change direction. Don't forget to rename your RoR content folder to "Rigs of Rods 0.38", otherwise RoR won't start any more.

2. Placing the tracks in a 3d modeling program (for professionals :-P )

When you want to create your track layout in a 3d modeling program (Blender, 3ds Max), you need to make sure the coordinates in the 3d modeling program are the same as in RoR. Open the terrain *.zip and search for a *.cfg file. Read out the size of the terrain, switch to your 3d modeling program and create a plane with the same size in the correct position:

Fig. 6: Coincide coordinates

This will be our placement help.

Now load the tracks from the blender file and start assembling them to a nice railway track. It is quite similar to RoR Toolkit. When finished, you need to attach all track pieces together, but DO NOT ATTACH THE SWITCHES! We only placed them to read out the coordinates and we will place them on the map using the terrn file. For that purpose, open the terrn file, click each switch in blender/3ds and copy the coordinates (including rotational values) over to the terrn file. Then do the same as in Fig. 5 to place the node and beam. Annoying, I know ;-) When done, it's time to export the track layout. It should look like in Fig. 7, with gaps for the switches.
Fig. 7: Gaps for switches
. Move the pivot point of the track to (0, 0, 0) and export the mesh. Now you just need to place it on (0, 0, 0) in the terrn file and probably get the angles right. Everything should be ingame then.

If you choose to place your track using a 3d modeling program, you can also generate a track from a spline.

Building Railroad vehicles

This tutorial can be found here: Building Railroad vehicles

Additional Manuals

See also

Generate a track from a spline

If you have a question on the system, please post here.