New global pathfinding

From OpenTTD

(Redirected from NPF)
Jump to: navigation, search


A patch that uses a completely different pathfinding algorithm for all vehicles.

Contents

[edit] Description

New global PathFinder (NPF) global pathfinder which works for all vehicles. Uses an A* algorithm to find its route. It's fast, it's good and will always return the best results. However, on extremely complex railway networks it can be CPU-consuming, so on older machines (and bigmaps with lots of trains), it might lower performance and thus can be disabled. If this is the case, then you should probably at least enable New Train Pathfinding (NTP) or the Yet Another Pathfinder (YAPF)

[edit] Configuration Options

NPF has the following set of configuration options: This feature also has the following configuration options:

npf_max_search_nodesThe maximum amount of search nodes a single NPF run should take. This limit should make sure performance stays at acceptable levels at the cost of not being perfect anymore. This will probably be fixed in a more sophisticated way sometime soon.
npf_rail_firstred_penaltyThe penalty for when the first signal is red (and it is not an exit or combo signal)
npf_rail_firstred_exit_penaltyThe penalty for when the first signal is red (and it is an exit or combo signal)
npf_rail_lastred_penaltyThe penalty for when the last signal is red
npf_rail_station_penaltyThe penalty for rail station tiles
npf_rail_slope_penaltyThe penalty for sloping upwards on rail
npf_rail_curve_penaltyThe penalty for curves on rail
npf_rail_depot_reverse_penaltyThe penalty for reversing in depots
npf_buoy_penaltyThe penalty for going over (through) a buoy
npf_water_curve_penaltyThe penalty for curves for boats

[edit] Use

This feature is disabled by default. You can enable this patch through the configure patches -> vehicles window or use the following syntax in openttd.cfg:

[patches]
new_pathfinding_all = true

The configuration options may only be changed in openttd.cfg:

[patches]
npf_max_search_nodes = 10000
npf_rail_firstred_penalty = 1000
npf_rail_firstred_exit_penalty = 10000
npf_rail_lastred_penalty = 1000
npf_rail_station_penalty = 100
npf_rail_slope_penalty = 100
npf_rail_curve_penalty = 1
npf_rail_depot_reverse_penalty = 5000
npf_buoy_penalty = 200
npf_water_curve_penalty = 25

[edit] Notes

The algorithm is pretty amazing compared to the old system. Because of the penalty for red signals, it's quite easy to build simple load-balancing systems in some cases, especially in front of stations. Take care however when modifying tracks: if there is no path, the trains will try to get as close to the target station as possible and can get very lost doing so.

[edit] See Also

Personal tools