Penalties
From #openttdcoop wiki
Penalties are used by YAPF (Yet Another PathFinder) to determine which route a train should take between two destinations. Penalties can be pretty much everything; the amount of trains driving the same route, a road crossing, a red two-way signal, a slope, a short curve... Below is a list of the penalties and their respective values used in r17814. NOTE: These values tend to change quite often, so don't rely on them being up-to-date.
yapf.rail_firstred_twoway_eol = true yapf.rail_firstred_penalty = 1000 yapf.rail_firstred_exit_penalty = 10000 yapf.rail_lastred_penalty = 1000 yapf.rail_lastred_exit_penalty = 10000 yapf.rail_station_penalty = 1000 yapf.rail_slope_penalty = 200 yapf.rail_curve45_penalty = 300 yapf.rail_curve90_penalty = 600 yapf.rail_depot_reverse_penalty = 5000 yapf.rail_crossing_penalty = 300 yapf.rail_look_ahead_max_signals = 10 yapf.rail_look_ahead_signal_p0 = 500 yapf.rail_look_ahead_signal_p1 = -100 yapf.rail_look_ahead_signal_p2 = 5 yapf.rail_pbs_cross_penalty = 300 yapf.rail_pbs_station_penalty = 800 yapf.rail_pbs_signal_back_penalty = 1500 yapf.rail_doubleslip_penalty = 100 yapf.rail_longer_platform_penalty = 800 yapf.rail_longer_platform_per_tile_penalty = 0 yapf.rail_shorter_platform_penalty = 4000 yapf.rail_shorter_platform_per_tile_penalty = 0
Natural behaviour
In regular games, you usually don't have to worry about penalties. The only thing you may want to keep in mind is that you'll want to keep mainlines pretty much equally long. It's not that important that they are exactly level and exactly equally long (I doubt this is even possible), but make sure that you don't have one mainline that is going over massive hills all the time while another stays at the same level or there is one taking huge detours all the time and a parallel one is perfectly straight. Especially with long distances this may make a tiny difference when balancing but you probably won't notice.
yapf.rail_firstred_twoway_eol = true
This setting is always on in our games. eol stands for end-of-line, this means that a red-two way is actually an infinite penalty, a train will do pretty much everything to avoid running into a red two-way. This goes for regular two-way signals and pre-signals, two-way pbs are a different case we'll talk about later. To see the power of a red two-way have a look at the image below:
The same situation but with a one-way red signal.
This behavior is quite useful using advanced techniques such as SML or SRNW.