Pathfinding, my noob’s nightmare
Another night of debugging and trying to mess with the code of Golemizer. This time I downloaded the backup from last night as I suspected the data I had on my development machine was “too clean”.
Last night I published an updated version of Golemizer that wasn’t popping any exception while monitoring with perfmon on my development machine. I thought I did a nice job but once the code started running on the live server perfmon was now showing a couple of exceptions every seconds. Still it was far better than before.
So my guess was that I needed to use a version of the database with golems as they were on the live game. Players are leaving behind some golems in various zones and it’s just impossible for me to check every zone to make sure there’s nothing wrong. There are over 30,000 zones in Golemizer and players may have put anything in there.
It didn’t took 2 minutes to get the debugger to stop on that part of the code I fear very much, the pathfinding algorithm. That was one of the first system I coded for Golemizer and 2 years and a half ago I knew a lot less than I know right now so once I get it to work I locked it and never look back at it.
The way some zones are designed it’s possible that an NPC might not be able to find a path to reach its destination (for example if it’s trying to attack a target too far away it will first try to reach it). Poor coding on my part the exceptions for that case were not handled correctly. See I assumed that my code preventing “locks” in zones would be flawless. The players were smarter than this code though so it was a mistake on my part to assume I could prevent such thing.
It took 2 minutes to change the way the pathfinding code works to fix the exceptions. Well now there are no more exceptions as it should have been right from the start. What was hard to figure when I coded the first lines of Golemizer was now a trivial issue. The only problem was to find back this issue after so much time.
So right now I have the same exact world that was running last night on the live server and now there are no exceptions at all popping in perfmon. Hopefully this time I caught everything. It still seems that my work last night helped as the server has been running just fine all day today. With this new updated version I’ll push online tomorrow it should now run very smoothly.