Skip to main content
5 of 7
added 826 characters in body
tprieboj
  • 159
  • 1
  • 4

Browser RPG fight calculation formula

I am making a simple browser rpg game, similar to battleknight. To keep the game simple, I have just Strength, Constitution, and Luck. But as luck is random based, I'm struggling with fight calculations. I need some kind of formula to calculate attacks.

Preview from battleknight

Player attributes


UPDATE I was thinking about this model:


Strength - base dmg.


speed - chance of attack avoidance


toughness - increase HP


luck - crit. hit chance


defence - chance of attack blocking.


As I expect, there will be fight between high and lower ranked players so I want to calculate attack differently. My idea is sum of stronger player stats(this will be cap). So random based attributes will be divided by this sum. Example:

cap = sumOfStrongerPlayerAttributes
player1Luck = player1.luck / cap
player2Luck = player2.luck / cap
// also luck can be devided for ensure that crit hits will not be so often

Also crit. hit dmg. will be calculated from based dmg. like:

critHitDmg = player.strength * someKindOfConst

This model will prevent from too often crits.

tprieboj
  • 159
  • 1
  • 4