|
Post by lliviu on Jan 23, 2016 23:10:58 GMT
Hello Any suggestions about how to make the path-finding system avoid hexes that already have units on them? I was looking through the code and thought about doing for every hex that has a unit on it, something like connectionCosts.Add(10000) in ScanInternal() in HexGraph.cs; after that then try to reactivate the pathFinder with ActivatePathfinder(). But I feel like I'm not going in the right direction at all.
|
|
|
Post by khash on Jan 24, 2016 1:34:22 GMT
connection is still considered even if more expensive, I think its the best to remove nodes from the graph which are impossible to traverse, because if you have two areas linked by small corridor for 1 unit wide and you already have a unit there pathfinding will decide this path is valid and will try to progress further, unless you use some maximum cost safeguard. Other better path solving it might be to to simply remove path to nodes which are occupied but would allow unit to leave it. But in the end each case is a bit different and some solutions are better than other for them based on how often you need to do pathfinding, how much you can share between pathfindings for different entities etc.
|
|