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  Send TopicPrint
Hot Topic (More than 10 Replies) Best way to handle lingering hurtbox/area for projectiles? (Read 388 times)
Skywolf
Betatester
Offline


Just placeholding...

Posts: 770
Joined: Aug 2nd, 2009
Best way to handle lingering hurtbox/area for projectiles?
Nov 27th, 2017 at 3:02pm
Print Post  
Title says it all. I tried simply calling HurtRadiusProj every tick or so but that feels like a wrong way to handle it. I tried spawning a DynamicZoneInfo and change its properties based on what zone it's fired in but this has the obvious side effect that doesn't work well when you shoot it near another zone that has different properties (like creating air inside of a zone with bWaterZone enabled).

The goal is mainly to make a pool of acid that lasts for a few second dealing damage over time for anything that walks into it. But having it work on a projectile during flight would also be usefull. Assuming both require a different approach.
  

I hate it when people ask me what my favorite game is. Just try to explain you're not talking about Unreal Tournament Roll Eyes.
Back to top
 
IP Logged
 
yrex
Betatester
Offline


Oldunreal member

Posts: 143
Joined: May 6th, 2015
Gender: Male
Re: Best way to handle lingering hurtbox/area for projectiles?
Reply #1 - Nov 27th, 2017 at 8:22pm
Print Post  
First, HurtRadiusProj uses the trace check which is probably not what you want. You could use foreach TouchingActors() instead.

Second, the timing. To make it more ZoneInfo-like, do something like this (pseudocode):

Code
Select All
function Tick()
{
	foreach ActorsInRange(A)
	{
		if(Level.TimeSeconds>LastHurtTime(A)+1)
		{
			A.TakeDamage(...)
			LastHurtTime(A) = Level.TimeSeconds
		}
	}
} 

  

Website | ampoyrex at wp dot pl
Back to top
 
IP Logged
 
Skywolf
Betatester
Offline


Just placeholding...

Posts: 770
Joined: Aug 2nd, 2009
Re: Best way to handle lingering hurtbox/area for projectiles?
Reply #2 - Nov 27th, 2017 at 9:24pm
Print Post  
How would you go around implementing LastHurtTime though? Afaik the only way to do such a thing is by modifying the actor to have a variable called LastHurtTime which is not exactly desirable for obvious reasons.
  

I hate it when people ask me what my favorite game is. Just try to explain you're not talking about Unreal Tournament Roll Eyes.
Back to top
 
IP Logged
 
yrex
Betatester
Offline


Oldunreal member

Posts: 143
Joined: May 6th, 2015
Gender: Male
Re: Best way to handle lingering hurtbox/area for projectiles?
Reply #3 - Nov 28th, 2017 at 12:23am
Print Post  
Something like this:

Code
Select All
struct ActorInfo
{
	var Actor Actor;
	var float LastHurtTime;
};

var array<ActorInfo> ActorInfos;

function SetLastHurtTime(actor A, float time)
{
	local int i;
	for(i=0;i<Array_Size(ActorInfos);i++)
	{
		if(ActorInfos[i].Actor==A)
		{
			ActorInfos[i].LastHurtTime = time;
			return;
		}
	}

	Array_Size(ActorInfos,Array_Size(ActorInfos)+1);
	ActorInfos[Array_Size(ActorInfos)-1].Actor = A;
	ActorInfos[Array_Size(ActorInfos)-1].LastHurtTime = time;
}

function float GetLastHurtTime(actor A)
{
	local int i;
	for(i=0;i<Array_Size(ActorInfos);i++)
	{
		if(ActorInfos[i].Actor==A)
			return ActorInfos[i].LastHurtTime;
	}

	return 0;
} 

  

Website | ampoyrex at wp dot pl
Back to top
 
IP Logged
 
Masterkent
Developer Team
Offline



Posts: 890
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: Best way to handle lingering hurtbox/area for projectiles?
Reply #4 - Nov 28th, 2017 at 11:04am
Print Post  
Skywolf wrote on Nov 27th, 2017 at 3:02pm:
The goal is mainly to make a pool of acid that lasts for a few second dealing damage over time for anything that walks into it.

A proper implementation depends on the shape of the pool and the laws of how entered actors are supposed to be damaged (whether the caused damage per sec is the same within the hitting area or is different on the bounds and the epicentre, what happens if the affected actor is partly inside the hitting area and partly outside of it, what is the frequency of damaging - 1 time per second, 10 times per second, etc...).
  
Back to top
 
IP Logged
 
Skywolf
Betatester
Offline


Just placeholding...

Posts: 770
Joined: Aug 2nd, 2009
Re: Best way to handle lingering hurtbox/area for projectiles?
Reply #5 - Nov 28th, 2017 at 5:21pm
Print Post  
Since it's a splat of acid (similair to that of the blood splat that spawns under carcasses only instant) it would make sense to deal equal damage no matter what part you are touching. And since acid has a constant burning effect would it be more realistic to have a lot small amounts of damage per second.

Another problem is that you can have multiple splats on the floor at the same time. Which makes the damage stack if you implement it like Yrex suggested. Unless you can somehow share the actor array  so all splats in the level have access to the same variables.
  

I hate it when people ask me what my favorite game is. Just try to explain you're not talking about Unreal Tournament Roll Eyes.
Back to top
 
IP Logged
 
gopostal
Betatester
Offline


Retired

Posts: 739
Joined: Jul 31st, 2008
Gender: Male
Re: Best way to handle lingering hurtbox/area for projectiles?
Reply #6 - Nov 28th, 2017 at 9:13pm
Print Post  
You can take a look at my work on the Saucier gun in the Food Fight mod for UT if you want something to follow. It's a gun that shoots either sprays or globs of hot sauce that ignite items that will burn (made of wood, cloth, etc). The flames are tricky though because in certain circumstances they can spread, like if you hit the bottom box of a stack. It could then burn it's way up the stack. You can also start forest fires by setting a tree or two on fire. Maybe this is getting close to what you want?
« Last Edit: Nov 29th, 2017 at 2:50am by gopostal »  

I'm outta here. C ya!
Back to top
 
IP Logged
 
Skywolf
Betatester
Offline


Just placeholding...

Posts: 770
Joined: Aug 2nd, 2009
Re: Best way to handle lingering hurtbox/area for projectiles?
Reply #7 - Nov 29th, 2017 at 10:35pm
Print Post  
Can you upload the relevant snipped(s) of code here? I don't own UT so I can't open your Food Fight Mod.
  

I hate it when people ask me what my favorite game is. Just try to explain you're not talking about Unreal Tournament Roll Eyes.
Back to top
 
IP Logged
 
gopostal
Betatester
Offline


Retired

Posts: 739
Joined: Jul 31st, 2008
Gender: Male
Re: Best way to handle lingering hurtbox/area for projectiles?
Reply #8 - Nov 30th, 2017 at 2:39pm
Print Post  
I always post source code: http://www.moddb.com/mods/food-fight/addons/ff-mh-source-code

Look at the Saucier alt fire globs and the way they spawn a class called ObjectsFlames and set things nearby on fire.

I'm honestly a lower level coder compared to the rock stars in here but I'm happy to help any way I can. If you need help applying the Food Fight code I idle in my TS3 server most west coast US evenings.
  

I'm outta here. C ya!
Back to top
 
IP Logged
 
Masterkent
Developer Team
Offline



Posts: 890
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: Best way to handle lingering hurtbox/area for projectiles?
Reply #9 - Nov 30th, 2017 at 7:18pm
Print Post  
Skywolf wrote on Nov 28th, 2017 at 5:21pm:
Since it's a splat of acid (similair to that of the blood splat that spawns under carcasses only instant)

Is its size constant or smoothly decreasing to zero?

Skywolf wrote on Nov 28th, 2017 at 5:21pm:
Another problem is that you can have multiple splats on the floor at the same time. Which makes the damage stack if you implement it like Yrex suggested

I think, stacking makes sense: more acid -> more damage. Besides, each splat could have its own "instigator" (the pawn which is formally responsible for damaging/killing). If you don't allow stacking, you may face with difficulties related to determining the instigator. For example, in Coop game, admins often disallow friendly fire, so allies can't hurt you while enemies can. This would imply the need to distinguish acid splats which may hurt a particular player and the ones which cannot.
  
Back to top
 
IP Logged
 
Skywolf
Betatester
Offline


Just placeholding...

Posts: 770
Joined: Aug 2nd, 2009
Re: Best way to handle lingering hurtbox/area for projectiles?
Reply #10 - Dec 3rd, 2017 at 4:39pm
Print Post  
To give a better idea what I'm trying to do, here is what is looks like (ignore the blue spark thingy, that is just a temporary projectile for helping me debugging stuff):


As you can see is it impossible to tell if multiple splats are on the same spot. which is why I prefer it if the damage doesn't stack as it would just create player confusion.

And the size is constant. I would like it to fade out but the splats use AlphaBlend so it's impossible to do this.

As for the FoodFight mod. I'm terrible at reading code but from what I understand it simply does exactly what HurtRadiusProj does in terms of dealing damage only it spawns a copy of itself on nearby actors. It doesnt do the whole ZoneInfo-style damage dealing.
  

I hate it when people ask me what my favorite game is. Just try to explain you're not talking about Unreal Tournament Roll Eyes.
Back to top
 
IP Logged
 
Masterkent
Developer Team
Offline



Posts: 890
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: Best way to handle lingering hurtbox/area for projectiles?
Reply #11 - Dec 3rd, 2017 at 8:13pm
Print Post  
Skywolf wrote on Dec 3rd, 2017 at 4:39pm:
As you can see is it impossible to tell if multiple splats are on the same spot. which is why I prefer it if the damage doesn't stack as it would just create player confusion.

Then the next question you should answer is "who is the damage instigator of the union of two acid splats which have different instigators?" This is a critical question if you're going to support multiplayer game.
  
Back to top
 
IP Logged
 
Skywolf
Betatester
Offline


Just placeholding...

Posts: 770
Joined: Aug 2nd, 2009
Re: Best way to handle lingering hurtbox/area for projectiles?
Reply #12 - Dec 3rd, 2017 at 8:45pm
Print Post  
You can probably do both and simply split the damage (And simply draw a random instigator, which you will practically have to do anyway if you made them stack). Which is one of the possible solutions I came up with for this problem. Issue is that if two splats only partially overlap the whole area would have reduced damage even on the parts the two don't overlap.

If that implementation is impossible I would say the one who shot last. As their acid covers that of the other player. The acid is supposed to damage the instigator anyway so you can't just use your acid to make that of another player suddenly safe.

Bonus question unrelated to this: What is the best way to spawn a pawn that is used as a pawn kill detector from a mutator? These can't exist out of bounds so currently I have it search for a PlayerStart it can spawn at assuming that no mapper puts all of these in a location where nothing can spawn.
  

I hate it when people ask me what my favorite game is. Just try to explain you're not talking about Unreal Tournament Roll Eyes.
Back to top
 
IP Logged
 
Masterkent
Developer Team
Offline



Posts: 890
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: Best way to handle lingering hurtbox/area for projectiles?
Reply #13 - Dec 3rd, 2017 at 9:52pm
Print Post  
Skywolf wrote on Dec 3rd, 2017 at 8:45pm:
You can probably do both and simply split the damage

If you mean the approach which implies changing the instigator on every damage tick, then you may get an effect that is opposite to stacking: the damage per time interval can be reduced. F.e. if you stayed only a on splat from your enemy, you'd get the full damage rate, but if you're also staying on a splat from your teammate and 100% protection from friendly fire is enabled, then you would take damage only on those damage ticks for which the instigator is defined to be your enemy.

Quote:
Bonus question unrelated to this: What is the best way to spawn a pawn that is used as a pawn kill detector from a mutator?

What set of game versions are you going to support? In case of 227, you can use GameRules.NotifyKilled instead of the trick with Pawn. If you need a possibility to spawn a Pawn out of world for other reasons, 227 lets you do this by means of function SpawnAct (providing false as the argument for parameter bMayColFail). If using 227-specific functions is not an option for you, then you can try to use a hack with setting bIsPawn to false (by means of calling ConsoleCommand("set" @ PawnClass @ "bIsPawn false")). Then bIsPawn must be set back to true as soon as possible - e.g. in Spawned().
  
Back to top
 
IP Logged
 
gopostal
Betatester
Offline


Retired

Posts: 739
Joined: Jul 31st, 2008
Gender: Male
Re: Best way to handle lingering hurtbox/area for projectiles?
Reply #14 - Dec 4th, 2017 at 3:15am
Print Post  
Why don't you do damage depending on how far the player is from the acid pool center? If they are barely touching the edge then the damage is mitigated some. If they wade through the middle then they get full damage. This can be done with a simple and fast distance trace and then blunt the damage more for higher distance.

Add an instigator check and you are covered for team games with FF disabled.
  

I'm outta here. C ya!
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint
Bookmarks: del.icio.us Digg Facebook Google Google+ Linked in reddit StumbleUpon Twitter Yahoo