New answers tagged

0

Why not use a Dictionary, where the key is a tuple that holds int x and int y values and the other entry is a pointer or reference to your tile?


4

Not only is it feasible, I believe it was done in a commercial game in the 90s - BattleZone (1998). That game had 3D units with free non-tile-based movement, and tile-based base construction. This is how it seemed to work: First, A* or something similar (likely a variation of A* with strict limits on how long a path it can find, so it never takes too many ...


49

This sounds like a use case for Flow Fields. In this technique, you do a single pathfinding query outward from your player object(s), marking each cell you encounter with the cell you reached it from. If all your tiles/edges have equal traversal cost, then you can use a simple breadth-first search for this. Otherwise, Dijkstra's algorithm (like A* with no ...


8

A* is not performance heavy. I would approach this situation by varying the algorithms. Do A* from time to time and in between check whether the next step is free to step onto or you need evasion. For example, track the players distance from the A* target location, if it's above a threshold recalculate a* and then just do update movements. Most games use a ...


1

There are a few misunderstandings of A* here. You add every node to the closed set before you add it to the open set, but that's strictly speaking premature: at this point, we know we've found a route here, but we don't yet know whether it's the shortest route possible. We know we've found the shortest route to current, since it was at the head of the ...


0

You are correct in your understanding that increasing the number of choices will significantly increase the problem size. Whether or not it increases it too much depends on many factors. For instance, I've seen A* extended all tiles within a distance of three (Directional-48 search) in order to path find with turning radius constraints. That doesn't ...


0

am I overcomplicating/misunderstanding I'm afraid, you are (to some extent). All you really need to build the graph is to walk through all of your nodes (2) and connect them using a mask like this. --UJU-- -UUJUU- U0W*W0U where * -- Anchor point, that's the position of the node we are currently testing - -- nodes we can't reach (directly) from the ...


Top 50 recent answers are included