Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Variables
CCmpUnitMotion.cpp File Reference
#include "precompiled.h"
#include "simulation2/system/Component.h"
#include "ICmpUnitMotion.h"
#include "simulation2/components/ICmpObstruction.h"
#include "simulation2/components/ICmpObstructionManager.h"
#include "simulation2/components/ICmpOwnership.h"
#include "simulation2/components/ICmpPosition.h"
#include "simulation2/components/ICmpPathfinder.h"
#include "simulation2/components/ICmpRangeManager.h"
#include "simulation2/helpers/Geometry.h"
#include "simulation2/helpers/Render.h"
#include "simulation2/MessageTypes.h"
#include "simulation2/serialization/SerializeTemplates.h"
#include "graphics/Overlay.h"
#include "graphics/Terrain.h"
#include "maths/FixedVector2D.h"
#include "ps/CLogger.h"
#include "ps/Profile.h"
#include "renderer/Scene.h"

Go to the source code of this file.

Classes

class  CCmpUnitMotion
 

Variables

static const entity_pos_t WAYPOINT_ADVANCE_MAX = entity_pos_t::FromInt(TERRAIN_TILE_SIZE*8)
 When advancing along the long path, and picking a new waypoint to move towards, we'll pick one that's up to this far from the unit's current position (to minimise the effects of grid-constrained movement) More...
 
static const int WAYPOINT_ADVANCE_LOOKAHEAD_TURNS = 4
 When advancing along the long path, we'll pick a new waypoint to move towards if we expect to reach the end of our current short path within this many turns (assuming constant speed and turn length). More...
 
static const entity_pos_t SHORT_PATH_SEARCH_RANGE = entity_pos_t::FromInt(TERRAIN_TILE_SIZE*10)
 Maximum range to restrict short path queries to. More...
 
static const entity_pos_t SHORT_PATH_GOAL_RADIUS = entity_pos_t::FromInt(TERRAIN_TILE_SIZE*3/2)
 When short-pathing to an intermediate waypoint, we aim for a circle of this radius around the waypoint rather than expecting to reach precisely the waypoint itself (since it might be inside an obstacle). More...
 
static const entity_pos_t DIRECT_PATH_RANGE = entity_pos_t::FromInt(TERRAIN_TILE_SIZE*4)
 If we are this close to our target entity/point, then think about heading for it in a straight line instead of pathfinding. More...
 
static const entity_pos_t CHECK_TARGET_MOVEMENT_MIN_DELTA = entity_pos_t::FromInt(TERRAIN_TILE_SIZE*4)
 If we're following a target entity, we will recompute our path if the target has moved more than this distance from where we last pathed to. More...
 
static const entity_pos_t CHECK_TARGET_MOVEMENT_MIN_DELTA_FORMATION = entity_pos_t::FromInt(TERRAIN_TILE_SIZE*1)
 If we're following as part of a formation, but can't move to our assigned target point in a straight line, we will recompute our path if the target has moved more than this distance from where we last pathed to. More...
 
static const entity_pos_t CHECK_TARGET_MOVEMENT_AT_MAX_DIST = entity_pos_t::FromInt(TERRAIN_TILE_SIZE*16)
 If we're following something but it's more than this distance away along our path, then don't bother trying to repath regardless of how much it has moved, until we get this close to the end of our old path. More...
 
static const CColor OVERLAY_COLOUR_LONG_PATH (1, 1, 1, 1)
 
static const CColor OVERLAY_COLOUR_SHORT_PATH (1, 0, 0, 1)
 
static const entity_pos_t g_GoalDelta = entity_pos_t::FromInt(TERRAIN_TILE_SIZE)/4
 

Variable Documentation

const entity_pos_t CHECK_TARGET_MOVEMENT_AT_MAX_DIST = entity_pos_t::FromInt(TERRAIN_TILE_SIZE*16)
static

If we're following something but it's more than this distance away along our path, then don't bother trying to repath regardless of how much it has moved, until we get this close to the end of our old path.

Definition at line 96 of file CCmpUnitMotion.cpp.

const entity_pos_t CHECK_TARGET_MOVEMENT_MIN_DELTA = entity_pos_t::FromInt(TERRAIN_TILE_SIZE*4)
static

If we're following a target entity, we will recompute our path if the target has moved more than this distance from where we last pathed to.

Definition at line 81 of file CCmpUnitMotion.cpp.

const entity_pos_t CHECK_TARGET_MOVEMENT_MIN_DELTA_FORMATION = entity_pos_t::FromInt(TERRAIN_TILE_SIZE*1)
static

If we're following as part of a formation, but can't move to our assigned target point in a straight line, we will recompute our path if the target has moved more than this distance from where we last pathed to.

Definition at line 89 of file CCmpUnitMotion.cpp.

const entity_pos_t DIRECT_PATH_RANGE = entity_pos_t::FromInt(TERRAIN_TILE_SIZE*4)
static

If we are this close to our target entity/point, then think about heading for it in a straight line instead of pathfinding.

Definition at line 74 of file CCmpUnitMotion.cpp.

const entity_pos_t g_GoalDelta = entity_pos_t::FromInt(TERRAIN_TILE_SIZE)/4
static

Definition at line 101 of file CCmpUnitMotion.cpp.

const CColor OVERLAY_COLOUR_LONG_PATH(1, 1, 1, 1)
static
const CColor OVERLAY_COLOUR_SHORT_PATH(1, 0, 0, 1)
static
const entity_pos_t SHORT_PATH_GOAL_RADIUS = entity_pos_t::FromInt(TERRAIN_TILE_SIZE*3/2)
static

When short-pathing to an intermediate waypoint, we aim for a circle of this radius around the waypoint rather than expecting to reach precisely the waypoint itself (since it might be inside an obstacle).

Definition at line 68 of file CCmpUnitMotion.cpp.

const entity_pos_t SHORT_PATH_SEARCH_RANGE = entity_pos_t::FromInt(TERRAIN_TILE_SIZE*10)
static

Maximum range to restrict short path queries to.

(Larger ranges are slower, smaller ranges might miss some legitimate routes around large obstacles.)

Definition at line 61 of file CCmpUnitMotion.cpp.

const int WAYPOINT_ADVANCE_LOOKAHEAD_TURNS = 4
static

When advancing along the long path, we'll pick a new waypoint to move towards if we expect to reach the end of our current short path within this many turns (assuming constant speed and turn length).

(This could typically be 1, but we need some tolerance in case speeds or turn lengths change.)

Definition at line 55 of file CCmpUnitMotion.cpp.

const entity_pos_t WAYPOINT_ADVANCE_MAX = entity_pos_t::FromInt(TERRAIN_TILE_SIZE*8)
static

When advancing along the long path, and picking a new waypoint to move towards, we'll pick one that's up to this far from the unit's current position (to minimise the effects of grid-constrained movement)

Definition at line 46 of file CCmpUnitMotion.cpp.