Pyrogenesis  trunk
Public Member Functions | List of all members
ICmpPathfinder Class Referenceabstract

Pathfinder algorithms. More...

#include <ICmpPathfinder.h>

Inheritance diagram for ICmpPathfinder:
Inheritance graph
[legend]
Collaboration diagram for ICmpPathfinder:
Collaboration graph
[legend]

Public Member Functions

virtual void GetPassabilityClasses (std::map< std::string, pass_class_t > &passClasses) const =0
 Get the list of all known passability classes. More...
 
virtual void GetPassabilityClasses (std::map< std::string, pass_class_t > &nonPathfindingPassClasses, std::map< std::string, pass_class_t > &pathfindingPassClasses) const =0
 Get the list of passability classes, separating pathfinding classes and others. More...
 
virtual pass_class_t GetPassabilityClass (const std::string &name) const =0
 Get the tag for a given passability class name. More...
 
virtual entity_pos_t GetClearance (pass_class_t passClass) const =0
 
virtual entity_pos_t GetMaximumClearance () const =0
 Get the larger clearance in all passability classes. More...
 
virtual const Grid< NavcellData > & GetPassabilityGrid ()=0
 
virtual const GridUpdateInformationGetAIPathfinderDirtinessInformation () const =0
 Get the accumulated dirtiness information since the last time the AI accessed and flushed it. More...
 
virtual void FlushAIPathfinderDirtinessInformation ()=0
 
virtual Grid< u16ComputeShoreGrid (bool expandOnWater=false)=0
 Get a grid representing the distance to the shore of the terrain tile. More...
 
virtual u32 ComputePathAsync (entity_pos_t x0, entity_pos_t z0, const PathGoal &goal, pass_class_t passClass, entity_id_t notify)=0
 Asynchronous version of ComputePath. More...
 
virtual void ComputePathImmediate (entity_pos_t x0, entity_pos_t z0, const PathGoal &goal, pass_class_t passClass, WaypointPath &ret) const =0
 
virtual u32 ComputeShortPathAsync (entity_pos_t x0, entity_pos_t z0, entity_pos_t clearance, entity_pos_t range, const PathGoal &goal, pass_class_t passClass, bool avoidMovingUnits, entity_id_t controller, entity_id_t notify)=0
 Request a short path computation, asynchronously. More...
 
virtual WaypointPath ComputeShortPathImmediate (const ShortPathRequest &request) const =0
 
virtual void SetDebugPath (entity_pos_t x0, entity_pos_t z0, const PathGoal &goal, pass_class_t passClass)=0
 If the debug overlay is enabled, render the path that will computed by ComputePath. More...
 
virtual bool IsGoalReachable (entity_pos_t x0, entity_pos_t z0, const PathGoal &goal, pass_class_t passClass)=0
 
virtual bool CheckMovement (const IObstructionTestFilter &filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, entity_pos_t r, pass_class_t passClass) const =0
 Check whether the given movement line is valid and doesn't hit any obstructions or impassable terrain. More...
 
virtual ICmpObstruction::EFoundationCheck CheckUnitPlacement (const IObstructionTestFilter &filter, entity_pos_t x, entity_pos_t z, entity_pos_t r, pass_class_t passClass, bool onlyCenterPoint=false) const =0
 Check whether a unit placed here is valid and doesn't hit any obstructions or impassable terrain. More...
 
virtual ICmpObstruction::EFoundationCheck CheckBuildingPlacement (const IObstructionTestFilter &filter, entity_pos_t x, entity_pos_t z, entity_pos_t a, entity_pos_t w, entity_pos_t h, entity_id_t id, pass_class_t passClass) const =0
 Check whether a building placed here is valid and doesn't hit any obstructions or impassable terrain. More...
 
virtual ICmpObstruction::EFoundationCheck CheckBuildingPlacement (const IObstructionTestFilter &filter, entity_pos_t x, entity_pos_t z, entity_pos_t a, entity_pos_t w, entity_pos_t h, entity_id_t id, pass_class_t passClass, bool onlyCenterPoint) const =0
 Check whether a building placed here is valid and doesn't hit any obstructions or impassable terrain. More...
 
virtual void SetDebugOverlay (bool enabled)=0
 Toggle the storage and rendering of debug info. More...
 
virtual void SetHierDebugOverlay (bool enabled)=0
 Toggle the storage and rendering of debug info for the hierarchical pathfinder. More...
 
virtual void SendRequestedPaths ()=0
 Finish computing asynchronous path requests and send the CMessagePathResult messages. More...
 
virtual void StartProcessingMoves (bool useMax)=0
 Tell asynchronous pathfinder threads that they can begin computing paths. More...
 
virtual void UpdateGrid ()=0
 Regenerates the grid based on the current obstruction list, if necessary. More...
 
virtual void GetDebugData (u32 &steps, double &time, Grid< u8 > &grid) const =0
 Returns some stats about the last ComputePath. More...
 
virtual void SetAtlasOverlay (bool enable, pass_class_t passClass=0)=0
 Sets up the pathfinder passability overlay in Atlas. More...
 
- Public Member Functions inherited from IComponent
virtual ~IComponent ()
 
virtual void Init (const CParamNode &paramNode)=0
 
virtual void Deinit ()=0
 
virtual void HandleMessage (const CMessage &msg, bool global)
 
CEntityHandle GetEntityHandle () const
 
void SetEntityHandle (CEntityHandle ent)
 
entity_id_t GetEntityId () const
 
CEntityHandle GetSystemEntity () const
 
const CSimContextGetSimContext () const
 
void SetSimContext (const CSimContext &context)
 
virtual void Serialize (ISerializer &serialize)=0
 
virtual void Deserialize (const CParamNode &paramNode, IDeserializer &deserialize)=0
 
virtual bool NewJSObject (const ScriptInterface &scriptInterface, JS::MutableHandleObject out) const
 Returns false by default, indicating that a scripted wrapper of this IComponent is not supported. More...
 
virtual JS::Value GetJSInstance () const
 
virtual int GetComponentTypeId () const =0
 

Additional Inherited Members

- Public Types inherited from IComponent
using AllocFunc = IComponent *(*)(const ScriptInterface &scriptInterface, JS::HandleValue ctor)
 
using DeallocFunc = void(*)(IComponent *)
 
- Static Public Member Functions inherited from IComponent
static std::string GetSchema ()
 
static void RegisterComponentType (CComponentManager &mgr, EInterfaceId iid, EComponentTypeId cid, AllocFunc alloc, DeallocFunc dealloc, const char *name, const std::string &schema)
 
static void RegisterComponentTypeScriptWrapper (CComponentManager &mgr, EInterfaceId iid, EComponentTypeId cid, AllocFunc alloc, DeallocFunc dealloc, const char *name, const std::string &schema)
 
static u8 GetSerializationVersion ()
 

Detailed Description

Pathfinder algorithms.

There are two different modes: a tile-based pathfinder that works over long distances and accounts for terrain costs but ignore units, and a 'short' vertex-based pathfinder that provides precise paths and avoids other units.

Both use the same concept of a PathGoal: either a point, circle or square. (If the starting point is inside the goal shape then the path will move outwards to reach the shape's outline.)

The output is a list of waypoints.

Member Function Documentation

◆ CheckBuildingPlacement() [1/2]

virtual ICmpObstruction::EFoundationCheck ICmpPathfinder::CheckBuildingPlacement ( const IObstructionTestFilter filter,
entity_pos_t  x,
entity_pos_t  z,
entity_pos_t  a,
entity_pos_t  w,
entity_pos_t  h,
entity_id_t  id,
pass_class_t  passClass 
) const
pure virtual

Check whether a building placed here is valid and doesn't hit any obstructions or impassable terrain.

Returns
ICmpObstruction::FOUNDATION_CHECK_SUCCESS if the placement is okay, else a value describing the type of failure.

Implemented in CCmpPathfinder.

◆ CheckBuildingPlacement() [2/2]

virtual ICmpObstruction::EFoundationCheck ICmpPathfinder::CheckBuildingPlacement ( const IObstructionTestFilter filter,
entity_pos_t  x,
entity_pos_t  z,
entity_pos_t  a,
entity_pos_t  w,
entity_pos_t  h,
entity_id_t  id,
pass_class_t  passClass,
bool  onlyCenterPoint 
) const
pure virtual

Check whether a building placed here is valid and doesn't hit any obstructions or impassable terrain.

when onlyCenterPoint = true, only check the center tile of the building

Returns
ICmpObstruction::FOUNDATION_CHECK_SUCCESS if the placement is okay, else a value describing the type of failure.

Implemented in CCmpPathfinder.

◆ CheckMovement()

virtual bool ICmpPathfinder::CheckMovement ( const IObstructionTestFilter filter,
entity_pos_t  x0,
entity_pos_t  z0,
entity_pos_t  x1,
entity_pos_t  z1,
entity_pos_t  r,
pass_class_t  passClass 
) const
pure virtual

Check whether the given movement line is valid and doesn't hit any obstructions or impassable terrain.

Returns true if the movement is okay.

Implemented in CCmpPathfinder.

◆ CheckUnitPlacement()

virtual ICmpObstruction::EFoundationCheck ICmpPathfinder::CheckUnitPlacement ( const IObstructionTestFilter filter,
entity_pos_t  x,
entity_pos_t  z,
entity_pos_t  r,
pass_class_t  passClass,
bool  onlyCenterPoint = false 
) const
pure virtual

Check whether a unit placed here is valid and doesn't hit any obstructions or impassable terrain.

When onlyCenterPoint = true, only check the center tile of the unit

Returns
ICmpObstruction::FOUNDATION_CHECK_SUCCESS if the placement is okay, else a value describing the type of failure.

Implemented in CCmpPathfinder.

◆ ComputePathAsync()

virtual u32 ICmpPathfinder::ComputePathAsync ( entity_pos_t  x0,
entity_pos_t  z0,
const PathGoal goal,
pass_class_t  passClass,
entity_id_t  notify 
)
pure virtual

Asynchronous version of ComputePath.

Request a long path computation, asynchronously. The result will be sent as CMessagePathResult to 'notify'. Returns a unique non-zero number, which will match the 'ticket' in the result, so callers can recognise each individual request they make.

Implemented in CCmpPathfinder.

◆ ComputePathImmediate()

virtual void ICmpPathfinder::ComputePathImmediate ( entity_pos_t  x0,
entity_pos_t  z0,
const PathGoal goal,
pass_class_t  passClass,
WaypointPath ret 
) const
pure virtual

Implemented in CCmpPathfinder.

◆ ComputeShoreGrid()

virtual Grid<u16> ICmpPathfinder::ComputeShoreGrid ( bool  expandOnWater = false)
pure virtual

Get a grid representing the distance to the shore of the terrain tile.

Implemented in CCmpPathfinder.

◆ ComputeShortPathAsync()

virtual u32 ICmpPathfinder::ComputeShortPathAsync ( entity_pos_t  x0,
entity_pos_t  z0,
entity_pos_t  clearance,
entity_pos_t  range,
const PathGoal goal,
pass_class_t  passClass,
bool  avoidMovingUnits,
entity_id_t  controller,
entity_id_t  notify 
)
pure virtual

Request a short path computation, asynchronously.

The result will be sent as CMessagePathResult to 'notify'. Returns a unique non-zero number, which will match the 'ticket' in the result, so callers can recognise each individual request they make.

Implemented in CCmpPathfinder.

◆ ComputeShortPathImmediate()

virtual WaypointPath ICmpPathfinder::ComputeShortPathImmediate ( const ShortPathRequest request) const
pure virtual

Implemented in CCmpPathfinder.

◆ FlushAIPathfinderDirtinessInformation()

virtual void ICmpPathfinder::FlushAIPathfinderDirtinessInformation ( )
pure virtual

Implemented in CCmpPathfinder.

◆ GetAIPathfinderDirtinessInformation()

virtual const GridUpdateInformation& ICmpPathfinder::GetAIPathfinderDirtinessInformation ( ) const
pure virtual

Get the accumulated dirtiness information since the last time the AI accessed and flushed it.

Implemented in CCmpPathfinder.

◆ GetClearance()

virtual entity_pos_t ICmpPathfinder::GetClearance ( pass_class_t  passClass) const
pure virtual

Implemented in CCmpPathfinder.

◆ GetDebugData()

virtual void ICmpPathfinder::GetDebugData ( u32 steps,
double &  time,
Grid< u8 > &  grid 
) const
pure virtual

Returns some stats about the last ComputePath.

Implemented in CCmpPathfinder.

◆ GetMaximumClearance()

virtual entity_pos_t ICmpPathfinder::GetMaximumClearance ( ) const
pure virtual

Get the larger clearance in all passability classes.

Implemented in CCmpPathfinder.

◆ GetPassabilityClass()

virtual pass_class_t ICmpPathfinder::GetPassabilityClass ( const std::string &  name) const
pure virtual

Get the tag for a given passability class name.

Logs an error and returns something acceptable if the name is unrecognised.

Implemented in CCmpPathfinder.

◆ GetPassabilityClasses() [1/2]

virtual void ICmpPathfinder::GetPassabilityClasses ( std::map< std::string, pass_class_t > &  passClasses) const
pure virtual

Get the list of all known passability classes.

Implemented in CCmpPathfinder.

◆ GetPassabilityClasses() [2/2]

virtual void ICmpPathfinder::GetPassabilityClasses ( std::map< std::string, pass_class_t > &  nonPathfindingPassClasses,
std::map< std::string, pass_class_t > &  pathfindingPassClasses 
) const
pure virtual

Get the list of passability classes, separating pathfinding classes and others.

Implemented in CCmpPathfinder.

◆ GetPassabilityGrid()

virtual const Grid<NavcellData>& ICmpPathfinder::GetPassabilityGrid ( )
pure virtual

Implemented in CCmpPathfinder.

◆ IsGoalReachable()

virtual bool ICmpPathfinder::IsGoalReachable ( entity_pos_t  x0,
entity_pos_t  z0,
const PathGoal goal,
pass_class_t  passClass 
)
pure virtual
Returns
true if the goal is reachable from (x0, z0) for the given passClass, false otherwise. Warning: this is synchronous, somewhat expensive and not should not be called too liberally.

Implemented in CCmpPathfinder.

◆ SendRequestedPaths()

virtual void ICmpPathfinder::SendRequestedPaths ( )
pure virtual

Finish computing asynchronous path requests and send the CMessagePathResult messages.

Implemented in CCmpPathfinder.

◆ SetAtlasOverlay()

virtual void ICmpPathfinder::SetAtlasOverlay ( bool  enable,
pass_class_t  passClass = 0 
)
pure virtual

Sets up the pathfinder passability overlay in Atlas.

Implemented in CCmpPathfinder.

◆ SetDebugOverlay()

virtual void ICmpPathfinder::SetDebugOverlay ( bool  enabled)
pure virtual

Toggle the storage and rendering of debug info.

Implemented in CCmpPathfinder.

◆ SetDebugPath()

virtual void ICmpPathfinder::SetDebugPath ( entity_pos_t  x0,
entity_pos_t  z0,
const PathGoal goal,
pass_class_t  passClass 
)
pure virtual

If the debug overlay is enabled, render the path that will computed by ComputePath.

Implemented in CCmpPathfinder.

◆ SetHierDebugOverlay()

virtual void ICmpPathfinder::SetHierDebugOverlay ( bool  enabled)
pure virtual

Toggle the storage and rendering of debug info for the hierarchical pathfinder.

Implemented in CCmpPathfinder.

◆ StartProcessingMoves()

virtual void ICmpPathfinder::StartProcessingMoves ( bool  useMax)
pure virtual

Tell asynchronous pathfinder threads that they can begin computing paths.

Implemented in CCmpPathfinder.

◆ UpdateGrid()

virtual void ICmpPathfinder::UpdateGrid ( )
pure virtual

Regenerates the grid based on the current obstruction list, if necessary.

Implemented in CCmpPathfinder.


The documentation for this class was generated from the following file: