View Issue Details

IDProjectCategoryLast Update
0019315AI War 2Crash/ExceptionFeb 8, 2018 3:39 pm
ReporterBadgerBadger Assigned Tokeith.lamothe  
Severityminor 
Status resolvedResolutionfixed 
Product Version0.612 
Summary0019315: Crash in special forces
DescriptionI started a new game and captured a planet. After a few minutes I hit a crash:
12/20/2017 6:49:38 PM Successfully opened host socket
12/20/2017 6:51:12 PM Error in thread for execution context 'executionContext':System.NullReferenceException: Object reference not set to an instance of an object
  at Arcen.AIW2.External.IndependentAIFleetSubType.DoSingleBudgetLoopIteration (Arcen.AIW2.Core.Faction faction, Arcen.AIW2.Core.ArcenSimContext Context, FInt strength, Int32 BudgetAsInt) [0x00000] in <filename unknown>:0
  at Arcen.AIW2.External.BaseSpecialForces.DoBudgetLoop (Arcen.AIW2.Core.Faction faction, Arcen.AIW2.Core.ArcenSimContext Context) [0x00000] in <filename unknown>:0
  at Arcen.AIW2.External.IndependentAIFleetSubType.DoPerSecondLogic (Arcen.AIW2.Core.Faction faction, Arcen.AIW2.Core.ArcenSimContext Context) [0x00000] in <filename unknown>:0
  at Arcen.AIW2.External.SpecialFaction_AISpecialForces.DoPerSecondLogic (Arcen.AIW2.Core.Faction faction, Arcen.AIW2.Core.ArcenSimContext Context) [0x00000] in <filename unknown>:0
  at Arcen.AIW2.Core.Faction.DoFactionSecondLogic (Arcen.AIW2.Core.ArcenSimContext Context) [0x00031] in C:\vcprojs\arcengames_aiw_ultra\ArcenAIW2Core\src\Logic\GameState\Faction\Faction.cs:372
  at Arcen.AIW2.Core.World_AIW2+<DoWorldSecondLogic>c__AnonStorey2.<>m__0 (Arcen.AIW2.Core.Faction faction) [0x00008] in C:\vcprojs\arcengames_aiw_ultra\ArcenAIW2Core\src\Logic\GameState\World_AIW2.cs:453
  at Arcen.AIW2.Core.World_AIW2.DoForFactions (Arcen.AIW2.Core.ProcessorDelegate Processor) [0x00015] in C:\vcprojs\arcengames_aiw_ultra\ArcenAIW2Core\src\Logic\GameState\World_AIW2.cs:763
  at Arcen.AIW2.Core.World_AIW2.DoWorldSecondLogic (Arcen.AIW2.Core.ArcenSimContext Context) [0x00074] in C:\vcprojs\arcengames_aiw_ultra\ArcenAIW2Core\src\Logic\GameState\World_AIW2.cs:451
  at Arcen.AIW2.Core.World_AIW2.DoWorldStepLogic (Arcen.AIW2.Core.ArcenSimContext Context) [0x00076] in C:\vcprojs\arcengames_aiw_ultra\ArcenAIW2Core\src\Logic\GameState\World_AIW2.cs:226
  at Arcen.AIW2.Core.SimExecution.Execute () [0x00078] in C:\vcprojs\arcengames_aiw_ultra\ArcenAIW2Core\src\Logic\Sim\SimExecution\SimExecution.cs:35
12/20/2017 6:51:13 PM Error in thread for execution context 'executionContext':System.NullReferenceException: Object reference not set to an instance of an object
  at Arcen.AIW2.External.IndependentAIFleetSubType.DoSingleBudgetLoopIteration (Arcen.AIW2.Core.Faction faction, Arcen.AIW2.Core.ArcenSimContext Context, FInt strength, Int32 BudgetAsInt) [0x00000] in <filename unknown>:0
  at Arcen.AIW2.External.BaseSpecialForces.DoBudgetLoop (Arcen.AIW2.Core.Faction faction, Arcen.AIW2.Core.ArcenSimContext Context) [0x00000] in <filename unknown>:0
  at Arcen.AIW2.External.IndependentAIFleetSubType.DoPerSecondLogic (Arcen.AIW2.Core.Faction faction, Arcen.AIW2.Core.ArcenSimContext Context) [0x00000] in <filename unknown>:0
  at Arcen.AIW2.External.SpecialFaction_AISpecialForces.DoPerSecondLogic (Arcen.AIW2.Core.Faction faction, Arcen.AIW2.Core.ArcenSimContext Context) [0x00000] in <filename unknown>:0
  at Arcen.AIW2.Core.Faction.DoFactionSecondLogic (Arcen.AIW2.Core.ArcenSimContext Context) [0x00031] in C:\vcprojs\arcengames_aiw_ultra\ArcenAIW2Core\src\Logic\GameState\Faction\Faction.cs:372
  at Arcen.AIW2.Core.World_AIW2+<DoWorldSecondLogic>c__AnonStorey2.<>m__0 (Arcen.AIW2.Core.Faction faction) [0x00008] in C:\vcprojs\arcengames_aiw_ultra\ArcenAIW2Core\src\Logic\GameState\World_AIW2.cs:453
  at Arcen.AIW2.Core.World_AIW2.DoForFactions (Arcen.AIW2.Core.ProcessorDelegate Processor) [0x00015] in C:\vcprojs\arcengames_aiw_ultra\ArcenAIW2Core\src\Logic\GameState\World_AIW2.cs:763
  at Arcen.AIW2.Core.World_AIW2.DoWorldSecondLogic (Arcen.AIW2.Core.ArcenSimContext Context) [0x00074] in C:\vcprojs\arcengames_aiw_ultra\ArcenAIW2Core\src\Logic\GameState\World_AIW2.cs:451
  at Arcen.AIW2.Core.World_AIW2.DoWorldStepLogic (Arcen.AIW2.Core.ArcenSimContext Context) [0x00076] in C:\vcprojs\arcengames_aiw_ultra\ArcenAIW2Core\src\Logic\GameState\World_AIW2.cs:226
  at Arcen.AIW2.Core.SimExecution.Execute () [0x00078] in C:\vcprojs\arcengames_aiw_ultra\ArcenAIW2Core\src\Logic\Sim\SimExecution\SimExecution.cs:35

Once the errors started I continued to hit them once a second (which is what one would expect in the DoPerSecond Logic
TagsNo tags attached.

Activities

BadgerBadger

Dec 21, 2017 12:42 am

manager   ~0046632

I find it a bit confusing that AISpecialForces_Normal.cs involves calling code in HunterFleet_Normal.cs. I feel like the hierarchy from the files you have suggests that abstract classes go in HunterFleet.cs or AISpecialForces.cs, which are then implemented in AISpecialForces_XXXXX or HunterFleet_YYYY.cs. So it seems weird to have the abstract IndependentAIFleetSubType class defined in HunterFleet_Normal.cs.

My critique of your code organization aside, if the answer to this isn't immediately obvious I'll try to recreate the problem with more logging later.

BadgerBadger

Jan 3, 2018 10:22 am

manager   ~0046658

I'm very suspicious of the line
                    GameEntity entityToSpawnAt = this.unitsThatCanSpawnStandalones.PickRandomItemAndReplace( Context.QualityRandom );
                    GameEntity newEntity = GameEntity.CreateNew( entityToSpawnAt.Planet.GetPlanetFactionForFaction( faction ), typeToBuy, entityToSpawnAt.WorldLocation, Context );

I believe the issue is that after quitting and starting a new game sometimes entityToSpawnAt has a null Planet. If you stick the following debugging code in

                    ArcenDebugging.ArcenDebugLogSingleLine("Hunter budget: find entity to spawn at", Verbosity.DoNotShow );
                    GameEntity entityToSpawnAt = this.unitsThatCanSpawnStandalones.PickRandomItemAndReplace( Context.QualityRandom );
                    if(entityToSpawnAt == null)
                        ArcenDebugging.ArcenDebugLogSingleLine("BUG: hunterCode there's no unit that can spawn standalone", Verbosity.DoNotShow );
                    ArcenDebugging.ArcenDebugLogSingleLine("Hunter budget: call createNew", Verbosity.DoNotShow );
                    if(entityToSpawnAt.Planet == null)
                    {
                        ArcenDebugging.ArcenDebugLogSingleLine("Bug one", Verbosity.DoNotShow );
                        break;
                    }
                    if(entityToSpawnAt.Planet.GetPlanetFactionForFaction( faction ) == null)
                        ArcenDebugging.ArcenDebugLogSingleLine("Bug two", Verbosity.DoNotShow );
                    if(entityToSpawnAt.WorldLocation == null)
                        ArcenDebugging.ArcenDebugLogSingleLine("Bug three", Verbosity.DoNotShow );
                    GameEntity newEntity = GameEntity.CreateNew( entityToSpawnAt.Planet.GetPlanetFactionForFaction( faction ), typeToBuy, entityToSpawnAt.WorldLocation, Context );
                    if(newEntity == null)
                        ArcenDebugging.ArcenDebugLogSingleLine("BUG: hunterCode could not actually create new entity", Verbosity.DoNotShow );
                    ArcenDebugging.ArcenDebugLogSingleLine("Entity created", Verbosity.DoNotShow );

you'll eventually observe some error messages

BadgerBadger

Jan 9, 2018 9:15 am

manager   ~0046661

See also this crash report from the Steam beta build I got. I suspect it is the same problem

Error in thread for execution context 'executionContext'
Object reference not set to an instance of an object
===PSUEDO INFO===
Method DoSingleBudgetLoopIteration
Line 60
===STACK FRAMES (with file info)===
FILE METHOD IL_OFFSET NATIVE_OFFSET LINE_NUMBER COLUMN_NUMBER
        DoSingleBudgetLoopIteration 0 2329 0 0
        DoBudgetLoop 0 138 0 0
        DoPerSecondLogic 0 315 0 0
        DoPerSecondLogic 0 69 0 0
C:\vcprojs\arcengames_aiw_ultra\ArcenAIW2Core\src\Logic\GameState\Faction\Faction.cs DoFactionSecondLogic 49 192 360 0
C:\vcprojs\arcengames_aiw_ultra\ArcenAIW2Core\src\Logic\GameState\World_AIW2.cs <>m__0 8 42 453 0
C:\vcprojs\arcengames_aiw_ultra\ArcenAIW2Core\src\Logic\GameState\World_AIW2.cs DoForFactions 21 70 763 0
C:\vcprojs\arcengames_aiw_ultra\ArcenAIW2Core\src\Logic\GameState\World_AIW2.cs DoWorldSecondLogic 51 196 451 0
C:\vcprojs\arcengames_aiw_ultra\ArcenAIW2Core\src\Logic\GameState\World_AIW2.cs DoWorldStepLogic 118 529 226 0
C:\vcprojs\arcengames_aiw_ultra\ArcenAIW2Core\src\Logic\Sim\SimExecution\SimExecution.cs Execute 120 307 35 0
===RAW STACK TRACE===
  at Arcen.AIW2.External.IndependentAIFleetSubType.DoSingleBudgetLoopIteration (Arcen.AIW2.Core.Faction faction, Arcen.AIW2.Core.ArcenSimContext Context, FInt strength, Int32 BudgetAsInt) [0x00000] in <filename unknown>:0
  at Arcen.AIW2.External.BaseSpecialForces.DoBudgetLoop (Arcen.AIW2.Core.Faction faction, Arcen.AIW2.Core.ArcenSimContext Context) [0x00000] in <filename unknown>:0
  at Arcen.AIW2.External.IndependentAIFleetSubType.DoPerSecondLogic (Arcen.AIW2.Core.Faction faction, Arcen.AIW2.Core.ArcenSimContext Context) [0x00000] in <filename unknown>:0
  at Arcen.AIW2.External.SpecialFaction_AISpecialForces.DoPerSecondLogic (Arcen.AIW2.Core.Faction faction, Arcen.AIW2.Core.ArcenSimContext Context) [0x00000] in <filename unknown>:0
  at Arcen.AIW2.Core.Faction.DoFactionSecondLogic (Arcen.AIW2.Core.ArcenSimContext Context) [0x00031] in C:\vcprojs\arcengames_aiw_ultra\ArcenAIW2Core\src\Logic\GameState\Faction\Faction.cs:360
  at Arcen.AIW2.Core.World_AIW2+<DoWorldSecondLogic>c__AnonStorey2.<>m__0 (Arcen.AIW2.Core.Faction faction) [0x00008] in C:\vcprojs\arcengames_aiw_ultra\ArcenAIW2Core\src\Logic\GameState\World_AIW2.cs:453
  at Arcen.AIW2.Core.World_AIW2.DoForFactions (Arcen.AIW2.Core.ProcessorDelegate Processor) [0x00015] in C:\vcprojs\arcengames_aiw_ultra\ArcenAIW2Core\src\Logic\GameState\World_AIW2.cs:763
  at Arcen.AIW2.Core.World_AIW2.DoWorldSecondLogic (Arcen.AIW2.Core.ArcenSimContext Context) [0x00033] in C:\vcprojs\arcengames_aiw_ultra\ArcenAIW2Core\src\Logic\GameState\World_AIW2.cs:451
  at Arcen.AIW2.Core.World_AIW2.DoWorldStepLogic (Arcen.AIW2.Core.ArcenSimContext Context) [0x00076] in C:\vcprojs\arcengames_aiw_ultra\ArcenAIW2Core\src\Logic\GameState\World_AIW2.cs:226
  at Arcen.AIW2.Core.SimExecution.Execute () [0x00078] in C:\vcprojs\arcengames_aiw_ultra\ArcenAIW2Core\src\Logic\Sim\SimExecution\SimExecution.cs:35

BadgerBadger

Feb 1, 2018 9:40 am

manager   ~0046809

Last edited: Feb 1, 2018 9:41 am

I'm pretty sure this got fixed last release. I seem to recall Keith changing a bunch of that code

keith.lamothe

Feb 8, 2018 3:39 pm

administrator   ~0046932

Yep :)

Issue History

Date Modified Username Field Change
Dec 20, 2017 6:53 pm BadgerBadger New Issue
Dec 21, 2017 12:42 am BadgerBadger Note Added: 0046632
Jan 3, 2018 10:22 am BadgerBadger Note Added: 0046658
Jan 3, 2018 11:40 am BadgerBadger Assigned To => BadgerBadger
Jan 3, 2018 11:40 am BadgerBadger Status new => assigned
Jan 3, 2018 11:40 am BadgerBadger Assigned To BadgerBadger => keith.lamothe
Jan 9, 2018 9:15 am BadgerBadger Note Added: 0046661
Feb 1, 2018 9:40 am BadgerBadger Note Added: 0046809
Feb 1, 2018 9:41 am BadgerBadger Note Edited: 0046809
Feb 8, 2018 3:39 pm keith.lamothe Status assigned => resolved
Feb 8, 2018 3:39 pm keith.lamothe Resolution open => fixed
Feb 8, 2018 3:39 pm keith.lamothe Note Added: 0046932