View Issue Details

IDProjectCategoryLast Update
0023109AI War 2Crash/ExceptionApr 6, 2020 9:26 pm
ReporterBadgerBadger Assigned ToChris_McElligottPark  
Status resolvedResolutionfixed 
Product Version2.017 GOG Achievements 
Fixed in Version2.018 Hotfix 
Summary0023109: Exception: Can't get planet faction for faction after game load
DescriptionI have tried to load a couple save games; each game I load I hit
Error occurred in sim planning context executionContext
ArgumentOutOfRangeException
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
===STACK FRAMES (with file info)===
FILE METHOD IL_OFFSET NATIVE_OFFSET LINE_NUMBER COLUMN_NUMBER
    ThrowArgumentOutOfRangeException 41 75 0 0
    ThrowArgumentOutOfRangeException 0 19 0 0
    GetPlanetFactionForFaction 60 135 0 0
    Update 50 247 0 0
    UpdateDataForPlanning 106 555 0 0
    Execute 292 643 0 0
    InnerRun 84 195 0 0
===RAW STACK TRACE===
  at System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) [0x00029] in <1f0c1ef1ad524c38bbc5536809c46b48>:0
  at System.ThrowHelper.ThrowArgumentOutOfRangeException () [0x00000] in <1f0c1ef1ad524c38bbc5536809c46b48>:0
  at Arcen.AIW2.Core.Planet.GetPlanetFactionForFaction (Arcen.AIW2.Core.Faction Faction) [0x0003c] in <087da7cd3f594bdc85fe96bc3db57964>:0
  at Arcen.AIW2.Core.LongRangePlanningData_Planet.Update (Arcen.AIW2.Core.Planet Planet) [0x00032] in <087da7cd3f594bdc85fe96bc3db57964>:0
  at Arcen.AIW2.External.ArcenLongTermIntermittentPlanningContext.UpdateDataForPlanning () [0x0006a] in <b32105353cea4fc7bc08bc3879b8e8da>:0
  at Arcen.AIW2.External.SimExecution.Execute () [0x00124] in <b32105353cea4fc7bc08bc3879b8e8da>:0
  at Arcen.AIW2.External.ArcenSimPlanningContext.InnerRun () [0x00054] in <b32105353cea4fc7bc08bc3879b8e8da>:0

  at System.Environment.get_StackTrace () [0x00000] in <1f0c1ef1ad524c38bbc5536809c46b48>:0
  at Arcen.Universal.ArcenDebugging.ArcenDebugLog (System.String Message, Arcen.Universal.DebugLogDestination Destination, System.Boolean IncludeStackTrace, Arcen.Universal.Verbosity Verbosity) [0x00000] in <a46bf594d95147fca13792eb57390f5b>:0
  at Arcen.Universal.ArcenDebugging.ArcenDebugLog (System.String Message, Arcen.Universal.DebugLogDestination Destination, Arcen.Universal.Verbosity Verbosity) [0x00000] in <a46bf594d95147fca13792eb57390f5b>:0
  at Arcen.Universal.ArcenDebugging.ArcenDebugLog (System.String Message, Arcen.Universal.Verbosity Verbosity) [0x00000] in <a46bf594d95147fca13792eb57390f5b>:0
  at Arcen.Universal.ArcenDebugging.LogException (System.Exception e, System.String message, Arcen.Universal.Verbosity verbosity) [0x00000] in <a46bf594d95147fca13792eb57390f5b>:0
  at Arcen.AIW2.External.ArcenSimPlanningContext.InnerRun () [0x00000] in <b32105353cea4fc7bc08bc3879b8e8da>:0
  at Arcen.AIW2.External.ArcenExecutionContext.InnerRun () [0x00000] in <b32105353cea4fc7bc08bc3879b8e8da>:0
  at Arcen.AIW2.External.ArcenThread.InternalActualThreadFunction () [0x00000] in <b32105353cea4fc7bc08bc3879b8e8da>:0
  at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00000] in <1f0c1ef1ad524c38bbc5536809c46b48>:0
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <1f0c1ef1ad524c38bbc5536809c46b48>:0
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <1f0c1ef1ad524c38bbc5536809c46b48>:0
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x00000] in <1f0c1ef1ad524c38bbc5536809c46b48>:0
TagsNo tags attached.

Activities

BadgerBadger

Apr 6, 2020 7:48 pm

manager   ~0056711

Last edited: Apr 6, 2020 8:08 pm

I tossed some debug text in, and it's related to the AI Reserves being added to the game.
        public PlanetFaction GetPlanetFactionForFaction( Faction Faction )
        {
            if ( Faction == null || this.Factions.Count < Faction.FactionIndex)
                return null;
            if ( Faction.FactionIndex >= this.Factions.Count )
                ArcenDebugging.ArcenDebugLogSingleLine("Tried to get PlanetFaction for " + Faction.ToString() + " but there was no instance of this in the planet", Verbosity.DoNotShow );
            return this.Factions[Faction.FactionIndex];
        }

and the output of this code:
4/6/2020 5:47:54 PM Tried to get PlanetFaction for AIReserves index 19 but there was no instance of this in the planet

It looks like this planet's faction list doesn't include the AI Reserves.

This happens whenever I load a save (but not when I start a new game), and prevents the game from being played

Chris_McElligottPark

Apr 6, 2020 9:02 pm

administrator   ~0056712

I'll get it -- thanks for that.

Chris_McElligottPark

Apr 6, 2020 9:26 pm

administrator   ~0056714

Thanks!

* Fix to a bug that was causing some-but-not-all savegames to fail to load in the previous version of the game. Mainly saves that were games started in 2.016 that were being loaded in 2.017. This was to do with fixing the AI reserves missing. Turns out those should not be added in mid-save. Now that no longer happens, but in the other cases where AI reserves were missing, it adds them properly.

* Also added in a helpful method on the World_AIW2 singleton object which lets us just quickly write all the factions (invisible and otherwise) to the log.

Issue History

Date Modified Username Field Change
Apr 6, 2020 7:46 pm BadgerBadger New Issue
Apr 6, 2020 7:46 pm BadgerBadger Status new => assigned
Apr 6, 2020 7:46 pm BadgerBadger Assigned To => Chris_McElligottPark
Apr 6, 2020 7:48 pm BadgerBadger Note Added: 0056711
Apr 6, 2020 7:50 pm BadgerBadger Note Edited: 0056711
Apr 6, 2020 8:08 pm BadgerBadger Note Edited: 0056711
Apr 6, 2020 9:02 pm Chris_McElligottPark Note Added: 0056712
Apr 6, 2020 9:26 pm Chris_McElligottPark Status assigned => resolved
Apr 6, 2020 9:26 pm Chris_McElligottPark Resolution open => fixed
Apr 6, 2020 9:26 pm Chris_McElligottPark Fixed in Version => 2.018 Hotfix
Apr 6, 2020 9:26 pm Chris_McElligottPark Note Added: 0056714