Possible bug with GUO to set walkability on two adjacent nodes?

Hi, I want to see if this behavior is a known issue on your radar. First of all:

A* 3.2.5.1
LayerGridGraphGenerator

  1. Starting with an area where all nodes are walkable, I use a two GUOs to mark two adjacent nodes as unwalkable
    1b) http://screencast.com/t/fvms4woDfUpw. Note that there is no connection between the two unwalkable nodes but the surrounding nodes have connections to the unwalkables (as designed)

  2. Use one GUO to set the left node to walkable
    2b) http://screencast.com/t/1mUQeHT9E. Links from the left node to its north, south, and west neighbors are properly updated but there is no link to its right neighbor (the remaining unwalkable). I believe this is NOT as designed and i think it’s because of an unneeded ‘walkable’ check inside CalculateConnections() in LayerGridGraphGenerator: http://screencast.com/t/KZostAomI1

  3. Use one more GUO to set the right node to walkable
    3b) http://screencast.com/t/byIR8SlaNFB8. It properly sets connections to all its neighbors (including its left neighbor)
    3c) But that link to the left neighbor is still just a one way link. What results is two walkable nodes but with one-way connectivity

Is this a known issue? Is removing that ‘node.walkable’ check in CalculateConnections() the right fix? If you can’t repro I can furnish a test project.

Let me know,
Jeff

Hi

That looks like a bug.

At least 3c. 2b is however the correct behaviour. I skip adding connections to unwalkable nodes because it is faster to search the graph. Less nodes that need exploring. Note that 1b is incorrect, caused by the same issue.

I found the bug. It was caused by me using && instead of || in one place.
You can fix the issue by changing
if (willChangeWalkability && erosion > 0) {
to
if (willChangeWalkability || erosion > 0) {
In the LayerGridGraphGenerator.cs script (around line 150).

Here is the full diff. Including some other small bugfixes: http://pastebin.com/SBAjzbTa

thanks for the fix!