
New Radius Damage
|
posted 10-16-98 12:00 AM CT (US) Here's how it works: ·
Finds all targets within maxrange ·
Finds distance between explosion and target ·
Subtracts one point of damage per unit that the target is from the
explosion Here's how my new
function works: ·
Finds all targets within maxrange ·
Finds distance between explosion and target · Evenly
distributes the radius damage over the blast area. So, the target looses
radius damage * (1 - (distance / maxrange)) Effectively, the
damage is now evenly distributed with the outer bounds of the explosion
dealing minimal damage, and the closer you get, the more damage you recieve. Here's the new
function: /* ============ T_RadiusDamage ============ */ void T_RadiusDamage (edict_t *inflictor, edict_t *attacker, float damage, edict_t *ignore, float radius, int mod) { float points; edict_t *ent = NULL; vec3_t v; vec3_t dir; while ((ent =
findradius(ent, inflictor->s.origin, radius)) != NULL)
VectorAdd (ent->mins, ent->maxs, v); Hope you find this
of use. I sure did. With the standard q2 function radius damage always had to
be greater than the blast radius to ensure that at least one point was dealt
per unit away from the blast while within the blast radius. However, my
function allows you to specify and blast radius and any radius damage
ammounts. And, by the way, rocket jumping with the new radius damage function
absolutely rulez... I can't explain it exactly, but it actually
"feels" more realistic : ) -WarZone- |
|
|
posted 10-16-98 1:24 PM CT (US) |
|
|
posted 10-16-98 4:41 PM CT (US) to: damage = (1 /
(sqrt(VectorLength(v) / radius)); This might not be an
exactly correct inverse-square... but almost. =) Haven't tried this in quake, so dont blame me if it sux. (oh, and please shout if the above math is totaly of track... im abit rusty on this stuff =) |
|
|
posted 10-16-98 5:24 PM CT (US) damage *= 1 -
(sqrt(radius) / sqrt(VectorLength(v)); Now there's a nice
parabolic damage distribution :) -WarZone- |
|
|
posted 10-16-98 6:39 PM CT (US) And your equation
doesn't quite make sense... (i notice some mistakes in my first try too =). The way your trying,
it should proberly be: right? well... nevermind, I dont think any of this will be very useful in quake anyway. It just takes up CPU power... and no one will hardly notice =). |
|
|
posted 10-17-98 9:45 PM CT (US) |
|
|
posted 10-17-98 10:04 PM CT (US) points =
damage/(VectorLength(v)^2); That is if
vectorlength is really the distance from the origin.. It may be, however,
that the other functions provided above are indeed mathematically equivalent.
Dunno, but I sure like Warzone's function! If nothing else, it just looks
good!!! |