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] 2 3  Send TopicPrint
Very Hot Topic (More than 25 Replies) bloblets etc (Read 7682 times)
Leo T_C_K
Betatester
Offline



Posts: 1968
Joined: Aug 27th, 2005
Gender: Male
bloblets etc
Nov 16th, 2015 at 6:11pm
Print Post  
Bloblets and other pawns which are not supposed to have blood (like the shadowple in upsxmon2) drop blood particles/decals ocassionaly when shot.

Has this been adressed before?
  

People who accuse others of trolling are usually the biggest trolls themselves.
Back to top
YouTube  
IP Logged
 
[]KAOS[]Casey
Developer Team
Betatester
Offline


nedm

Posts: 3180
Joined: Aug 7th, 2011
Gender: Male
Re: bloblets etc
Reply #1 - Nov 16th, 2015 at 9:50pm
Print Post  
Oops... kinda wish I never actually implemented that whole system years ago.

what is a "shadowple" ?

there's a way we could shim in a way to fix it for bloblets no problem but we couldnt know that a shadowple shouldn't bleed (most likely)
  
Back to top
 
IP Logged
 
Leo T_C_K
Betatester
Offline



Posts: 1968
Joined: Aug 27th, 2005
Gender: Male
Re: bloblets etc
Reply #2 - Nov 16th, 2015 at 10:11pm
Print Post  
Well, any pawn that doesn't spawn blood by default but instead spawns smoke etc should not have any kind of blood obviously (and this thing is an extra function too). The "shadowple" spawn black smoke upon being hurt, just like bloblet spawns green smoke. If you'll download unreal psx rework demo that I released couple of years back:
http://www.moddb.com/mods/unreal-psx-rework-rise-of-jrath

You can try them yourself. Note that most of the bugs I noted don't happen anymore with 227i as this was tested with 227h, except the shadowple thin i guess and the masking problems with the custom krall.
  

People who accuse others of trolling are usually the biggest trolls themselves.
Back to top
YouTube  
IP Logged
 
Masterkent
Developer Team
Offline



Posts: 1323
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: bloblets etc
Reply #3 - Feb 16th, 2016 at 6:13pm
Print Post  
The only general resolution that comes to mind is a complete refactoring of the code responsible for bleeding and spawning blood decals.

While Pawn.TakeDamage has the direct access to essential values such as damage momentum, damage type, etc, it doesn't really know if/when a particular pawn is supposed to bleed and what blood color should be chosen for it (so it has to rely on the hardcoded check Pawn.IsA('ScriptedPawn') && ScriptedPawn(Pawn).bGreenBlood which does not cover non-ScriptedPawns).

Typically visual effects corresponding to a pawn damage are defined in PlayHit that may spawn blood effects (existing in pre-227 versions) or not. The majority of (if not all) such blood effects are implemented in UnrealShare.Blood2 (or its subclasses). The presence of an UnrealShare.Blood2 whose Instigator is the last damaged pawn is an evidence that the given pawn is bleeding, so we can relatively safely spawn UnrealShare.BloodSpray2 in such a case and avoid a situation when a pawn begins to bleed when it's not supposed to do so. UnrealShare.Blood2.PreBeginPlay could perform all necessary checks and possibly spawn UnrealShare.BloodSpray2 (which is directly responsible for spawning blood decals) as shown below:

Engine.LevelInfo:
Code
Select All
struct PawnDamageInfo
{
	var Pawn Victim;
	var Pawn Instigator;
	var vector HitLocation;
	var vector Momentum;
	var name DamageType;
	var float Time;
	var bool bSpawnedBlood;
};

var transient PawnDamageInfo LastPawnDamage; 


Engine.Pawn.TakeDamage:
Code
Select All
	if ( Level.Game!=None && Level.Game.GameRules!=None )
	{
		for ( GR=Level.Game.GameRules; GR!=None; GR=GR.NextRules )
			if ( GR.bModifyDamage )
				GR.ModifyDamage(Self,instigatedBy,Damage,hitlocation,damageType,momentum);
	}

	Level.LastPawnDamage.Victim = self;
	Level.LastPawnDamage.Instigator = instigatedBy;
	Level.LastPawnDamage.HitLocation = HitLocation;
	Level.LastPawnDamage.Momentum = momentum;
	Level.LastPawnDamage.DamageType = damageType;
	Level.LastPawnDamage.Time = Level.TimeSeconds;
	Level.LastPawnDamage.bSpawnedBlood = false; 


Code
Select All
	if (!bDeleteMe && actualdamage > 0 && DamageType != 'DROWNED')
	{
		Momentum2=Momentum*3.0;
		if (DamageType == 'SHREDDED')
			Momentum2 = vect(0,0,0);
		if (DamageType == 'SHOT')
			Momentum2 = Momentum2*2;

		RadNum = Rand(4);
		if (RadNum > 0)
		{
			if (Pawn_BloodsprayClass == None)
				Pawn_BloodsprayClass = class<actor>(DynamicLoadObject("UnrealShare.BloodSpray2",class'Class'));

			if (Pawn_BloodsprayClass != none)
			{
				for (i = 0; i< RadNum; i++)
				{
					b=Spawn(Pawn_BloodsprayClass,self,'',hitlocation,rotator(location-hitlocation));
					if (b != none)
						b.Velocity=Momentum2+Vrand()*100;
				}
			}
		}
		if ( Level.Game.bBleedingEnabled && FRand() < 0.5 ) // Start bleeding.
		{
			if (BleedingActor == None)
			{
				if (!bIsBleeding)
				{
					if(Pawn_BleedingClass == None)
						Pawn_BleedingClass = class<actor>(DynamicLoadObject("UnrealShare.Bleeding",class'Class'));
					 if (Pawn_BleedingClass != none)
						BleedingActor=Spawn(Pawn_BleedingClass,Self,'',hitlocation,rotator(location-hitlocation));
					if (BleedingActor != none)
					{
						bIsBleeding=True;
						BleedingActor.Instigator=InstigatedBy;
						BleedingActor.SetTimer(0.1,false);
					}
				}
			}
			else
			{
				bIsBleeding=True;
				BleedingActor.Instigator=InstigatedBy;
				BleedingActor.SetTimer(Level.TimeDilation + (Rand(3) / Level.TimeDilation), false);
			}
		}
	} 


UnrealShare.Blood2
Code
Select All
var array<BloodSpray2> BloodSprays;
var Bleeding PawnBleedingActor;

simulated function GreenBlood()
{
	Texture = texture'BloodSGrn';
	GreenBleeding();
}

function PreBeginPlay()
{
	PawnBleeding();
	if ( Level.Game!=None && Level.Game.bVeryLowGore )
		GreenBlood();
}

function PawnBleeding()
{
	local vector Momentum;
	local int i;
	local Actor b;

	if (Instigator != none &&
		Instigator == Level.LastPawnDamage.Victim &&
		Level.LastPawnDamage.Time == Level.TimeSeconds &&
		!Level.LastPawnDamage.bSpawnedBlood)
	{
		Momentum = Level.LastPawnDamage.Momentum / FMax(Instigator.Mass, 1) * 3.0;
		if (Level.LastPawnDamage.DamageType == 'SHREDDED')
			Momentum = vect(0,0,0);
		else if (Level.LastPawnDamage.DamageType == 'SHOT')
			Momentum *= 2;


		if (Instigator.Pawn_BloodsprayClass == None)
			Instigator.Pawn_BloodsprayClass = class'BloodSpray2';

		for (i = Rand(4); i > 0; --i)
		{
			b = Spawn(Instigator.Pawn_BloodsprayClass, Instigator, '', Location, rotator(Instigator.Location - Level.LastPawnDamage.HitLocation));
			if (b != none)
				b.Velocity = Momentum + VRand() * 100;
			if (BloodSpray2(b) != none)
				BloodSprays[Array_Size(BloodSprays)] = BloodSpray2(b);
		}

		if (Level.Game.bBleedingEnabled && FRand() < 0.5) // Start bleeding.
		{
			if (Instigator.Pawn_BleedingClass == none)
				Instigator.Pawn_BleedingClass = class'Bleeding';

			b = Spawn(Instigator.Pawn_BleedingClass, Instigator, '', Location, rotator(Instigator.Location - Level.LastPawnDamage.HitLocation));

			if (b != none)
			{
				if (Instigator.BleedingActor != none)
					Instigator.BleedingActor.Destroy();
				Instigator.BleedingActor = b;
				Instigator.bIsBleeding = true;
				Instigator.BleedingActor.Instigator = Level.LastPawnDamage.Instigator;
			}
			PawnBleedingActor = Bleeding(Instigator.BleedingActor);
		}

		Level.LastPawnDamage.bSpawnedBlood = true;
	}
}

function GreenBleeding()
{
	local int i;

	for (i = 0; i < Array_Size(BloodSprays); ++i)
		if (BloodSprays[i] != none && !BloodSprays[i].bDeleteMe)
		{
			BloodSprays[i].Green();
			if (ScriptedPawn(Instigator) == none)
				BloodSprays[i].RemoteRole = ROLE_None; // impossible to transfer color change to clients
		}
	if (PawnBleedingActor != none && !PawnBleedingActor.bDeleteMe)
		PawnBleedingActor.Green();
} 


(I also modified the implementation of postponed bleeding, since it doesn't seem to work as intended, namely, 227 code does not reset pawn's BleedingActor (UnrealShare.Bleeding) properly when its counter BleedAmount reaches zero, so once the pawn stops to bleed, further damage cannot make it bleed anymore. Was this functionality ever tested?)

It may be too late to make such changes without introducing a new config option, because some mods may rely on the existing implementation.
« Last Edit: Feb 17th, 2016 at 10:12am by Masterkent »  
Back to top
 
IP Logged
 
BobIsUnreal
God Member
*****
Offline


Guy who has too much time
invested to quit now

Posts: 755
Joined: Apr 12th, 2010
Gender: Male
Re: bloblets etc
Reply #4 - Feb 16th, 2016 at 10:37pm
Print Post  
If you guys refator the whole system , it woulds be great to  allow use replacable gib/colored blood classes.
i think you can do some spawn notify/ replace to swap/replace blood already tho  i always wanted some confeti / anti gib mod for the lulz
  

[REM_img]http://i.imgur.com/V3OSsDu.gif.disable[/img]http://i.imgur.com/JOu38Gs.gif
Back to top
IP Logged
 
[]KAOS[]Casey
Developer Team
Betatester
Offline


nedm

Posts: 3180
Joined: Aug 7th, 2011
Gender: Male
Re: bloblets etc
Reply #5 - Feb 17th, 2016 at 3:25am
Print Post  
Quote:
pawn stops to bleed, further damage cannot make it bleed anymore. Was this functionality ever tested?


All pawns subjected to na-palis atmosphere once bleeding never bleed again. True facts.

I blame shivaxi.
  
Back to top
 
IP Logged
 
Smirftsch
Forum Administrator
*****
Offline



Posts: 7923
Location: at home
Joined: Apr 30th, 1998
Gender: Male
Re: bloblets etc
Reply #6 - Mar 6th, 2016 at 2:38pm
Print Post  
BobIsUnreal wrote on Feb 16th, 2016 at 10:37pm:
If you guys refator the whole system , it woulds be great to  allow use replacable gib/colored blood classes.
i think you can do some spawn notify/ replace to swap/replace blood already tho  i always wanted some confeti / anti gib mod for the lulz


MK? Smiley

A struct in LevelInfo like that is very unhandy btw. due to its native bindings and dependency order (with Pawn especially).
« Last Edit: Mar 6th, 2016 at 4:00pm by Smirftsch »  

Sometimes you have to lose a fight to win the war.
Back to top
WWWICQ  
IP Logged
 
Masterkent
Developer Team
Offline



Posts: 1323
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: bloblets etc
Reply #7 - Mar 6th, 2016 at 8:40pm
Print Post  
Smirftsch wrote on Mar 6th, 2016 at 2:38pm:
BobIsUnreal wrote on Feb 16th, 2016 at 10:37pm:
If you guys refator the whole system , it woulds be great to  allow use replacable gib/colored blood classes.
i think you can do some spawn notify/ replace to swap/replace blood already tho  i always wanted some confeti / anti gib mod for the lulz


MK? Smiley

I wasn't really going to refactor decorations. If there are detailed suggestions regarding decorations, I could think about possible implementations.

Quote:
A struct in LevelInfo like that is very unhandy btw. due to its native bindings and dependency order (with Pawn especially).

How about GameInfo?

Initially I wanted to add a similar struct and variable in Engine.Pawn instead, but I couldn't test the functionality, since the engine doesn't like new variables in Pawn without changing some native checks. Consider this implementation as a proof of concept (everyone can apply the indicated changes and test the result right now without waiting for updates of 227j).
  
Back to top
 
IP Logged
 
Smirftsch
Forum Administrator
*****
Offline



Posts: 7923
Location: at home
Joined: Apr 30th, 1998
Gender: Male
Re: bloblets etc
Reply #8 - Mar 8th, 2016 at 8:40am
Print Post  
Could add all vars into pawn, I think it would be indeed most fitting there, only keeping them as struct is still no good idea.
  

Sometimes you have to lose a fight to win the war.
Back to top
WWWICQ  
IP Logged
 
Smirftsch
Forum Administrator
*****
Offline



Posts: 7923
Location: at home
Joined: Apr 30th, 1998
Gender: Male
Re: bloblets etc
Reply #9 - Mar 11th, 2016 at 6:51am
Print Post  
// PawnDamageInfo - helper vars for blood effects.
var transient Pawn PawnDamageVictim;            // The damage victim.
var transient Pawn PawnDamageInstigator;      // The damage instigator
var transient vector PawnDamageHitLocation;      // HitLocation for pawn damage
var transient vector PawnDamageMomentum;      // Momentum for pawn damage
var transient name PawnDamageType;                  // Pawn damage type
var transient float PawnDamageTime;                  // Pawn damage time
var transient bool PawnDamageSpawnedBlood;      // Damage spawned blood.

so what about something like this into pawn? As said, adding a struct is a problem because it requires the struct to be defined in the native part as well then.
  

Sometimes you have to lose a fight to win the war.
Back to top
WWWICQ  
IP Logged
 
Masterkent
Developer Team
Offline



Posts: 1323
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: bloblets etc
Reply #10 - Mar 11th, 2016 at 10:38am
Print Post  
Quote:
// PawnDamageInfo - helper vars for blood effects.
var transient Pawn PawnDamageVictim;            // The damage victim.
var transient Pawn PawnDamageInstigator;      // The damage instigator
var transient vector PawnDamageHitLocation;      // HitLocation for pawn damage
var transient vector PawnDamageMomentum;      // Momentum for pawn damage
var transient name PawnDamageType;                  // Pawn damage type
var transient float PawnDamageTime;                  // Pawn damage time
var transient bool PawnDamageSpawnedBlood;      // Damage spawned blood.

so what about something like this into pawn?

PawnDamageVictim is not needed, because it's always equal to self. And I'd name such variables a bit differently

Code
Select All
var transient Pawn LastDamageInstigator;	// The damage instigator
var transient vector LastDamageHitLocation;	// HitLocation for pawn damage
var transient vector LastDamageMomentum;	// Momentum for pawn damage
var transient name LastDamageType;			// Pawn damage type
var transient float LastDamageTime;			// Pawn damage time
var transient bool bLastDamageSpawnedBlood;	// Damage spawned blood. 


to make it clear that they describe the most recent registered damage.
  
Back to top
 
IP Logged
 
Smirftsch
Forum Administrator
*****
Offline



Posts: 7923
Location: at home
Joined: Apr 30th, 1998
Gender: Male
Re: bloblets etc
Reply #11 - Mar 11th, 2016 at 1:22pm
Print Post  
ok, fine with me.

lol, for some funny reason it spawns now the blood but it stays in the air and never won't disappear again. Oh well...going to check in the evening (I hope) Tongue
« Last Edit: Mar 11th, 2016 at 2:29pm by Smirftsch »  

Sometimes you have to lose a fight to win the war.
Back to top
WWWICQ  
IP Logged
 
han
Global Moderator
Unreal Rendering Guru
Developer Team
*****
Offline


Oldunreal member

Posts: 564
Location: Germany
Joined: Dec 10th, 2014
Gender: Male
Re: bloblets etc
Reply #12 - Mar 11th, 2016 at 4:32pm
Print Post  
How about putting this PawnDamageInfo variables into a struct itsself (with that name) declared in Actor.uc itsself. And just declare a transient variable of it in Pawn instead as the struct itsself looks general purpose and might be of interesst to use in other places as well, let alone the ability to easier pass the data along to other functions.
  

HX on Mod DB. Revision on Steam.
Back to top
 
IP Logged
 
Smirftsch
Forum Administrator
*****
Offline



Posts: 7923
Location: at home
Joined: Apr 30th, 1998
Gender: Male
Re: bloblets etc
Reply #13 - Mar 11th, 2016 at 7:16pm
Print Post  
seems to do fine now Smiley
  

Sometimes you have to lose a fight to win the war.
Back to top
WWWICQ  
IP Logged
 
Masterkent
Developer Team
Offline



Posts: 1323
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: bloblets etc
Reply #14 - Mar 19th, 2016 at 5:29pm
Print Post  
A minor tweaking:

the following code should be inserted in UnrealShare.Blood2.PawnBleeding

Code
Select All
		if (Instigator == Instigator.LastDamageInstigator)
			Momentum *= 0.6; 


after

Code
Select All
	if (Instigator != none &&
		Instigator.LastDamageTime == Level.TimeSeconds &&
		!Instigator.bLastDamageSpawnedBlood)
	{
		Momentum = Instigator.LastDamageMomentum / FMax(Instigator.Mass, 1) * 3.0; 

  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 3 
Send TopicPrint
Bookmarks: del.icio.us Digg Facebook Google Google+ Linked in reddit StumbleUpon Twitter Yahoo