My mod is being crippled by AI Update Time Overflow bugs.
ABJECT_SELF
Member Posts: 24
I'm having a huge problem with the latest version of my mod. I'm getting constant reports of AI Update Time Overflow errors and massive framedrops to outright freezes whenever they pop up. This seems to affect all creatures in the game including the PC and even occasionally a VFX placeable.
This mod features a lot of large-scale battles and naturally I'd expect some hiccups when 30+ creatures are fighting onscreen, but these overflows still pop up from time to time just walking around a small area. I've checked the debug menu to confirm there are no extra creatures left in other areas and I have no idea what script I could mess up to cause even the PC to have these overflows when navigating around an object.
Here's a shot of what I'm seeing most of the time. I thought the ResMan screen could provide some hints as to what's going on, but no dice. Notice the errors continue to flow in even after the game is paused.
Does anybody have any ideas how I can narrow down what's causing this? I'm really trying to avoid having to rollback to last year's version.
This mod features a lot of large-scale battles and naturally I'd expect some hiccups when 30+ creatures are fighting onscreen, but these overflows still pop up from time to time just walking around a small area. I've checked the debug menu to confirm there are no extra creatures left in other areas and I have no idea what script I could mess up to cause even the PC to have these overflows when navigating around an object.
Here's a shot of what I'm seeing most of the time. I thought the ResMan screen could provide some hints as to what's going on, but no dice. Notice the errors continue to flow in even after the game is paused.
Does anybody have any ideas how I can narrow down what's causing this? I'm really trying to avoid having to rollback to last year's version.
0
Comments
These slowdowns happen even when DebugMode is off. Turning on DebugMode simply shows what's going on.
I've seen this in DebugMode after a module has been running for ages. It is fixable, but you need to analyse case by case.
For example, I noticed in one module that all the sitting NPCs were overflowing. Turns out a script was issuing actions that never happened because sitting is indefinite.
In another case, all those playing Talk Forceful were glitched. This was fixed by cancelling the animation when the PC left the area, rebooting when they returned.
It has some fixes where it abort attempts at pathfinding early if the target destination isn’t achievable.
In almost all cases they seem to be simply moving from point to point, suggesting that it's somehow related to pathfinding, especially since the PC triggers these issues when clicking to move near obstacles. Whatever could be causing pathfinding to slow down to such an extent is beyond me right now.
I double-checked that I'm using the latest stable build and not the development build of the toolset. I do switch between stable and development but always build in stable. Also tried running the mod on another, more powerful machine and still encountered the same issue, so it's independent of the game version and hardware running it.
If there was any documentation on AI Update Time Overflows and what causes them, I could narrow this down further, but I can barely find a mention of this error in any official docs or forums.
This tells me two things:
1. Having just one single NPC experience an AI update time overflow is enough to slow down the entire game.
2. This is definitely related to pathfinding and the AI recursively and unsuccessfully searching for a path to a certain point.
If there was some way to detect an AI update time overflow in a script and clear the offending NPC's actions, this issue could probably be resolved. I still can't determine what is causing them in the first place and whether this is caused by code I wrote personally or some sort of conflict with the updated pathfinding system in custom tilesets.
Conversation clears all actions, so your finding suggests that the NPC is stuck for some reason, but continues to receive new actions until overflow occurs.
This can even happen with default WalkWaypoints. When AI level is low (no PCs in the area) the NPC is either stuck or moving very occasionally, but AI keeps adding actions to the queue. The fix in that case is to stop NPCs walking (or delete them) until a PC shows up.
If it's your script, maybe you overcome the NPC being stuck - for example, ForceMoveToObject or EffectCutsceneGhost - or else prevent your script from adding too many more actions prematurely.
I can easily imagine that walking might encounter unusual pathfinding issues during combat.
I tried absolutely everything. I rolled back to a previous version. I cleared the mod of custom walkwaypoints calls. I even created a branch where I tore out every heartbeat script and cleared the mod of any existing NPCs. Still got AI Update Time Overflow errors and horrible lockups.
Then, finally, the other day I tried testing the module without opening the Aurora Toolset. Lo and behold, not a single hiccup. 60fps all the way to the end.
It turns out that, for whatever reason, having the Aurora Toolset open when I test the module (and I almost always launch tests from the toolset) is causing all these overflow errors. This occurred across multiple machines and game versions. I have no idea how this happens or why it wasn't happening prior to this year, but it looks like all this time the module was completely fine and I could have had a new version out months ago