Tag Info

New answers tagged


Your best bet is to attach the debugger and see where things are going wrong. If you're getting a stackoverflow it means you're recursing too far into your CheckSquare method. That either means your map is too large, or you're checking the same tiles multiple times. I'd bet on the latter given your screenshot. Depending on the IDE you're using, you can ...


A typical implementation of A* will use a loop instead of recursion. Change the if (ClosedList[ClosedList.Count - 1] != End) CheckSquare(...) into a while loop. However, I suspect the code won't work correctly even with that change, because you're clearing all the data after you check just one square. A* needs all that data (OpenList, gValues, etc.) so you ...


you say it's so complicated to implement a path-finding algorithm, but it isn't... and what's even better, once you have implemented one you can use that algorithm whenever needed again... i can provide you with an simple one (A* it is - and it is easy) and it's so open you can use it on hexfields, squared fields or even on cubes... private ...


Probably the easiest way is to alter the A* heuristic. Once a tile has been used in a path, increase the heuristic for this tile so that the next pathfinding call will try to avoid that tile. This will also make the zombies gather around the player.


One of the possible solutions would be to disable unit collision in such tight spots. For example in the Starcraft game, workers (SCVs, Probes, Drones) don't collide with each other when mining crystals.


If you're working with a uniform-weighted grid and don't need to worry about dynamic pathing, Jump-Point Search is an extremely efficient pathfinding algorithm. It's extremely fast, usually ten-to-thirty times as speedy as A*. It achieves this through symmetry reduction, which is a method by which empty spaces are ignored.


Various graph representations exist. Yours is an adjacency list with explicit vertices and implicit edges: Each vertex stores its adjacent vertices, each of which implies a directed edge to it. In the above, blue squares are vertex objects, arrows are references vertex A's list of vertices is [ B ] vertex B's list of vertices is [ A, C ] vertex C's list ...


Have you tried to create your own class/struct to represent the nodes? You don't tell much about what your nodes are but with a Node class made by you you'd be able to stock anything you need inside and still use it as Dictionary key. That way, when you walk through your dictionary you can always know Nodes weight. But you can also save the list of ...


A potential field is a type of scalar field. In contrast, a flow field is a vector field. These are essentially just multidimensional arrays that are used as low level data structures for various pathfinding designs; there really is no "standard" algorithm equivalent to the ubiquity of A* for point-to-point pathfinding. Typically, a potential field maps ...

Top 50 recent answers are included