(svn r2204) - Add: [NPF] NPF now has a maximum number of nodes it will search. The default value is 5000 for now, which is an educated guess. Probably needs some finetuning. Hopefully this "feature" can be removed later on, when more sophisticated means of limiting the pathfinder have been implemented. This should make ships and larger networks playable for now, though.

pull/155/head
matthijs 19 years ago
parent 7b673ec0cb
commit c6f40b4696

@ -785,7 +785,10 @@ void InitializeNPF(void)
init_AyStar(&_npf_aystar, NPFHash, NPF_HASH_SIZE);
_npf_aystar.loops_per_tick = 0;
_npf_aystar.max_path_cost = 0;
_npf_aystar.max_search_nodes = 0;
//_npf_aystar.max_search_nodes = 0;
/* We will limit the number of nodes for now, until we have a better
* solution to really fix performance */
_npf_aystar.max_search_nodes = _patches.npf_max_search_nodes;
#if 0
init_AyStar(&_train_find_station, NTPHash, 1024);
init_AyStar(&_train_find_depot, NTPHash, 1024);

@ -926,6 +926,9 @@ const SettingDesc patch_settings[] = {
/* New Path Finding */
{"new_pathfinding_all", SDT_BOOL, (void*)false, &_patches.new_pathfinding_all, NULL},
/* The maximum number of nodes to search */
{"npf_max_search_nodes", SDT_UINT32, (void*)10000, &_patches.npf_max_search_nodes, NULL},
/* When a red signal is encountered, a small detour can be made around
* it. This specifically occurs when a track is doubled, in which case
* the detour is typically 2 tiles. It is also often used at station

@ -192,9 +192,19 @@ typedef struct Patches {
byte drag_signals_density; // many signals density
bool ainew_active; // Is the new AI active?
/* New Path Finding */
/*
* New Path Finding
*/
bool new_pathfinding_all; /* Use the newest pathfinding algorithm for all */
/**
* The 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
*/
uint32 npf_max_search_nodes;
uint32 npf_rail_firstred_penalty; /* The penalty for when the first signal is red (and it is not an exit or combo signal) */
uint32 npf_rail_firstred_exit_penalty; /* The penalty for when the first signal is red (and it is an exit or combo signal) */
uint32 npf_rail_lastred_penalty; /* The penalty for when the last signal is red */

Loading…
Cancel
Save