Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant archive_postsperpage - assumed 'archive_postsperpage' (this will throw an Error in a future version of PHP) in ..../archive/index.php on line 456
Clients A* pathfinding [Archive] - Forums

PDA

View Full Version : Clients A* pathfinding



Darius
07-14-2015, 01:39 PM
Yo,

I've been trying to use the clients A* path finding algorithm, I've located the function and it works pretty neat.
However, after a random amount of function calls I get a deadlock.

I've created function prototypes accordingly to what you can see in the OllyDbg screenshot.


// Get player XYZ
typedef void _GetPlayerXYZ(int* pOutX, int* pOutY, int* pOutZ);

// UnknownA is pushed in as '1' at client call.
// UnknownB is pushed in as '0' at client call.
typedef int _FindAStarPath(int StartX, int StartY, int StartZ, int GotoX, int GotoY, int GotoZ, BOOL UnknownA, int* pOutTilesToGo, int* pUnknown, BOOL UnknownB, int* X, int* Y, int *Z);
// The last three arguments is not pushed to the stack before the functionc all, I assume they're kept from the GetPlayerXYZ call as they're still a part of the parameters according to the stack window in Olly.

// Will return 1 if a path if found.
// I'm not pushing in the clients NumberOfTiles to go, instead I've set up my own variable which is passed as 'pOutTilesToGo' as I don't want modify the clients data.
// all I want is to use the function for checking if a target is accessible.

// The FindAStarPath() is called once within the client and it's called from what I call PlayerGoToPos(), this function is called when you mapclick or click on the screen. The client will search for a path and if one is found, it will start moving.
// This function works as expected and you can make your character walk really far as the client will recalculate an A* path whenever you've walked X <> 7 or Y <> 5 as it seems to calculate a path only for what's visible on the screen.
// Thus it knows where you start from and where you want to go, it will calculate a path along the way.
typedef int _PlayerGotoPos(int GotoX, int GotoY, int GotoZ, BOOL UnknownA, BOOL UnknownB);
// In order for the above function to work, you must also call;
typedef void _StartWalking(void);
// Otherwise your character will move one square and freeze, you can stop the freeze by rightclicking on a tile. But calling the above function is how the client continues after a path is found.

// I've tried with changing the calling convention from standard __cdecl to __stdcall, but __stdcall gives me ESP failures.


http://s16.postimg.org/3yjsg4vfn/olly.png

Any inputs on why this deadlocks occurs is greatly appreciated.
Best regards.

EDIT:
int *pUnknown is the direction in wich to start walking.
UP = 3
DOWN = 7
LEFT = 5
RIGHT = 1

EDIT2:
UnknownA is likely to be "ForceDiagonal"
UnknownB is likely to be "MustReach"