Is it possible to find path with minimum obstacle ?
As per my scenario, If i have specified target and there is obstacle in between every path which can be used to reach to that target.
First i want to find path with minimum obstacle and if there are more number of path with same number of obstacle , then select shortest path.
Is it possible to perform this type of search ?
Please help me . Give me some idea by using astar i can do something like this.
I don’t really understand what you are trying to achieve. Could you elaborate?
I want to select easiest path means having minimum number of obstacle.
Then you would want to apply a penalty to the nodes where the walls are instead of making them unwalkable. A higher penalty will make it prefer avoiding walls more instead of taking a slightly longer path.
No that will not work. That will avoid all walls and will go towards cannon. I do not want to avoid wall. I just want to find easiest path although i stop to that wall. But that choosen path must be easiest means minimum number of wall i need to break to reach to that target.
Is there any way which can return complete path and number of unwalkable nodes coming in that path ?
It should avoid walls as much as possible (depending on the penalty), but if necessary it will go through walls.
Ok. You will have to post process the path to do that. If the system should be able to calculate the path with the minimum number of required walls to break, it will have to calculate the whole path to the target (including through the walls). You can go through the path and remove all points/nodes when you find a node with a penalty greater than 1 (or with a specific tag if you are using a tag).
This page describes how to update the graph and add penalties to specific nodes (possibly you will want to set a tag instead however and set the penalty on the Seeker component) http://arongranberg.com/astar/docs/graph-updates.php
The nodes the walls are on should not be unwalkable, they should just have a penalty (or tag).
Ok. means i can search path till target by making wall unwalkable and adding penalty or tag . and in PathComplete delegate i can traverse through path .
But that path will be easiest path (having minimum number of wall) . Is it so ?
The path will contain all nodes up to the target (including walls), you will have to either post process the path to remove the nodes after the first wall or just make the character stop there. If the penalty is sufficiently high (i’d suggest something like 100000, but it depends on the world size) it will find the path which goes through the lowest number of walls.
Ok. Thanks. I got it. I will try and if i stuck i will let you know. Thanks a lot…