Register for your free account! | Forgot your password?

Go Back   elitepvpers › Popular Games › Silkroad Online › SRO Coding Corner
You last visited: Today at 15:02

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Silkroad Damage Formula

Discussion on Silkroad Damage Formula within the SRO Coding Corner forum part of the Silkroad Online category.

Reply
 
Old   #1
 
mgunbatti's Avatar
 
elite*gold: 0
Join Date: Aug 2018
Posts: 54
Received Thanks: 44
Silkroad Damage Formula

Hey everyone

After spending quite some time investigating Silkroad's damage calculations, I wanted to share my findings and the source code with other developers.

I started with the damage formulas that have been circulating in the community for years. They helped us understand the basics, but several parts were still unclear, especially damage randomization, mastery scaling, level differences, and how Imbue damage is actually added.

Instead of continuing to guess where the missing constants 1.27 1.28 come from
Thanks to @ we went directly into the original ''32-bit SR_GameServer.exe'' and analyzed its assembly code with ghidra.

What we found

I. Damage randomization

The GameServer doesn't use a simple uniform random damage roll. We identified a system involving three random samples, their minimum, and an additional random branch that affects damage distribution.

II. Level damage multiplier

The level difference bonus isn't a universal fixed multiplier like 1.28 or 1.30.

The recovered calculation increases damage by approximately 3% per level difference, capped at 30% for a higher-level attacker.

III. Mastery and damage calculations

We traced how mastery affects attack power and identified the separate physical and magical calculation paths, including balance, defense, absorption, and modifier order.

IV. Skill damage and Imbue

One of the most interesting findings was the secondary damage calculation.

The GameServer stores separate percentages for a skill's main damage and its secondary contribution.

For example, Flame Wave can use 250% for its main magical damage while applying 83% to the secondary Imbue contribution.

This explains why simply adding Physical and Magical damage with the same skill multiplier isn't always correct.

V. Critical damage

Critical hits double the physical damage component, not the magical component.

We also identified where integer truncation and floating-point calculations affect the final result.

In-game validation

I compared our calculations against actual in-game damage using Normal Attacks, Physical Skills, Fire Nukes, Cold Nukes, Lightning Skills, and Imbues.

The results were extremely close, with many comparisons differing by only 1–4 damage points. The secondary Imbue contributions matched within 0–1 damage in our three elemental tests.

Source Code & Technical Documentation

I'm making the research and implementation available so other developers can inspect, reproduce, and improve it.

Recovered Damage Engine (JavaScript):**


Original GameServer Analysis (assembly references, offsets, formulas and constants):


Hybrid Damage Implementation:


Full GitHub Repository:


Hopefully, this research will save others some time and help us get closer to a fully understood Silkroad systems to improve.
mgunbatti is online now  
Thanks
3 Users
Old   #2
 
JellyBitz's Avatar
 
elite*gold: 0
Join Date: Sep 2018
Posts: 452
Received Thanks: 1,101
I tried long ago to make the maths on how damage is calculated to know what's the best output, the break point on damage between bow hybrid builds, but I wasn't able to do it.

Here is my maths, I was able to calculate exactly hp/mp/phy and mag balance. But the most important, the damage didn't matched at all in game, I give up.

calcs.py
PHP Code:
### Define your server settings
StatsPointsPerLevel = 3
BaseSTR 
= 20
BaseINT 
= 20
### Define your character
## (Bow lv.135 | 3:0 | FullBlue | Devil 15% | Fire/Cold)
Level = 100
BalancePointsSTR 
= 1 # Ex. 9:10 => 9 STR : 10 INT
BalancePointsINT = 1
SetTotalSTR 
= 0#12*3 # 11 items * 8 STR
SetTotalINT = 0#12*3 # 11 items * 8 INT
ExtraSTR = 5
ExtraINT 
= 0
ExtraHP 
= 0#30*3
ExtraMP = 0#30*3
ExtraHPPercent = 0 # 15% Devil
ExtraMPPercent = 0 #
ExtraPhyDamagePercent = 5 # 5% avatar
ExtraMagDamagePercent = 5
### Define your weapon (Bow | Legendary D15 +15)
PhyAtkPwrMin = 6750
PhyAtkPwrMax 
= 7798
PhyReinforceMin 
= 496.7
PhyReinforceMax 
= 608.7
MagAtkPwrMin 
= 10814
MagAtkPwrMax 
= 12491
MagReinforceMin 
= 794.8
MagReinforceMax 
= 974.0

### WARNING !!!
### Math alert, read by your own risk ...
BalancePointsTotal = BalancePointsSTR+BalancePointsINT
StatsPointsTotal 
= (Level-1)*StatsPointsPerLevel
BalanceTotalSTR 
= StatsPointsTotal*(BalancePointsSTR*1.0/BalancePointsTotal)
BalanceTotalINT = StatsPointsTotal*(BalancePointsINT*1.0/BalancePointsTotal)
STR = BaseSTR + (Level-1) + BalanceTotalSTR + SetTotalSTR + ExtraSTR
INT 
= BaseINT + (Level-1) + BalanceTotalINT + SetTotalINT + ExtraINT
HP 
= round(pow(1.02,(Level-1)) * STR * 10) + ExtraHP
MP 
= round(pow(1.02,(Level-1)) * INT * 10) + ExtraMP
HP 
= HP + (ExtraHPPercent * HP / 100)
MP = MP + (ExtraMPPercent * MP / 100)

M = 28 +Level*4
PhysicalBalance 
= 100-100*2/3*(M - STR)/M  #round(100-(100*2/3*(StatsPointsTotal-STR)/StatsPointsTotal))
MagicalBalance = 100*INT/M
if PhysicalBalance > 120:
    
PhysicalBalance = 120
if MagicalBalance > 120:
    
MagicalBalance = 120

PhyAtkMin 
= (PhyAtkPwrMin+(STR*PhyReinforceMin/100))*(1+ExtraPhyDamagePercent/100)
PhyAtkMax = (PhyAtkPwrMax+(STR*PhyReinforceMax/100))*(1+ExtraPhyDamagePercent/100)
MagAtkMin = (MagAtkPwrMin+(INT*MagReinforceMin/100))*(1+ExtraMagDamagePercent/100)
MagAtkMax = (MagAtkPwrMax+(INT*MagReinforceMax/100))*(1+ExtraMagDamagePercent/100)
### Your Results are on screen! ->
print("SRO Hybrid Solutions v0.0.1")
print()
print(
"HP: "+str(HP))
print(
"MP: "+str(MP))
print()
print(
"STR: "+str(STR))
print(
"INT: "+str(INT))
print(
"Stat points distribuited: "+str(StatsPointsTotal))
print()
print(
"Physical balance: "+str(int(PhysicalBalance))+"(%) "+str(PhysicalBalance))
print(
"Magical balance: "+str(int(MagicalBalance))+"(%) "+str(MagicalBalance))
print()
print(
"Phy. Atk. Pwr: "+str(int(PhyAtkMin))+" to "+str(int(PhyAtkMax)))
print(
"Mag. Atk. Pwr: "+str(int(MagAtkMin))+" to "+str(int(MagAtkMax)))
print(
"Total Atk. Pwr: "+str(int(PhyAtkMin + MagAtkMin))+" to "+str(int(PhyAtkMax + MagAtkMax)))
print(
"Total Atk. Pwr. (Critical): "+str(int(PhyAtkMin*(1+PhysicalBalance/100) + MagAtkMin))+" to "+str(int(PhyAtkMax*(1+PhysicalBalance/100) + MagAtkMax))) 
Let me know if you can

Edit: Oh, and to answer your question, yeah, skill should be flat added to the damage of the weapon based on the percentage it says at the end between parenthesis for each hit.
1 hit (+%100) = x1
3 hit (+%80) = x0.8 + x0.8 + x0.8 so each hit is calculated separately with different dice/roll.
JellyBitz is offline  
Thanks
1 User
Old   #3
 
elite*gold: 0
Join Date: Jun 2014
Posts: 97
Received Thanks: 72
i recently did it to my UE project, and it was a nightmare, but if i manage to, i bet you can also, just put effort
alangomez2 is offline  
Old   #4
dotCom
 
Devsome's Avatar
 
elite*gold: 10077
The Black Market: 107/0/0
Join Date: Mar 2009
Posts: 17,451
Received Thanks: 5,014
Quote:
Originally Posted by alangomez2 View Post
i recently did it to my UE project, and it was a nightmare, but if i manage to, i bet you can also, just put effort
Messages like that don't help at all, so you might as well not reply.
Devsome is offline  
Thanks
5 Users
Old   #5
 
mgunbatti's Avatar
 
elite*gold: 0
Join Date: Aug 2018
Posts: 54
Received Thanks: 44
Quote:
Originally Posted by JellyBitz View Post
I tried long ago to make the maths on how damage is calculated to know what's the best output, the break point on damage between bow hybrid builds, but I wasn't able to do it.

Here is my maths, I was able to calculate exactly hp/mp/phy and mag balance. But the most important, the damage didn't matched at all in game, I give up.

calcs.py
PHP Code:
### Define your server settings
StatsPointsPerLevel = 3
BaseSTR 
= 20
BaseINT 
= 20
### Define your character
## (Bow lv.135 | 3:0 | FullBlue | Devil 15% | Fire/Cold)
Level = 100
BalancePointsSTR 
= 1 # Ex. 9:10 => 9 STR : 10 INT
BalancePointsINT = 1
SetTotalSTR 
= 0#12*3 # 11 items * 8 STR
SetTotalINT = 0#12*3 # 11 items * 8 INT
ExtraSTR = 5
ExtraINT 
= 0
ExtraHP 
= 0#30*3
ExtraMP = 0#30*3
ExtraHPPercent = 0 # 15% Devil
ExtraMPPercent = 0 #
ExtraPhyDamagePercent = 5 # 5% avatar
ExtraMagDamagePercent = 5
### Define your weapon (Bow | Legendary D15 +15)
PhyAtkPwrMin = 6750
PhyAtkPwrMax 
= 7798
PhyReinforceMin 
= 496.7
PhyReinforceMax 
= 608.7
MagAtkPwrMin 
= 10814
MagAtkPwrMax 
= 12491
MagReinforceMin 
= 794.8
MagReinforceMax 
= 974.0

### WARNING !!!
### Math alert, read by your own risk ...
BalancePointsTotal = BalancePointsSTR+BalancePointsINT
StatsPointsTotal 
= (Level-1)*StatsPointsPerLevel
BalanceTotalSTR 
= StatsPointsTotal*(BalancePointsSTR*1.0/BalancePointsTotal)
BalanceTotalINT = StatsPointsTotal*(BalancePointsINT*1.0/BalancePointsTotal)
STR = BaseSTR + (Level-1) + BalanceTotalSTR + SetTotalSTR + ExtraSTR
INT 
= BaseINT + (Level-1) + BalanceTotalINT + SetTotalINT + ExtraINT
HP 
= round(pow(1.02,(Level-1)) * STR * 10) + ExtraHP
MP 
= round(pow(1.02,(Level-1)) * INT * 10) + ExtraMP
HP 
= HP + (ExtraHPPercent * HP / 100)
MP = MP + (ExtraMPPercent * MP / 100)

M = 28 +Level*4
PhysicalBalance 
= 100-100*2/3*(M - STR)/M  #round(100-(100*2/3*(StatsPointsTotal-STR)/StatsPointsTotal))
MagicalBalance = 100*INT/M
if PhysicalBalance > 120:
    
PhysicalBalance = 120
if MagicalBalance > 120:
    
MagicalBalance = 120

PhyAtkMin 
= (PhyAtkPwrMin+(STR*PhyReinforceMin/100))*(1+ExtraPhyDamagePercent/100)
PhyAtkMax = (PhyAtkPwrMax+(STR*PhyReinforceMax/100))*(1+ExtraPhyDamagePercent/100)
MagAtkMin = (MagAtkPwrMin+(INT*MagReinforceMin/100))*(1+ExtraMagDamagePercent/100)
MagAtkMax = (MagAtkPwrMax+(INT*MagReinforceMax/100))*(1+ExtraMagDamagePercent/100)
### Your Results are on screen! ->
print("SRO Hybrid Solutions v0.0.1")
print()
print(
"HP: "+str(HP))
print(
"MP: "+str(MP))
print()
print(
"STR: "+str(STR))
print(
"INT: "+str(INT))
print(
"Stat points distribuited: "+str(StatsPointsTotal))
print()
print(
"Physical balance: "+str(int(PhysicalBalance))+"(%) "+str(PhysicalBalance))
print(
"Magical balance: "+str(int(MagicalBalance))+"(%) "+str(MagicalBalance))
print()
print(
"Phy. Atk. Pwr: "+str(int(PhyAtkMin))+" to "+str(int(PhyAtkMax)))
print(
"Mag. Atk. Pwr: "+str(int(MagAtkMin))+" to "+str(int(MagAtkMax)))
print(
"Total Atk. Pwr: "+str(int(PhyAtkMin + MagAtkMin))+" to "+str(int(PhyAtkMax + MagAtkMax)))
print(
"Total Atk. Pwr. (Critical): "+str(int(PhyAtkMin*(1+PhysicalBalance/100) + MagAtkMin))+" to "+str(int(PhyAtkMax*(1+PhysicalBalance/100) + MagAtkMax))) 
Let me know if you can

Edit: Oh, and to answer your question, yeah, skill should be flat added to the damage of the weapon based on the percentage it says at the end between parenthesis for each hit.
1 hit (+%100) = x1
3 hit (+%80) = x0.8 + x0.8 + x0.8 so each hit is calculated separately with different dice/roll.
thanks bro you save me a lot of time on hp mp phy mag balance,ı cooked some damage formulas but didnt tested yet when its finished i share the code here
mgunbatti is online now  
Old   #6
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,000
Received Thanks: 471
I did a very deep research and I've got this result

At the moment I don't have the access to my computer, but as soon I will, I will upload the dmg formula, it's reversed from the original GameServer binary... I will update this post, asap
leo2111 is offline  
Old   #7
 
mgunbatti's Avatar
 
elite*gold: 0
Join Date: Aug 2018
Posts: 54
Received Thanks: 44
Quote:
Originally Posted by leo2111 View Post
I did a very deep research and I've got this result

At the moment I don't have the access to my computer, but as soon I will, I will upload the dmg formula, it's reversed from the original GameServer binary... I will update this post, asap
Interesting.Since you said it was reversed from the original GameServer, could you also share the
  • GameServer version,
  • function address/RVA,
  • small Ghidra/IDA snippet
  • constants used by the calculation
when you post the formula? That would make it much easier to verify.
mgunbatti is online now  
Old   #8
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,000
Received Thanks: 471
Quote:
Originally Posted by mgunbatti View Post
Interesting.Since you said it was reversed from the original GameServer, could you also share the
  • GameServer version,
  • function address/RVA,
  • small Ghidra/IDA snippet
  • constants used by the calculation
when you post the formula? That would make it much easier to verify.
I wrote it in a .md file , try to open it via a program that supports the .md, looks nicer, easier to understand, I also uploaded the gameserver version that I used to extract it.
This is the base calculation.
This document covers damage amounts and the immediately relevant caller modifiers. It does not claim a complete probability model for accuracy, avoidance, critical chance, blocking, abnormal-status application, aggro, or skill-target selection.

--The .exe I used to extract the formula is ISRO-R GameServer, RIGID files, I don't know if whoever had it before reaching me, edited something related to the dmg formula, which I doubt... so whatever .md file details contains, it's from that compiled version of GameServer, also mind one thing, VSRO version might be different, I wouldn't say very different, from my understanding. SROR introduced dmg 1, when the calculation reaches a certain coefficient.

leo2111 is offline  
Old   #9
 
mgunbatti's Avatar
 
elite*gold: 0
Join Date: Aug 2018
Posts: 54
Received Thanks: 44
Quote:
Originally Posted by leo2111 View Post
I wrote it in a .md file , try to open it via a program that supports the .md, looks nicer, easier to understand, I also uploaded the gameserver version that I used to extract it.
This is the base calculation.
This document covers damage amounts and the immediately relevant caller modifiers. It does not claim a complete probability model for accuracy, avoidance, critical chance, blocking, abnormal-status application, aggro, or skill-target selection.

--The .exe I used to extract the formula is ISRO-R GameServer, RIGID files, I don't know if whoever had it before reaching me, edited something related to the dmg formula, which I doubt... so whatever .md file details contains, it's from that compiled version of GameServer, also mind one thing, VSRO version might be different, I wouldn't say very different, from my understanding. SROR introduced dmg 1, when the calculation reaches a certain coefficient.

Thanks a lot, We had already worked out most of the damage formula, but your files helped us finally understand the 1.30 / 1.28 constants and the Attack Rate part. Those were two of the missing pieces in our research.
I’ll post our cleaned-up formula and findings once I tested new formula in game.
mgunbatti is online now  
Old   #10
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,000
Received Thanks: 471
Quote:
Originally Posted by mgunbatti View Post
Thanks a lot, We had already worked out most of the damage formula, but your files helped us finally understand the 1.30 / 1.28 constants and the Attack Rate part. Those were two of the missing pieces in our research.
I’ll post our cleaned-up formula and findings once I tested new formula in game.
Lovely. I will update my post once I have extra information!
leo2111 is offline  
Old   #11
 
mgunbatti's Avatar
 
elite*gold: 0
Join Date: Aug 2018
Posts: 54
Received Thanks: 44
Quote:
Originally Posted by leo2111 View Post
Lovely. I will update my post once I have extra information!
**Silkroad Damage Formula – In-Game Test Results**

All tests were performed using normal attacks, without imbue or additional damage bonuses.

| Test | Attacker | Target | Calculated Max | In-Game Max |
|---|---|---|---:|---:|
| 1 | Lv51, STR 297, AP 1300–1550 | Manyang Lv1 | Reference test | 2758 |
| 2 | Lv51, STR 227, AP 1185–1410 | Manyang Lv1 | 2082 | 2082 |
| 3 | Lv51, STR 227, AP 1185–1410 | Yeoha Lv10 | ~1888* | 1888 |
| 4 | Lv52, STR 301, AP 1315–1568 | Bunwang Lv45 | ~1442 | 1442 |
| 5 | Lv52, STR 301, AP 1315–1568 | Manyang Lv1 | 2782 | 2783 |

*Test 1 was used as the initial reference. Test 3 was recalculated after correcting the target absorption input.*

**Final independent test: 2782 calculated vs. 2783 observed — only 1 damage difference.**

These results show very close agreement between the reconstructed damage calculation and observed in-game normal attacks.
mgunbatti is online now  
Old   #12
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,000
Received Thanks: 471
Quote:
Originally Posted by mgunbatti View Post
Do you also have the server data/config/database files used with this SR_GameServer.exe? I’m specifically trying to recover the runtime values for character parameters 174, 175, 178, 180 and 259, plus the basic attack descriptor value.


I used these.

PARAM_DMG_ABS_PHY_MIN = 174,
PARAM_DMG_ABS_PHY_MAX = 175,
PARAM_PHY_DMG_REDUCE = 178,
PARAM_PHY_DEF_REDUCE = 180,
leo2111 is offline  
Old   #13
 
mgunbatti's Avatar
 
elite*gold: 0
Join Date: Aug 2018
Posts: 54
Received Thanks: 44
Quote:
Originally Posted by leo2111 View Post


I used these.

PARAM_DMG_ABS_PHY_MIN = 174,
PARAM_DMG_ABS_PHY_MAX = 175,
PARAM_PHY_DMG_REDUCE = 178,
PARAM_PHY_DEF_REDUCE = 180,

Yea i made big progress.But i must confess there is 3687 skill data and each one have different parameters to effect end damage for example.Fire Tree Nukes

Element Skill Count MainDamage(Param4) Imbue Rate(Param7)
Fire A 18 %250 %83
Fire B 18 %300 %100
Fire C 18 %300 / 315 / 330 %100
Fire D 22 %263 %88
Fire E 19 %315 %105
Fire F 13 %330 %110
Fire G 7 %263 %88

The damage engine and formula works %100 but if you try to add imbue and skill together you will need that skills imbue rate at database.So my plan giving ai this dataset and make it work with damage engine.
mgunbatti is online now  
Old   #14
 
elite*gold: 0
Join Date: Oct 2017
Posts: 11
Received Thanks: 0
Did you try reverse engineered with REA?


I'll give it a try this week see if I can help the project.
hobitut is offline  
Old   #15
 
mgunbatti's Avatar
 
elite*gold: 0
Join Date: Aug 2018
Posts: 54
Received Thanks: 44
Quote:
Originally Posted by hobitut View Post
Did you try reverse engineered with REA?


I'll give it a try this week see if I can help the project.
Thanks for the suggestion! 😄

We've already reverse-engineered SR_GameServer.exe using Ghidra and validated the damage formulas in-game.

Still, I appreciate your willingness to help!
mgunbatti is online now  
Reply


Similar Threads Similar Threads
[Request] Attack Player Damage Formula
04/03/2021 - CO2 Private Server - 3 Replies
Hello Guys, If anyone have some good formula on how to get the perfect / balance damage without calculating the battle potency. I'm thinking of plain damage no Battle Power add on. I'm thinking of the calculation of late conquer something like a version of (4427). What could be a nice formula for this action: 1. Melee / Physical Damage. 2. Ranged Damage. 3. Magic Damage.
The Silkroad Damage Formula
02/16/2020 - Silkroad Online - 18 Replies
Copied from: http://sro.mmosite.com/content/2009-09-11/20090911 002742992.shtml Posted on 11 September, 2009. Looks like a very accurate formula that seems to work every single time. Whoever figured this out really is going to help out emulator developers. Check the link to see the screenshots!
Plus / Damage Formula
04/19/2019 - Silkroad Online - 9 Replies
hi all. i'm working on an alchemy simulator and want to be precise about these values without typing all of them separately. does anybody know the alchemy formula that determines the min/max phy. and mag. damage of a weapon one plus above? lv.90 bow for example: +0 phy. atk. 1047~1283 +1 phy. atk. 1083~1319 +2 phy. atk. 1120~1356 +0 mag. atk. 1674~2052 +1 mag. atk. 1732~2110
Plus / Damage Formula
04/15/2019 - SRO Private Server - 0 Replies
wasn't meant to open here, please delete
Damage Damage Damage
02/28/2012 - Mabinogi Hacks, Bots, Cheats & Exploits - 3 Replies
Because of poor English grammar may be a bit strange May I ask what damage accumulated or MOD



All times are GMT +1. The time now is 15:03.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.