Tag Info

New answers tagged

1

From your screenshot it looks like you've made your grid by placing a bunch of specific sprites or prefabs or whatnot. This will make it difficult to address your needs for adjacency, because each tile is totally distinct. Instead, consider storing the tiles of your map in an array somewhere. This will allow you to use array indexing to determine tiles ...


0

To highlight adjacent tiles from current tile, use a modified floodfill with a depth parameter to get all the nearest tiles within X depth/distance. To allow a GO to move on any of those adjacent tiles, said floodfill should return a list of tiles, check if clicked tiled is in the list, if so, move GO. A possible implementation of said floodfill (in ...


0

Within this project, you are able to define what is passable and impassable terrain. If you recast the graph and alter the maximum slope that's walkable to the gradient of your mountains, they should be included in the navmesh, albeit at a higher cost to use. There may be other ways, but ultimately, what you want to be looking to do is include the mountain ...


1

A* keeps a list of visited cells and a frontier. It will first explore the top of grid as you say but once all the possibilities there are explored, the A* will begin to go downwards. Think of it as a greedy breadth first search. See http://www.redblobgames.com/pathfinding/a-star/introduction.html.


0

If you're feeling adventurous, you could try a simple stochastic hill climbing shortcutter on your path before fitting a NURBS curve. Here's how it would go in pseudocode: function Path Shortcut(Path path): // Shortcut the path until a max number of timesteps is reached for t = 1 to MAX_TIMESTEPS // Get two random path indices to shortcut ...


1

I have implemented A* pathfinding on a hexagonal grid in C# that nicely smooths paths like so (in an opensource project under the MIT License): Key portions of the code are reproduced here. void ExpandNeighbour(IDirectedPath path, NeighbourHex neighbour) { if ( ! OpenSet.Contains(neighbour.Hex.Coords)) { var cost = StepCost(neighbour.Hex, ...


3

You could look at Theta* - it's invented for exactly that purpose. Pretty much like A*, except when adding a node it tests if the new node can be reached directly from the active node's parent, and if so from that node's parent, and so on. It produces very-nearly-perfect paths in most conditions. Image is the output of my very, vey buggy C++ ...



Top 50 recent answers are included