Difference between revisions of "Penalties"

From #openttdcoop wiki

Jump to: navigation, search
m (Changed to basic networking)
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
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... It's worth noting that trains ignore penalties if they don't have orders. The reason for this is pretty simple; if trains don't have a destination there is no reason to determine the cost of the route. For you this means that you should always give trains an order, even if the order is to go to a dummy station and can't actually be reached. This may be relevant for dummy trains or trains on timers.Below is a list of the penalties and their respective values used in r17814.
+
Penalties are used by YAPF (Yet Another PathFinder) to determine which route a train should take between its current position and its destination. Penalties can be pretty much everything; the amount of trains driving the same route, a road crossing, a red [[Two-way-Signals|two-way signal]], a slope, a short curve... It's worth noting that trains ignore penalties if they don't have orders. The reason for this is pretty simple; if trains don't have a destination there is no reason to determine the cost of the route. For you this means that you should always give trains an order, even if the order is to go to a dummy station and can't actually be reached. This may be relevant for dummy trains or trains on timers.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.
 
NOTE: These values tend to change quite often, so don't rely on them being up-to-date.
  
<pre width="30%">
+
<pre width="35%">
 
yapf.rail_firstred_twoway_eol = true
 
yapf.rail_firstred_twoway_eol = true
 
yapf.rail_firstred_penalty = 1000
 
yapf.rail_firstred_penalty = 1000
Line 29: Line 29:
  
 
==yapf.rail_firstred_twoway_eol = true==
 
==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:
+
This setting is always on in our games. eol stands for end-of-line, this means that a red [[Two-way-Signals|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:
  
 
[[File:red_twoway.PNG|400px|thumb|none|This train happily takes all penalties on the much longer route, just to avoid the red two-way]]
 
[[File:red_twoway.PNG|400px|thumb|none|This train happily takes all penalties on the much longer route, just to avoid the red two-way]]
Line 37: Line 37:
 
[[File:red_oneway.PNG|400px|thumb|none|This train waits for the signal to become green rather than taking a ride on our penalty roller coaster]]
 
[[File:red_oneway.PNG|400px|thumb|none|This train waits for the signal to become green rather than taking a ride on our penalty roller coaster]]
  
This behavior is quite useful using advanced techniques such as [[SML]] or [[Self-regulating_Network|SRNW]].
+
This behavior is quite useful using advanced techniques such as [[SML]] or [[Self-regulating_Network|SRNW]]. You can find more information in the article about [[Two-way-Signals|two-way signals]].
 
You should be careful not to force trains to take a huge loop by accident, though it's unlikely you'll manage to do so.
 
You should be careful not to force trains to take a huge loop by accident, though it's unlikely you'll manage to do so.
  
Line 47: Line 47:
 
YAPP (Yet Another PBS Patch) introduced the following new penalties:
 
YAPP (Yet Another PBS Patch) introduced the following new penalties:
  
<pre width="30%">
+
<pre width="35%">
 
yapf.rail_pbs_cross_penalty = 300
 
yapf.rail_pbs_cross_penalty = 300
 
yapf.rail_pbs_station_penalty = 800
 
yapf.rail_pbs_station_penalty = 800
Line 53: Line 53:
 
</pre>
 
</pre>
  
These penalties mostly make sure trains before to take a slightly longer path to a destination rather than crossing an existing one, they should not be changed.
+
These penalties mostly make sure trains prefer to take a slightly longer path to a destination rather than crossing an existing one, they should not be changed.
  
 
==Road penalties==
 
==Road penalties==
Line 59: Line 59:
 
Additionally, YAPF uses the following penalties and respective values for road vehicle path finding:
 
Additionally, YAPF uses the following penalties and respective values for road vehicle path finding:
  
<pre width="30%">
+
<pre width="35%">
 
yapf.road_slope_penalty = 200
 
yapf.road_slope_penalty = 200
 
yapf.road_curve_penalty = 100
 
yapf.road_curve_penalty = 100
Line 67: Line 67:
  
 
These are provided mainly for completeness sake and should not be changed.
 
These are provided mainly for completeness sake and should not be changed.
 +
 +
[[Category:BasicNetworking]]

Latest revision as of 08:51, 4 December 2013

Penalties are used by YAPF (Yet Another PathFinder) to determine which route a train should take between its current position and its destination. 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... It's worth noting that trains ignore penalties if they don't have orders. The reason for this is pretty simple; if trains don't have a destination there is no reason to determine the cost of the route. For you this means that you should always give trains an order, even if the order is to go to a dummy station and can't actually be reached. This may be relevant for dummy trains or trains on timers.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_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:

This train happily takes all penalties on the much longer route, just to avoid the red two-way

The same situation but with a one-way red signal:

This train waits for the signal to become green rather than taking a ride on our penalty roller coaster

This behavior is quite useful using advanced techniques such as SML or SRNW. You can find more information in the article about two-way signals. You should be careful not to force trains to take a huge loop by accident, though it's unlikely you'll manage to do so.

Fine tuning using penalties

Penalties can be used if you want to discourage trains from taking a certain route. Before PBS was introduced we used single tile stations for this, now we usually use two-way PBS signals facing backwards. In SML-games we sometimes increase the penalty for yapf.rail_pbs_signal_back_penalty to 10,000, to match up with the penalty for stations that was used when SML was invented.

PBS penalties

YAPP (Yet Another PBS Patch) introduced the following new penalties:

yapf.rail_pbs_cross_penalty = 300
yapf.rail_pbs_station_penalty = 800
yapf.rail_pbs_signal_back_penalty = 1500

These penalties mostly make sure trains prefer to take a slightly longer path to a destination rather than crossing an existing one, they should not be changed.

Road penalties

Additionally, YAPF uses the following penalties and respective values for road vehicle path finding:

yapf.road_slope_penalty = 200
yapf.road_curve_penalty = 100
yapf.road_crossing_penalty = 300
yapf.road_stop_penalty = 800

These are provided mainly for completeness sake and should not be changed.

Powered by MediaWiki
  • This page was last modified on 4 December 2013, at 08:51.