X2CommunityCore / X2WOTCCommunityHighlander

https://steamcommunity.com/workshop/filedetails/?id=1134256495
MIT License
60 stars 68 forks source link

Crashes with bullpups using Experimental Ammo #1229

Open Iridar opened 1 year ago

Iridar commented 1 year ago

Original report from workshop comments on Highlander:

I've got a bugfix request: Plasma Bullpups when equipped with DoT ammo such as Venom or Dragon Rounds (Or Corrosive Rounds mod) cause frequent crashes to desktop. It's primarily Plasma tier Bullpups , though Plasma Tier weapons with DoT ammo has caused crashes for me with other guns such as cannons, Sniper Rifles, Chosen Hunter's Rifle (Nearly as bad as Plas Bullpups), and Rifle.

Dragon Rounds cause these crashes significantly less than Venom or Corrosive Rounds, but it's a persistent bug that exists even in the base game when I run zero mods at all. Skirmishers are just flat out banned from using anything but Tracer / Bluescreen / Talon Rounds for me.

BlackDog86 commented 1 year ago

Managed to make this happen in skirmish mode - equipped a bunch of skirms with dragon / venom rounds for testing. The crash happened while shooting venom rounds at a purifier, notably while the 'over the shoulder' camera was being used. No other mods other than CHL & Alien Hunters CHL. Going to try some further tests and see if it's reproducible. Crash log from start of final turn to CTD attached below: Crashlog.txt

RustyDios commented 1 year ago

Summary of Crash log (last lines before crash);

[1440.33] ScriptWarning: Accessed None 'NewProjectile'
    XGUnit Plot_ABN_Guerilla_ElTrain_02.TheWorld:PersistentLevel.XGUnit_26
    Function XComGame.XGUnitNativeBase:SpawnAndConfigureNewProjectile:00CA
[1441.70] ScriptWarning: Accessed None 'ParticleEffectComponent'
    X2UnifiedProjectile Plot_ABN_Guerilla_ElTrain_02.TheWorld:PersistentLevel.X2UnifiedProjectile_56
    Function XComGame.X2UnifiedProjectile:EndConstantProjectileEffects:00E8

Seems like an assert/none failed check - one of Iridars favourite issues :)

Iridar commented 1 year ago

Well there's no assert here, just 'accessed none'. And yeah I've been noticing a ton of these while testing stuff recently. Technically, 'accessed none' shouldn't cause crashes, so there's a good chance it doesn't have anything to do with the crash. Then again, it is projectile-related, so maybe it does.

BlackDog86 commented 1 year ago

I did another test with a team of 4 skirmishers, all with venom rounds and completed a mission, killing 16 enemies predominantly using venom round bullpup and didn't get a crash at all this time round. The only significant difference was the level type on the earlier mission was one of the abandoned city centre plot types.

BlackDog86 commented 1 year ago

`Does this code look ok from XGUnitNativeBase - Seems to be this part is responsible for creating the projectile actors for special ammo:

//Create projectile actors associated with ammo type
            if (SourceItemGameState != none && SourceItemGameState.HasLoadedAmmo())
            {
                SpecialAmmoGameState = XComGameState_Item(History.GetGameStateForObjectID(SourceItemGameState.LoadedAmmo.ObjectID));

                if (SpecialAmmoGameState != none)
                {
                    SpawnAndConfigureNewProjectile(Actor(SpecialAmmoGameState.GetGameArchetype()), Notify, AbilityContext, WeaponEntity);
                }
            }
BlackDog86 commented 1 year ago

Additionally, in X2UnifiedProjectile: Is it possible a 'none' entity could be added to the projectiles array?

function EndConstantProjectileEffects( )
{
    local int Index;

    for (Index = 0; Index < Projectiles.Length; ++Index)
    {
        if ((Projectiles[Index].ProjectileElement.UseProjectileType == eProjectileType_RangedConstant) && !Projectiles[Index].bConstantComplete)
        {
            Projectiles[Index].bConstantComplete = true;

            Projectiles[ Index ].ParticleEffectComponent.DeactivateSystem( );
            Projectiles[ Index ].ParticleEffectComponent.KillParticlesForced( );
            Projectiles[ Index ].SourceAttachActor.SetPhysics( PHYS_None );
            Projectiles[ Index ].TargetAttachActor.SetPhysics( PHYS_None );
        }
    }
}
Iridar commented 1 year ago

SpawnAndConfigureNewProjectile() doesn't do any none-checking on the actor its given, so if this Actor(SpecialAmmoGameState.GetGameArchetype()) is none, the code's gonna do a whole lot of stuff it shouldn't. Whether that could cause crashes or not is unknown.