OldUnreal / UnrealTournamentPatches

Other
978 stars 29 forks source link

[469b] MH-RTrain sometimes produce heavy lags on server #552

Open SeriousBuggie opened 3 years ago

SeriousBuggie commented 3 years ago

https://ut99.org/viewtopic.php?f=5&t=14813

When you reach part with last titan - water one, sometimes appear heavy server freezes. Which lead to temporary lost connection for all.

I suspect titan throw rocks which drop into high sped zone and start move away, but stuck near closest brush. So collide many times which cause lags. But not sure.

SeriousBuggie commented 3 years ago

Look like rock below train rotate and produce too big count of sounds. So completely overflow clients speed limit for receive data: STAT NET v436: img v469c: img

SeriousBuggie commented 3 years ago

astat detail img UnrealI.Rockhit used as ImpactSound for BigRock.

auto state Flying
{
    function ProcessTouch (Actor Other, Vector HitLocation)
    {
        local int hitdamage;

        if ( Other == instigator )
            return;
        PlaySound(ImpactSound, SLOT_Interact, DrawScale/10);    

        if ( !Other.IsA('BigRock') && !Other.IsA('Titan') )
        {
            Hitdamage = Damage * 0.00002 * (DrawScale**3) * speed;
            if ( (HitDamage > 6) && (speed > 150) )
                Other.TakeDamage(hitdamage, instigator,HitLocation,
                    (35000.0 * Normal(Velocity)), 'crushed' );
        }
    }

    simulated function Landed(vector HitNormal)
    {
        HitWall(HitNormal, None);
    }

    function MakeSound()
    {
        local float soundRad;

        if ( Drawscale > 2.0 )
            soundRad = 500 * DrawScale;
        else
            soundRad = 100;
        PlaySound(ImpactSound, SLOT_Misc, DrawScale/8,,soundRad);   
    }

    simulated function HitWall (vector HitNormal, actor Wall)
    {
        local vector RealHitNormal;

        if ( (Role == ROLE_Authority) && (Mover(Wall) != None) && Mover(Wall).bDamageTriggered )
            Wall.TakeDamage( Damage, instigator, Location, MomentumTransfer * Normal(Velocity), '');
        speed = VSize(velocity);
        MakeSound();
        if ( (HitNormal.Z > 0.8) && (speed < 60 - DrawScale) )
        {
            SetPhysics(PHYS_None);
            GotoState('Sitting');   
        }
        else
        {           
            SetPhysics(PHYS_Falling);
            RealHitNormal = HitNormal;
            if ( FRand() < 0.5 )
                RotationRate.Pitch = Max(RotationRate.Pitch, 100000);
            else
                RotationRate.Roll = Max(RotationRate.Roll, 100000);
            HitNormal = Normal(HitNormal + 0.5 * VRand()); 
            if ( (RealHitNormal Dot HitNormal) < 0 )
                HitNormal.Z *= -0.7;
            Velocity = 0.7 * (Velocity - 2 * HitNormal * (Velocity Dot HitNormal));
            DesiredRotation = rotator(HitNormal);
            if ( (speed > 150) && (FRand() * 30 < DrawScale) )
                SpawnChunks(4);
        }
    }

Begin:
    Sleep(5.0);
    SetPhysics(PHYS_Falling);
}

There few places for PlaySound(ImpactSound: 1: ProcessTouch

  1. MakeSound which called from HitWall.

So during big velocity of zone, rock hit wall again and again very fast. Make constant flood of sounds on network.

I think there be some limit for count sounds from HitWall. Possible for ProcessTouch too.

an-eternity commented 3 years ago

Should this be considered as the problem of the map, or there should be some protection added in the native part to prevent bandwidth overflow in such cases? Something similar probably may occasionally happen in some other maps too...

SeriousBuggie commented 3 years ago

No. This problem not of map. Nothing bad with map. I even not sure if need fix problem at Rock level. Possible need do this on native part, as you mention. For prevent appear same problem toggled by different things in different conditions,

an-eternity commented 2 years ago

Wasn't there many warnings "moved without proper hashing" in the server log file?

Similar issue can reproduce on the map MH-MonsterMash2.unr:

  1. Trigger event blok to spawn BigRock.
  2. Trigger event plat or plat2 to make collision with Mover.

This overloads CPU thread and overflows network bandwidth for a moment. If number of BigRock is high enough, server may hang for quite a long time...

SeriousBuggie commented 7 months ago

Reproduce:

  1. Start on server RockNetIssue.zip
  2. Connect as client.
  3. Open stat net

Expected result: Network not overflowed. Actual result: Network overflow by repetitive sounds: img