Re: Calculating relistic falling dammage?

Post 8 is correct, but it's easier to just calculate damage from velocity, because it's usually an info you have available:

damage = damage factor * velocity ^ 2

where velocity is the speed at which your character is going down. The sign doesn't matter here because of the square

So unless there are different gravities into the game, you don't need to divide by the acceleration, because the damage factor can just absorb it by being 9.8 times larger. Whenever you want to model something in a game, what's important is to know how it scales, then you can fine tune factors. In your case, you can choose different factors for different surfaces like post 8 said.

I don't know if you have basic physics notion, so here is a summary:

When we fall, we accelerate. On earth, the acceleration is -9.8 m/s^2, depends on where you are on Earth, there are some variations, but let's say it's -10 m/s^2. It's negative because by convention when it's going down it's negative and going up is positive. Since Earth's acceleration is towards earth, so dowon that is, it's negative by convention.

The unit m/s^2 can be read "meters per seconds squared", but don't be confused by that unit. You know velocity is "meters per second" or m/s, then acceleration is "meters per second, per second" or (m/s)/s or m/s^2. Basically, if I accelerate at a rate of 10 m/s^2, it means my velocity will increase by 10 m/s every second.

So say I'm in the air and my velocity is -5 m/s. Here minus means it's going down, I'm falling at this very instant at 5 m/s. But my velocity increases as I'm accelerating. After 0.5 seconds, my velocity is now -10 m/s. After another 0.5 seconds, so 1 second from start, it's at -15 m/s and so on.

In a game, we usually update parameters by ticks. So if you have a game tick every 0.03 seconds, then you would update your verlocity like that, assuming you are falling:
velocity = velocity - 10 * 0.03 = velocity * 0.3

You can update position like that:
position = position + velocity * 0.03
where 0.03 is tick length

When you hit the ground, calculate damage like that:
damage = damage factor * velocity^2

Of course you can add a treshold like post 8 said.

When you jump, just set velocity to some positive value. Say if you sset velocity = 10, then your character will start going up, as velocity is positive and will loose speed as acceleration is negative. After 1 seconds, velocity will be 0, meaning your character doesn't go up nor does it go down and then he will start going down.

Hope that was somewhat clear. But wait! There is more! You can calculate damage even more realisticly. This is because post 8 assumed damage like that:

1) As you fall, you rack up energy. The faster you go down, the more energy you rack.
2) On impact, the ground violently decelerates you, converting that energy into damage for you.

While that is true, it's oversimplifying. You see, base jumpers who can jump from really high without dieing roll and they hit the ground. This is to spread the impact on as much time as possible. It's also to convert some velocity into rotation. This is because what matters is not energy, but power. Power is energy rate so to speak, energy per second. You wouldn't die if you fell from 200m if you had a equally distributed impact over 1 month. What makes the impact kill is that it's really quick, less than a second.

But you cannot roll if you fall straight, so it depends on the angle at which you hit the ground. Angle will change over time of fall, because usually horizontal velocity is constant and vertical velocity is accelerated downwards.

There is also material bounciness, when you fall with high velocity, depending on the impact distribution, the ground material and the character shape and mass, the character will bounce. In real life, some people survived really high fall, until the second impact, meaning when you bounce, the second impact also inflicts you damage.

It also depends on which body parts hit the ground, if you fall on the head... good luck.

There is also air resistance. If you wonder if a free falling object will keep accelerating as it falls infinitely, well no, it doesn't. The fastest you fall, the more air tries to prevent you from accelerating, until you reach a point where air decelerates you so much that it completely evens out Earth's gravity, meaning you have a net acceleration of 0 m/s^2. This speed at which this happens is called terminal speed or terminal velocity and it depends on the shape of an object, it's orientation, mass, etc. This is why a sheet of paper falss slower than a glass, the sheet of paper's terminal speed is very low.

Remember when I said someone falling straight couldn't roll, well if they place their feet off-centered compared to their center of gravity relative to the ground, they can have a lever effect and create a tork converting some of the downwards velocity into rotation. So I simplified there.

What I want to get at is unless you are making a physics simulator, usually in games, we don't aim for realistic, but rather realistic "enough". This is also true for AAA titles. We approximate because it would take too much CPU to do the most exact calculations factoring in all physics concepts. But mostly because what's important in a game is fun. If you'd like your character to roll when he falls and is moving horizontally to reduce damage, just create a rolling sound asset and include that rolling damage reduction in your damage formula. If you want your character to bounce, add materials a bouncing index that will restitute some upward velocity on impact with a decay and a treshold. If you want your character to have a parachute to use air resistance to reduce damage, just set a max velocity with that parachute, say -10 m/s or whatever you like. If you want to put a mechanic that breaks physics, it's ok too, like those games where you can double jump, although it's impossible to jump on air for us humans, it's still a good mechanic.

So yeah, you can totally use damage = damage factor * velocity^2. Is it realistic, well not really. Is it realistic enough? Depends on your game, but mostly yes.

Note: the formulas here are based on Newton equations, but they were proven not exact, especially at high speeds by Einstein. So even using those formulas are simplification, because the difference is so small at low speeds that it doesn't matter.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : dardar via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : redfox via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : redfox via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Dragonlee via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : redfox via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : omer via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : nuno69 via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Origine via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Origine via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : redfox via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : roelvdwal via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Mitch via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Mitch via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : omer via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : mahdi-abedi via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : rory-games via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : roelvdwal via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : drums61999 via Audiogames-reflector

Reply via email to