View Issue Details

IDProjectCategoryLast Update
0019604AI War 2Bug - GameplayJun 29, 2018 10:05 am
ReporterOvalcircle Assigned Tokeith.lamothe  
Status resolvedResolutionfixed 
Product Version0.721-0.722 Down The Wormhole 
Fixed in Version0.746 Disposing of the Invisible Man 
Summary0019604: Partitioning bug for AOE weapons allows AOE to hit multiple planets
DescriptionPlay a game with Dyson Sphere and Nanocaust. (Not sure if intensity at 10 affects anything). Anyway, start the game and pause immediately. Scout all, go to Dyson planet, and watch as Nanocaust ships spawn from the AI guardian that comes under fire from the Dyson Guardian. Note: This is not 100% reproducible. You may have to set up everything a few times before this happens.
TagsNo tags attached.

Relationships

related to 0019591 resolvedBadgerBadger Nanocaust ship(s) appearing on another planet randomly 
has duplicate 0019592 resolvedBadgerBadger Bomber is now allied with Devourer Golem 

Activities

Ovalcircle

Apr 25, 2018 12:06 am

reporter  

Dyson Nano Bug (1).jpg (159,892 bytes)   
Dyson Nano Bug (1).jpg (159,892 bytes)   
Dyson Nano Bug (2).jpg (99,978 bytes)   
Dyson Nano Bug (2).jpg (99,978 bytes)   
Dyson Nano Bug (3).jpg (146,857 bytes)   
Dyson Nano Bug (3).jpg (146,857 bytes)   
Dyson nano bug game 2.jpg (161,256 bytes)   
Dyson nano bug game 2.jpg (161,256 bytes)   
nano appearance.save (2,020,718 bytes)

BadgerBadger

Apr 25, 2018 8:52 am

manager   ~0047452

The nanocaust uses zombifying weapons, so ordinarily having the nanocaust turn ships it kills into nanocaust ships is expected. Having the Dyson sphere turning AI ships into Nanocaust ships is apt to be a great source of confusion for the Dyson Sphere....

BadgerBadger

Apr 25, 2018 11:28 am

manager   ~0047453

Last edited: Apr 25, 2018 12:28 pm

I added some logging to DoOnDeathEffect in GameEntity.cs
                    Faction killingFaction = FiringSystemOrNull == null ? null : FiringSystemOrNull.ParentEntity.PlanetFaction.Faction;
                    if ( this.DeathEffectDamageLastDoneByFactionIndex.GetHasKey( pair.Key ) )
                        factionIndex = this.DeathEffectDamageLastDoneByFactionIndex[pair.Key];
                    Faction responsibleFaction = World_AIW2.Instance.GetFactionByIndex( factionIndex );
                    if(killingFaction != null)
                        ArcenDebugging.ArcenDebugLogSingleLine("DoOnAnyDeathInCombat: Firing system " +FiringSystemOrNull.ParentEntity.TypeData.InternalName + " on " + FiringSystemOrNull.ParentEntity.Planet.Name + " killing " +this.TypeData.InternalName + " on " + this.Planet.Name + " value: " +pair.Value + " scale \
" + pair.Key.Scale , Verbosity.DoNotShow );
                    pair.Key.Implementation.HandleDeathWithEffectApplied( this, pair.Value, killingFaction, responsibleFaction, Context );

I see
4/25/2018 11:19:12 AM DoOnAnyDeathInCombat: Firing system Abomination on DeMarco killing Bomber_Mark4 on DeMarco value: 359760 scale 10000
4/25/2018 11:19:12 AM DoOnAnyDeathInCombat: Firing system Aberration on DeMarco killing Bomber_Mark4 on DeMarco value: 373356 scale 10000
4/25/2018 11:19:12 AM DoOnAnyDeathInCombat: Firing system Aberration on DeMarco killing StealthGuardian_Mark3 on Sassenrath value: 12444 scale 10000 <==== it looks like a ship on one planet just killed a ship on another planet. I don't think this should be possible.

Also it looks like this is happening only with AOE damage.

Unfortunately Keith is (rightly) busy doing other things right now. If I get the chance I'll keep poking at this though.

When I load this save game and let it run for 10 or 20 seconds, I see this issue.

a.save (2,144,811 bytes)

Chris_McElligottPark

Apr 25, 2018 11:56 am

administrator   ~0047454

It looks like some system from the abomination is firing on some other ship. I wonder if that's somehow linked inappropriately to another ship, or if we have invisible nanocaust actually attacking the Dyson here?

BadgerBadger

Apr 25, 2018 12:16 pm

manager   ~0047461

Last edited: Apr 25, 2018 12:50 pm

(Edited to improve logging) This is 100% a bug in the spatial partitioning Sim code. The "Find possible targets for AOE weapon hit" code allows an AOE effect to target ships not on this planet.

Proof: I added some logging code to CheckForAOEDetonation:
        public void CheckForAOEDetonation( ArcenSimContext Context )
        {
            int aoe = this.GetMyAreaOfEffect();
            if ( aoe > 0 ) <==== so this is an aoe weapon that hits everything in radius aoe
            {
.....
                                                                                                                                                                                                                                                                                                                              
                List<GameEntity> entities = this.Planet.PartitionedSpace.FillListWithDistinctEntitiesActuallyOverlappingCircle( Context, GameEntityCategory.Ship, this.WorldLocation, aoe ); <==== this is a list of every ship in the blast radius for this shot
....
                for ( int i = 0; i < entities.Count; i++ )
                {
                    GameEntity entity = entities[i];
                                        ArcenDebugging.ArcenDebugLogSingleLine("CheckForAOEDetonation blast radius weapon " + this.TypeData.InternalName + " " + this.PrimaryKeyID + " on " + this.Planet.Name + ": considering " + entity.TypeData.InternalName + " " + entity.PrimaryKeyID + " on " + entity.Planet.Name + " as a potential hit target", Verbosity.DoNotShow );
......

Now I see
4/25/2018 12:48:55 PM CheckForAOEDetonation blast radius weapon PlasmaTorpedoAOEBurstAtEnd 8382 on Sassenrath: considering Bomber_Mark4 8416 on DeMarco as a potential hit target
4/25/2018 12:48:55 PM CheckForAOEDetonation blast radius weapon PlasmaTorpedoAOEBurstAtEnd 8382 on Sassenrath: considering Bomber_Mark4 8838 on DeMarco as a potential hit target
.... <=== more ships on DeMarco
4/25/2018 12:48:55 PM CheckForAOEDetonation blast radius weapon PlasmaTorpedoAOEBurstAtEnd 8382 on Sassenrath: considering Aberration 8397 on DeMarco as a potential hit target
4/25/2018 12:48:55 PM CheckForAOEDetonation blast radius weapon PlasmaTorpedoAOEBurstAtEnd 8382 on Sassenrath: considering Abomination 8398 on DeMarco as a potential hit target
4/25/2018 12:48:55 PM CheckForAOEDetonation blast radius weapon PlasmaTorpedoAOEBurstAtEnd 8382 on Sassenrath: considering LaserGuardian_Mark2 8861 on Sassenrath as a potential hit target
4/25/2018 12:48:55 PM PlasmaTorpedoAOEBurstAtEnd 8382 on Sassenrath hitting Bomber_Mark4 8838 on DeMarco with a blast radius weapon
4/25/2018 12:48:55 PM
Bomber_Mark4 8838 on DeMarco just took 273 damage from PlasmaTurret_Gun fired from PlasmaTurret_Mark3 7246 on Sassenrath
                                                                                                                                                                                                                                                  
   at System.Environment.get_StackTrace() in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Environment.cs:line 227
   at Arcen.Universal.ArcenDebugging.ArcenDebugLog(System.String Message, DebugLogDestination Destination, Boolean IncludeStackTrace, Verbosity Verbosity)
   at Arcen.Universal.ArcenDebugging.QuickDebug(System.String Message)
   at Arcen.AIW2.Core.GameEntity.TakeDamage(Int32 Damage, Arcen.AIW2.Core.EntitySystem FiringSystemOrNull, Arcen.AIW2.Core.GameEntity ShotThatHitOrNull, Boolean IsSelfDamage, Boolean PreventReversionToNeutral, Boolean HonorFiniteHitCountAOE,\
 Int32 ByRef ActualDamageDone, Arcen.AIW2.Core.ArcenSimContext Context)
   at Arcen.AIW2.Core.GameEntity.DoHitLogic(Arcen.AIW2.Core.GameEntity Target, Boolean HonorFiniteHitCountAOE, FInt PercentOfTotalAttackPowerForThisHit, FInt ByRef PercentOfTotalAttackPowerUsedForThisHit, Arcen.AIW2.Core.ArcenSimContext Cont\
ext)
   at Arcen.AIW2.Core.GameEntity.DoHitLogic(Arcen.AIW2.Core.GameEntity Target, FInt PercentOfTotalAttackPowerForThisHit, FInt ByRef PercentOfTotalAttackPowerUsedForThisHit, Arcen.AIW2.Core.ArcenSimContext Context)
   at Arcen.AIW2.Core.GameEntity.CheckForAOEDetonation(Arcen.AIW2.Core.ArcenSimContext Context)
   at Arcen.AIW2.Core.GameEntity.DoOnAnyDeathInCombatLogic(Arcen.AIW2.Core.EntitySystem FiringSystemOrNull, Arcen.AIW2.Core.ArcenSimContext Context)
   at Arcen.AIW2.Core.GameEntity.DoOnDeathInCombatLogic(Arcen.AIW2.Core.EntitySystem FiringSystemOrNull, Arcen.AIW2.Core.ArcenSimContext Context)
   at Arcen.AIW2.Core.Planet+<>c.<DoCombatStep>b__101_3(Arcen.AIW2.Core.GameEntity entity)
   at Arcen.AIW2.Core.EntityCollection.DoForEntities(GameEntityCategory Category, Arcen.AIW2.Core.ProcessorDelegate Processor)
   at Arcen.AIW2.Core.Planet.DoForEntities(GameEntityCategory Category, Arcen.AIW2.Core.ProcessorDelegate Processor)
   at Arcen.AIW2.Core.Planet.DoCombatStep(Arcen.AIW2.Core.ArcenSimContext Context)
   at Arcen.AIW2.Core.World_AIW2.DoWorldStepLogic(Arcen.AIW2.Core.ArcenSimContext Context)
   at Arcen.AIW2.Core.SimExecution.Execute()
   at Arcen.AIW2.Core.ArcenSimPlanningContext.InnerRun()
   at Arcen.AIW2.Core.ArcenExecutionContext.InnerRun()
   at Arcen.Universal.ArcenThread.InternalActualThreadFunction()

                 
Note that the spatial partitioning code is returning a ship on another planet as a potential target to be hit. Not a Nanocaust bug.

Chris_McElligottPark

Apr 25, 2018 12:23 pm

administrator   ~0047462

Yikes, okay. I'll make a note to Keith, as this seems pretty high-priority even during the pivot. Thank you for finding it!

BadgerBadger

Apr 25, 2018 1:06 pm

manager   ~0047466

Last edited: Apr 25, 2018 1:17 pm

If you print out all the partitions in the PartitionedSpace before you call UpdatePartitioningFor() in FillListWithDistinctEntitiesActuallyOverlappingCircle (omitting empty partitions) you see

4/25/2018 1:03:36 PM CheckForAOEDetonation: invoking FillListWithDistinctEntitiesActuallyOverlappingCircle against planet Sassenrath
4/25/2018 1:03:36 PM FillListWithDistinctEntitiesActuallyOverlappingCircle: using 150 partitions. First lets print out all the category Ship units in those partitions before the update
4/25/2018 1:03:36 PM partition 0 has 1 entities: <, PowerDistributionNode 7114 on DeMarco>
4/25/2018 1:03:36 PM partition 1 has 9 entities: <, MissileCorvette_Mark4 8461 on DeMarco, MissileCorvette_Mark4 8462 on DeMarco, MissileCorvette_Mark4 8463 on DeMarco, MissileCorvette_Mark4 8464 on DeMarco, Bomber_Mark4 8465 on DeMarco, Bomber_Mark4 84\
66 on DeMarco, Bomber_Mark4 8467 on DeMarco, Bomber_Mark4 8468 on DeMarco, Bomber_Mark4 8469 on DeMarco>
4/25/2018 1:03:36 PM partition 4 has 1 entities: <, MLRSTurret_Mark4 7136 on DeMarco>
4/25/2018 1:03:36 PM partition 5 has 1 entities: <, AlarmPost 8334 on DeMarco>
4/25/2018 1:03:36 PM partition 6 has 1 entities: <, AlarmPost 8334 on DeMarco>
.....
4/25/2018 1:03:36 PM partition 70 has 8 entities: <, Bomber_Mark4 8471 on DeMarco, Bomber_Mark4 8472 on DeMarco, Bomber_Mark4 8473 on DeMarco, Bomber_Mark4 8474 on DeMarco, MissileCorvette_Mark4 8475 on DeMarco, MissileCorvette_Mark4 8476 on DeMarco, MissileCorvette_Mark4 8477 on DeMarco, MissileCorvette_Mark4 8478 on DeMarco>
4/25/2018 1:03:36 PM partition 78 has 1 entities: <, PowerDistributionNode 7229 on Sassenrath>
4/25/2018 1:03:36 PM partition 79 has 1 entities: <, PowerDistributionNode 7229 on Sassenrath>
....
4/25/2018 1:03:36 PM partition 132 has 1 entities: <, StealthGuardian_Mark3 7232 on Sassenrath>
4/25/2018 1:03:36 PM partition 136 has 1 entities: <, StealthGuardian_Mark3 7232 on Sassenrath>
4/25/2018 1:03:36 PM partition 147 has 7 entities: <, Fighter_Mark4 8488 on DeMarco, Bomber_Mark4 8490 on DeMarco, Bomber_Mark4 8492 on DeMarco, Bomber_Mark4 8493 on DeMarco, Bomber_Mark4 8494 on DeMarco, Bomber_Mark4 8489 on DeMarco, Bomber_Mark4 8491 \
on DeMarco>


Note that we're mixing between planets.

I am suspicious that the Context.WorkingPartitionList is problematic. My guess is that we're not clearing this properly at some stage.
        public List<GameEntity> FillListWithDistinctEntitiesActuallyOverlappingCircle( ArcenSimContext Context, GameEntityCategory Category, ArcenPoint CenterPoint, int Radius )
        {
            List<Partition> PartitionList = Context.WorkingPartitionList; <====

BadgerBadger

Jun 23, 2018 2:18 pm

manager   ~0047572

We need to remember to ask Keith if this got fixed at any point during the Pivot.

keith.lamothe

Jun 29, 2018 10:05 am

administrator   ~0047621

I did address some areas where the context's working list was not being cleared between usages, and I just addressed the remaining cases I could find.

A bit of background: each thread has its own context object, and each context object has its own partition list so that the "which partitions are in range?" operations are thread-safe. The list is reused (within that thread) to avoid thrashing the heap with constant allocation and re-allocation.

Issue History

Date Modified Username Field Change
Apr 25, 2018 12:06 am Ovalcircle New Issue
Apr 25, 2018 12:06 am Ovalcircle File Added: Dyson Nano Bug (1).jpg
Apr 25, 2018 12:06 am Ovalcircle File Added: Dyson Nano Bug (2).jpg
Apr 25, 2018 12:06 am Ovalcircle File Added: Dyson Nano Bug (3).jpg
Apr 25, 2018 12:06 am Ovalcircle File Added: Dyson nano bug game 2.jpg
Apr 25, 2018 12:06 am Ovalcircle File Added: nano appearance.save
Apr 25, 2018 12:07 am Ovalcircle Description Updated
Apr 25, 2018 8:52 am BadgerBadger Note Added: 0047452
Apr 25, 2018 10:00 am BadgerBadger Relationship added related to 0019591
Apr 25, 2018 11:28 am BadgerBadger File Added: a.save
Apr 25, 2018 11:28 am BadgerBadger Note Added: 0047453
Apr 25, 2018 11:47 am BadgerBadger Note Edited: 0047453
Apr 25, 2018 11:55 am Chris_McElligottPark Assigned To => BadgerBadger
Apr 25, 2018 11:55 am Chris_McElligottPark Status new => assigned
Apr 25, 2018 11:56 am Chris_McElligottPark Note Added: 0047454
Apr 25, 2018 12:16 pm BadgerBadger Note Added: 0047461
Apr 25, 2018 12:23 pm Chris_McElligottPark Assigned To BadgerBadger => keith.lamothe
Apr 25, 2018 12:23 pm Chris_McElligottPark Note Added: 0047462
Apr 25, 2018 12:28 pm BadgerBadger Note Edited: 0047453
Apr 25, 2018 12:50 pm BadgerBadger Note Edited: 0047461
Apr 25, 2018 12:50 pm BadgerBadger Note Edited: 0047461
Apr 25, 2018 1:06 pm BadgerBadger Note Added: 0047466
Apr 25, 2018 1:07 pm BadgerBadger Note Edited: 0047466
Apr 25, 2018 1:08 pm BadgerBadger Note Edited: 0047466
Apr 25, 2018 1:17 pm BadgerBadger Note Edited: 0047466
Apr 25, 2018 11:50 pm BadgerBadger Relationship added related to 0019592
Apr 25, 2018 11:51 pm BadgerBadger Relationship replaced has duplicate 0019592
May 1, 2018 2:08 pm BadgerBadger Summary Nanocaust ships spawn from AI Guardian => Partitioning bug for AOE weapons allows AOE to hit multiple planets
Jun 23, 2018 2:18 pm BadgerBadger Note Added: 0047572
Jun 29, 2018 10:05 am keith.lamothe Status assigned => resolved
Jun 29, 2018 10:05 am keith.lamothe Resolution open => fixed
Jun 29, 2018 10:05 am keith.lamothe Fixed in Version => 0.746 Disposing of the Invisible Man
Jun 29, 2018 10:05 am keith.lamothe Note Added: 0047621