I'm trying to come up with a formula for the computer to determine who should win a match between an attacker and a defender, in a way that would improve how engaging the battle rules would be in a Player Vs Player scenario.

In short, what should the math be where I can build a character in a certain way, without having a clear-cut winner when my build goes up another build each time I attack.


Attacker 15 strength - would this be a function of Attack and Stamina? 60% chance of a critical hit

Defender 7 Agility - would this be a function of Energy and Defense? 10 defense

The outcome should have the following: Who wins, how much damage dealt, health lost (health is normally 100)

Any play between Attack, Defense, Stamina, Energy and Crit Chance would be good for us to discuss as well.

Any help would be appreciated.

Extra info

It's a simple text based game where people can hit each other. Just a single hit not multiple.

A person has Stamina, Attack, Defense. Depending on the weapons equiped also increase your defense and attack.

At first comparing the attacks Attack vs defenders Defense was considered. But it results in to many draws. So we added in chance of a critical hit and change do dodging.

Attack = Users attack stat + weapons attack stat * {crit=2, hard=1.5, normal=1}(Chance) Defense = Users defense stat + weapson defense stat * {dodge=2, sway=1.5, normal=1}(Chance)

if draw who has the better chance wins.

It just seems to easy.

  • 1
    \$\begingroup\$ Some more informations about the goals of your model may help us to give you some useful ralation. \$\endgroup\$ – FxIII Dec 29 '11 at 14:15
  • 1
    \$\begingroup\$ Maybe related: This question and this question. \$\endgroup\$ – bummzack Dec 29 '11 at 14:27
  • 3
    \$\begingroup\$ You ask a tough question. The short answer is "it dependes 100% on the (unique) characteristics of your game." I recommend trying to simulate the most probable outcome and using that result. \$\endgroup\$ – ashes999 Dec 29 '11 at 14:32
  • 1
    \$\begingroup\$ This question is way too broad to be answered in its current form. You need to tell us what kind of gameplay you're trying to create. How you want the game to play out, what you intend for the player to learn as they advance, what you intend for these stats to mean and do, etc. \$\endgroup\$ – Nicol Bolas Dec 29 '11 at 19:33
  • \$\begingroup\$ This is a QA site, not a discussion forum. \$\endgroup\$ – Jari Komppa Dec 29 '11 at 20:43

Figuring out the exact stats and formulas is something that requires a lot of tweaking and tests to get right. It's hard for somebody to give advice without having a deep insight in your game mechanics.

Some similar questions have been asked on this site, so maybe these are useful to you:


This is a vast topic. And it all depends on your focus. Do you want to focus on realism, levels, items, competences...

There are literally hundreds of combat rules, you could try to base your approach on one of the existing ones. Table top role playing games usually implement combat mechanics that are made to be as simple to resolve as possible - with dice - and the logics can be very quickly transposed to video games. You could get inspired by GURPS the d20 system and the Storytelling System.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.