## [No]Damage per distance

Moderator: Developers

### Damage per distance

I suggest a weapon or projectile actor property that increases damage by n factor for every x distance. The general idea is to simulate more realistic ballistics damage from very long distances. It would look something like this,

DamageForce (2, 100) (factor, distance)

Meaning that for every 100 distance it traveled the damage would increase by 2x. Basically at a very long range the weapon or projectile would instakill many monsters and players but would substantially weaker at point blank range.
Conversely,
DamageForce (.5, 100)
This would cut the damage in half for every 100 distance the projectile travelled. Thus the weapon would be devastating at close range but do very little at mid to long range.

Spottswoode

Joined: 17 Jan 2012

### Re: Damage per distance

I think time would be a better modifier than distance.

Also, it should just be DamageForce 2, 100 or DamageForce .5, 100. Parenthesis imply imply it's one value, although without much meaning considering there's nothing using the two numbers.

XutaWoo
one day when going to see the rabbit, there was a previous visitor ...

Joined: 30 Dec 2006
Location: beautiful hills of those who are friends

### Re: Damage per distance

No, time is not a better modifier than distance because it cannot take projectile speed into account. Many weapons (like a custom railgun for instance) with high speeds would die before it could take effect. Velocity, in the formula for stopping power (MV)^2, implies speed with direction.
Time is probably more feasible than distance in programming, it is not a better descriptor under any realistic circumstance.

And on a much less important side note, technically it would be one value in physics.

Spottswoode

Joined: 17 Jan 2012

### Re: Damage per distance

Okay, why is it realistic that ballistic projectiles (i.e., not self-propelling objects) acquire more energy over distance? This seems highly counter-intuitive and I'd like to have an explanation for the physics involved.
Gez

Joined: 06 Jul 2007

### Re: Damage per distance

Gravity?
I don't know. But this is Doom. When has physics ever made sense within it?

ChronoSeth
You are totally unique... just like everyone else.

Joined: 05 Jul 2010

### Re: Damage per distance

Gez wrote:Okay, why is it realistic that ballistic projectiles (i.e., not self-propelling objects) acquire more energy over distance? This seems highly counter-intuitive and I'd like to have an explanation for the physics involved.

Physically it's nonsense, plain and simple.

It's also not quite as easy to implement as it is written here and considering the limited appeal of something this weird, I take the easy solution...

Graf Zahl

Joined: 19 Jul 2003
Location: Germany

### Re: Damage per distance

ChronoSeth wrote:Gravity?

:nitpick:
Only in a planet without air and if you're shooting from higher z to lower z position (gravity is a conservative force btw).

Otherwise (still in the planet) ... air resistance, air resistance ... it will slow every projectile to a certain speed, which depends on the mass of the projectile and the air composition, because it compensates the gravity force.
Edward-san
Mathematics is the language with which God has written the universe. (Galilei)

Joined: 17 Oct 2009

### Re: Damage per distance

Heh, "more realistic".

Spottswoode wrote:No, time is not a better modifier than distance because it cannot take projectile speed into account.
Game logic runs per tic. Projectiles move Speed units per game tic. Unless your projectile speed is non-constant (due to in-state velocity modification), Distance = Speed * Lifetime-Tics. Even with varying velocity you can still add up travel distance each tic.

You can factor up current absolute velocity, and add/subtract to a user variable. (Decorate Expressions and A_SetUserVar will help you here.) Then, A_Explode can be used to deal the actual damage, with the modified damage value passed to it. (The projectile itself can be set to (0) damage.)

NeuralStunner
O'Neill with it.

Joined: 21 Jul 2009
Location: The Colonies

### Re: Damage per distance

Edward-san wrote:
ChronoSeth wrote:Gravity?

:nitpick:
Only in a planet without air and if you're shooting from higher z to lower z position (gravity is a conservative force btw).

Otherwise (still in the planet) ... air resistance, air resistance ... it will slow every projectile to a certain speed, which depends on the mass of the projectile and the air composition, because it compensates the gravity force.

Refer to the second line of my post.

ChronoSeth
You are totally unique... just like everyone else.

Joined: 05 Jul 2010

### Re: Damage per distance

ChronoSeth wrote:Refer to the second line of my post.

ChronoSeth wrote:When has physics ever made sense within it?

Obviously Doom physics never made sense, but it doesn't mean zdoom should implement more nonsense physics properties (though I'd like to ask devs if in these years of development there are some of these).
Edward-san
Mathematics is the language with which God has written the universe. (Galilei)

Joined: 17 Oct 2009

### Re: Damage per distance

Graf Zahl wrote:
Gez wrote:Okay, why is it realistic that ballistic projectiles (i.e., not self-propelling objects) acquire more energy over distance? This seems highly counter-intuitive and I'd like to have an explanation for the physics involved.

Physically it's nonsense, plain and simple.

It's also not quite as easy to implement as it is written here and considering the limited appeal of something this weird, I take the easy solution...

Hmm..no. It's real simple. Long range bullets (.408 Chey Tac for example) are fired in a parabolic trajectory to hit a target around the curvature of the earth with maximum impact. Wind speed, air temperature, and variable humidity also affect bullet trajectory. At 1 mile (or 1760 yards) a bullet travelling at close to Mach 3 generates enough energy to blow a human apart via hydrostatic shock. My example is a SIMPLIFICATION of said physics, as 1 mile in range is completely infeasible in map design with the current standards. Is my example a gross oversimplification? Absolutely. But as stated above, it's Doom and this was just a fleeting suggestion. I was well aware of the goofiness and odds of such a suggestion.
Oh yes, I also said time was more feasible than distance in programming. It's just not better for more accurate simulation.
Just something to think about. Christ.

Spottswoode

Joined: 17 Jan 2012

### Re: Damage per distance

...I'd still like easy damage falloff or rampup over time, considering how much hell it is to modifiy a projectile's damage.

XutaWoo
one day when going to see the rabbit, there was a previous visitor ...

Joined: 30 Dec 2006
Location: beautiful hills of those who are friends

### Re: Damage per distance

Gez wrote:Okay, why is it realistic that ballistic projectiles (i.e., not self-propelling objects) acquire more energy over distance? This seems highly counter-intuitive and I'd like to have an explanation for the physics involved.

I've been told that the Gyrojet is a real-world gun whose projectile accelerates the longer it is in flight, thus theoretically doing more damage if it flies farther.

wildweasel
...huh.

Joined: 15 Jul 2003
Location: Non-euclidean space

### Re: Damage per distance

XutaWoo wrote:...I'd still like easy damage falloff or rampup over time, considering how much hell it is to modifiy a projectile's damage.

Why not suggest a feature to modify a projectile's damage value? That'd give all the flexibility one would really need.

Xaser
secretly a supercomputer being a government

Joined: 20 Jul 2003
Location: .plɹoʍɹǝʌǝu.

### Re: Damage per distance

Hmm..that would be considerably more flexible if it were an actor state or state change. It still doesn't fit quite the purpose I had in mind, but it could be worked around to some degree. I would really want to apply it to a railgun though.

Spottswoode

Joined: 17 Jan 2012

Next