Damage per distance
Moderator: GZDoom Developers
- Spottswoode
- Posts: 18
- Joined: Tue Jan 17, 2012 8:41 pm
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.
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.
- XutaWoo
- Posts: 4005
- Joined: Sat Dec 30, 2006 4:25 pm
- Location: beautiful hills of those who are friends
- Contact:
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.
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.
- Spottswoode
- Posts: 18
- Joined: Tue Jan 17, 2012 8:41 pm
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.
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.
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.
- ChronoSeth
- Posts: 1631
- Joined: Mon Jul 05, 2010 2:04 pm
- Location: British Columbia
Re: Damage per distance
Gravity?
I don't know. But this is Doom. When has physics ever made sense within it?
I don't know. But this is Doom. When has physics ever made sense within it?
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49230
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
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...
-
- Posts: 1774
- Joined: Sat Oct 17, 2009 9:40 am
Re: Damage per distance
:nitpick:ChronoSeth wrote:Gravity?
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.
- NeuralStunner
-
- Posts: 12328
- Joined: Tue Jul 21, 2009 12:04 pm
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: capital N, capital S, no space
- Contact:
Re: Damage per distance
Heh, "more realistic".
You can factor up current absolute velocity, and add/subtract to a user variable. ([wiki]Decorate Expressions[/wiki] and [wiki]A_SetUserVar[/wiki] will help you here.) Then, [wiki]A_Explode[/wiki] 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.)
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.Spottswoode wrote:No, time is not a better modifier than distance because it cannot take projectile speed into account.
You can factor up current absolute velocity, and add/subtract to a user variable. ([wiki]Decorate Expressions[/wiki] and [wiki]A_SetUserVar[/wiki] will help you here.) Then, [wiki]A_Explode[/wiki] 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.)
- ChronoSeth
- Posts: 1631
- Joined: Mon Jul 05, 2010 2:04 pm
- Location: British Columbia
Re: Damage per distance
Refer to the second line of my post.Edward-san wrote::nitpick:ChronoSeth wrote:Gravity?
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.

-
- Posts: 1774
- Joined: Sat Oct 17, 2009 9:40 am
Re: Damage per distance
ChronoSeth wrote: Refer to the second line of my post.
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).ChronoSeth wrote:When has physics ever made sense within it?
- Spottswoode
- Posts: 18
- Joined: Tue Jan 17, 2012 8:41 pm
Re: Damage per distance
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.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...
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.

- XutaWoo
- Posts: 4005
- Joined: Sat Dec 30, 2006 4:25 pm
- Location: beautiful hills of those who are friends
- Contact:
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. 

- wildweasel
- Posts: 21706
- Joined: Tue Jul 15, 2003 7:33 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): A lot of them
- Graphics Processor: Not Listed
- Contact:
Re: Damage per distance
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.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.
Re: Damage per distance
Why not suggest a feature to modify a projectile's damage value? That'd give all the flexibility one would really need.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.
- Spottswoode
- Posts: 18
- Joined: Tue Jan 17, 2012 8:41 pm
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.