Sometimes the greatest error lies between the desk and the chair.
I thought I was done with that pathfinding, as mentioned. But during testing, I noticed that occasionally, it seemed to cease pathing to the goal halfway through. I discovered this while putting it through its paces, I created an obstacle course for it to path, a central barrier extending from the bottom left to the top right of the map, with smaller zig-zags between. Sometimes, I noticed, it would simply stop in the upper right. My first instinct was that for some reason the searching code wasn't able to detect new nodes in some cases.
No, that seems to be just fine. All the checks are in order.
Maybe dictionaries or arraylists have an upper limit on their content? Let's try making an extremely long and narrow course...
No, it's going through this entire thing just fine.
Maybe it's the smoothing algorithm? Perhaps it's cutting off nodes after a certain point.
No, the final node in the pathfinder matches the final node in the smoother.
Hm, maybe it just needs more nodes to work with, perhaps there are some exotic cases where it can't go around certain types of corners. Let's just have it place a new node every few steps, and...
...Nothing. That's not the case.
What the HELL is going ON!?
...
Uh.
Oh.
I just noticed there's an obstacle inside the goal marker.
Welp.
So, as it turns out, I'm an idiot. What was throwing me off was that, when it can't find the goal, it'll just path to whatever point is closest. Unfortunately, I never actually wrote that part of the code. My obstacle course is built such that the halfway point is in the upper-right corner, and it was defaulting to the upper-right corner not because it was closest to the goal, but because it was FARTHEST AWAY, because that's the last node it checks before it decides it can't reach the goal. It couldn't reach the goal because I put an obstacle RIGHT where the goal is.
Lesson learned: Probably none.















