1
\$\begingroup\$

By editing my A* algorithm as such that:

  • a tile is valid if all of its neighbours are valid (checking this N-1 deep)

I can find N wide paths, where N is odd, and my unit just follow the "center" tiles.

But what if my unit is even tiles wide?

Yes, I generate a 2 tiles wide path, and then traverse it with an offset, so my unit will walk on the overlapping edge between the 2 tiles. (maybe there is a better solution, suggestions are welcome)

But how do I find even wide paths?

(Or my whole approach is bad?)

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

instead of pathfinding on the centers of the tiles, pathfind along the corners and edges of the tiles.

A corner is valid if all the neighbouring tiles are valid according to your existing algorithm(n-1)

\$\endgroup\$
0
\$\begingroup\$

Draw an NxN square with the tile in the corner. The tile is only valid if every tile in the square is valid.

\$\endgroup\$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.