* Actually fixes bots wrongfully failing to pathfind (#58064)
I botched #57873 and made the wrong part of the code return an empty list, so instead of it being part of the wrapper proc (like it was before), it was part of the core pathfinding proc. This meant that sometimes a non-list return value would make it by the wrapper proc when a list was expected, eventually causing bots to fail to respond to summons from AIs/PDAs as I detailed in the last PR. This solves it by ensuring all returns are lists, with the exceptions of invalid callers or endpoints, which should error.
* Actually fixes bots wrongfully failing to pathfind
Co-authored-by: Ryll Ryll <3589655+Ryll-Ryll@users.noreply.github.com>
* Fixes simple bots wrongfully failing to path (#57873)
In #56780 I thought it'd be fine to change the get_path function to return null if there was no path found instead of an empty list, but apparently quite a lot of code in simple bots expects empty lists and freaks out if path is just null, causing simple bots to occasionally fail to respond to summoning even if a path is clearly found and briefly assigned
This undoes that
* Fixes simple bots wrongfully failing to path
Co-authored-by: Ryll Ryll <3589655+Ryll-Ryll@users.noreply.github.com>
* Dog AI 2.0 (#57186)
Now that JPS and AI movement datums are fully merged, I'm here to take another (my third actually) crack at giving dogs fun AI. Here's a video demonstration (somewhat WIP), and a quick rundown of everything dogs will be able to do. Basically all of these behaviors are generic and can be extended to other simple mobs,
Commands and Friendship
Fetching
Attack/Harass
Heel
Play Dead
* Dog AI 2.0
Co-authored-by: Ryll Ryll <3589655+Ryll-Ryll@users.noreply.github.com>
* Implements JPS (Jump Point Search) Pathfinding (#56780)
So a month or so ago I wanted to make it so dogs in my dog AI PR could path through doors if they had access, and was told I'd need to improve our pathfinding efficiency if I wanted to use full pathfinding for them. Thus, enter JPS, a pathfinding algorithm that allows for massive timesavings in systems with uniform cost grids like ours. This code is still fairly rough and needs polishing, but it's fully functional and already shows massive savings over traditional A*! I plan for this to replace A* as our default pathing method, but I'll leave the A* code in place in case someone ever needs it for whatever reason, like if a specific case needs variable cost pathing.
Note that this allows for diagonal pathing instead of the cardinal pathing our A* uses right now, and the current version of the code costs the same to move diagonally as it does to move laterally, which may change later. There's also a lot of dummy/test code in right now in general, but you should still be able to test it out for yourself by spawning a bot like a medibot and using your PDA to summon it.
Preliminary Profile Results
A preliminary profile is available here. Using one medibot by itself on Metastation, I generated a list of 500 random blob spawn points around the station, gave the medibot all access, then let each algorithm tackle the list. The old A* algorithm took a total of 86 seconds to complete the list and processed 978065 nodes, while JPS took a total of 46 seconds and processed only 100062 nodes, for a 47% decrease in total time and an almost 90% decrease in nodes processed!
Why It's Good For The Game
Significantly cheaper pathing, which will very much come in handy for the AI datums I'm looking to dig into, what's not to like?
* Implements JPS (Jump Point Search) Pathfinding
Co-authored-by: Ryll Ryll <3589655+Ryll-Ryll@users.noreply.github.com>