Jump to content
  • Advertisement
Sign in to follow this  
Erzengeldeslichtes

Self integration?

This topic is 5466 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a part of my game that does "non-lethal damage", which deals damage to the health depending upon what percentage the health is. The equation looks like this: c = c - A((c/m) - s) where c is the current health, m is a constant representing the max health, s is a constant scalar (which can be between 0.05 or 0.5, where lower level characters only take non-lethal damage up to 50% of their health and the highest level characters take damage until 5% life). Now at the moment I do a for loop to continuously calculate what c is after doing a bit of damage (In other words, if I want to do 100 damage, I loop through and calculate this equation 100 times with 1 for A), so that the damage is fully reduced depending on how low your health is. Now what I'm thinking is that this could be done with integrals, but I can't seem to recall (or find in my calculus books) how I would go about integrating the changing c since c is the result and also a variable. C is changing based on this equation which is based on c which is based on this equation which is... you get the point. Is it possible to do with integrals, and if so, how? Thanks for any help.

Share this post


Link to post
Share on other sites
Advertisement
You got a differential equation to solve : c' = - A((c/m) - s)

How about C(t)=C0(s+(1-s)e-At/m) ?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!