Page 1 of 1

heightDamageBonus request

Posted: 08 Dec 2008, 21:13
by Guessmyname
Basically, it's a request to make weapons do more damage depending on how high up above their opponent they are. This is for games like S44, who could then represent weak upper armour and to all that would like to give further advantages to high ground.

The current plan is for it to work something like this:

Three tags in the mod definitions (heightDamageBonus, heightDamageThreshold and heightDamageScalar) that states whether or not the mod uses this feature, a threshold for angle calculations and a scalar for the bonus.

How it works
Damage dealt = Weapon damage for that armour class * vertical angle between the two units * heightDamageScalar, with two additional rules:
If vertical angle * heightDamageScalar is less than 1, the height bonus is not applied.
The lower of the two units has no bonus applied

Example One
Say Unit A is on higher ground than Unit B, but a long way away (for the sake of argument, assume it's hyperaccurate guided artillery that won't miss). Whilst higher than Unit B, it is a long way away: in sensible terms, due to projectile drop and all that, this would probably be a side-on hit if it made contact. However, because he take the angle, not the 'how further up the y-axis is A than B?' value, this is taken into account, and Unit A doesn't score stupid amounts of extra damage. It gets some though (however miniscule), so it's still worth sticking it high up on that hill.

Example Two.
Unit A and Unit B are in a ravine. A is the outside of the ravine, firing in. B is at the bottom, firing back. They are quite close to each other.
Assuming Unit A = Unit B (ie they're the same unit type), Unit A should win, because it gets the damage bonus, and the bonus will be higher than in Example One even if the ravine is actually smaller than the hill of Ex. One because we're taking angle, not the vertical distance

Re: heightDamageBonus request

Posted: 08 Dec 2008, 21:44
by Argh
Can't the current armor system be used to accomplish this, or HitByWeaponID?

Re: heightDamageBonus request

Posted: 08 Dec 2008, 21:51
by Gota
What i would like is for laser based weapons to not get a range bonus when they are on higher grounds.
What would be nice is the ability to get more los as turrets are built on higher gorunds and units being on higher grounds.

Re: heightDamageBonus request

Posted: 08 Dec 2008, 21:57
by lurker
Gota wrote:What i would like is for laser based weapons to not get a range bonus when they are on higher grounds.
Have you looked in the past few months?

Re: heightDamageBonus request

Posted: 08 Dec 2008, 22:06
by Pressure Line
lurker wrote:
Gota wrote:What i would like is for laser based weapons to not get a range bonus when they are on higher grounds.
Have you looked in the past few months?
Do not feed the trolls.

Thats completely definable by the modder, (and iirc lasers always used cylinder targetting) lern2tdf Gota.

Re: heightDamageBonus request

Posted: 09 Dec 2008, 00:08
by Evil4Zerggin
Would something like

Code: Select all

flankingBonusMode = 3, --mode 1 would probably work too
flankingBonusMobility = 0,
flankingBonusMobilityAdd = 0,
flankingBonusMax = 1.25,
flankingBonusMin = 0.75,
flankingBonusDir = "0 -1 0",
be close enough? It is indeed based on attacker direction, not hit direction:
Unit.cpp wrote: const float3 adir = (attacker->pos - pos).Normalize();
[...]
float3 adirRelative;
adirRelative.x = adir.dot(rightdir);
adirRelative.y = adir.dot(updir);
adirRelative.z = adir.dot(frontdir);
[...]
damage *= flankingBonusAvgDamage - adirRelative.dot(flankingBonusDir) * flankingBonusDifDamage;
No threshold though.

Re: heightDamageBonus request

Posted: 09 Dec 2008, 00:29
by Pressure Line
you could do it with HitByWeapon as well. just add a percentage onto the damage taken if it comes from above a certain angle.

Re: heightDamageBonus request

Posted: 09 Dec 2008, 00:36
by lurker
It won't be based on attacker direction for long now that better collision detection is in. :P

Re: heightDamageBonus request

Posted: 09 Dec 2008, 10:04
by Warlord Zsinj
'better' is entirely arguable, atleast for 077b5 :P

Re: heightDamageBonus request

Posted: 09 Dec 2008, 10:07
by lurker
It's not that collision isn't detected, it's that it forgets to apply the 'always damage what was hit' rule. Different functions. :P

Re: heightDamageBonus request

Posted: 09 Dec 2008, 10:27
by KDR_11k
Could just add damage in UnitDamaged to avoid having to modify tons of COBs...