Jump to content


Photo

Damage Resolution


  • Please log in to reply
17 replies to this topic

#1 ArchMageOmega

ArchMageOmega

    GMC Member

  • New Member
  • 346 posts

Posted 25 April 2007 - 05:55 PM

Here's a quick question that will hopefully spark an interesting discussion. ;)

Imagine you are making some game. You've decided that there are three relevant attributes when it comes to damage: HP, DEF and ATK. Now, the question is, what creative ways can you think of to decide when the enemies die based on their HP and DEF and your ATK?

I'll be honest. I don't intend to use this in a Game Maker Game, at least not any time soon. Still, it's a good discussion to have since it might help other people who run into similar questions. Such a simple system could be applied to just about any genre (except hard-core RPGs, where it's probably too simple).

Here are a couple of examples. The first is probably the simplest, but that's a bit boring.
- Each attack does ATK-DEF damage and the enemy dies when HP reaches 0.
- The enemy dies if RAND*ATK-DEF is greater than HP. (RAND is a random number between 0 and 1.)

Another thing to discuss is what are the desirable properties of such a system. Is randomness good or bad? What range should the stats fall in? Should there be more stats? Etc.

Edited by ArchMageOmega, 25 April 2007 - 05:59 PM.

  • 0

#2 Lukasaurus

Lukasaurus

    GMC Member

  • New Member
  • 685 posts

Posted 25 April 2007 - 08:41 PM

What about weapons? The character should have a base attack power. Something like STR + DEX + LEVEL.

ATK should be a weapon modifier (+1, +2 etc)

base defense power could be STR + END + LEVEL

DEF could be an armour modifier (+1 etc)

HP is based on Endurance (END + 2 x LEVEL)

I don't know. It's too early for me to think straight.
  • 0

#3 syth184

syth184

    GMC Member

  • New Member
  • 1313 posts

Posted 25 April 2007 - 11:00 PM

it should be more of (0-2)*ATK-DAM or (0-1.5). critical ihts are pretty important.

this might help you out. in D&D (the traditional sence, not drag and drop) you have to have liek -15 health before you die. if you have less than 1 you fall unconcious
  • 0

#4 ArchMageOmega

ArchMageOmega

    GMC Member

  • New Member
  • 346 posts

Posted 25 April 2007 - 11:15 PM

Lukasaurus: This was under the assumption that those were the only three stats. In other words, no STR or END. Weapons can simply be an ATK bonus and armor a DEF bonus and leveling up can raise both. (Although, it's easy enough to layer more stats over these, like you did, it doesn't really help this discussion.) Given that, what ways are there of determining when the enemy dies?

syth184: The thing with your formulas is that (0-2)*ATK is the same as (0-1)*ATK with the ATK doubled. Since there's nothing saying what range ATK (or HP or DEF) should be in (which would depend on the formulas anyway), changing the range of the random numbers doesn't do much. If it was something like RAND*RAND*ATK, then it'd make a difference (since that'd make high numbers less likely). Even so, that's only part of the problem. How do DEF and HP factor in?

Edited by ArchMageOmega, 25 April 2007 - 11:16 PM.

  • 0

#5 Lukasaurus

Lukasaurus

    GMC Member

  • New Member
  • 685 posts

Posted 25 April 2007 - 11:18 PM

Current HP / ATK = Damage Dealt

This way, the weaker you get, the less damage you can actually deal. Not sure about defense though.
  • 0

#6 inarma

inarma

    GMC Member

  • GMC Member
  • 599 posts

Posted 25 April 2007 - 11:21 PM

I'm making my own rpg and I have a code for my damage, here goes

damage=round(random(strength*2+accuracy/2)+accuracy/2+wpnstrength)

And when you hit someone its damage-defense.
  • 0

#7 syth184

syth184

    GMC Member

  • New Member
  • 1313 posts

Posted 26 April 2007 - 12:36 AM

i see. but it actualy does make a diffrence wiether it is (0-1) and (0-2). it changes the frequency of getting the same amount fo damage. you CAN negae its effects by doubling health, but thatd be your fault really.

but i see what you are asking. and here are soem things i jsut came up with

(0-1) x ATK = DMG
ATK-DEF/2= % HIT CHANCE (HC)
HP-[(DMG-DEF)*HC]

heres why

first is pretty obviose. in reality its hard to always strike the same spot with the same strenght.

second. if soemthing has has defence it suggests its a defencive creature/person. thus it must be good at dodging too. or it could have places where hitting it doesnt really matter (i.e shell, sheild, ect)

third DEF obviousley lowers the damge you recieve. the damge should also be multiplied by the % cahnge you have a of hitting it, so to say you didnt punch it in the foot.

thats what im using now

heres another idea

ATK - (0-1)*DEF = DMG
HP-(0-1)*DMG

this one is easier

obviousley you dotn always hit the same spot and you ight come across a hard spot that does less damage

last one is another way to check wither you hit them in the foot or sliced through their stomache.

im not 100% sure what you are asking but thats what i understand
  • 0

#8 ArchMageOmega

ArchMageOmega

    GMC Member

  • New Member
  • 346 posts

Posted 26 April 2007 - 04:49 AM

Lukasaurus: Current HP / ATK gets weaker as ATK gets higher though. Did you meant Current HP * ATK?

synth184: What I was saying is that in the (0-1)*ATK-DEF, 4 ATK and 2 DEF would be the same as 2 ATK and 2 DEF in the (0-2)*ATK-DEF system. Another way to show that is: (0-2)*ATK = ((0-1)*2)*ATK = (0-1)*(2*ATK)

These two are interesting though (I just rearranged stuff in the equations):
- (RAND*ATK - DEF)*(ATK - DEF/2) damage
- RAND*(ATK - RAND*DEF) damage

You could also do:
- RAND*ATK - RAND*DEF damage

Can anyone think of any systems that don't simply deal HP damage until the enemy dies? What about this system?
- If RAND*ATK is greater than HP+DEF, do 1 point of damage (obviously HP would be a low number)

Edit: Oh yeah, when you said Hit Chance, did you actually mean that to be a probability (as in a number between 0 and 1)?

Edited by ArchMageOmega, 26 April 2007 - 04:53 AM.

  • 0

#9 ArchMageOmega

ArchMageOmega

    GMC Member

  • New Member
  • 346 posts

Posted 28 April 2007 - 02:08 AM

Is there no more interest in this? This should be discussed more heavily, but everyone seems adverse to talking math, despite how vital math is to game programming.
  • 0

#10 syth184

syth184

    GMC Member

  • New Member
  • 1313 posts

Posted 28 April 2007 - 03:45 AM

i see so you want an origonal way to deal damage. thats diffrent...
so like if

DMG=(ATK+HP) - (E_DEF+E_HP)

E_DEF and E_HP are obviousley for the enemy. adn that makes sence because obviouisley if you are bleeding from the eyes, you wont be able to deal as much damage. also for the emeny its harder to dodge/block if you are more wounded.

thats more a -if you will- yu-gi-oh card game style damage system, whihc if i rember correctly wasnt that bad, w/e.

but you also seem to be looking for something where you deal a fixed amount of damage

so.. say average HP is 1 (stay with me). then to follow the same sort of idea

if (ATK*HP) > (E_DEF*E_HP)
E_HP - .1

thats the same idea but based more on percents with a fixed amount of damage. THough thats a bit boring so i coudl add to it

if (ATK*HP) - (E_DEF*E_HP) > 5
E_HP - .2
else
if (ATK*HP) > (E_DEF*E_HP)
E_HP - .1

then you could amke it more random so player would not easily interpret if they will automaticly win or not (i.e if every turn you deal 1 damage and you have 10 health and fi your opponent always deasl 1 damge and has 5 health. you automaticly win.)
so

if ((RAND*ATK)*HP) - ((RAND*E_DEF)*E_HP) > 5
E_HP - ((0-.09)+.2)
else
if ((RAND*ATK)*HP) > ((RAND*E_DEF)*E_HP)
E_HP - ((0-.09)+.1)

i hope thats closer to what you are looknig for i think its pretty cool, but seems more liek a card game type sytem rather than RPG, though it coudl work out..

maybe you could implement

(RAND*ATK)/(RAND*E_DEF) into it or something if subtrating doesnt cut it?

(btw sorry for my typos but im lazy and not very good at spelling anyway, im sure you can read this fine though :GM123:)

EDIT: oh and when i said hit chance i set it equal to
ATK-DEF/2
which calculates the chance you would hit them based on how powerful your attack it and how sturdy theri defence is

Edited by syth184, 28 April 2007 - 03:47 AM.

  • 0

#11 ArchMageOmega

ArchMageOmega

    GMC Member

  • New Member
  • 346 posts

Posted 28 April 2007 - 09:47 AM

Well, you're right about it being card game like since that's what I was thinking of when I started this thread, but it's very applicable to many types of games. Most games can get away with a numbers-lite system like this unless character customization is a major part of the game.

Anyway, factoring HP into it could be interesting and would make staying healthy a big deal. A simpler version of that from paper and pencil RPGs is that, if you're damaged, you're ATK is reduced by 1.

Actually, most of these formula end up being too complex for a card game though, but no reasonable formula is too complex for a computer game. :GM123:
  • 0

#12 pwhk

pwhk

    GMC Member

  • New Member
  • 407 posts

Posted 28 April 2007 - 11:06 AM

if rand(100)<=HitChance then
begin
dmg=player.atk-enemy.def
enemy.hp-=dmg*rand()
end;

Maybe multiplying constants depending your games' datum.
  • 0

#13 syth184

syth184

    GMC Member

  • New Member
  • 1313 posts

Posted 28 April 2007 - 05:58 PM

well if you are making a card game then you definatly need something diffrent, unless its a copmputerized card game, i mean these topics sort of have to be about gamemaker so, we cant realyl discuss a card game here.

but yeah i realize you hve said this can be impleented into a game so you're probably jsut gonna get complicated stuff which is always cool.( i rember from when i played pokemon, i always wondered how the damage worked. i was too yung to research it but i still kind of want to know...does anyone know?)

anwyay i think ive given my ideas so good luck with your game
  • 0

#14 ArchMageOmega

ArchMageOmega

    GMC Member

  • New Member
  • 346 posts

Posted 28 April 2007 - 09:35 PM

A quick search found this page.

As far as the card game goes, I doubt there's much that can be done that's simple enough for a card game. It's still an interesting exercise in game design. If you can work out a good system just using three stats, it'd be a good start for designing a more complex system.
  • 0

#15 -Twister-

-Twister-

    GMC Member

  • New Member
  • 402 posts

Posted 28 April 2007 - 10:21 PM

3 variables: ATK, DEF, and HP.

You are attacking the enemy, so...

Damage = your ATK - the enemy's DEF.
The damage is then subtracted from the enemy's HP.

...so what's the question?
  • 0

#16 Radnom

Radnom

    Burninator

  • GMC Member
  • 777 posts
  • Version:GM:Studio

Posted 29 April 2007 - 12:48 AM

I'm pretty sure they're looking for something a little more interesting, Element Studios ::lmao::


How about:
damage=ATK-random(ATK/4)
dealt_damage=damage*(1/(DEF-random(DEF/4)))*10

Tested with
ATK=get_integer("ATK",10)
DEF=get_integer("DEF",10)

damage=ATK-random(ATK/4)
dealt_damage=damage*(1/(DEF-random(DEF/4)))*10

show_message(string(dealt_damage))

It's complicated, therefore good!
  • 0

#17 Potnop

Potnop

    GMC Member

  • GMC Member
  • 3102 posts

Posted 29 April 2007 - 06:05 AM

I'd say soemthing like this:

DMG = RAND*ATK;

HP -= DMG-DEF*DMG;
DEF -= (DMG-(1-DEF)*DMG)/100;

In game DEF can be a number from 1-75. But on the code level it's a number from .01 to .75. This way depending on def it defends from a percentage of the attack damage. And the rest of the damage is absorbed by the armor. For this you'd need to find new armor since it diminishes in defensability or whatever. This is mostly how it is in Shooter Games though but it could be fun in RPG's.

Or to do it exactly like in Shooter Games you'd do this:

DMG = RAND*ATK;

HP -= DMG-DEF*DMG;
ARMOR -= DMG-(1-DEF)*DMG;

DEF is armor class. It stays constant unlike the above way. ARMOR itself is the amount of damage left that the armor can absorb. Once ARMOR is zero DEF becomes zero. You could make it so you have to repair the armor or find new armor.
  • 0

#18 ArchMageOmega

ArchMageOmega

    GMC Member

  • New Member
  • 346 posts

Posted 29 April 2007 - 08:28 AM

Element Studios: Yeah, that was the first option I mentioned.

radnom Games: That's a good one, but let me see if I can't rearrange things a bit.
damage_dealt = (ATK - random(ATK/4))/(DEF - random(DEF/4))*10
= 10*(ATK - RAND*ATK/4)/(DEF - RAND*DEF/4)
= 10*(ATK*(3 + RAND)/4)/(DEF*(3 + RAND)/4)
= 10*(ATK/DEF)*((3+RAND)/(3+RAND))
I think if you try it, you should get the same results. (Although I might have messed the math up. I do that some times.)

Potnop: I hadn't thought about having attacks reduce defence/armor in a game like this even though I've played other games where that happens. It could be interesting and would certainly make a place for armorsmiths in the game.

I suppose I should say that the three stats would be the starting values (things that'd be set during character/item creation), and any numbers derived from them would be fine. That includes, for example, DMG or Current_HP.

Here are a few ideas, although I don't really know how well any would work:
- New_HP = floor(Old_HP * ATK / (ATK + DEF))
- Damage = -log(ATK / (ATK + DEF))
- Damage = ATK * ATK / (ATK + DEF)
- If RAND < ATK/(ATK + DEF) then deal 1 damage

Does anyone have any more ideas that don't involve a damage formula, like my fourth idea above?
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users