So for the past week or so I've been hard at work developing a completely new pathing system for the AI. The previous system with the nodes was technically working but there would always be a few issues that I could never seem to completely fix, and I was getting frustrated by it. So I came up with a totally new system, I actually got the idea from playing Assassin's Creed: Origins. In the game, whenever you are on a horse, you can hold a button to tell it to basically just follow the road automatically so you don't have to steer or anything. It then draws this line in front of you and it constantly updates as you travel along it.
So it got me thinking and I thought that this would be a much better system to try to implement into AA. In the collision map for LSI I drew a line that goes right up the path in the middle of the map, making sure that on both ends it is just into the adjacent zone. You can see this in the image below, I color coded it just so you can see the individual zones, but I just drew a basic curved line right through the path.
The way the code works is that it basically fills a list with each point in the line, saving it's coordinates and what zone that point of the line is in. Then as the AI is seeking it's target, it checks if the target is in the same zone, and if they aren't, then it finds the closest point in the path to the AI and they move towards it. Once they are in contact with the line, the code will then find the end point of the line that is closest to the target and in the target's zone. Then it will navigate through the line until they come into contact with that end point, wherein it gets switched off and the AI will navigate to the target like normal. After countless trial and error runs and squashing many bugs, I believe it is finally starting to work correctly, there are still a couple of random situations where an AI might get stuck and start flipping back and forth, or just decide to not follow the path at all, but I will continue to make tweaks and iron out the last couple bugs, but I already think it is working better than the old node system. I also tried spawning a ton of enemies and only noticed some lag when there was over 30 enemies which would only happen in the event of getting to the last survival stage before the boss and not killing anyone, so it's a rare occurence to have that many enemies on the screen at once.
So I've submitted this update (that also contained a few other items) as a good testing state for this new pathing system. Right now it is only in place in this one spot on the LSI arena, but I will add it to the rest of the areas/arenas once it has been cleaned up and is working properly. So test this area like crazy, I usually just walk up and down the path, wait at the top like in the above image for the enemies to catch up and then walk back down to the big open area. Let me know what you think of this new system and what kind of bugs you come across, I know there are still a couple lingering about.