melee and getting it right.
Moderator: Moderators
melee and getting it right.
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?
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?
Re: melee and getting it right.
MCL uses per-piece collision volumes. You can get the piece which was hit then.how do I get the side a unit was hit
If you strictly want the side, check relative position of attacker unit maybe?
Spring.GetUnitPiecePosDir gives you those values (in world space).AND the current torso rotation to see where the shield(if any) is?
Re: melee and getting it right.
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.
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.
Re: melee and getting it right.
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.emits actual melee weapon
That is way of least hassle imo. Or maybe Explosion() callin to get where the blow was landed on hit unit.check relative position of attacker unit maybe
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
Re: melee and getting it right.
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.knorke wrote: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.emits actual melee weapon
Re: melee and getting it right.
Why do you need still direction *after* it was already decided that the attack was succesful?
Re: melee and getting it right.
Hit test if unit blocked/can block damage is either negated or not
Re: melee and getting it right.
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)
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)
Re: melee and getting it right.
Right now I am just trying to get a basic version going. I am entirely uninterested in DOW style melee
Re: melee and getting it right.
knorke wrote:?

Melee hits don't always lead to damage.
Re: melee and getting it right.
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.
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.
Re: melee and getting it right.
You should shut it yes
- Evangelion
- Posts: 43
- Joined: 11 Dec 2013, 13:55
Re: melee and getting it right.
http://springrts.com/wiki/Lua_SyncedRea ... formationssmoth wrote:how do I get the side a unit was hit on
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.
http://springrts.com/wiki/Lua_SyncedRead#Unit_Piecessmoth wrote:current torso rotation to see where the shield(if any) is?
Re: melee and getting it right.
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.
Doing it via gadget should be possible as well with Spring.GetUnitPiecePosDir which returns values in world space.
Re: melee and getting it right.
I understood that.FLOZi wrote:http://www.swordacademy.com/academy-vid ... 08.big.jpgknorke wrote:?
Melee hits don't always lead to damage.
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.
Re: melee and getting it right.
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.
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.
Re: melee and getting it right.
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..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.)
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.
Re: melee and getting it right.
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.
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.