Re: Calculating relistic falling dammage?

2019-03-17 Thread AudioGames . net Forum — Developers room : roelvdwal via Audiogames-reflector


  


Re: Calculating relistic falling dammage?

@21You're completely right, it's been too long.. Still the formulas should be correct.ANd especially with games, how would you implement getting to the correct form before landing? I have made the assumption (perhaps I should have stated it) that this would be a game similar to 2d platformer in it's mechanics and falling. Then, having predictable damage results but still them being somewhat realistic is what I'd aim for. If we start obsessing over realism the game itself can be advursly affected, we couldn't have creaking doors for example.

URL: https://forum.audiogames.net/post/419743/#p419743




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Calculating relistic falling dammage?

2019-03-16 Thread AudioGames . net Forum — Developers room : drums61999 via Audiogames-reflector


  


Re: Calculating relistic falling dammage?

Guys, gravity isn't 9.8 meters per second, it's 9.8 meters per second per second.Second, after reaching a certain speed, landing on water is like landing on concrete since liquids do not compress. That's why form is so important when doing those 80 foot dives, they need to pierce the surface tension of the water.Here's a wikipedia article on falling object formula.https://en.wikipedia.org/wiki/Equations … lling_body

URL: https://forum.audiogames.net/post/419530/#p419530




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Calculating relistic falling dammage?

2019-03-16 Thread AudioGames . net Forum — Developers room : roelvdwal via Audiogames-reflector


  


Re: Calculating relistic falling dammage?

Yes. What I wrote is only speed upon impact. Obviously different surfices do more or less damage. The easiest way to define this is to have a factor for each surfice which is multiplied with the health lost. For concrete this could be 1 for example, and water 0.1 (rough estimates). If you want to have more controll over the player's air resistance for example if you have a parachute, you can use the following formula:v += 9.8/(tv*tv) * dttv is the target speed, for a parachute this might be 2 meters per secondBut generally, the more realism the more work.

URL: https://forum.audiogames.net/post/419302/#p419302




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Calculating relistic falling dammage?

2019-03-16 Thread AudioGames . net Forum — Developers room : rory-games via Audiogames-reflector


  


Re: Calculating relistic falling dammage?

I think you should also make it that, depending on how the player fell off, he might fall on his side, face, back, head, causing different types of injuries and just different damages and possibly paralysis. Mind you, I couldn't do math for my life, so I'm useless there.

URL: https://forum.audiogames.net/post/419296/#p419296




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Calculating relistic falling dammage?

2019-03-16 Thread AudioGames . net Forum — Developers room : mahdi-abedi via Audiogames-reflector


  


Re: Calculating relistic falling dammage?

hiI think, eg if tile is 10, player should loos 1000 health: in each hight, 4 health should be lost: for first 3 hights(if hight is <3) or <5, player shouldn't loos any healthwhy I sed in each hight 10 health should be loos? we have mountain with hight of 100: in real life, if you fall you'll die? so it should be in game to make it realistic

URL: https://forum.audiogames.net/post/419273/#p419273




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Calculating relistic falling dammage?

2019-03-16 Thread AudioGames . net Forum — Developers room : omer via Audiogames-reflector


  


Re: Calculating relistic falling dammage?

16, that is right.

URL: https://forum.audiogames.net/post/419270/#p419270




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Calculating relistic falling dammage?

2019-03-15 Thread AudioGames . net Forum — Developers room : Mitch via Audiogames-reflector


  


Re: Calculating relistic falling dammage?

From the physics that I remember (I'm still taking physics in high school, so this may not be correct) you also need to keep in mind your falling momentum and the amount of force the impact with the surface will absorb. For example, you would conceivably take more damage falling onto concrete rather than falling into water, due to the fact that more dense objects are not affected as much by forces, which transers it back to you. The reaction force of the ground acting on you (I think) tends to bleed off some of the momentum that you have achieved during freefall, and the firmness of the ground also plays a part. I haven't checked my facts completely, so take it with a grain of salt, but that's what I remember.  Physics is fun!

URL: https://forum.audiogames.net/post/419171/#p419171




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Calculating relistic falling dammage?

2019-03-15 Thread AudioGames . net Forum — Developers room : Mitch via Audiogames-reflector


  


Re: Calculating relistic falling dammage?

From the physics that I remember [q~"]GhI'm still taking physics in high school, so this may not be correct) you also need to keep in mind how much of the impact the ground will bleed off. For example, you would conceivably take more damage falling onto concrete rather than falling into water, based on Newton's third law. The reaction force of the ground acting on you (I think) tends to bleed off some of the momentum that you have achieved during ⠋⠗⠑⠑⠋⠁⠇⠇⠲Physics is fun!

URL: https://forum.audiogames.net/post/419171/#p419171




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Calculating relistic falling dammage?

2019-03-15 Thread AudioGames . net Forum — Developers room : roelvdwal via Audiogames-reflector


  


Re: Calculating relistic falling dammage?

The more realistic you get the more complicated things become. That said, here's my take:when any object falls down to earth, there are two forces (simplified) working on it:1. Earths gravity, causing an acceleration (speedup) of 9.8 meters per second.So if we would only have gravity, we'd end up falling faster and faster and faster with the same acceleration, 9.8 meters per second.2. The air resistance, and here it gets interesting.The air resistance is squared compared to the velocity. If you don't understand, it basically means that for small velocities the air resistance is allmost not present, but the larger the velocity, the larger the air resistance becomes, eventually balancing out gravity and making someone go down with a constant velocity (terminal velocity). Notice that when someone has a constant velocity the acceleration is 0 (Do you understand why?)According to my google efforts, the max speed for a human falling down is 53 meters per second. This will yield the following:v -= 9.8*dt; // gravity, we are falling down so negativev += 0.003488786045 * v * v * dt; // air resistance for humanAnd here dt is the time elapsed since last computation. So let's say you check movement every 5 ms it will be 0.005. You can use the elapsed value from a timer.So now you only have the impact velocity when something hits the ground. How you map it to health is dependent on your game.

URL: https://forum.audiogames.net/post/419164/#p419164




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Calculating relistic falling dammage?

2019-03-15 Thread AudioGames . net Forum — Developers room : redfox via Audiogames-reflector


  


Re: Calculating relistic falling dammage?

ah! my! brain! oww! ow! ow ow!

URL: https://forum.audiogames.net/post/419141/#p419141




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Calculating relistic falling dammage?

2019-03-15 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: Calculating relistic falling dammage?

if (this._onGround_ == false) this.v.y -= 9.8 * dt;else if (this.v.y < -9.8*dt){ // This is when you hit the ground after falling.falldamage = this.v.y * fallfactor;// landsounds, etcthis.v.y = 0; // assuming you don't want to bounce.}I tend to like values between 5 and 7 for v.y when jumping, but the important thing to remember is that whatever v.y is at the start of a jump, it will be negative that when landing. So you should avoid falldamage for any value of v.y greater than minus jumpspeed, at least.And dt is how much time each frame covers. If you're using timers, this will be time.elapsed * 0.001. If you're using fixed frame lengths, it's whatever that is.

URL: https://forum.audiogames.net/post/419139/#p419139




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Calculating relistic falling dammage?

2019-03-15 Thread AudioGames . net Forum — Developers room : Origine via Audiogames-reflector


  


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 ^ 2where velocity is the speed at which your character is going down. The sign doesn't matter here because of the squareSo 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.3You can update position like that:position = position + velocity * 0.03where 0.03 is tick lengthWhen you hit the ground, calculate damage like that:damage = damage factor * velocity^2Of 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 g

Re: Calculating relistic falling dammage?

2019-03-15 Thread AudioGames . net Forum — Developers room : Origine via Audiogames-reflector


  


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 ^ 2where velocity is the speed at which your character is going down. The sign doesn't matter here because of the squareSo 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.3You can update position like that:position = position + velocity * 0.03where 0.03 is tick lengthWhen you hit the ground, calculate damage like that:damage = damage factor * velocity^2Of 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 g

Re: Calculating relistic falling dammage?

2019-03-15 Thread AudioGames . net Forum — Developers room : nuno69 via Audiogames-reflector


  


Re: Calculating relistic falling dammage?

Oh, good thinking DragonLee. I would use more complex physics equation but I didn't think about the simplest way

URL: https://forum.audiogames.net/post/419070/#p419070




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Calculating relistic falling dammage?

2019-03-15 Thread AudioGames . net Forum — Developers room : omer via Audiogames-reflector


  


Re: Calculating relistic falling dammage?

well use the curront ones until you learn those things then

URL: https://forum.audiogames.net/post/419061/#p419061




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Calculating relistic falling dammage?

2019-03-15 Thread AudioGames . net Forum — Developers room : redfox via Audiogames-reflector


  


Re: Calculating relistic falling dammage?

@8, omfg omfg oomfg omfg omfg!I'm not even in high school yett! I like complex math but god dmn!

URL: https://forum.audiogames.net/post/419049/#p419049




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Calculating relistic falling dammage?

2019-03-15 Thread AudioGames . net Forum — Developers room : Dragonlee via Audiogames-reflector


  


Re: Calculating relistic falling dammage?

your algorithm should have a minimum threshhold  for falling height , since if the player falls down 10 cm then they shouldnt take 1 hp damage. so let's say that starts at 2 meters. from physics we have the potential energy of a object suspended in air is= mass times gravity times heightmass and gravity are constants in this instance, so the variable  we are concerned is height.from this equation, the energy of the impact is linearly proportional to height, so it is reasonable to assume the fall damage would scale linearly. so we can just multiply by the height fallen by a constant damage factor.btw, the height fallen can be derived from the velocity  at impact, sincemass times velocity^2 = mass times acceleration times heightso, rearranging:height = (velocity^2) / accelerationat least that should be right... been a while since I done physics in high school.so the basic algorithm would be in pseudo code:int damage(height) {if height > minimumDamageThreshhold return height * damage_factorelsereturn 0}for some extra realism, the minimum damage threshhold and damage factor can depend on the material of the surface the player fell on, so grass or water would be have greater threshhold and smaller dmg factor and for concrete or a bed of nails it would b the other way around.

URL: https://forum.audiogames.net/post/419041/#p419041




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Calculating relistic falling dammage?

2019-03-15 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: Calculating relistic falling dammage?

Are we talking realtime? If so, just go with v.y on impact.

URL: https://forum.audiogames.net/post/419030/#p419030




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Calculating relistic falling dammage?

2019-03-15 Thread AudioGames . net Forum — Developers room : redfox via Audiogames-reflector


  


Re: Calculating relistic falling dammage?

I think I've got it, I'll just have to iron out how to calculate the fallingspeed into the equation.Base Health lost from falling: fallingdistance+fallingspeed*10 = fallingdammage

URL: https://forum.audiogames.net/post/419008/#p419008




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Calculating relistic falling dammage?

2019-03-15 Thread AudioGames . net Forum — Developers room : redfox via Audiogames-reflector


  


Re: Calculating relistic falling dammage?

@4, I don't understand that, what language is that? Py py?

URL: https://forum.audiogames.net/post/418999/#p418999




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Calculating relistic falling dammage?

2019-03-15 Thread AudioGames . net Forum — Developers room : dardar via Audiogames-reflector


  


Re: Calculating relistic falling dammage?

simple:if(heightz-playerz<10): health-=(heightsz-playerz) else:  player:die()

URL: https://forum.audiogames.net/post/418995/#p418995




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Calculating relistic falling dammage?

2019-03-15 Thread AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector


  


Re: Calculating relistic falling dammage?

Hi, i don't know if it is fine, but i would say:current hight minus the coords the player gets to fall on. like let's say i am on a platform wich is 20 meters high, and i fall to 0, the final health that should be subtracted will then be 20. when you have 1000 health, you would then have 980 health.

URL: https://forum.audiogames.net/post/418985/#p418985




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Calculating relistic falling dammage?

2019-03-15 Thread AudioGames . net Forum — Developers room : redfox via Audiogames-reflector


  


Re: Calculating relistic falling dammage?

hmm, interesting, but I want more realism. If you fall 20 feet, then your going to get a lot more hurt then that.

URL: https://forum.audiogames.net/post/418990/#p418990




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector