[RESOLVED] Two Server Crashes - Seeking Root Cause
#38
Thanks to AusGre's help yesterday, last night I was able to (pretty much) consistently repro the server lock-up issue on the development machine as well. I'm still not 100% sure the exact cause of the issue, but after spending quite a few more hours late last night and into today on this, I believe that I have been able to stop this from happening.

Essentially, what was happening is: Creatures all send silent shouts/commands to nearby allies to attack their target, or that they spotted an enemy, etc. It's one of the primary ways the AI in NWN (and Thay) has been setup to work. When fighting a number of creatures at one time, these creatures end up processing dozens of commands from their allies at almost the exact same time. So the creature conversation script (nw_c2_default4) is being called dozens upon dozens of times within milliseconds when there is a mob of creatures in battle against a PC(s). The part I'm still not 100% sure on is why bleeding would seem to exacerbate the problem; but it usually took about 4+ times of bleeding, then stabilizing, in relatively short order for the lockup to occur. It would occur, for a reason I have not figured out, when the multiple-time-bleeding PC was about ready to stabilize again and at the point where the creatures would send commands to allies to follow them or attack, processing these dozens of commands would lock up the server.

To resolve the problem, at least via my testing on the development server, I have limited how often these commands get processed to once per second. So if a creature gets a command it is marked on them for one second and if they receive another one, the processing of the command simply stops. This may actually help with lag issues too as there will be many fewer NPC command calls during battles. Time will tell if this works, although I am hopeful it will.

I guess if nothing else this problem has resulted in what should be a more efficient death and dying system, and some long-term 'wishes' have occurred because of it - I reduced the main death script from about 3890 lines of code to 850, on your side your containers will now not empty of items when they are moved from the corpse of the PC to the PC backpack (like upon returning from the Fugue yourself), and when subdued in situations like where a guard or legionnaire gets mad at your for an assassination attempt or otherwise attacking a commoner, the subdual should also reset all faction status' to their default settings for you.


Messages In This Thread
RE: Two Server Crashes - Seeking Root Cause - by Balanor - 04-26-2015, 04:19 PM

Forum Jump:


Users browsing this thread: 20 Guest(s)