View Issue Details

IDProjectCategoryLast Update
0026131AI War 2Bug - GameplayJan 24, 2022 5:40 pm
ReporterZeusAlmighty Assigned ToChris_McElligottPark  
Status resolvedResolutionfixed 
Product VersionBeta 3.786 A Very Intense Patch 
Fixed in VersionBeta 3.786 A Very Intense Patch 
Summary0026131: Bug report -- Sapper triggering error report
DescriptionSapper triggered some sort of error
TagsNo tags attached.

Activities

ZeusAlmighty

Jan 16, 2022 5:24 pm

manager  

Sapper bug.save (381,428 bytes)
ArcenDebugLog.txt (346,503 bytes)

BadgerBadger

Jan 16, 2022 5:47 pm

manager   ~0063815

This is a very funky problem.
1/16/2022 2:20:54 PM 3.785 SINGLEP DELAYED21 TID5 Hit exception in ProcessSappers debugCode 400 System.Exception: Unknown sapper destination Topaz Blaster 0019593 Anti-Player Zombie on Akari was reached but the code did not know how to handle it.
  at Arcen.AIW2.External.SappersFactionDeepInfo.CollectResourcesFromDestinationIfPossible (Arcen.AIW2.Core.GameEntity_Squad sapper, Arcen.AIW2.External.SappersPerUnitBaseInfo data, Arcen.AIW2.Core.ArcenHostOnlySimContext Context) [0x00258] in <67cbedc4a68642e0b614aa013a037cc2>:0
  at Arcen.AIW2.External.SappersFactionDeepInfo+<>c__DisplayClass10_1.<ProcessSappers>b__0 (Arcen.AIW2.Core.GameEntity_Squad sapper) [0x00244] in <67cbedc4a68642e0b614aa013a037cc2>:0
  at Arcen.Universal.DoubleBufferedConcurrentList`1[ItemType].Display_DoFor (Arcen.Universal.DoubleBufferedConcurrentListProcessor`1[ItemType] Processor) [0x0002c] in <3637db2066ca4766aaac882c23fd375d>:0
  at Arcen.AIW2.External.SappersFactionDeepInfo.ProcessSappers (Arcen.AIW2.Core.ArcenHostOnlySimContext Context, Arcen.AIW2.External.PerFactionPathCache PathCacheData) [0x0009f] in <67cbedc4a68642e0b614aa013a037cc2>:0

Here's what happened: A sapper figured out it wanted to go to some particular destination to collect resources. It keeps the primary key of its Destination in its PerUnitData, which is then translated into the actual unit here in Sappers FactionDeepInfo
        private void UpdateNonSerializedFields( GameEntity_Squad sapper, SappersPerUnitBaseInfo data )
        {
            if ( data.DestinationId != -1 && data.Destination == null )
                data.Destination = World_AIW2.Instance.GetEntityByID_Squad( data.DestinationId );

Unfortunately, the game believes this entity is not a suitable unit type (Sappers go to things like Crystals, not combat units like blasters), and it also belongs to the wrong faction. I'm not sure how this can happen? Perhaps we reused the GameEntity_Squad in question?

I'm wondering if it might be related to bugs like 0026119?
I'm going to add some more defensive code in any case, but chris might want to take a look as well

BadgerBadger

Jan 16, 2022 5:51 pm

manager   ~0063816

I hypothesize that the game reused the same GameEntity_Squad after a few minutes as this zombie, so I've put in an explicit check for "Was this unit destroyed? If so, discard this as a Destination".
I'm assigning this to chris to review just in case he thinks something else might be going on

Chris_McElligottPark

Jan 24, 2022 5:28 pm

administrator   ~0063878

This is one reason to use lazy load squad wrappers, actually. They have a GetSquad() method on them that returns null if the entity is dead, or if the entity's new PKID is not the same as the PKID of what it was when it was set in there.

Chris_McElligottPark

Jan 24, 2022 5:40 pm

administrator   ~0063879

Okay, I think this should fix it unless something truly odd is going on:

* Adjusted the destination on the sappers to use the lazy load wrapper, which gives it protection against various things like its identity changing partway through execution.
** The old cost was only semi-protected against this, because it had a separate entry for the ID and the actual object reference. The ID reference was protected, but the object reference would have to be reconciled with that, which is very hard to do properly. The lazy load squad wrapper automates all that, with very few lines of code and also without having to really think about it much.
*** The short version is that when the ID in the wrapper no longer matches the ID of the unit it is caching, then it stops returning the cached unit and just returns null instead. This is very powerful, and does not take a lot of extra code to do, so lazy load squad wrappers should be preferred versus a pair of ID/object variables.

Issue History

Date Modified Username Field Change
Jan 16, 2022 5:24 pm ZeusAlmighty New Issue
Jan 16, 2022 5:24 pm ZeusAlmighty Status new => assigned
Jan 16, 2022 5:24 pm ZeusAlmighty Assigned To => BadgerBadger
Jan 16, 2022 5:24 pm ZeusAlmighty File Added: Sapper bug.save
Jan 16, 2022 5:24 pm ZeusAlmighty File Added: ArcenDebugLog.txt
Jan 16, 2022 5:47 pm BadgerBadger Note Added: 0063815
Jan 16, 2022 5:49 pm BadgerBadger Assigned To BadgerBadger => Chris_McElligottPark
Jan 16, 2022 5:51 pm BadgerBadger Note Added: 0063816
Jan 24, 2022 5:28 pm Chris_McElligottPark Note Added: 0063878
Jan 24, 2022 5:40 pm Chris_McElligottPark Status assigned => resolved
Jan 24, 2022 5:40 pm Chris_McElligottPark Resolution open => fixed
Jan 24, 2022 5:40 pm Chris_McElligottPark Fixed in Version => Beta 3.786 A Very Intense Patch
Jan 24, 2022 5:40 pm Chris_McElligottPark Note Added: 0063879