SphereCommunity
Major update on combat engine (damage/armor calculations) - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: General Discussion (/Forum-General-Discussion)
+--- Forum: News (/Forum-News)
+--- Thread: Major update on combat engine (damage/armor calculations) (/Thread-Major-update-on-combat-engine-damage-armor-calculations)



Major update on combat engine (damage/armor calculations) - Coruja - 01-29-2015 11:55 AM

As promised, I'm bringing good news to everyone Smile
With some users feedback, I made a huge optimization on sphere internal damage/armor calculations. This means: the code is now lightweight, faster, and support some new features.

If someone want use new features, just enable it and they will be ready to use.
And if someone want keep using old calculations, they still avaible and fully working too.

Changes:
  • COMBAT_SPECIALDAMAGE and COMBAT_USE_RESISTANCE settings on sphere.ini are now a single COMBAT_ELEMENTAL_ENGINE which does the same thing (but now unified)
  • COMBAT_ELEMENTAL_ENGINE now totally overrides old AR calculations with new AOS damage/resist types instead use both at the same time. If you want the new AOS engine just enable this, otherwise keep it disabled to use the old pre-AOS engine (AR)
  • The old AR was doing a wrong calculation for years and now it's fixed (calculation details explained below)
  • Char damage is now calculated using correct formulas. If unarmed (wrestling) the base damage will be the char DAM (default is 1-4 for all players, but it can be customizable, just make sure that your c_man/c_woman/c_elf_male/etc chardefs has proper DAM set), and using weapons the base damage will be the weapon damage. This base damage can be increased with some bonuses (if COMBAT_OSIDAMAGEMOD it will use OSI bonus calculation, otherwise it will use sphere default bonus [STR/10]).
  • On AOS+ clients, the char status menu now will show exactly the damage range that the char can deal (including all bonuses)
  • New blood effects

Removed features (as discussed here):
  • COMBAT_TARGETTEDHIT setting on sphere.ini. Previously it was used to set a hit prefference and make the char hit this body location. The internal code got removed to make the general code more lightweight, and if someone still using this feature, it can be softcoded on scripts without problems.
  • All "hit location" messages on sphere_msgs.scp. They are just tons of random messages without any real functionality.
  • Old [Physical/Fire/Cold/Poison/Energy]Damage properties got removed and replaced with the new DAM[Physical/Fire/Cold/Poison/Energy], which is compatible with COMBAT_ELEMENTAL_ENGINE and works using correct calculations.

These changes will be live on next nightly (30/01/15), I recommend everyone make some tests before use it on live servers, and also update your sphere.ini (CombatFlags list) and sphere_msgs.scp (just remove all combat_hit_* messages)

Feel free to test it and make any suggestion

More info about elemental engine (AOS) x old AR engine (pre-AOS):



RE: Major update on combat engine (damage/armor calculations) - Jim - 01-29-2015 01:47 PM

Great!
Thanks Coruja! :_)


RE: Major update on combat engine (damage/armor calculations) - dagger4k - 01-29-2015 06:58 PM

good work Coruja


RE: Major update on combat engine (damage/armor calculations) - XuN - 01-29-2015 07:53 PM

Good work, I have to request you to update sphere_combat.scp to keep reflected there the current base formulas and damages so anyone can have access to everything and make use of an updated and fast rework of the hardcoded engine.

Also for me and Ben to keep the removed code in somewhere (targetted code is now in the current sphere_combat.scp) but if it's going to be removed it's not a big deal for us to give out one script with the code instead of making people to try formulas and code they possibly cannot figure out.

And, again, nice work Big Grin


RE: Major update on combat engine (damage/armor calculations) - Lazarus - 02-10-2015 05:22 AM

This is amazing. Thanks!


RE: Major update on combat engine (damage/armor calculations) - Sharlenwar - 03-04-2015 05:42 AM

Hey Coruja! Thanks for the amazing update!

*Yes, I still watch these every so often*


RE: Major update on combat engine (damage/armor calculations) - DerParagorn - 03-05-2015 08:15 AM

Hallo i'am a new and i want to make my first shard.
The New blood effects is this the blood spam on a combat? Can i disable this?


RE: Major update on combat engine (damage/armor calculations) - advikahluwalia - 05-11-2015 07:36 PM

Excellent.. Nice Work You Had Done Coruja :-)


RE: Major update on combat engine (damage/armor calculations) - Lazarus - 09-10-2015 11:01 AM

(01-29-2015 11:55 AM)Coruja Wrote:  AR resist calculation:
It's the old pre-AOS combat engine. It uses only 1 damage type and 1 resist (AR).

Sphere always used a wrong AR formula, where the AR is always a random value between 0~AR (example: if you have 50 AR, you will resist a random 0~50 damage).
Now the AR calculation is fixed and it uses the correct AR formula:

max resist = AR * rand(7, 35) / 100
min resist = max / 2

total resist = rand( min, (max-min)+1 )
final damage = total damage - total resist

There is something weird about this formula.
For example:
Code:
DAMAGE=50
ARMOR=50
Max resist = 50 * 15 / 10 == 7,5
Min Resist = 7,5 /2 == 4
Total resist = Random between (4, (7,5-4)+1) //(this last formula will be min +1 everytime!
Total resist = Random between (4,4)
final damage = 50-4

The unique "RANDOM" PART OF THE CODE will be the 7,35
is this right?