Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have custom built as a little personal project a website coded in php that is a MMORPG.

It is at the minute just a personal private project but I am stuck as what to do when it comes to users battling each others' accounts!

I have four stats for each user which they can train at a gym if they wish too, so the differences in stats could be huge or not so much.

The stats are:

Speed - How fast they can hit

Strength - How hard they hit

Agility - How well they can dodge attacks

Endurance - How long they can fight for / How good their defence is

All these numbers are floats with upto 6 decimals, I was wondering if anyone on gamedev SO could point me into a good direction of how writing a script so each player could battle each other with all these factors involved.

At the minute I am just working out percentage differences of the two and using that, but it is isn't very consistent!


share|improve this question
Basically you need to do pretty much everything, starting from game design itself. You could search for some game design courses online, such as gamedesignconcepts.wordpress.com –  Lohoris Dec 5 '11 at 13:28
I am not so much stuck on the design but the actual logic that goes on behind the scenes. –  cgwebprojects Dec 5 '11 at 13:32
That's a big part the design. –  Lohoris Dec 5 '11 at 14:42
The game design is the logic that goes on behind the scenes, and (unless you are building a clone game) will be different for each game. My advice, decide how you want the game to work and try (prototyping) it, then if it isn't fun try something different until you have something fun to play. –  Kevin van der Velden Dec 5 '11 at 14:56

1 Answer 1

up vote 0 down vote accepted

I think the same algorithm as used in warcraft could help you in your way. in warcraft there are these parameters:

  • hitpoint : which means how much can one take damages without dying!
  • armor : which is basically telling you how much can damage is taken from attack (the higher armor means less damage).
  • damage : which means how much damage can player deal in one attack
  • attack speed : means how many attacks can one deal in one second
  • life regen : which means how much hitpoint will player regain every second
  • strength : which directly affects health and life regen
  • agility : which directly affects armor

knowing these parameters there are two variables which will determine battle results

  1. dps (which is damage per second) is equal to attackspeed*damage
  2. ehp (which means effective hitpoint) is equal to hitpoint * (1+constant*armor)

while in warcraft engine the battle takes place in real time, you can directly compute results in your game, as a note every variable with number 1 is related to player 1 and every thing I assume 1/(1+constant * armor) * dps > liferegen:

  • t1 = (hitpoint2+liferegen2) * (1 + constant * armor2) / dps1;
  • t2 = (hitpoint1+liferegen1) * (1 + constant * armor1) / dps2;

t1 and t2 will represent how much time does it take for player1 to kill player2 and time needed for player2 to kill player1. you can easily check if t1>t2 or t2>t1 and declare results.

share|improve this answer
Thanks this is exactly what I was looking for thanks. –  cgwebprojects Dec 5 '11 at 15:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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