Closed Kaillera closed 2 years ago
Hmm, it's a weird issue. I was able to reproduce it twice in multiplayer, but not in single player. But I can't repro it consistently and have no idea why it happens.
The type of enemy doesn't matter, but it's possible that the issue is somehow related to the ice blocks or caves in general.
Been testing this on version 0.18.12.0, replicated it somewhat but with erratic/50% of the time results - I spawn spinelings which dart around a lot and keep a distance on seed mhaDpYjx using Azimuth with a dedicated server on nest mission mode which generates a cave with decent geometry.
I outfitted some AI, godmoded the lot and had them follow the human player, freecammed and teleported them inside to begin testing, I found sometimes corpses would perhaps trigger this as well as the creatures darting around level geometry as if for X time without a clear shot but initially having a good aim, they will continue to fire in erattic directions, perhaps the direction they are simply facing at the time.
Larger view of that area:
The above images is one such case of this, a spineling has darted around the ice and the AI continued shooting in an erratic direction. clearly they do not have line of sight and this is the only spineling alive in the area from all my other spawns while I tried to capture an image of this.
One important thing of note, the AI considerably slows down its firing rate when it is attacking in random directions. This behaviour has been extremely consistent when it occurs.
further investigations of debugging the code has shown the AI to somehow be firing its weapons without triggering any code inside of AIObjectiveCombat.cs beyond the if statement for "canSeeTarget" (As it returns there) and without triggering any UseWeapon code despite continueing to fire.
Further debugging has revealed when the AI is shooting without a clear target - The shoot input is set via AIObjectiveGoTo in UseScooter - the AI is suppost to have a scooter and if not return, but then it is set while they have an SMG active, implying this order is done before the AIObjectiveCombat order changes the weapon to an SMG perhaps, though im not sure if the orders can work like this it would explain a lot if they are attempting to travel (They are on follow orders then lose sight of the target) with an SMG in their hands.
This causes the character to fire their weapons despite not going through the code on AIObjectiveCombat to trigger firing the weapon.
In one final test - I removed their scooters and then was completely unable to get them to fire randomly, they instead swam towards the hostile target.
Nice digging! Did you manage to repro it in single player or is it mp only?
I can't recall but I believe for AI issues I generally test in single player as I am not sure how well the debugai information is accurate to a clients perspective, and figure they generally should mimic the same behavior between the two. I'm sure there are probably multiplayer-specific issues that exist but I would check for those after failing to find them in single player.
so although I cannot be 100% certain now, I definitely believe this was tested in single player back then (Though I do always spawn bots in my multiplayer tests anyways using the autofill and/or spawn commands, I generally don't target testing those unless I can't reproduce the issue basically)..
If I did debug the issue on a server though, I would have been checking the information from the dedicated server instance in visual studio, though I can't remember what I ate 22 days ago let alone how I went about that test, I'll remember to include if its single/multiplayer tested in the future for AI.
Its also possible (from the initial description) I did replicate this using a dedicated server, that is around the time I figured out I could attach a debugger to additional instances and stop disconnecting myself every time (This does sound like the issue I had problems with that...). I actually recall that so there's also a good chance I multiplayer tested this one. but again can't remember or confirm, I could always test again as I generally know the root cause of the issue in the code?
Tested against bugfixes commit https://github.com/Regalis11/Barotrauma-development/commit/e176d08351da8d12043ea5020c9227d120dd502b, no issues found, closing.
Description Multiplayer - Dedicated Server
So we were entering a cave to mine some Uranium for a mission. We had a bot with a SMG followed us. There was a ice block between us and the Spineling. Once the bot entered it's range where it would detect and shoot at the Spineling, the bot would just randomly fire it's smg at random directions, hitting players too.
After that, I decided to test the problem again and spawn a spineling, but this time with clear line of sight to the enemy, the bot is still firing at random directions until the spineling got closer to it, and then it will shoot directly at it.
Version 0.,15.15.0