Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
Functions | |
bool | CheckLineMovement (entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, pass_class_t passClass, const Grid< NavcellData > &grid) |
void | NearestNavcell (entity_pos_t x, entity_pos_t z, u16 &i, u16 &j, u16 w, u16 h) |
Compute the navcell indexes on the grid nearest to a given point w, h are the grid dimensions, i.e. More... | |
void | TerrainTileCenter (u16 i, u16 j, entity_pos_t &x, entity_pos_t &z) |
Returns the position of the center of the given terrain tile. More... | |
void | NavcellCenter (u16 i, u16 j, entity_pos_t &x, entity_pos_t &z) |
Variables | |
constexpr fixed | NAVCELL_SIZE = fixed::FromInt(1) |
The long-range pathfinder operates primarily over a navigation grid (a uniform-cost 2D passability grid, with horizontal/vertical (not diagonal) connectivity). More... | |
constexpr int | NAVCELL_SIZE_INT = 1 |
constexpr int | NAVCELL_SIZE_LOG2 = 0 |
constexpr int | NAVCELLS_PER_TERRAIN_TILE = TERRAIN_TILE_SIZE / NAVCELL_SIZE_INT |
The terrain grid is coarser, and it is often convenient to convert from one to the other. More... | |
constexpr entity_pos_t | CLEARANCE_EXTENSION_RADIUS = fixed::FromInt(1) |
To make sure the long-range pathfinder is more strict than the short-range one, we need to slightly over-rasterize. More... | |
bool Pathfinding::CheckLineMovement | ( | entity_pos_t | x0, |
entity_pos_t | z0, | ||
entity_pos_t | x1, | ||
entity_pos_t | z1, | ||
pass_class_t | passClass, | ||
const Grid< NavcellData > & | grid | ||
) |
|
inline |
|
inline |
Compute the navcell indexes on the grid nearest to a given point w, h are the grid dimensions, i.e.
the number of navcells per side
|
inline |
Returns the position of the center of the given terrain tile.
|
inlineconstexpr |
To make sure the long-range pathfinder is more strict than the short-range one, we need to slightly over-rasterize.
So we extend the clearance radius by 1.
|
inlineconstexpr |
The long-range pathfinder operates primarily over a navigation grid (a uniform-cost 2D passability grid, with horizontal/vertical (not diagonal) connectivity).
This is based on the terrain tile passability, plus the rasterized shapes of obstructions, all expanded outwards by the radius of the units. Since units are much smaller than terrain tiles, the nav grid should be higher resolution than the tiles. We therefore split each the world into NxN "nav cells" (for some integer N, preferably a power of two).
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
The terrain grid is coarser, and it is often convenient to convert from one to the other.