N00byEdge / BWEM-community

Other
17 stars 7 forks source link

Hitchhiker 1.1 crashes/hangs BWEM #30

Open bmnielsen opened 6 years ago

bmnielsen commented 6 years ago

BWEM crashes or hangs on Hitchhiker 1.1 (part of the CIG map pack). I've just confirmed that this is still an issue with the current version of BWEM-community.

This has been discussed a few times on the SSCAIT discord, here are some quotes (easily found by just searching the whole discord for "hitchhiker"):

PurpleWaveJadien:

The one issie I know about is BWEM not handling partially-overlapping neutral buildings which was the issue on Hitchhiker

McRave:

So I found BWEMs stall issue on hitchhiker It gets stuck in its BFS

and

It seems that the visited.empty() never is true on hitchhiker At map.h line 272 It seems as though it's potentially iterating between 2 or more tiles and not storing that it was visited Or the function using it is stuck looping In any case, I can try to find more information on it or a fix

bmnielsen commented 6 years ago

I dug into this a bit today, and it seems to create some odd chokepoints with center (0,0). This causes some kind of loop in computing the distance between chokepoints.

The root cause is the semi-overlapping neutrals. I have prevented BWEM from stacking the neurals when they only partially overlap by adding this line at neutral.cpp:77:

if (pTop->TopLeft() != TopLeft() || pTop->BottomRight() != BottomRight()) continue;

This at least allows BWEM to finish analyzing the map, but I don't know if it has any side effects.

MicroDK commented 6 years ago

Should this not be PR'ed? ;) Anyway, the workaround works. BWEM does not hard crash anymore.