Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
Functions | |
const CColor | OVERLAY_COLOR_LONG_PATH (1, 1, 1, 1) |
const CColor | OVERLAY_COLOR_SHORT_PATH (1, 0, 0, 1) |
Variables | |
constexpr entity_pos_t | SHORT_PATH_MIN_SEARCH_RANGE = entity_pos_t::FromInt(12 * Pathfinding::NAVCELL_SIZE_INT) |
Min/Max range to restrict short path queries to. More... | |
constexpr entity_pos_t | SHORT_PATH_MAX_SEARCH_RANGE = entity_pos_t::FromInt(56 * Pathfinding::NAVCELL_SIZE_INT) |
constexpr entity_pos_t | SHORT_PATH_SEARCH_RANGE_INCREMENT = entity_pos_t::FromInt(4 * Pathfinding::NAVCELL_SIZE_INT) |
constexpr u8 | SHORT_PATH_SEARCH_RANGE_INCREASE_DELAY = 1 |
constexpr entity_pos_t | SHORT_PATH_LONG_WAYPOINT_RANGE = entity_pos_t::FromInt(4 * Pathfinding::NAVCELL_SIZE_INT) |
When using the short-pathfinder to rejoin a long-path waypoint, aim for a circle of this radius around the waypoint. More... | |
constexpr entity_pos_t | LONG_PATH_MIN_DIST = entity_pos_t::FromInt(16 * Pathfinding::NAVCELL_SIZE_INT) |
Minimum distance to goal for a long path request. More... | |
constexpr entity_pos_t | DIRECT_PATH_RANGE = entity_pos_t::FromInt(24 * Pathfinding::NAVCELL_SIZE_INT) |
If we are this close to our target entity/point, then think about heading for it in a straight line instead of pathfinding. More... | |
constexpr entity_pos_t | TARGET_UNCERTAINTY_MULTIPLIER = entity_pos_t::FromInt(8 * Pathfinding::NAVCELL_SIZE_INT) |
To avoid recomputing paths too often, have some leeway for target range checks based on our distance to the target. More... | |
constexpr u8 | KNOWN_IMPERFECT_PATH_RESET_COUNTDOWN = 12 |
When following a known imperfect path (i.e. More... | |
constexpr u8 | MAX_FAILED_MOVEMENTS = 35 |
When we fail to move this many turns in a row, inform other components that the move will fail. More... | |
constexpr u8 | ALTERNATE_PATH_TYPE_DELAY = 3 |
When computing paths but failing to move, we want to occasionally alternate pathfinder systems to avoid getting stuck (the short pathfinder can unstuck the long-range one and vice-versa, depending). More... | |
constexpr u8 | ALTERNATE_PATH_TYPE_EVERY = 6 |
constexpr u8 | BACKUP_HACK_DELAY = 10 |
Units can occasionally get stuck near corners. More... | |
constexpr u8 | VERY_OBSTRUCTED_THRESHOLD = 10 |
After this many failed computations, start sending "VERY_OBSTRUCTED" messages instead. More... | |
const CColor anonymous_namespace{CCmpUnitMotion.h}::OVERLAY_COLOR_LONG_PATH | ( | 1 | , |
1 | , | ||
1 | , | ||
1 | |||
) |
const CColor anonymous_namespace{CCmpUnitMotion.h}::OVERLAY_COLOR_SHORT_PATH | ( | 1 | , |
0 | , | ||
0 | , | ||
1 | |||
) |
|
constexpr |
When computing paths but failing to move, we want to occasionally alternate pathfinder systems to avoid getting stuck (the short pathfinder can unstuck the long-range one and vice-versa, depending).
|
constexpr |
|
constexpr |
Units can occasionally get stuck near corners.
The cause is a mismatch between CheckMovement and the short pathfinder. The problem is the short pathfinder finds an impassable path when units are right on an obstruction edge. Fixing this math mismatch is perhaps possible, but fixing it in UM is rather easy: just try backing up a bit and that will probably un-stuck the unit. This is the 'failed movement' turn on which to try that.
|
constexpr |
If we are this close to our target entity/point, then think about heading for it in a straight line instead of pathfinding.
|
constexpr |
When following a known imperfect path (i.e.
a path that won't take us in range of our goal we still recompute a new path every N turn to adapt to moving targets (for example, ships that must pickup units may easily end up in this state, they still need to adjust to moving units). This is rather arbitrary and mostly for simplicity & optimisation (a better recomputing algorithm would not need this).
|
constexpr |
Minimum distance to goal for a long path request.
|
constexpr |
When we fail to move this many turns in a row, inform other components that the move will fail.
Experimentally, this number needs to be somewhat high or moving groups of units will lead to stuck units. However, too high means units will look idle for a long time when they are failing to move. TODO: if UnitMotion could send differentiated "unreachable" and "currently stuck" failing messages, this could probably be lowered.
|
constexpr |
When using the short-pathfinder to rejoin a long-path waypoint, aim for a circle of this radius around the waypoint.
|
constexpr |
|
constexpr |
Min/Max range to restrict short path queries to.
(Larger ranges are (much) slower, smaller ranges might miss some legitimate routes around large obstacles.) NB: keep the max-range in sync with the vertex pathfinder "move the search space" heuristic.
|
constexpr |
|
constexpr |
|
constexpr |
To avoid recomputing paths too often, have some leeway for target range checks based on our distance to the target.
Increase that incertainty by one navcell for every this many tiles of distance.
|
constexpr |
After this many failed computations, start sending "VERY_OBSTRUCTED" messages instead.
Should probably be larger than ALTERNATE_PATH_TYPE_DELAY.