I submitted a new issue to Github, but I think there are even more root causes for crashes when other players die.
We're fixing them as they come!
For clarity, the mod hasn't become dramatically more unstable. Crashes from failed assertions are added by us to essentially stop the game once behavior that isn't supposed to happen takes place. This prevents the bugs from silently persisting for months or years.
This issue here for instance wouldn't have been caught at all if we hadn't added this.
Turns out this is an issue present for several versions (and that was very hard to catch) causing Diplomacy AI approach scores towards human players to become randomly corrupted, often with huge positive or negative numbers, leading to high aggression or passivity for no reason. Happy to have caught and fixed that.
Most of these checks are intended to prevent arrays in the Diplomacy AI from being accessed out of bounds (for example, a memory container is expanded to size MAX_MAJOR_CIVS (22) and it tries to access or set the value for player 35, a City-State). C++ does not crash by default when this happens and instead it causes the dreaded
undefined behavior.
Previously there were a lot of checks that would function like this, which were removed and replaced with assertions.
Code:
if (ePlayer < 0 || ePlayer >= MAX_MAJOR_CIVS) return 0;
These would prevent undefined behavior, but it would fail silently, and we wouldn't know that the code wasn't functioning as intended. Some of these assertion trigger crashes are easily fixed by for example, checking to see if ePlayer is a major civ before trying to set a value for them, but others are more difficult. I discovered an issue with the AI's evaluation of their biggest World Congress competitor where it would try to compare if a player had a worse voting score than NO_PLAYER, which necessitated rewriting the entire function to fix because I hadn't accounted for that originally. The new function is a lot tidier now that I'm more experienced at writing code.
There are other places in the DLL that lack these assertions. We fixed a lot of these issues during testing and are planning on fixing more of them in the future.