The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom armor rating calculation
Author Message
Murmur
Apprentice
*

Posts: 33
Likes Given: 3
Likes Received: 2 in 2 posts
Joined: Feb 2013
Reputation: 0



Post: #1
Custom armor rating calculation
First, I'd like to thank everyone for helping me get to this point. I have wanted to create my own custom combat system for literally 15+ years and it's finally becoming a reality, so thank you very much.

I have successfully created my custom @HitTry and @Hit, and I'm very satisfied with them.

Logically, next is doing my @GetHit for calculating armor.

Since my server would be considered a customized T2A or pre-T2a, all I need to do is calculate how much damage is done in melee and spells in regards to one value, the AR value (or I guess in modern terms, physical AR).

I have my pseudocode completely fleshed out, and I have tested all the calculations on a dynamic spreadsheet. There is only one snag I've hit.

My core calculation in my pseudocode is
Code:
damage * (100 - ARMOR) / 100

I've tried my absolute best to do my homework at each step, and I'm 100% convinced all my code works with this base formula, but of course, there is a snag in the 'Vision'.

With this formula, any AR value greater than or equal to 100 technically negates any value of damage dealt. That's easy to fix by using percentages to guarantee damage at the end of the calculation, but I'm wanting a little more flexibility in my custom armors that I'm planning on making, so I'd like to use AR values up to 200.

I've messed around with this formula for like 4 hours straight on a spreadsheet and never found one that works. Let me paint 2 scenarios:

Scenario 1:
Armor Calculation is currently 'damage * (100 - ARMOR) / 100'.
20damage * (100 - 50AR) / 100
So that would be:
20 * (50) / 100 = 10 damage

Does anyone have any good ideas on how to implement a similar equation, but with 200AR as the 'max'?

Obviously, this doesn't work:
Scenario 2:
Armor Calculation is currently 'damage * (200 - ARMOR) / 100'.
20damage * (200 - 50AR) / 100
So that would be:
20 * (150) / 100 = 30 damage

It was immediately clear to me this is no good. But I tried for 4 hours to find another algorithm that worked and I just don't think I'm creative enough to figure it out. Has anyone else seen/heard/used a good algorithm for my server idea?

I'd appreciate any input, and thanks again for all the help. I really appreciate it.
-Murmur

*you glance to your left to a region you just surveyed... you glimpse a magical being, more shadow than substance, caught midway in transformation... the figure smiles, the corners of his mouth jut upwards slightly on the edges, suddenly stretched to a length not at all human...*
05-10-2017 05:00 PM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #2
RE: Custom armor rating calculation
Changing the / 100 to /200 should do the trick:

damage * ( 200 - AR ) / 200

At 100 AR you will have 50% damage reduction
At 50 AR you will have 25% damage reduction

and so on
05-10-2017 08:17 PM
Find all posts by this user Like Post Quote this message in a reply
bmanny
Apprentice
*

Posts: 25
Likes Given: 1
Likes Received: 0 in 0 posts
Joined: May 2017
Reputation: 0



Post: #3
RE: Custom armor rating calculation
I do something like this that works nice for me. You would need to determine how you get your armorMod though. I do mine based on my tactics versus creature armor.

if
WeaponDMG * (armorMod/100+1) > 1
dmg = WeaponDMG * (armorMod/100+1)
else
dmg = 1
05-11-2017 02:55 AM
Find all posts by this user Like Post Quote this message in a reply
Murmur
Apprentice
*

Posts: 33
Likes Given: 3
Likes Received: 2 in 2 posts
Joined: Feb 2013
Reputation: 0



Post: #4
RE: Custom armor rating calculation
Thanks darksun84 and bmanny.

@bmanny - I'm completely re-writing it all from nothing. So with your example of dmg = WeaponDMG * (armorMod/100+1), I plugged my AR value (physical AR in modern terms), which, for instance, a full set of normal plate gives 28 AR. When I use your formula with my AR, it looks like this:

10 damage (dagger) * (28AR/100+1) = 12.8 damage
and then lets use a heavy crossbow
24 damage (heavy crossbow) * (28AR/100+1) = 30.72 damage

then I change the armor value from 28 to 100

10 damage (dagger) * (100AR/100+1) = 20.0 damage
and then lets use a heavy crossbow
24 damage (heavy crossbow) * (100AR/100+1) = 48 damage

So with the same weapon, with 100 AR, its doing more damage. So that wouldn't work, I'd have to rewrite how I get my armor value, which has already been done. Thanks for the suggestion though! I'm sure it will help someone at some point searching the forums in the future.

@darksun84 - I have tested this formula a lot tonight, and it looks like it will work for now. I think I want a gradual curve on the % of damage that is mitigated, and I'll probably have to write this out with like 4 different formulas depending on if my armor is less than 50, less than 100, less than 150 and less than 200 but the formula you suggested is almost exactly what I needed at this point.

Thank you again to both of you.
-Murmur

*you glance to your left to a region you just surveyed... you glimpse a magical being, more shadow than substance, caught midway in transformation... the figure smiles, the corners of his mouth jut upwards slightly on the edges, suddenly stretched to a length not at all human...*
05-11-2017 04:48 PM
Find all posts by this user Like Post Quote this message in a reply
bmanny
Apprentice
*

Posts: 25
Likes Given: 1
Likes Received: 0 in 0 posts
Joined: May 2017
Reputation: 0



Post: #5
RE: Custom armor rating calculation
I would actually recommend NOT testing damage against AR. The system is very unscalable and to create engaging pve content means breaking pvp content.

I would try something like this:
Test some variable against armor to get a damage mod.
Apply the damage mod directly to weapon damage(can make damage go up or down).
You may want to regulate the damage to make sure it doesn't go too high or too low.
05-12-2017 01:55 AM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #6
RE: Custom armor rating calculation
maybe "damage * (200 - AR) / 200" should do the trick if you want use max AR value of 200

that's exactly the same way how elemental damages are calculated:
Code:
damage type * (100 - resist type) / 100
of course the main difference is that on elemental combat you must split the single damage into all 5 types (physical/fire/cold/poison/energy) to calculate each value and then add all the 5 results into the final damage. Clients also have RESPHYSICALMAX/RESFIREMAX/etc that will limit char max resist value (75 by default) to prevent them reach resist >= 100 and break the formula. 75 is a nice limit because even at maximum resist ppl still get 25% of the damage. Using old AR there's no MAXAR property so you must do something like this on your code, because if the max AR is 200, it's not a good idea let ppl have 200 AR to make them immortal always resisting 100% of all damages

also if you want to skip sphere internal resist calculations to calculate using your own formula on @GetHit, don't forget to add damage type "dam_fixed" on your @Hit trigger and all other sources of damage, like spells ("LOCAL.DamType |= dam_fixed" on @Effect / @SpellEffect), custom scripts (using DAMAGE 10 dam_fixed), etc
(This post was last modified: 05-17-2017 02:32 PM by Coruja.)
05-17-2017 02:28 PM
Find all posts by this user Like Post Quote this message in a reply
Artyk
Journeyman
*

Posts: 75
Likes Given: 43
Likes Received: 9 in 9 posts
Joined: Sep 2014
Reputation: 0



Post: #7
RE: Custom armor rating calculation
There could be a mathematical formula for your case, but you have to prefix a maximum armor achievable and with that maximum the percentage of reduction you want.
Also you have to choose if every point of armor has a flat corresponding % of reduction or some particular behavior, like the next armor point gives less than the preceding.

In the case you want armor to be flat %, simply use a proportion to calculate the reduction:
max_reduction : max_armor = actual_reduction : actual_armor => actual_reduction = max_reduction * actual_armor / max_armor

In the other case tell us what kind "curve" you want and maybe can be solved with a formula Smile
08-10-2017 04:11 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)