| Thread (3 posts) | ||
|---|---|---|
|
mrdek11 5/10/08 12:27:16 AM
|
||
|
Novice Member
Joined: 5/16/07 |
I am working on a browser based role-playing game. I just started work on it tonight, so right now, the combat system is a matter of chance with VERY slight use of your level. It's win or lose based on chance. Later tonight, however, I will be adding an inventory and equipment system. I plan to add HP, STR and Def bonuses. STR and DEF would both be levels you could train, plus wearing the right equipment would boost them. I need a combat formula that can somehow factor in all my skills and my level, vs the npc's, and decide how much hp I hit and how much they hit. Can anybody help me with this, or at least get me started? I'm no good at logistical math. Here's the game, if you need a little reference. Keep in mind I just started it a few hours ago, so it's not that great yet. www.kolwebs.org/darkrealm |
|
| - Derek - |
||
|
mrdek11 5/10/08 12:41:42 AM
|
||
|
Novice Member
Joined: 5/16/07 |
Well I just thought something up, can anybody see any problems with this? Would this work on a normal basis? my_hit=(((mystr+hishp)*hislvl)/mylvl)/2
My Lvl: 66, my str: 53, my def: 54, my HP: 59 my_hit=(((53+81)*84)/66)/2 //Calculates to 85 Hmm If I change the formula to.... my_hit=((53*66)/84)/2 // I would hit him for 20 My Lvl: 50 My str: 45 My Def: 34 My HP: 44 my_hit=((45*50)/25)/2 // I hit him for 45 Lets try roughly equal stats. my_hit=((44*50)/50)/2 //I hit him for 22 The problem is clearly the way I am differing the formulas, but I'm too tired to think better right now. Hopefully somebody can shed some light on this project! |
|
| - Derek - |
||
|
Barrikor 5/15/08 10:18:06 PM
|
||
|
Advanced Member
Joined: 12/06/07 |
You're using PHP? Maybe something like this might work...
$Power = ($Level * $Str) * $ModifyDown; Also does "Level" matter for your game? Could you just use $Str alone in the formula?
$Power = ($Level * $Def) * $ModifyDown;
// This code would work best in a function or loop: $My_Stats = array( $My_Level , $My_Str , $My_Def , $My_HP); //My Attack at him //His Attack at me
Also maybe you should have different attack modes; ex: slash, stab, over-defensive, over-aggressive etc. maybe each mob would have a given attack mode that it's weaker against... The weapons could have a mode that they hit more with... $His_HP = $His_HP - ( (AttackPower($My_Stats) + getWeaponBonus($My_Stats)) - (DefensePower($His_Stats) - getModeWeakness($My_Stats,$His_Stats))); The way I have arrays being passed into the functions might not be a good idea though, some of the values passed won't be used by the function and passing them is unnecessary work for the server... Passing them individually would be better. (But it would clutter up my example if I did it here :) ... Anyway, everything I wrote up above is just guesswork, only you know what's best for your game. |
|
| - Barrikor |
||