D
DirectOrder
Guest
I am using the mp_grid functions to generate pathfinding for my enemies, and I do have "allow diagonal" set to true, however, if two walls are diagonal from each other, the enemy does not see that as a valid path. For instance:
a = enemy
b = goal
X = wall
--------------------
--------X-----------
--------X-----------
--------X---b-------
-----a---X----------
---------X----------
---------X----------
--------------------
The enemy should be able to move forward 3 spaces, then up-right diagonally through the break in the wall, but the way mp_grid calculates paths, it doesn't allow for diagonal movement like this. I understand why it doesn't allow it. But I need to find a workaround. Has anybody figured out a way to make it see this as a valid path?
I know I could code my own pathfinding algorithm, and I did (A*), but it is way too slow. The built-in pathfinding seems to run muuuuch faster, so I'd really like to figure out a way to use it. I just need it to see two diagonally adjacent empty cells as a valid path somehow.
a = enemy
b = goal
X = wall
--------------------
--------X-----------
--------X-----------
--------X---b-------
-----a---X----------
---------X----------
---------X----------
--------------------
The enemy should be able to move forward 3 spaces, then up-right diagonally through the break in the wall, but the way mp_grid calculates paths, it doesn't allow for diagonal movement like this. I understand why it doesn't allow it. But I need to find a workaround. Has anybody figured out a way to make it see this as a valid path?
I know I could code my own pathfinding algorithm, and I did (A*), but it is way too slow. The built-in pathfinding seems to run muuuuch faster, so I'd really like to figure out a way to use it. I just need it to see two diagonally adjacent empty cells as a valid path somehow.
Last edited by a moderator: