View Issue Details

IDProjectCategoryLast Update
0026664AI War 2Bug - GameplayMar 9, 2022 10:49 am
Reporterhenry700 Assigned ToChris_McElligottPark  
Severitymajor 
Status resolvedResolutionfixed 
Product Version4.002 Macrophage Live! 
Fixed in Version4.003 A Bit Too Chromatic Horrifying 
Summary0026664: ChooseWaveTarget exception for every wave
DescriptionRelevant part from logs:

3/9/2022 12:14:51 AM 4.002 SINGLEP DELAYED40 TID32 ChooseWaveTarget exception at debugStage 3200, Exception: System.NullReferenceException: Object reference not set to an instance of an object
  at Arcen.Universal.DrawBag`1[T].GetIndexOfItem (T Item) [0x00020] in <840a78b1269f4ce59e1c34693ecb56d9>:0
  at Arcen.Universal.DrawBag`1[T].AddItem (T Item, System.Int32 Count) [0x0001f] in <840a78b1269f4ce59e1c34693ecb56d9>:0
  at Arcen.AIW2.External.WavesHelper.GetWaveComposition (Arcen.Universal.Dictionary`2[TKey,TValue] DictToFill, Arcen.AIW2.Core.Faction faction, Arcen.AIW2.Core.ArcenHostOnlySimContext Context, System.Int32 budget, System.Int32& budgetSpent, System.Int32 numDifferentShipsToSpawn, System.Int32 maxGuardianTypes, Arcen.AIW2.External.PlannedWaveOptions Options, Arcen.AIW2.Core.Planet planetToUseForSpawningTypes, System.Boolean tracing, Arcen.Universal.ArcenCharacterBuffer tracingBuffer, Arcen.AIW2.Core.GameEntityTypeData mustIncludeOneOf) [0x00310] in <75d536c604b04641852191e40f05f82b>:0
  at Arcen.AIW2.External.AISentinelsFactionBaseInfo.Helper_GetWaveCompositionWrapper (Arcen.AIW2.Core.ArcenHostOnlySimContext Context, System.Int32 budget, Arcen.AIW2.External.PlannedWaveOptions Options, Arcen.AIW2.Core.Planet planetWeAreTryingToSpawnFrom, System.Boolean tracing, Arcen.Universal.ArcenCharacterBuffer tracingBuffer) [0x00206] in <75d536c604b04641852191e40f05f82b>:0
  at Arcen.AIW2.External.AISentinelsFactionBaseInfo+<>c__DisplayClass4_1.<ChooseWaveTarget>b__0 (Arcen.AIW2.Core.GameEntity_Squad entity) [0x000fe] in <75d536c604b04641852191e40f05f82b>:0
  at Arcen.AIW2.Core.EntityCollection.DoForEntities (Arcen.AIW2.Core.EntityRollupType Rollup, Arcen.AIW2.Core.GameEntity_Squad+ProcessorDelegate Processor) [0x00068] in <72c5c87e2a7e4f629085b0e967b53d8a>:0
  at Arcen.AIW2.Core.Faction.DoForEntities (Arcen.AIW2.Core.EntityRollupType Rollup, Arcen.AIW2.Core.GameEntity_Squad+ProcessorDelegate Processor) [0x00033] in <72c5c87e2a7e4f629085b0e967b53d8a>:0
  at Arcen.AIW2.External.AISentinelsFactionBaseInfo.ChooseWaveTarget (Arcen.AIW2.Core.ArcenHostOnlySimContext Context, System.Int32 budget, Arcen.AIW2.External.PlannedWaveOptions Options) [0x00173] in <75d536c604b04641852191e40f05f82b>:0
3/9/2022 12:15:01 AM 4.002 SINGLEP DELAYED41 TID13 Memory not cleaned up properly at RapidAntiLeakPoolable 'WavesHelper-GetWaveComposition-workingUnitsToSpawn' of type Arcen.Universal.DrawBag`1[Arcen.AIW2.Core.GameEntityTypeData]
3/9/2022 12:15:01 AM 4.002 SINGLEP DELAYED42 TID13 Memory not cleaned up properly at RapidAntiLeakPoolable 'WavesHelper-GetWaveComposition-workingBag' of type Arcen.Universal.DrawBag`1[Arcen.AIW2.Core.GameEntityTypeData]
TagsNo tags attached.

Activities

henry700

Mar 8, 2022 10:19 pm

reporter  

Ironman Save at 30m 0s.savemet (79 bytes)   
UK
46759563
1800
Aurora
Adaptive
Difficulty 8
1
<color=#318ce7>henry700</color>

BadgerBadger

Mar 9, 2022 12:44 am

manager   ~0065279

I've added some debugging code but don't have time for further investigation

Chris_McElligottPark

Mar 9, 2022 10:49 am

administrator   ~0065293

Thanks!

* Added a new ThrowawayDrawBagCanMemLeak data type, and this internally uses our existing ThrowawayListCanMemLeak type (which is mostly used in mapgen until now).
** These are used for very short periods of time, and are meant to be thrown to the garbage collector. I had wanted to avoid this sort of thing, but we've been having persistent intermittent issues with cross-threading issues on certain worker methods (like for wave spawn), and the RapidAntiLeakPoolable approach that I had developed is just not robust enough. I also worry about that contention on that leading to slowdown in larger games.
** I am going to build out some more of these kinds of throwaway collections and probably will phase out a lot of the RapidAntiLeakPoolable thing since it seems to only be causing problems.
** There is also a new interface called IDrawBag<T>, which can be used to manipulate either kind of draw bag without knowing or caring which kind it is.
*** I actually am not yet using that on any methods, because on the methods where it would be relevant, I actually want to signal that only a throwaway draw bag should be used, because the sorts of manipulations that are being done in those methods are not for permanent data.
** As an aside, this should not be taken as a signal by modders/developers to just use the throwaway collections willy-nilly. There are many better code patterns, such as not using a collection at all and instead using an iterator/dofor, which have the benefit of both performance and better memory usage, while still having the same amount of readability.
*** This is essentially something that should be used in place of places where we were using RapidAntiLeakPoolable stuff before, because that had its own performance implications and occasional cross-threading issues. If you can refactor slightly to avoid the need for any of this, and just use an iterator, then so much the better.

Issue History

Date Modified Username Field Change
Mar 8, 2022 10:19 pm henry700 New Issue
Mar 8, 2022 10:19 pm henry700 File Added: Ironman Save at 30m 0s.save
Mar 8, 2022 10:19 pm henry700 File Added: Ironman Save at 30m 0s.savemet
Mar 9, 2022 12:44 am BadgerBadger Note Added: 0065279
Mar 9, 2022 10:49 am Chris_McElligottPark Assigned To => Chris_McElligottPark
Mar 9, 2022 10:49 am Chris_McElligottPark Status new => resolved
Mar 9, 2022 10:49 am Chris_McElligottPark Resolution open => fixed
Mar 9, 2022 10:49 am Chris_McElligottPark Fixed in Version => 4.003 A Bit Too Chromatic Horrifying
Mar 9, 2022 10:49 am Chris_McElligottPark Note Added: 0065293