Author Topic: Damage calculator  (Read 22825 times)

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Damage calculator
« on: March 28, 2013, 03:10:00 pm »
I know there was a damage calculator spreadsheet around here somewhere. I was hoping someone could repost it and explain the damage formulas since I probably won't be able to open the spreadsheet up :smash2:

Offline Verdite

  • VIP
  • Dark Slayer Destroyer
  • *****
  • Posts: 1624
Re: Damage calculator
« Reply #1 on: March 28, 2013, 04:18:52 pm »
I hope Wolf doesnt mind me linking to his thread, its his work

 :grumble: :science: :zx11shocked:

http://www.swordofmoonlight.com/bbs/index.php?topic=493.msg5821#msg5821

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Damage calculator
« Reply #2 on: March 28, 2013, 05:30:38 pm »
Yeah that's the problem with this "calculator" I see (again) now. I can't use it, and can't even open the file in a text editor to look for formulas because its all binary or encrypted or something one.

If the calculator works, how come we don't have a document explaining how damage is calculated? Or must I figure that out myself and publish the information for everyone (as always) too? :1782:
« Last Edit: March 28, 2013, 05:32:10 pm by Holy Diver »

Offline Verdite

  • VIP
  • Dark Slayer Destroyer
  • *****
  • Posts: 1624
Re: Damage calculator
« Reply #3 on: March 28, 2013, 07:02:40 pm »
I'm sure wolf knows best.

Offline HwitVlf

  • Dark Slayer Destroyer
  • ****
  • Posts: 1667
Re: Damage calculator
« Reply #4 on: March 28, 2013, 07:18:55 pm »
I don't mind you linking at all Ben. Once I post it, it's "open season" :wink:

Mick, there are several Excel readers readily available that don't require Microsoft Office, including tools that convert Excel into free-standing EXE files and the formula is easily viewable in the (who would have guessed) "FORMULA BAR". 

If you want my advice, the damage formula should be the first thing you yank out with your Ex wrapper. A simple system where "damage = attack-defense" would be better.

SoM's current setup is designed to make damage increase/decrease  exponentially as player/enemy stats get further apart. Which means that lower level enemies will get "1-hit killed" and higher level enemies will be overpowering. So the only game area that will be challengingly fun to play is the area designed to match your current level. Everywhere else will be easy or deadly.

The simple way of thinking of the formula is if ATK=DEF then damage = ATK/2.

P.S. Continually saying you "always have to do everything yourself" is probably the best way to insure you WILL have to do everything yourself.

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Damage calculator
« Reply #5 on: March 28, 2013, 09:21:52 pm »
So far I have done everything on the technical end myself. I've had assistance, but nothing would get done otherwise.

If you could make the calculator an EXE it would be a lot more accessible. If it works, then why not post the formulas? Or is that a proprietary secret?

The calculator does factor in Strength and Magic right? If not, how is that done? Or is it just player damage, and is Strength not a factor?


PS: I would have thought "attack-defense" without having ever tried anything myself. Is that all for player damage? You can see enemy damage in at least two ways with Ex. But player damage you'd just have to watch the HP drop and do the math without adding anything new.

I am about to add a Damage section for setting up falling damage, or impact damage rather, you could explain how you think that should work to override the default behavior WRT to all types of damage if you want to influence that... although its a little bit early for that because I have no idea to go about changing things in this dept. But if there was a really good game plan and a lot of demand that might make things more attractive.

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Damage calculator
« Reply #6 on: March 29, 2013, 10:05:29 am »
P.S. Continually saying you "always have to do everything yourself" is probably the best way to insure you WILL have to do everything yourself.

Just to be doubly clear on this, I can honestly care less why people opt not to do good in the world. It's totally not my business (there's obviously no shortage of people not being part of the solution. And even if some kind of nonsensical (borderline insane) mental gymnastics can remedy that, it's not worth the headache (nor tempting insanity) or the time and effort while there is so much work to be done :1zhelp:)


I just want to add, its almost irrelevant, but I've been putting a lot of thought into a different damage system that I think would be ideal for King's Field, but works just as well for any game. It leads me to think that the damage calculation should be broken up into two parts. The first part can probably be called the damage model, and the second part the damage formula.

There may be more parts, but this seems to be logical, because the system I have in mind changes the model, but not the formula. Or in other words it is independent of the formula. In the post up above "ATK=DEF then damage = ATK/2" expresses the formula. And the classical model is simply ATK=ATK and DEF=DEF.


Now I will explain a new model, I've decided to call the Void model. In the Void model only the magical affinities deal damage, so that the physical affinities cancel out. But first the magical affinities are modulated by the physical affinities, in the form of N dimensional unit vectors, where N is equal to the number of physical affinities. The formula is applied to each component of the vectors. So there are N*M sources of damage (instead of N+M) where M is the number of magical affinities....

In other words, you don't have a fire attack and a slash attack, you have a slashing fire attack. And you can't have a slashing fire attack and a piercing water attack in the same attack. You can have a slashing and piercing fire and water attack though.

So if a piece of armor has 0 fire defense and some slashing defense, and is attacked with a slashing fire attack, then the slashing defense is not a factor, the fire attack passes through unscathed. You could say the slashing defense is voided, but that's not why its called the Void model...


It's called the Void model because it introduces a 4th physical affinity and a 6th magical affinity, but the two affinities happen to be mutually exclusive because of the way they are calculated. Technically they are a dual affinity, so that one is positive and one is negative, or vice versa. Together they are called the Void affinity. And they occupy the hole after the Stab affinity, and the hole after the Holy affinity. You can even treat them as separate affinities if you want to as long as you keep in mind that they can't both exist on the same piece of equipment (not a problem if you only use one or the other)

For the sake of discussion we can call the physical affinity Avoid and the magical affinity Ovoid, or Alpha and Omega void. These affinities only exist if the sum of the physical affinities does not match the sum of the magical affinities. In which case the difference goes into Avoid if negative, or Ovoid if positive. Since physical affinities cancel out in the Void model, the damage itself can simply be said to be Void damage. Void in this case is equal to the Ovoid affinity, since only magical affinities deal damage.

You could probably use whatever kanji SOM_PRM uses for Magical and Physical, but it would just confuse things I think (and not translate into English well) because the void affinities are really remainders, so the Ovoid magical affinity really represents physical damage, so if you were to translate it this way, then you'd have a magical affinity being called Physical.

The simple way to think about this, is if an author setup an attack with 10 Fire damage, and 0 on all of the physical affinities, without the Void affinities then this attack would deal 0 damage. Obviously that's probably not what we want. So after you calculate the difference, there is 10 physical affinity unallocated, so that goes in Avoid, and now you have an attack which has none of the classical physical affinities, so its like a Magic wave attack or something, you can imagine the attack cooking the target from the inside out. Of course you can have armor that can defend against such an attack, or a magical field might be better, but said armor can't defend against an Avoid attack and an Ovoid attack simultaneously.

An Ovoid attack is pretty straight forward. It represents a weapon with no magical properties more or less. One way of looking at it is if a game took place in a contemporary setting, everyday objects would probably deal Ovoid attacks. Since they have not magical properties.


Finally,  I just want to say that I don't think conventional King's Field games require a Dark affinity, like in KF4. But a Void affinity can take its place more or less. That said Void is not at all supposed to represent darkness. But Dark Souls does have an odd kind of Dark magic that deals physical damage and is connected to humanity, so that could be a way to think of it, if you wanted to make a class of magic that deals strictly Void damage. But any magic can deal (a)Void damage in varying degrees. It would probably be interesting if (a)Void magic was a class of attack that can't be defended by natural means, Eg. no equipment can defend it, but spells can, or only a special class of equipment can. But (o)Void damage could potentially be a quality of all equipment if you wanted it to play a significant role in your game. In fact Dark Souls's Dark Magic would almost definitely be Ovoid variety.

Back to KF. The way I see it, any magic that literally manipulates light (or darkness) should use the Holy affinity. But if its like necromancy it should mainly use the Earth affinity. But all of the elements can have a role in necromancy. For example ghosts and skeletons are animated by Wind, unless underwater, then by Water. And unless I have my monsters mixed up a Wraith is really a ghost made of Fire.


PS: By default the void affinities will be hidden, like dark matter/energy you might miss them/not realize the true potential of a weapon or spell. But they will be translatable, so that a game can show them and call them whatever it likes. Also the model will have variations. Like void+1 to convert the first magical affinity to a physical affinity, and void-1 to do the opposite, and so on. And void-less to simply normalize the physical affinities so that no void affinities shall exist and everything is easier to setup.
« Last Edit: March 29, 2013, 10:11:56 am by Holy Diver »

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Damage calculator
« Reply #7 on: March 29, 2013, 11:52:50 am »
EDITED: I think another useful variable would be a weighting system, so that you don't have to think about things, like for example, if Fire magic is always stronger than the other elements, then an automatic weighting system can make sure it always gets a damage boost. I think for KF since Earth is healing, and Water is lesser healing (poison) then, the general damage weights would look like Fire > Wind > Water > Earth (edited: also just happens to roughly line up with the familiar physical states of matter; plasma, gas, liquid, solid)

I don't know if the weights should be pre-applied or post-applied (would be much simpler WRT the Void model; so probably) or if the results of the weighting should appear in the stats in the Equip menu or not. It would be more informative of actual damage output, but would also make the stats appear much more noisy, which when you are dealing with so many affinities already, might not help players make informed decisions about equipment (at the very least it would be tougher to gauge the stats at a glance if they say 77, 66, 55, 44, instead of 60, 60, 60, 60 or whatever... plus if would make a sword like the Dark Slayer look like it is shifted towards fire, when really it is all elements being equal)
« Last Edit: March 29, 2013, 12:05:09 pm by Holy Diver »

Offline HwitVlf

  • Dark Slayer Destroyer
  • ****
  • Posts: 1667
Re: Damage calculator
« Reply #8 on: March 29, 2013, 12:35:21 pm »
Here you go. I copied the formula from the Excel. Now you can't ever say you had to do everything yourself.
Damage =
ROUNDDOWN
(IF(ATK<1,0,
IF(DEF<1,ATK+(STR/5),
IF(((((ATK+(STR/5))+DEF)/DEF-(DEF+DEF)/(ATK+(STR/5)))+1)*(ATK+(STR/5))/2<1,1,
[otherwise](((((ATK+(STR/5))+DEF)/DEF-(DEF+DEF)/(ATK+(STR/5)))+1)*(ATK+(STR/5))/2))))
,0) [round down end]

MAG would be substituted for ATK for Magic damage types. Now aren't you glad you asked? Personally, I wouldn't "bake in" any damage formula. I would set up a simple default formula which is loaded from an external configuration text document. Thus letting users insert their own formula if they want.
« Last Edit: March 29, 2013, 12:41:59 pm by HwitVlf »

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Damage calculator
« Reply #9 on: March 29, 2013, 02:53:56 pm »
Here you go. I copied the formula from the Excel. Now you can't ever say you had to do everything yourself.

Lets not be so bitter now.

Quote
Damage =
ROUNDDOWN
(IF(ATK<1,0,
IF(DEF<1,ATK+(STR/5),
IF(((((ATK+(STR/5))+DEF)/DEF-(DEF+DEF)/(ATK+(STR/5)))+1)*(ATK+(STR/5))/2<1,1,
[otherwise](((((ATK+(STR/5))+DEF)/DEF-(DEF+DEF)/(ATK+(STR/5)))+1)*(ATK+(STR/5))/2))))
,0) [round down end]

This is a lot to tease apart. Lets see...

Quote

IF(ATK<1) RETURN 0;

ELSE ATK = ATK+STR/5; IF(DEF<1) RETURN ATK;

RETURN (1+(ATK+DEF)/DEF-DEF*2/ATK)*ATK/2+1;

Does this look correct? Syntax aside. I am pretty sure that SOM rounds up if non-zero. I just stuck +1 on the end to guarantee damage. I actually think damage should be rounded down to zero, but that's another story.

Did you use an exponential function to generate this? I expected something that would convert to some number between 0 and 1 and probably do a simple square operation to yield the exponential curve.

The simple take away is you seem to get a full point bonus for every 5 strength. If you can confirm for me this simplification is correct (parenthesis overload) I intend to take a second look and see if it can't be better expressed in terms of ratios. How certain are we that this will always produce the same results in game?

Quote
MAG would be substituted for ATK for Magic damage types. Now aren't you glad you asked?

It's all in a days work. Dealing with unsavory characters is what I do :cool:

But are you positive that Magic is used for the magical affinities? It seems like it would make more sense if Strength was for weapons, and Magic was for magic missiles.

Quote
Personally, I wouldn't "bake in" any damage formula. I would set up a simple default formula which is loaded from an external configuration text document. Thus letting users insert their own formula if they want.

That is the idea, since its a formula after all. But some kinds of operations can be a bit much to express in simple calculator like syntax. Once you get to the formula part it should be like defining a simple kernel with just ATK and DEF as inputs.


EDITED: It looks to me like this function can only decrease the damage. So its not obvious how you could end up doing one hit kills unless the attack power exceeds the monster's HP in the first place. In other words, aside from the linear Strength/Magic bonus, the function appears to just be modeling defensive armor.
« Last Edit: March 29, 2013, 03:01:54 pm by Holy Diver »