View Issue Details

IDProjectCategoryLast Update
0023237AI War 2Crash/ExceptionJun 30, 2020 6:41 pm
ReporterGreatYng Assigned ToChris_McElligottPark  
Severityminor 
Status resolvedResolutionfixed 
Product Version2.048 Bugfixes 
Fixed in VersionBeta 2.088 Banishment of Undead AIs 
Summary0023237: Exception in ReactToPowerLevel
DescriptionSo I discovered this error had flooded the ArcenDebugLog (I attached a copy), there are literally thousands of entries related to this error.
I wasn't playing at my best and lost power for about 15 minutes. I was amused by the lack of response from the AIs to this issue, but didn't think to much of it.
There were no in-game announcements of this error.
Interestingly, the exception continues to be listed long after I fixed the power issues, because I got back into positive power before killing the last AI.
Entry 10412 of the log lists my victory, but the brownout had been fixed at least 30-ish minutes earlier (possibly more) and yet the exceptions is still listed up until this point. I don't think it stopped listing the error until I quit that particular game.
TagsNo tags attached.

Activities

GreatYng

May 30, 2020 2:56 pm

reporter  

ArcenDebugLog.txt (1,783,652 bytes)

BadgerBadger

May 30, 2020 3:28 pm

manager   ~0057147

I've added some debugging code for this; any chance you have a save game in there?

GreatYng

May 30, 2020 7:10 pm

reporter   ~0057151

As a matter of fact I completely forgot to make a save; on one hand I didn't know of the error back then, and on the other hand I was too fascinated by watching a stack of 500 Sentinel Gunboats destroy the Zenith Power Generator but leave the Fleet Extender and focus on the dormant Spire City instead. Yeah, not my best moment.

Good news though: I checked my save files and while I can't replicate the error in some of the earlier ones, I can replicate it in at least one of the later ones. If you need more saves I could try checking again tomorrow, but it will be the same campaign.
Just deleting some Spire Shard Reactors and a command station did the trick (maybe even just getting a brownout in any way will do) and got the error to show up in the log again.
Einde 5.save (2,753,979 bytes)

BadgerBadger

Jun 27, 2020 3:31 pm

manager   ~0057448

It took a couple save/loads, but I think the error you are hitting is
                      GameEntity_Squad king = BadgerFactionUtilityMethods.findKing(faction);
                      if ( king == null )
                      {
                          ArcenDebugging.ArcenDebugLogSingleLine("BUG: could not find king for " + faction.GetDisplayName() + " " + faction.FactionIndex, Verbosity.DoNotShow );
                          spawningFaction = king.PlanetFaction.Faction; <==== this line seems to be a mistake
                      }

We check earlier whether the AI is defeated thusly:
                  if ( faction.FactionIsDefeated )
                    return; //if the faction is defeated, no more extragalactic war units

So I don't know how the AI can not have a king while also being undefeated.

The findKing function is in UtilityMethods:
        public static GameEntity_Squad findKing(Faction faction = null)
        {
            GameEntity_Squad king = null;
            if ( !World_AIW2.Instance.HasEverBeenUnpaused )
                return king;
            World_AIW2.Instance.DoForEntities( EntityRollupType.KingUnitsOnly, delegate ( GameEntity_Squad entity )
            {
                if ( faction != null )
                {
                    //if an optional Faction is passed in, return the king of that faction
                    if ( entity.PlanetFaction.Faction != faction )
                        return DelReturn.Continue;
                }
                king = entity;
                return DelReturn.Continue;
            } );
            return king;
        }

Chris_McElligottPark

Jun 30, 2020 6:02 pm

administrator   ~0057472

Thank you for the catch! This is nothing to do with energy, this was simply an oversight on our part in multi-AI games when one of the AIs is dead. That's all that was happening in this case, and it should not be logging errors about that.

* Fixed a place where the game was spamming some errors if you were playing with the fallen spire on, multiple AIs, and one of the AIs was dead. It was acting like the death of one AI king was a bug in data, when in reality that is a very reasonable thing to have happen. The dead AI is unable to launch extragalactic forces, now (it already was, but it was spamming your error log hard during that previously).

BadgerBadger

Jun 30, 2020 6:07 pm

manager   ~0057473

Last edited: Jun 30, 2020 6:09 pm

I'm really confused though; if the faction has no king then we should have bailed out earlier:

                   if ( faction.FactionIsDefeated )
                    return; //if the faction is defeated, no more extragalactic war units

Each AI faction runs this independently. So if this faction's king is dead then it should have flagged that the faction is defeated. If this faction's king is not dead then we shouldn't hit this error

Chris_McElligottPark

Jun 30, 2020 6:41 pm

administrator   ~0057475

Thanks for the save that somehow had an AI faction that did not know it was dead!

* It turns out there were some sort of edge cases where the AI king could be dead but its faction would not have gone through the "we have lost" logic. We don't yet know how that could possibly be possible, but we now have a safety check from then on in the future that makes sure that even if the kings death was somehow missed when it happens, it now recognizes that it happened in the next few seconds and will mark the faction as defeated.
** This lets you actually win the game in events where that was going on, and properly turns that AI against the other AIs if that's the setting that is on, etc.

Issue History

Date Modified Username Field Change
May 30, 2020 2:56 pm GreatYng New Issue
May 30, 2020 2:56 pm GreatYng File Added: ArcenDebugLog.txt
May 30, 2020 3:28 pm BadgerBadger Note Added: 0057147
May 30, 2020 7:10 pm GreatYng File Added: Einde 5.save
May 30, 2020 7:10 pm GreatYng Note Added: 0057151
Jun 27, 2020 11:05 am Chris_McElligottPark Assigned To => Chris_McElligottPark
Jun 27, 2020 11:05 am Chris_McElligottPark Status new => assigned
Jun 27, 2020 3:31 pm BadgerBadger Note Added: 0057448
Jun 30, 2020 6:02 pm Chris_McElligottPark Status assigned => resolved
Jun 30, 2020 6:02 pm Chris_McElligottPark Resolution open => fixed
Jun 30, 2020 6:02 pm Chris_McElligottPark Fixed in Version => Beta 2.088 Banishment of Undead AIs
Jun 30, 2020 6:02 pm Chris_McElligottPark Note Added: 0057472
Jun 30, 2020 6:07 pm BadgerBadger Note Added: 0057473
Jun 30, 2020 6:09 pm BadgerBadger Note Edited: 0057473
Jun 30, 2020 6:41 pm Chris_McElligottPark Note Added: 0057475