Sign up ×
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

closed as primarily opinion-based by Philipp, Boreal, Krom Stern, Seth Battin, Sean Middleditch Apr 7 at 1:12

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the 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 – o0'. 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. – o0'. 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
The first thing you need to make up your mind about is how you want your game to feel for the player. Then you design game mechanics which make the game feel like it. – Philipp Mar 31 at 14:53

2 Answers 2

up vote 1 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 * (1 + constant * armor2) / (dps1 - liferegen2 * (1 + constant * armor2));
  • t2 = hitpoint1 * (1 + constant * armor1) / (dps2 - liferegen1 * (1 + constant * armor1));

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

Don't create an algorithm!

Determine what you want to happen, first.

Do you want player skill to trump stats? How much of a level difference should a skillful player be able to overcome? How much benefit should high level/experience/age in a character make? Does strength trump armor, or agility trump strength?

Set the parameters of exactly what you -want- to happen, and then create tests of the behavior that you expect. Then when you create the actual algorithm, you won't just be shooting in the dark, you'll know whether it's doing what you want.

share|improve this answer

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