Caculating Health and Damage

A place for Ogre users to discuss non-Ogre subjects with friends from the community.
Post Reply
User avatar
Dyn0myte
Halfling
Posts: 87
Joined: Sat Jul 12, 2008 12:05 am
Location: Orlando, Florida / USA

Caculating Health and Damage

Post 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.
reptor
Ogre Magi
Posts: 1120
Joined: Wed Nov 15, 2006 7:41 pm
Location: Finland
x 5

Re: Caculating Health and Damage

Post 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.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Caculating Health and Damage

Post by jacmoe »

Quake damage or one-bullet-is-enough ?

You could of course also employ some DnD type dice throwing :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
Dyn0myte
Halfling
Posts: 87
Joined: Sat Jul 12, 2008 12:05 am
Location: Orlando, Florida / USA

Re: Caculating Health and Damage

Post 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?
tominku
Gnoblar
Posts: 1
Joined: Fri Apr 23, 2010 3:58 am

Re: Caculating Health and Damage

Post 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
Hi, i'm online game client programmer in south korea.
User avatar
Dyn0myte
Halfling
Posts: 87
Joined: Sat Jul 12, 2008 12:05 am
Location: Orlando, Florida / USA

Re: Caculating Health and Damage

Post 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!
jjp
Silver Sponsor
Silver Sponsor
Posts: 597
Joined: Sun Jan 07, 2007 11:55 pm
Location: Cologne, Germany
Contact:

Re: Caculating Health and Damage

Post 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.
Enough is never enough.
User avatar
Dyn0myte
Halfling
Posts: 87
Joined: Sat Jul 12, 2008 12:05 am
Location: Orlando, Florida / USA

Re: Caculating Health and Damage

Post 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.
User avatar
EricB
Bronze Sponsor
Bronze Sponsor
Posts: 360
Joined: Fri Apr 09, 2010 5:28 am
Location: Florida
x 213
Contact:

Re: Caculating Health and Damage

Post 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?
Image
User avatar
Dyn0myte
Halfling
Posts: 87
Joined: Sat Jul 12, 2008 12:05 am
Location: Orlando, Florida / USA

Re: Caculating Health and Damage

Post 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.
User avatar
EricB
Bronze Sponsor
Bronze Sponsor
Posts: 360
Joined: Fri Apr 09, 2010 5:28 am
Location: Florida
x 213
Contact:

Re: Caculating Health and Damage

Post 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:
Image
Post Reply