Page 1 of 1

Caculating Health and Damage

Posted: Thu Apr 22, 2010 10:22 pm
by Dyn0myte
I was curious how other people calculate the health and damage in their game. Right now what I have, and I guess simplistic, is simply setting a value for the health and damage. So Enemy A has 100 health and the gun has 5 damage, so every hit takes off 5 points from the enemy's health. However that goes pretty fast with raycasting in an FPS, so I have to figure out a better way.

I was just curious if anyone did any actual percentages with armor, extra damage, or any other form of calculation.

Re: Caculating Health and Damage

Posted: Fri Apr 23, 2010 12:16 am
by reptor
What kind of objects would be targets?

For example: A "real" battle tank. Will have different armour values front versus rear, and sides. Usually if you can get behind a tank then it should be easier to blow it up than if you are facing the front of it.


OK... let's say you just mean "humans" hitting other "humans" with "bullets". I know one game which I like a lot, it's Operation Flashpoint by Bohemia Interactive Studio. If you are hit in the head you die. Problem solved! :lol:

If you are hit in the legs then you likely cannot stand up and have to crawl. In a mission where there are several kilometres to travel, this can be pretty interesting... fortunately in single-player mode you can speed the time up 8)

If you are hit in the arms then your arms will start to flounder and as a consequence it will become difficult to aim with your weapon.

Of course there are different levels of damage for each of those, but the main principle is that the unit will get seriously injured or die easily. Because that's what humans tend to do when hit with bullets in real life.

This is a question of realism - how far do you want to go with that?

Regarding Operation Flashpoint - there is for example one flaw in its damage model - you can blow up a tank with hand grenades if you keep throwing them at it. That's quite unrealistic. So they do have a "damage points" system built in there certainly. They've improved it in later games they've released but I am not so knowledgeable about that. If you want to read about what the "community" knows about the damage models in those games then start from http://www.bistudio.com and read the wiki and the forums... I think this game developer is aiming at a much higher level of realism than the usual game developers are aiming at and you can't go much wrong with your simpler game if you have a look at how they did it. They've developed real-life military training products as evolutions of Operation Flashpoint so they should know something about it.

It is another thing whether you want to follow that path of philosophy or not - maybe you want your players to be able to keep shooting even if they got a few bullets in the brain already! :lol: It's a question of what kind of a game are you creating - you didn't tell it in this thread. If it's "arcade" then it's probably better not to make it as punishing as it is in Operation Flashpoint.

Re: Caculating Health and Damage

Posted: Fri Apr 23, 2010 12:50 am
by jacmoe
Quake damage or one-bullet-is-enough ?

You could of course also employ some DnD type dice throwing :)

Re: Caculating Health and Damage

Posted: Fri Apr 23, 2010 1:21 am
by Dyn0myte
Interesting case about the rear and side damage. I guess with that, you'd need to create multiple collision planes/boxes; one for each side.

Actually, now that I'm reviewing my code, I'm using raycasting. How will be the best way to calculate the damage then? I can't simply decrement the values because it'd go too fast, unless I use large values (10000 health). Maybe use a timer?

Re: Caculating Health and Damage

Posted: Fri Apr 23, 2010 4:26 am
by tominku
Dyn0myte wrote: Actually, now that I'm reviewing my code, I'm using raycasting. How will be the best way to calculate the damage then? I can't simply decrement the values because it'd go too fast, unless I use large values (10000 health). Maybe use a timer?
It's too fast becuase the raycasting decrements hp in every frame.
in the real games, there is always a concept called 'tick damage' it does decrements hp in
every tick. not every frame. so i think you need to define the tick in every continual attack.
actually the tick is a set of frames. 1 tick may consist of 30frames(0.5sec) or any frames you want

Re: Caculating Health and Damage

Posted: Fri Apr 23, 2010 5:43 am
by Dyn0myte
Ah, that's interesting to know. I was trying to figure out how to use some sort of timer, but that should work fine. Thanks for the tip!

Re: Caculating Health and Damage

Posted: Sat Apr 24, 2010 7:52 am
by jjp
Your game logic should generally be independent of the actual frame rate and time. Either you update everything in fixed intervals, or you determine the time that has passed for each step and multiply things like damage with a factor.

Re: Caculating Health and Damage

Posted: Sun Apr 25, 2010 10:54 pm
by Dyn0myte
Thanks for the info. That's exactly what I was planning. I have a class that keeps track of the time that has passed and use it to pass that information to other parts of my program that need it.

Re: Caculating Health and Damage

Posted: Sun May 02, 2010 4:18 am
by EricB
Currently, I'm using a Great Naval Battles hybrid.

An airship has 6 sides, the sides and poles will be divided into sections, roughly 18 planes. When a plane is hit it'll correspond to a "damage grid" (the exact spot will be random), damage will be dependent on (armor - (weapon dmg - ac if >0 ), when the armor reaches 0, the grid is destroyed along with anything in it.

In theory anyway

GNB example.
Image



OP may I ask if you go to UCF?

Re: Caculating Health and Damage

Posted: Mon May 03, 2010 2:04 am
by Dyn0myte
Wow 18 planes, that's a lot to keep track of. But yeah, unfortunately I haven't been able to test out my code yet, due to finals. I do go to UCF.

Re: Caculating Health and Damage

Posted: Tue May 04, 2010 3:08 am
by EricB
Dyn0myte wrote:Wow 18 planes, that's a lot to keep track of. But yeah, unfortunately I haven't been able to test out my code yet, due to finals. I do go to UCF.
well think of it this way, 4 boxes, with the center box's left and right planes not being used :P

I attend ucf as well, every other semester :lol: