View unanswered posts | View active topics It is currently Thu Apr 24, 2014 4:42 pm



Welcome
Welcome to XP-Waste!

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today!


Reply to topic  [ 4 posts ] 
 Oldschool staking odds calculator and accuracy formula 
Author Message

Joined: Tue May 28, 2013 5:54 pm
Posts: 4
RSN: My Arena
Post Oldschool staking odds calculator and accuracy formula
Hey XP Waste,
I'm currently working on a calculator with a partner which determines the odds of one person winning given any stats vs any stats. This will be for boxing only at first, but we may work on one that does DD / whip stakes as well in the future.

I registered on this forum because I found that people here were the most competent among the RS fan site community. The owner grimy bunyip was talking about markov chains which happens to be the method we may end up using to make this calculator.

The two methods we are considering using are Markov chains, which would give the mathematically correct probability, or just running simulations. We still aren't fully comfortable in the area of markov chains, which is why we may end up using monte hall sims.

Anyways, we've ran into one major problem: The accuracy formula. The max hit formula is all over the web, so that's not the problem. We are still searching for the accuracy formula for our attack vs opponents defense. We have yet to find a reasonable accuracy formula for OSRS. It wouldn't even have to include weapon/armour bonuses because we're only interested in boxing atm.

If someone on this site could supply me with the accuracy formula, I'd be really grateful. This is basically the missing part of our calculator. If we have it, then we could produce the full simulation calc. in a few hours.


Tue May 28, 2013 6:33 pm
Profile

Joined: Mon May 27, 2013 1:04 am
Posts: 2
RSN: Vigilant Foe
Post Re: Oldschool staking odds calculator and accuracy formula
Direct quote from this thread:

http://www.rune-server.org/runescape-de ... rmula.html

Ignore the Dungeoneering and extra things. It was posted in 2011, and I believe it's just a copy of the original (and I think stickied) thread by Paleas on the RSOF.

There's no way to determine if it is 100% accurate without actually seeing the source code for RS, but it does a very good job. The formula for effective level is very well published, as well as easily testable using max hits (esp. when we had the 10x hitpoints).

Spoiler:
Quote:
To begin with , this is not my work , however I didin't saw any server with correct formula and threads in rs most times get deleted I decided to post here.

Original thread:RuneScape - MMORPG - The No.1 Free Online Multiplayer Game

I have tested this formula alot and it really seems that it's like rs.

<thread>

To The Accuracy Formula

The goal of this thread is to create a formula for combat accuracy free for everyone to use.

At the moment, the formula needs improvement. So feel free to post confirmation, disproof, ideas or questions. Bumps and data are also highly appreciated. ^_^

I thank Chaos Pooky, Mandulf and Obliv for their contrubution to this thread, the data and on improving the formula.

Determine your accuracy in the following three steps, mostly based on your level and equipment bonus:

****************************************
1. Calculate the effective level
****************************************

• Take your current (boosted) level from the stats interface (Attack, Ranged, Magic or Defence)
• Multiply this with any prayer or curse adjustments and round down.
• Add up 8.
• Add up the attack style bonus.
• Multiply with the Void Set bonus, if applicable.
• Round down and let 'E' equal this value from here on.

If you wish to calculate the magic defence roll, complete the previous steps for both Defence and Magic.

• Multiply Magic by 0.7 and Defence by 0.3
• Add up Magic and Defence
• Round down and let this equal 'E' in the defender's roll.




****************************************
2. Calculate the maximum roll
****************************************

• Use the next formula to calculate the amount of sides of the dice.

(A) Attacker's roll: E * (1 + Bonus/64)
(D) Defender's roll: E * (1 + Bonus/64)


• Round down the roll to the integer and - if applicable - multiply the maximum roll with one or more of the following bonuses and/or special attacks:

Attack roll modifiers:

Abyssal whip: multiply by 1.1
Barrelchest anchor: multiply by 2
Brackish blade: multiply by 2
Dragon dagger: multiply by 1.1
Dragon longsword: multiply by 1.1
Dragon slayer gloves: multiply by 1.1
Full slayer helmet, Black mask, Focus sight, Hexcrest: multiply by 7/6
Magic longbow: always 100% accuracy
Magic shortbow: multiply by 1.1
Runic accuracy aura: multiply by 1.05
Salve amulet: multiply by 7/6
Salve amulet (e): multiply by 1.2
Sharpshooter aura: multiply by 1.03

Defence roll modifiers:

Bloodrager: multiply melee defence by % equal to used tier
Deathslinger: multiply ranged defence by % equal to used tier
Stormbringer: multiply magic defence by % equal to used tier
Wolpertinger: multiply magic defence by 1.05


• Round down the value.

If you're using two or more multipliers, make sure you round down the value everytime after applying a bonus. Also note you cannot use the salve amulet and slayer helmet together. Because they do not stack, use the best bonus available.




****************************************
3. Calculate the accuracy
****************************************

The chance to hit is:

• If A<D:

(A-1) / (2D)


• If A>D:

1 - (D+1) / (2A)



This value (you may want to multiply it by 100) is an estimation of the accuracy. Note that the formula isn't 100% correct, so the results may be slightly off.

________________________

Attack style bonus
________________________

The attack style bonus is determined by the type of attacking in the combat style interface.

Melee:
Accurate: add up 3 Attack levels
Defensive: add up 3 Defence levels
Controlled: add up 1 Attack and 1 Defence level

Ranged:
Accurate: add up 3 Ranged levels
Long range: add up 3 Defence levels



________________________

Prayer bonus
________________________

After adding up bonus levels to your skill level (by drinking a potion, etc.) prayer adjustments will increase the value further by a percentage.

An example:
A player with 99 attack, a super attack potion and piety activated has an invisible level of:
99 + 19 = 118
118 * 1,2 = 141,6

The player's level is effectively 141.



________________________

Void Knight Armour
________________________

Melee Set: multiply by 1.1
Ranged Set: multiply by 1.1
Magic Set: multiply by 1.3



________________________

Summoning Familiars
________________________

Some familiars may modify the defence stats. Note that these modifications will be visible in the equipment stats screen and have already been calculated while the familiar is summoned.

Iron Titan: multiply all melee defence bonuses by 1.1
Steel Titan: multiply all melee defence bonuses by 1.15

Daemonheim familiar (Bloodrager, Deathslinger and Stormbringer) bonuses depend on the tier. Tier 1 equals a 1% boost and tier 10 equals a 10% boost.



________________________

Dwarf multicannon (DMC)
________________________

The accuracy of the multicannon is calculated in the same way as the accuracy of the user. The roll is based on the current attack style of the player.


Tue May 28, 2013 6:58 pm
Profile
Researcher
Researcher

Joined: Sat Apr 16, 2011 9:40 am
Posts: 1190
RSN: Meredith
Post Re: Oldschool staking odds calculator and accuracy formula
I have a staking simulator that should be easy enough to modify for old school purposes.

Spoiler:
Code:
#include <iostream>
#include <math.h>
#include <stdlib.h>
#include <time.h>

using namespace std;


int random(int min, int max){
   int range = max - min;
   return rand()%range + min;
}

class player{
   public:
      int lifepoints, remaining_lifepoints;
      int attack_level, strength_level, defense_level;
      int opponent_attack_level, opponent_strength_level, opponent_defense_level;
      int attack_bonus, strength_bonus, defense_bonus;
      int attack_style, strength_style, defense_style;
      float attack_prayer, strength_prayer, defense_prayer;
      int attack_turmoil, strength_turmoil, defense_turmoil;
      string prayer;
      string name;
      float void_armor;
      float multiplier;
      int max_attack_roll, max_strength_roll, max_defense_roll;
      int attack_roll, strength_roll, defense_roll;
      int damage;
      int victories = 0;

      int set_levels(int attack, int strength, int defense){
         attack_level = attack;
         strength_level = strength;
         defense_level = defense;
         return 0;
      }
      int set_opponent_levels(int attack, int strength, int defense){
         opponent_attack_level = attack;
         opponent_strength_level = strength;
         opponent_defense_level = defense;
         return 0;
      }
      int set_bonuses(int attack, int strength, int defense){
         attack_bonus = attack;
         strength_bonus = strength;
         defense_bonus = defense;
         return 0;
      }
      int set_prayer(string prayer_set){
         prayer = prayer_set;
         return 0;
      }
      int set_multiplier(float mult){
         multiplier = mult;
         return 0;
      }

      int set_void_armor(string void_class="magic"){
         if(void_class == "magic"){
            void_armor = 1.3;
         }
         if(void_class == "melee" || void_class == "ranged"){
            void_armor = 1.1;
         }
         else {void_armor = 1.0;}
         return 0;
      }

      int set_void_armor(bool void_armor_set){
         if(!void_armor_set){
            void_armor = 1.0;
         }
         return 0;
      }

      int set_name(string playername){
         name = playername;
         return 0;
      }

      int set_style(string attackstyle){
         if(attackstyle == "accurate"){
            attack_style = 3;
            strength_style = 0;
            defense_style = 0;
         }
         if(attackstyle == "aggressive"){
            attack_style = 0;
            strength_style = 3;
            defense_style = 0;
         }
         if(attackstyle == "defensive"){
            attack_style = 0;
            strength_style = 0;
            defense_style = 3;
         }
         if(attackstyle == "controlled"){
            attack_style = 1;
            strength_style = 1;
            defense_style = 1;
         }
         else {return 1;}
         return 0;
      }

      int prayer_bonus(){
         attack_turmoil = 0;
         strength_turmoil = 0;
         defense_turmoil = 0;

         if(prayer == "turmoil"){
            attack_prayer = 15;
            strength_prayer = 23;
            defense_prayer = 15;
            attack_turmoil = opponent_attack_level * 0.15;
            strength_turmoil = opponent_strength_level * 0.15;
            defense_turmoil = opponent_defense_level * 0.10;
         }
         if(prayer == "piety"){
            attack_prayer = 20;
            strength_prayer = 23;
            defense_prayer = 25;
         }
         if(prayer == "none"){
            attack_prayer = 0;
            strength_prayer = 0;
            defense_prayer = 0;
         }
         return 0;
      }

      int set_lifepoints(int lp){
         lifepoints = lp;
         remaining_lifepoints = lp;
         return 0;
      }

      int max_rolls(){
         float att_prayer = attack_prayer/100 + 1;
         float ea = floor(floor(attack_level * att_prayer)*void_armor) + attack_turmoil + attack_style + 8;
         float mar = ea * (1 + attack_bonus/64);
         max_attack_roll = mar * (multiplier/100 + 1);

         float str_prayer = strength_prayer/100 + 1;
         float es = floor(floor(strength_level * str_prayer)*void_armor) + strength_turmoil + strength_style + 8;
         float msr = es * (1 + strength_bonus/64) + 5;
         max_strength_roll = msr * (multiplier/100 + 1);

         float def_prayer = defense_prayer/100 + 1;
         float ed = floor(defense_level * def_prayer) + defense_turmoil + defense_style + 8;
         float mdr = ed * (1 + defense_bonus/64) + 5;
         max_defense_roll = mdr;

         return 0;
      }

      int roll(){
         attack_roll = random(0,max_attack_roll);
         strength_roll = random(0,max_strength_roll);
         defense_roll = random(0,max_defense_roll);
         return 0;
      }

      int attack(int defense){
         if (attack_roll > defense){
            damage = strength_roll;
         }
         else{
            damage = 0;
         }
         return 0;
      }
};


int main(){
   player player1;
   player player2;

   // Change this stuff.

   int iterations = 1000000;

   player1.set_name("Meredith");
   player1.set_levels(99,99,99);
   player1.set_bonuses(0,0,0);
   player1.set_prayer("none");
   player1.set_multiplier(0);
   player1.set_void_armor(false);
   player1.set_style("aggressive");
   player1.set_lifepoints(990);

   player2.set_name("Mierin");
   player2.set_levels(99,99,99);
   player2.set_bonuses(0,0,0);
   player2.set_prayer("none");
   player2.set_multiplier(0);
   player2.set_void_armor(false);
   player2.set_style("accurate");
   player2.set_lifepoints(990);

   // Stop changing stuff.

   player1.set_opponent_levels(player2.attack_level,player2.strength_level,player2.defense_level);
   player2.set_opponent_levels(player1.attack_level,player1.strength_level,player1.defense_level);

   player1.prayer_bonus();
   player1.max_rolls();
   player2.prayer_bonus();
   player2.max_rolls();
   bool dead = false;
   srand(time(NULL));


   for(int i = 0; i < iterations; i++){
      while(!dead){
         player1.roll();
         player2.roll();

         player1.attack(player2.defense_roll);
         player2.remaining_lifepoints -= player1.damage;
         if (player2.remaining_lifepoints <= 0){
            dead = true;
            player1.victories++;
         }
         else{
            player2.attack(player1.defense_roll);
            player1.remaining_lifepoints -= player2.damage;
            if(player1.remaining_lifepoints <= 0){
               dead = true;
               player2.victories++;
            }
         }
      }
      player1.remaining_lifepoints = player1.lifepoints;
      player2.remaining_lifepoints = player2.lifepoints;
      dead = false;
   }
   cout << endl;
   cout << player1.name << ": " << player1.victories << endl;
   cout << player2.name << ": " << player2.victories << endl;
}


Remember, this is a simulator, not a calculator, so it won't exactly fit your needs.

I recommend reading this post I made about how DPS is calculated: post15978.html#p15978

_________________


Tue May 28, 2013 7:02 pm
Profile

Joined: Tue May 28, 2013 5:54 pm
Posts: 4
RSN: My Arena
Post Re: Oldschool staking odds calculator and accuracy formula
Thank you guys so much for taking the time to reply. I guess I should have spent more time looking on this forum for it. I'll share my calc here once i'm finished with it.


Tue May 28, 2013 8:02 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
suspicion-preferred