melee and getting it right.

melee and getting it right.

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

melee and getting it right.

Post by smoth »

So right now I am trying to brainstorm for melee.

currently this is my thought.

Melee weapon with short range.
Unit aims(just turning torso)
unit fires->triggers punch/slash animation->emits actual melee weapon

all units are capable of blocking some how if they are not gunarms(aka my mech with the giant miniguns for arms.)
-here is my issue-
how do I get the side a unit was hit on AND the current torso rotation to see where the shield(if any) is?
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: melee and getting it right.

Post by Anarchid »

how do I get the side a unit was hit
MCL uses per-piece collision volumes. You can get the piece which was hit then.
If you strictly want the side, check relative position of attacker unit maybe?
AND the current torso rotation to see where the shield(if any) is?
Spring.GetUnitPiecePosDir gives you those values (in world space).
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: melee and getting it right.

Post by FLOZi »

Or Spring.UnitScript.GetPieceRotation if you want the unit space (or is that piece space?)

Reasonably sure PPCV won't work with the Melee weapon type, in terms of finding which piece was hit, as Melee deals damage directly. Not clear if you are indicating you would use that some other type (probably old reliable - LaserCannon)

You could use PPCV with a LaserCannon fake weapon to control aiming etc and then use Melee to deal damage, perhaps.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: melee and getting it right.

Post by knorke »

emits actual melee weapon
if that is supposed to be the way of actually dealing the damage after animations have been played, I would rather use Spring.AddUnitDamage because seems more reliable and exact.
check relative position of attacker unit maybe
That is way of least hassle imo. Or maybe Explosion() callin to get where the blow was landed on hit unit.

Also maybe
HitByWeapon ( x, z, weaponDefID, damage ) -> nil | number newDamage
This is called if a unit has been hit by a weapon. (x, z) is the direction from which the projectile came in unit space.

http://springrts.com/phpbb/viewtopic.ph ... 20#p498107
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: melee and getting it right.

Post by smoth »

knorke wrote:
emits actual melee weapon
if that is supposed to be the way of actually dealing the damage after animations have been played, I would rather use Spring.AddUnitDamage because seems more reliable and exact.
Because I want to know if the unit was facing right way as it was trying to block. By setting damage I do not get the direction the attack came from.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: melee and getting it right.

Post by knorke »

Why do you need still direction *after* it was already decided that the attack was succesful?
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: melee and getting it right.

Post by smoth »

Hit test if unit blocked/can block damage is either negated or not
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: melee and getting it right.

Post by knorke »

?
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: melee and getting it right.

Post by Anarchid »

Quick question - will the defending unit play an animation in case of block? I.e, raise the shield to intercept the incoming strike?

If so, i think you'll need to tell the defender to do the defense animation when attacker starts his animation -- which could be a lot of time before the damage would occur -- and not when the actual melee weapon is emitted and damage is either dealt or not in a single sub-frame event.

(and yeah getting piece direction in worldview would be very useful for determining which way the shield goes in this case)
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: melee and getting it right.

Post by smoth »

Right now I am just trying to get a basic version going. I am entirely uninterested in DOW style melee
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: melee and getting it right.

Post by FLOZi »

knorke wrote:?
Image

Melee hits don't always lead to damage.
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Re: melee and getting it right.

Post by SinbadEV »

Thinking about it in a timeline:

Step 1:
Attacker chooses target
Step 2:
Attacker starts attack animation
Target has a chance to notice attack
Step 3:
Target may move/animate in response to attack if it was noticed
Attacker continues attack animation
Step 4:
Point of Contact between Attacker's weapon and defender is determined and damage is assigned
Step 5:
Attack (follow through) and Defense (response) animations complete based on point of contact (if the point of contact was a shield then the attack could glance off or the target might be pushed back etc.)... or the defender may start it's "hit" or "death" animation.
Step 6:
Damage is applied to the defender and we return to step 1

But all that said... smoth it asking for programming help to determine the relative orientation of the two units in order to calculate the attack vector and point of contact so I should shut up.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: melee and getting it right.

Post by smoth »

You should shut it yes
User avatar
Evangelion
Posts: 43
Joined: 11 Dec 2013, 13:55

Re: melee and getting it right.

Post by Evangelion »

smoth wrote:how do I get the side a unit was hit on
http://springrts.com/wiki/Lua_SyncedRea ... formations
Not sure if it's possible to hook projectiles/impacts with lua yet. You can calculate where your attacker weapon piece is in relation to the target pieces. Doesn't even have to be precise, just take the nearest piece.
smoth wrote:current torso rotation to see where the shield(if any) is?
http://springrts.com/wiki/Lua_SyncedRead#Unit_Pieces
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Re: melee and getting it right.

Post by yuritch »

You can determine both incoming attack vector and current shield position in the same space (unit space in this case) if you control them from the defender's script. Basically units with shields should implement HitByWeapon, then GetPieceRotation/GetPiecePosDir of the shield and modify damage accordingly, units without shields can just ignore the callin and allow full damage through.

Doing it via gadget should be possible as well with Spring.GetUnitPiecePosDir which returns values in world space.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: melee and getting it right.

Post by knorke »

FLOZi wrote:
knorke wrote:?
http://www.swordacademy.com/academy-vid ... 08.big.jpg

Melee hits don't always lead to damage.
I understood that.
Why do you need still direction *after* it was already decided that the attack was succesful?
The attacker has done his animation, some system has decided if the attack was successful/missed/was blocked etc, the defender has done his animation. Only thing missing is actually damaging the defender, for that I suggested AddUnitDamage instead of EmitSfx-ing a weapon.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: melee and getting it right.

Post by FLOZi »

Who said you need it after?

1. Use an invisible non-melee weapon to detect hits and from that direction
2. Determine if 'body' or 'shield' was hit
3. Apply relevant damage

The more I think about it the more I'm tempted to suggest PPCV after all with shield having its own volume and melee weapons being a very short range LaserCannon emitted from the tip of the weapon model.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: melee and getting it right.

Post by knorke »

FLOZi wrote:Who said you need it after?
here:
http://springrts.com/phpbb/viewtopic.ph ... 04#p552463
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: melee and getting it right.

Post by smoth »

smoth wrote: Melee weapon with short range.
1) Unit aims(just turning torso)
2) unit fires->triggers punch/slash animation->emits actual melee weapon
3) all units are capable of blocking some how if they are not gunarms(aka my mech with the giant miniguns for arms.)
So a mech is in melee, it has it's shield raised, a mech punches the target, I then fire a shot of as part of the "punch" animation script. If the shot his the shield it is blocked, random chance the shield is knocked back down/off/etc..

Maybe it didn't have the shield raised? well raise the fucking shield dumbass, unit has shield raised, melee unit attacks again, If the shot his the shield it is blocked, random chance the shield is knocked back down/off/etc.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: melee and getting it right.

Post by knorke »

Was that at me?
Because it does not explain why you need still need direction after the system has already decided that the attack did hit and was not blocked.
Post Reply

Return to “Game Development”