Tag Info

New answers tagged

1

It's not a massive change, just instead of current_node == destination it will be destination_set.contains(current_node). Otherwise you can reverse the search, go from the endpoints to the start. That way you can use A* (given a proper heuristic). You just need to start with all endpoints in the starting set.


0

Cant comment so Ill leave as answer instead. I like the implementation of A* from this page: http://www.redblobgames.com/pathfinding/a-star/introduction.html. It goes step by step on how to build a path finding algorithm from the simplest and gradually increases complexity. I scanned over your implementation and it is not clear to me where the bug is. But ...


2

AStar is a suitable algorithm and can easily accomplish what you're describing. It all comes down to either applying a set of rules or costs to the various connections between the nodes in your world(graph). For example you could just have a bit of logic code in your TryGetNeighbours function call in each step of your pathfinding algorithm [untested code ...


2

Yes it can. You just have to create a method like "CanIMoveFrom1to2(currentNode, targetNode)". Then in A*, before analyzing that node any further, just check if its walkable from this node, if not, discard it, if yes then add it to open list.


0

Well, it seems Unity4 had a general problem with placing obstacles in a Navmesh. I have swapped to Unity5 which works as intended.


3

Add a meta graph that explains the route between floor entrances / exits from floor x to floor y. The vertices are entrances / exits, the edge length is the path between an entrance A and an exit B in tiles on floor z. Each entrance / exit is connected by such weighted edges to all entrances and exits that are accessible from it through the floor(s) it's ...


1

try and have a look at this: http://docs.unity3d.com/Manual/class-NavMeshObstacle.html you could make a prefab of the Obstacle you want to place, load it with (GameObject)Resources.Load("Obstacle") and then spawn it where you want. To give you a more in-depth answer you should be able to post the section of your code that handles obstacles, until that, this ...


1

I believe your error arises from rounding errors. I believe the problem could be solved by using float for pixel-coordinate storage. This way you will always get the exact increment needed for the given delta time, which is usually very small and thus the resulting per update increment is less than 1, and truncated to 0. Don't forget to use proper rounding ...


0

It depends. If the elevated surfaces could lead to other rooms, it could get very complicated unless the A* optimization function you are running is tailored with information specific to that room layout, it may need to search every possible path (like BFS). How to handle this issue: Complexity: You need a meta graph that represents rooms; i.e to get from ...


0

I would prefer to reuse the data structure you already have. So basically a 2D grid that is the floor with a bunch of entities that are put over it. A* actually works over a graph, so the trick is to make a decent abstract programming interface (API) for a graph. 2D or 3D grid A* is a trick by implicitly converting a grid into a graph with the shape of a ...


0

I can suggest to transform your "2d space with heigth" into a graph. Them use an A* on that graph . Example each walkable tile become a graph "node", and then add an "arc" for each "adiacent tiles" (even at different heigths)


3

There is really nice article at Rogue Basin on Dijkstra Maps about the problem you are encountering. This kind of "exploit" can be easily overused, cornering range units, while they are try to flee, they really stuck and can't move away. The article describes making "negative" Dijkstra maps. You create normal Dijkstra map, multiply result by value -1.2, and ...


6

First think of what you would do as a player (and/or ask others what they would do) and then try to program one or more of those strategies. There are probably several situations where a simple rule won't be a good idea to follow. This is actually a good thing, because otherwise your game would be fairly pointless to play as a human. Having an AI that can ...



Top 50 recent answers are included