0
\$\begingroup\$

I'm sure this has been asked before, but I couldn't find the thread. Let me know if you can locate the duplicate.

So, I have a my level is an array of tiles, where a tile can either be solid or walkable. I then use A-star to path-find my enemies from one location of the floor to another.

The issue is that I also have solid entities. As an example, I may spawn 3 breakable vases at a certain location. They can be larger or smaller than a single tile, and they are just objects in the world, not tiles themselves.

Because they are not a part of the A-star grid (can they? they're larger or smaller than a tile, and their position is not locked to the grid), the path-finding is not aware of their existence, since it only operates on its grid. As a result, sometimes the chosen path for the enemy to follow flows through the solid vases, so the enemy just gets stuck at that location.

Is there a solution that alleviates this problem? I want the enemies to path around the vases (until they're destroyed, of course), instead of just getting stuck trying to unsuccessfully move through them.

\$\endgroup\$
3
  • \$\begingroup\$ You might want to search for keywords like "navmesh obstacle" or "navmesh cut" for common strategies to address this problem. \$\endgroup\$ Commented Mar 23, 2021 at 23:50
  • \$\begingroup\$ Thanks for giving me some keywords, so now I know kind of what to look for. Do you have any resources or links on integrating this sort of thing with A-star? Example algorithms? If you put up a short answer of such I'll accept it. \$\endgroup\$ Commented Mar 24, 2021 at 0:02
  • 1
    \$\begingroup\$ A* searches a graph - if the graph to reflect things that block a path, then the algorithm will account for them - in general, it doesn't matter if those things are tiles or or not (though on some specific frameworks / implementations it may; if you're using one you should include that info in your question). Regarding changes, in some cases simply re-running A* on an updated graph is sufficient to account for changes. \$\endgroup\$ Commented Mar 24, 2021 at 2:52

0

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.