python-pathfinding icon indicating copy to clipboard operation
python-pathfinding copied to clipboard

Using floats between 0 and 1 on the 2D list

Open alejcas opened this issue 5 years ago • 1 comments

Hi, I need to set some fields on the 2D matrix that have a 'walk cost' of a quarter of a movement point (0.2) But when doing so, the pathfinding algorithm starts to do some weird things. If I instead use only integers the pathfinding works just great.

Is there any chance of using floats?

I'm using the A* algorithm.

alejcas avatar Jan 16 '20 18:01 alejcas

Interesting! In theory it should not make a difference. I tired to to recreate and fix it, but I wasn't successful (see the new test on the use_float-branch) so for now I'll mark this as a bug. I am not sure what causes the issue but I think it might have something to do with the way the path length gets calculated based on the heuristic.

The easiest workaround for now is to multiply the weight with a bigger number like 100.

brean avatar Jan 18 '20 18:01 brean