Recast & Detour Max Distance? menu

User Tag List

Results 1 to 4 of 4
  1. #1
    DarkLinux's Avatar Former Staff
    CoreCoins Purchaser Authenticator enabled
    Reputation
    1584
    Join Date
    May 2010
    Posts
    1,829
    Thanks G/R
    188/531
    Trade Feedback
    16 (100%)
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)

    Recast & Detour Max Distance?

    I am working with Recast & Detour and I have run into a problem, Recast is not finding a path. I have set the dtNavMeshQuery to 1,000,000 and it only reaches around 65k (65537). I have dtPolyRef set to 2k when calling findPath, it only reaches around 600. When calling findNearestPoly both start and end points are found. I'm thinking I should just create a system that find a path to each zone exit, and create a new query to the next zone exit until it finds the location. But then I feel like I'm doing what recast should be doing. Has anyone run into any problem like this? I remember reading someone had it working from the top of the map to the bottom, so I don't know why it cant find a path from 3 zones. I feel like I'm reaching some max buffer, I'm not going over the size of an int yet.

    basic example,
    Code:
    	dtNavMeshQuery* query = dtAllocNavMeshQuery();
    	dtStatus dtResult = query->init(navMesh, 1000000);
    
    	....
    
    
    	Vector3 extents = Vector3(5.f, 5.f, 5.f);
    	Vector3 closestPoint = Vector3(0.0f, 0.0f, 0.0f);
    	dtStatus dtResult = 0;
    
    	dtPolyRef startRef = 0;
    	dtResult = m_navMeshQuery->findNearestPoly((float*)&origin, (float*)&extents, &m_filter, &startRef, (float*)&closestPoint);
    	if (dtStatusFailed(dtResult) || startRef == INVALID_POLYREF)
    	{
    		printf("FAILED 1\n");
    	}
    
    	dtPolyRef endRef = 0;
    	dtResult = m_navMeshQuery->findNearestPoly((float*)&dest, (float*)&extents, &m_filter, &endRef, (float*)&closestPoint);
    	if (dtStatusFailed(dtResult) || endRef == INVALID_POLYREF)
    	{
    		printf("FAILED 2\n");
    	}
    
    	int prefixPolyLength = 0;
    	dtPolyRef* path = new dtPolyRef[20000];
    	dtResult = m_navMeshQuery->findPath(startRef, endRef, (float*)&origin, (float*)&dest, &m_filter, path, &prefixPolyLength, 20000);
    	if (dtStatusFailed(dtResult) || path == NULL)
    	{
    		printf("FAILED 3\n");
    	}
    
    	Vector3 pathPoints[20000];
    	BYTE pathFlags[20000];
    	dtPolyRef pathRef[20000];
    	unsigned int pointCount = 0;
    	dtResult = m_navMeshQuery->findStraightPath(
    		(float*)&origin,
    		(float*)&dest,
    		path,
    		prefixPolyLength,
    		(float*)pathPoints,
    		pathFlags,
    		pathRef,
    		(int*)&pointCount,
    		20000);
    
    	if (dtStatusFailed(dtResult) || !pointCount)
    	{
    		printf("FAILED 3\n");
    	}
    
    	vector<Vector3> __path;
    	for (int i = 0; i < pointCount; i++)
    	{
    		if (pathFlags[i] & DT_STRAIGHTPATH_OFFMESH_CONNECTION)
    		{
    			printf("FAILED 4\n");
    		}
    		else
    		{
    			static D3DXVECTOR3 last = D3DXVECTOR3(0,0,0);
    
    			D3DXVECTOR3 pos = D3DXVECTOR3(pathPoints[i].z, pathPoints[i].x, pathPoints[i].y);
    			D3DXVECTOR3 Target[2];
    			if (settings.m_Camera.CalcScreen(pos, Target[0]) && settings.m_Camera.CalcScreen(last, Target[1]))
    			{
    				CDraw::DrawLine(Target[0].x, Target[0].y, Target[1].x, Target[1].y, ImColor(255, 0, 255), 4);
    			}
    
    			last = D3DXVECTOR3(pathPoints[i].z, pathPoints[i].x, pathPoints[i].y);
    			__path.push_back(Vector3(pathPoints[i].x, pathPoints[i].y, pathPoints[i].x));
    		}
    	}
    Last edited by DarkLinux; 12-16-2016 at 02:08 AM.

    Recast &amp; Detour Max Distance?
  2. #2
    andy012345's Avatar Active Member
    Reputation
    59
    Join Date
    Oct 2007
    Posts
    124
    Thanks G/R
    0/7
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you tried changing the typedef of dtNodeIndex to an int?


    Looks like there's a bug for large nodepools currently and the devs are still trying to decide if fixing would impact low memory systems.

    Someone is obviously still running navmesh queries on their commodore 64.

  3. Thanks DarkLinux (1 members gave Thanks to andy012345 for this useful post)
  4. #3
    Bananenbrot's Avatar Contributor
    Reputation
    153
    Join Date
    Nov 2009
    Posts
    384
    Thanks G/R
    1/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, a past me could help you: [Recast] Tiles not aligning

    But obviously I can't time travel and hand you the exact changes which have to be made. It's actually just a lot of trial and error, just changing the typedef wasn't enough, IIRC. There were some subtleties like embedding flags within the node refs, etc. Something you can only come by with a less forgiving type system or a lot of debugging.

  5. Thanks DarkLinux, Bogie (2 members gave Thanks to Bananenbrot for this useful post)
  6. #4
    andy012345's Avatar Active Member
    Reputation
    59
    Join Date
    Oct 2007
    Posts
    124
    Thanks G/R
    0/7
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't think there's embedded data in the dtNodeIndex, there's just a problem with m_nodeCount allocating new nodes, it's an incrementing integer that casts to a short, breaking indexes above 65535 and every overflow with the low 16 bits all set will start causing logic failures as the reference is truncated to DT_NULL_IDX.

    Edit: all bits set, not 0. DT_NULL_IDX if 0xFFFF
    Last edited by andy012345; 12-17-2016 at 02:21 PM.

  7. Thanks DarkLinux (1 members gave Thanks to andy012345 for this useful post)

Similar Threads

  1. Path Generator – Recast/Detour and WowMapper – Step
    By RivaLfr in forum WoW Memory Editing
    Replies: 32
    Last Post: 05-13-2022, 05:38 AM
  2. [Link] C++ Recast/Detour Wrapper
    By Millow in forum WoW Memory Editing
    Replies: 11
    Last Post: 08-02-2011, 04:26 AM
  3. [Request] Recast n' Detour
    By Hi on helium in forum WoW Memory Editing
    Replies: 3
    Last Post: 01-12-2010, 04:35 AM
  4. Max Camera Distance, Easily
    By BaboonX in forum World of Warcraft Guides
    Replies: 15
    Last Post: 02-11-2009, 06:38 PM
  5. Changing the max-camera distance?
    By Andrige in forum WoW ME Questions and Requests
    Replies: 1
    Last Post: 07-07-2007, 12:12 PM
All times are GMT -5. The time now is 04:18 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search