1

Pathfinder by A* algorithm working fine, the smoothing path algorithm is working excellent too.

The problem is: pathfinder grid is not equal to monster hitbox (collision range), the grid size and hitbox are two different things. My path smoothing algorithm is taking into account the hitbox range BUT it is doing so after the A* setted the path already. So what i'm supposed to do? I guess i should add checking the hitbox collision during primary A* is setting the path, but this seems kinda weird and hard to do, i feel like people are doing it differently, A* visualizations on the internet always just showing straight path, never took into account the collision range so i'm feeling like A* algorith on its own should only work on pathfinder grid, and all other factors should be fixed later, but it's seems so not-economy way i would have to calculate new path after found collision.

On the picture below shouldn't monster dodge the edge on circular curve? Any tip how to achieve it in economic way?

Pathfinder

0

1 Answer 1

0

One solution would be to allow diagonal movement only if the neighbor tiles are free, otherwise do not allow diagonal movement.

Suppose you have 4 tiles named A,B,C, D arranged as follows

A  B
C  D

Now only allow direct movement from A to D if both B and C tiles are free. This can be done in the step where you compute the neighbors of A.

Suppose B is not walkable, then B is not a valid neighbor, D is also not a valid neighbor (bacause of B) and the path has to go through C avoiding the vertex collision with B: ( A->C->D )

Good luck with your game implementation.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.