Need some idea to optimizing my pathfinder
Hi.
First of all, please excuse my short english.
I am recenlty developping the pathfinder using the quad tree for both generating and storing the path nodes.
My pathfinder must be able to work for the multi-layer structure terrain which can have one navigation mesh can be located right on the top of another navigation mesh.
I finished first phase by using class structure like below.
class PathNode
{
public:
// functions ~~
public:
u16 m_Index;
Vector3 m_Intersect;
short m_NavMeshIndex;
uint m_Type;
uint m_Layer;
PathNode* m_StartNode;
PathNodes* m_AdjNodes[DIR_MAX];
PathNodes* m_NodeForLayers[MAX_LAYER];
EdgeType m_EdgesToAdjNodesType[MAX_LAYER * DIR_MAX];
}
Normally, the necessary PathNodes will be found using the FloodFill algorithm from the given NavMesh. The start PathNode will be found by picking the one of the corner of the NavMesh.
m_StartNode stores the start PathNode and the FloodFill algorithm will run from this node.
m_AdjNodes are filled as the adjacent nodes those are at the same layer with the current PathNode.
m_NodeForLayers are filled as the nodes those have same x, y position with the current PathNode, but not z position where z axis is the vertical axis.
m_EdgesToAdjNodesType are filled as the edge type between the current PathNode to the adjacent nodes include the adjacent nodes those have different layer. And that's why its size is MAX_LAYER * DIR_MAX. The edge types are decided by the height difference.
So far, when i ran, it looks working fine.
However, it seems i need to remove the layer concept because two different layers can be connected by the stairs or the sloping roads and EdgesToAdjNodesType can hold memory space for the unexisted PathNodes.
Anybody has some idea to producing the PathNodes without applying the layer concept?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement