logo
Main

Forums

Downloads

Unreal-Netiquette

Donate for Oldunreal:
Donate

borderline

Links to our wiki:
Wiki

Walkthrough

Links

Tutorials

Unreal Reference

Usermaps

borderline

Contact us:
Submit News
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Overuse of HurtRadiusProj crashes the game (Read 1054 times)
SFJake
Full Member
***
Offline


Oldunreal member

Posts: 248
Joined: Aug 15th, 2010
Gender: Male
Overuse of HurtRadiusProj crashes the game
Aug 14th, 2012 at 10:34pm
Print Post  
...or crashes the audio first, then crash the game. Everything was compiled, recompiled, and recompiled. Thats not the issue.

Basically, I made a new projectile that goes forward and explodes every 0.01 second. Yes, thats excessive. But even if I cut it down severely, the crash still happens.

To guarantee a crash, I spawn a Titan in Dig, spam the projectile at him, and by the time he's dead it crashed.

If I remove HurtRadiusProj (that occurs every 0.01), then no crash occurs, so that seems to be the problem.


Here is the code (2 actors, both under TazerProj), the 2nd one is the problem.

Code
Select All
//=============================================================================
// TazerRay.
//=============================================================================
class TazerRay expands TazerProj;

var byte sfi;

auto state Flying
{
	function ProcessTouch (Actor Other, vector HitLocation)
	{
		If( Other!=Instigator && TazerProj(Other)==None )
			Explode(HitLocation,Normal(HitLocation-Other.Location));
	}

	function BeginState()
	{
		if ( ScriptedPawn(Instigator) != None )
			Speed = FMax(ScriptedPawn(Instigator).ProjectileSpeed,Speed);
		Velocity = vector(Rotation) * speed;
	}

Begin:
	for( sfi=0; sfi<800; ++sfi )
	{
	Spawn(Class'TazerRayStand',,'',Location, Instigator.ViewRotation);
	Sleep(0.01);
	}
	Explode(Location, Vect(0,0,0));
}

function Explode(vector HitLocation,vector HitNormal)
{
	local RingExplosion r;

	PlaySound(ImpactSound, SLOT_Misc, 0.5,,, 0.5+FRand());
	HurtRadiusProj(Damage, 70, 'jolted', MomentumTransfer, Location );

	r = Spawn(class'RingExplosion3',,, HitLocation+HitNormal*8,rotator(HitNormal));

	r.PlaySound(r.ExploSound,,6);
	Destroy();
}

defaultproperties
{
	speed=3000.000000
	MaxSpeed=3000.000000
	MultiSkins(1)=FireTexture'UnrealShare.Effect1.FireEffect1pb'
}
 



Code
Select All
//=============================================================================
// TazerRayStand.
//=============================================================================
class TazerRayStand expands TazerProj;

auto state Flying
{
	function ProcessTouch (Actor Other, vector HitLocation)
	{
	}

	function BeginState()
	{
	}

Begin:
	Sleep(0.1);
	Explode(Location, Vect(0,0,0));
}

function Explode(vector HitLocation,vector HitNormal)
{
	PlaySound(ImpactSound, SLOT_Misc, 0.5,,, 0.5+FRand());
	HurtRadiusProj(Damage, 150, 'jolted', 0, Location );

	Spawn(class'RingExplosionNS',,, HitLocation+HitNormal*8,Instigator.ViewRotation);

	Destroy();
}

defaultproperties
{
	speed=0.000000
	MaxSpeed=0.000000
	Damage=20.000000
	LightType=LT_None
}
 



I don't know what to say. The whole concept is pointless if I can't even have damage done semi-frequently in a zone around the projectile.

What can I do? I have no idea why HurtRadiusProj would do that in the first place.

EDIT: Some more analysis. The problem doesn't seem to occur anywhere.

Lets say, a map with 50 skaarj, 50 kralls, 50 brutes, 50 troopers, all invading one area. I killed them all with this, no problem.

I spawn one titan, kill him, I get sound crash or a complete freeze/crash. Also had a crash when dealing with my giant pupae boss (that boss is huge).

EDIT2: This never happens right away on the first projectile. My first guess was something stacking that isn't removed and the engine eventually cannot take it.

EDIT 3: Found a temporary band-aid solution. Maybe permanent. Basically forces the HurtRadiusProj to only check Pawns and Decorations. Seems to have reduced (but hopefully nullified) the crashing. Still mystified by this, though.

Code
Select All
simulated final function HurtRadiusProjD( float DamageAmount, float DamageRadius, name DamageName, float Momentum, vector HitLocation )
{
	local actor Victims;
	local float damageScale, dist;
	local vector dir;

	if ( bHurtEntry )
		return;

	bHurtEntry = true;
	foreach VisibleCollidingActors( class 'Actor', Victims, DamageRadius, HitLocation )
	{
		if( Victims!=self && Victims!=LastHitActor && Victims!=Instigator && Victims.IsA('Pawn') || Victims.IsA('Decoration'))
		{
			dir = Victims.Location - HitLocation;
			dist = FMax(1,VSize(dir));
			dir = dir/dist;
			damageScale = 1 - FMax(0,(dist - Victims.CollisionRadius)/DamageRadius);

			Victims.TakeDamage
			(
				damageScale * DamageAmount,
				Instigator,
				Victims.Location - 0.5 * (Victims.CollisionHeight + Victims.CollisionRadius) * dir,
				(damageScale * Momentum * dir),
				DamageName
			);
		}
	}
	if( LastHitActor!=None )
	{
		dir = LastHitActor.Location - HitLocation;
		dist = FMax(1,VSize(dir));
		dir = dir/dist;
		damageScale = FMin(FMax(LastHitActor.CollisionRadius/(LastHitActor.CollisionRadius + LastHitActor.CollisionHeight),
			1 - FMax(0,(dist - LastHitActor.CollisionRadius)/DamageRadius)),1.f);
		LastHitActor.TakeDamage
		(
			damageScale * DamageAmount,
			Instigator,
			LastHitActor.Location - 0.5 * (LastHitActor.CollisionHeight + LastHitActor.CollisionRadius) * dir,
			(damageScale * Momentum * dir),
			DamageName
		);
	}
	bHurtEntry = false;
}
 


« Last Edit: Aug 15th, 2012 at 3:19am by SFJake »  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint
Bookmarks: del.icio.us Digg Facebook Google Google+ Linked in reddit StumbleUpon Twitter Yahoo