[Path finding] Inaccurate results

Report Construct 2 bugs here.

Post » Fri Oct 24, 2014 12:13 pm

Problem Description
Not sure whether this was a bug or not at first, im now pretty sure that it is not working as intended.

The problem is that the path finder give you wrong results regarding whether a path can be found or not. And that the calculations or way It figures out what cell is the best alternative is not working correctly as it ends up selecting invalid cells even though others are valid.

Here is a short example:
Shows the starting position of the unit. And the big green square is a solid.
Image

If the unit is told to move to either the left or top side it will work fine.
Image

But when told to move to right or bottom side it fails.
Image

Doing some testing it seems to indicate that these two sides have some problems, as moving the starting position doesn't have any effect.
Image

Result in the same problem
Image

It seems to be that a target destination to an empty cell near the original target when its a solid is not found correctly and therefore gives you wrong results.

Using the above example where the unit is starting above the big green square, the possible paths to the destination and the best possible path (indicated by the red square) to the target would be like this, so there should be no reason for it to give you a path not found.
Image

Description of Capx
Will just path find to a selected target. chosen by left mouse button.

Steps to Reproduce Bug
Click any of the solid tiles on the right or bottom side.

Observed Result
Will give you the result that no path could be found.

Expected Result
That it finds a path to the best nearest empty tile that it can reach.

Affected Browsers
All

Operating System and Service Pack
Windows 7

Construct 2 Version ID
r185
Don't think it have anything to do with this version as I believe this problem have been there for a very long time.
You do not have the required permissions to view the files attached to this post.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,828

Post » Fri Oct 24, 2014 2:13 pm

UPDATE:
I modified the program a bit, so it works now. However the solution is not really perfect or optimal I think.

Image
But the idea is to add what I call "Path mesh" in lack of better words. Which is indicated by the red tiles.

Image
Image

Checking where this mesh is placed in relation to the solid target, it can find the correct path to any of the sides, except diagonal as I haven't made that. But in cases where there are mesh in both directions, it rely on the path finding to fail to find a path so it can check the other cell. Which ofc shouldn't really be needed and this way of doing it will require a lot of correctional code to make it work under all possible circumstances I could imagine if it was a bit more complicated setup.
Image
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,828


Return to Bugs

Who is online

Users browsing this forum: No registered users and 1 guest