Skwizzy / SPT-LootingBots

AI Looting mod for Singleplayer Tarkov
https://hub.sp-tarkov.com/files/file/1096-looting-bots/#overview
29 stars 11 forks source link

Distance calculations for loot are triggered too frequently with the default search radius causing performance issues #99

Closed Skwizzy closed 5 months ago

Skwizzy commented 6 months ago

With the default search radius set to 75, there are a lot of cases where the path to the closest detected loot is just slightly over 75m causing the bot to move to the next detected item and recalculate loot. I need to investigate some solutions to this issue, one way is to add some sort of buffer to the max distance to account for small deviations in path lengths

Skwizzy commented 6 months ago

After some testing, I found that this issue doesnt really need this "buffer". I would like to instead defer any sort of behavior that expands the search radius to #43.

During testing I was finding some scenarios on customs with a 75m search radius where the closest paths I was seeing were 80-85m but I also noticed that there are just some cases where nearby loot is just not accessible due to navigation issues, loot behind locked/inaccessible doors ect. Adding a buffer wouldnt solve these cases and I was seeing upwards of 8 distance calculations a scan with no viable loot found. I decided to instead limit the amount of distance calculations to 3 as I found that if the first 3 items' paths are not close enough then no item will be.

Once 3 calculations have been performed, the bot will exit the looting logic and scan again at the next specified interval

Skwizzy commented 6 months ago

Code found here d52777d