Please critique my battle system equation
by Infinitum3D · in Game Design and Creative Issues · 06/08/2010 (9:51 am) · 7 replies
Let me just say, I absolutely HATE the concept of Random Numbers affecting an outcome. I understand that it is a necessary evil that must be incorporated to assume some measure of chance, but how on Earth does anyone know what BEST random number range should be used???
In my algorithm I use a random range of -3 to 3, because I want a slight variation to allow for random chance. But by using a negative possibility, a player could miss completely for no real reason. Anyways...
To test out the battle system I just started with basic variables;
Givens:
playerArmor ranges from 8 to 12
playerDefense ranges from 8 to 12
playerHealth ranges from 80 to 120
playerStrength ranges from 8 to 12
playerWeapon ranges from 8 to 12
(opponent variables are the same)
Oh, I almost forgot, this is for a TURN-BASED combat system.
Here's the actual equation:
__________________________
combatCalculation = rnd(-3 to 3) * [playerWeapon * (playerStrength + playerHealth)] - [opponentArmor * (opponentHealth + opponentDefense)]
__________________________
(in shorthand)
cCalc = rnd(-3 to 3) * [pWeap * (pStr + pHth)] - [opArmor * (opHth + opDef)]
The weapon and armor have the biggest influence on outcome (being multipliers). Is that a good idea?
To increase the variablity, on each turn, the attacker's weapon score is reduced by rnd(1 to 3), and if it is a hit, the defender's armor score is reduced by rnd(1 to 3)
So, on the player's attack turn;
playerWeapon = playerWeapon - rnd(1 to 3)
If combatCalculation > 0
Then opponentArmor = opponentArmor - rnd(1 to 3)
So as you can see this works (and is kinda fun), but I just picked the number three (3) as my variable modifier, with no real reason for choosing 3. I could just as easily have picked 789787367835.
I guess my real question is; "How do you choose the range for 'random' variation?
In my algorithm I use a random range of -3 to 3, because I want a slight variation to allow for random chance. But by using a negative possibility, a player could miss completely for no real reason. Anyways...
To test out the battle system I just started with basic variables;
Givens:
playerArmor ranges from 8 to 12
playerDefense ranges from 8 to 12
playerHealth ranges from 80 to 120
playerStrength ranges from 8 to 12
playerWeapon ranges from 8 to 12
(opponent variables are the same)
Oh, I almost forgot, this is for a TURN-BASED combat system.
Here's the actual equation:
__________________________
combatCalculation = rnd(-3 to 3) * [playerWeapon * (playerStrength + playerHealth)] - [opponentArmor * (opponentHealth + opponentDefense)]
__________________________
(in shorthand)
cCalc = rnd(-3 to 3) * [pWeap * (pStr + pHth)] - [opArmor * (opHth + opDef)]
The weapon and armor have the biggest influence on outcome (being multipliers). Is that a good idea?
To increase the variablity, on each turn, the attacker's weapon score is reduced by rnd(1 to 3), and if it is a hit, the defender's armor score is reduced by rnd(1 to 3)
So, on the player's attack turn;
playerWeapon = playerWeapon - rnd(1 to 3)
If combatCalculation > 0
Then opponentArmor = opponentArmor - rnd(1 to 3)
So as you can see this works (and is kinda fun), but I just picked the number three (3) as my variable modifier, with no real reason for choosing 3. I could just as easily have picked 789787367835.
I guess my real question is; "How do you choose the range for 'random' variation?
#2
In that system, a tabletop RPG, you use six-sided dice to affect your skills (if you so choose). But the values are in the range -1 to +1. The average roll for 2+ dice hovers somewhere around no change at all :)
What I think:
Damage should be a function of weapon type+possibly ammo+armour+hit location. Clear-cut values, no randomness.
Whether an attack hits should be based on skill+opponents ability to get away, and probably some randomness. A bullet or arrow travels really fast, so it would be all reflexes (if the target knows about the attacker). Evading a sword attack might be considered a different type of evasive skill, but in any case I consider the attack and the damage result two different calculations with different attributes in play.
The defender could also block or parry. Is the weapon of a sort that still hurts a bit if you block?
What sort of formulas you want for it isn't easy to plan, though. You just have to try different approaches and see what feels most natural :)
If you hate randomness, wide range environmental effect modifiers could give the same impression. Darkness and bad eyesight are not a swordsman's best friends! Let's say you represent everything with numbers starting at 1 (or 0 for unknown, but that's moot). You could make light be a percentage (0% = dank cave with no torch, 100% = best summer daylight at noon) and multiply actual skill by that. You could make strong wind above some level affect how well you can use a shield. The slope of a hill might affect how well you fight while wearing the heaviest of armour.
It should be possible to make a randomness-free system if you want to go through all sorts of minute calculations. I don't doubt it could be made fun. If it seems like too much work, that explains why people settle for a simpler method with some dice for skill checks.
06/08/2010 (6:22 pm)
Weird system, but I'll tell you about a weirder system which also has a fun sort of randomness: FUDGE.In that system, a tabletop RPG, you use six-sided dice to affect your skills (if you so choose). But the values are in the range -1 to +1. The average roll for 2+ dice hovers somewhere around no change at all :)
What I think:
Damage should be a function of weapon type+possibly ammo+armour+hit location. Clear-cut values, no randomness.
Whether an attack hits should be based on skill+opponents ability to get away, and probably some randomness. A bullet or arrow travels really fast, so it would be all reflexes (if the target knows about the attacker). Evading a sword attack might be considered a different type of evasive skill, but in any case I consider the attack and the damage result two different calculations with different attributes in play.
The defender could also block or parry. Is the weapon of a sort that still hurts a bit if you block?
What sort of formulas you want for it isn't easy to plan, though. You just have to try different approaches and see what feels most natural :)
If you hate randomness, wide range environmental effect modifiers could give the same impression. Darkness and bad eyesight are not a swordsman's best friends! Let's say you represent everything with numbers starting at 1 (or 0 for unknown, but that's moot). You could make light be a percentage (0% = dank cave with no torch, 100% = best summer daylight at noon) and multiply actual skill by that. You could make strong wind above some level affect how well you can use a shield. The slope of a hill might affect how well you fight while wearing the heaviest of armour.
It should be possible to make a randomness-free system if you want to go through all sorts of minute calculations. I don't doubt it could be made fun. If it seems like too much work, that explains why people settle for a simpler method with some dice for skill checks.
#3
To clarify "What's the difference between Armor and Defense?"
DEFENSE is a player's natural skill at evading damage. It's a fixed number, well, mostly fixed. I guess it should improve with experience, but it doesn't really change from minute to minute.
ARMOR is a physical component added to the player to reduce the damage taken from an attack. Every HIT result in a damage to the armor, thereby, reducing the protection it provides.
NOTE this part of the post:
If combatCalculation > 0 //-the player takes damage
Then opponentArmor = opponentArmor - rnd(1 to 3) //-armor value is reduced
Thank you both for the comments. Does anyone have any suggestions (specifics) on how to improve this system?
Can someone give an example of their own system?
Thanks again!
~I3D
06/09/2010 (3:34 pm)
Thanks for the replies!To clarify "What's the difference between Armor and Defense?"
DEFENSE is a player's natural skill at evading damage. It's a fixed number, well, mostly fixed. I guess it should improve with experience, but it doesn't really change from minute to minute.
ARMOR is a physical component added to the player to reduce the damage taken from an attack. Every HIT result in a damage to the armor, thereby, reducing the protection it provides.
NOTE this part of the post:
If combatCalculation > 0 //-the player takes damage
Then opponentArmor = opponentArmor - rnd(1 to 3) //-armor value is reduced
Thank you both for the comments. Does anyone have any suggestions (specifics) on how to improve this system?
Can someone give an example of their own system?
Thanks again!
~I3D
#4
It's not a bad system and I agree that it sounds like it could be fun (have you tested it?)
If you're against random numbers having an effect on battle, why not remove some? If armor is reducing with every hit, why not have it scale based on the amount of damage done? Under 10 damage reduce it by 1, 11-20 by 2, etc. (Or whatever numbers.) Or combine the tiers with a random amount of reduction. Under 10 damage: 1-2, over 10: 3-6 if you feel you need randomness.
This allows a player of your game to learn the system and become proficient at it. They will know that Iron Armor can soak around 80 damage, and when they need to repair or buy new armor.
But to answer your specific question: Pick your random numbers so you can predict the range that will occur. You need to know how many rounds of attack a typical battle will last. And you need to know how often you want them to miss an attack or do no damage.
If you have truly random battles, your battles will appeal less to skillful players. They want systems they can learn and understand. Also: You will have a harder time adjusting for difficulty. As your game goes toward the end, you need to ensure your system allows you to make the fights more challenging (while still allowing the players to feel like they're becoming more powerful) and also give you the ability to have boss-fights if you need them, which might be double or triple the length to fight and win than a normal fight.
Hope this helped,
Ibrahim
06/18/2010 (10:09 am)
Hey There,It's not a bad system and I agree that it sounds like it could be fun (have you tested it?)
If you're against random numbers having an effect on battle, why not remove some? If armor is reducing with every hit, why not have it scale based on the amount of damage done? Under 10 damage reduce it by 1, 11-20 by 2, etc. (Or whatever numbers.) Or combine the tiers with a random amount of reduction. Under 10 damage: 1-2, over 10: 3-6 if you feel you need randomness.
This allows a player of your game to learn the system and become proficient at it. They will know that Iron Armor can soak around 80 damage, and when they need to repair or buy new armor.
But to answer your specific question: Pick your random numbers so you can predict the range that will occur. You need to know how many rounds of attack a typical battle will last. And you need to know how often you want them to miss an attack or do no damage.
If you have truly random battles, your battles will appeal less to skillful players. They want systems they can learn and understand. Also: You will have a harder time adjusting for difficulty. As your game goes toward the end, you need to ensure your system allows you to make the fights more challenging (while still allowing the players to feel like they're becoming more powerful) and also give you the ability to have boss-fights if you need them, which might be double or triple the length to fight and win than a normal fight.
Hope this helped,
Ibrahim
#5
06/19/2010 (10:43 am)
You could inform the player "You have a 10% chance of a hit, 1% chance of winning this battle. The monster is carrying at least 100 gold coins" and let the player decide. Players who like to take risks for high reward will engage in the battle. Players who want a softer target will move on. You could qualify the variables with Spider-Man style comments like "Wow, that is shiny dragon-scale armor... I bet my sword won't even make a scratch." The player can, again, decide if they want this fight.
#6
I've been testing/tweaking the various equations using (*don't laugh*) Scratch scratch.mit.edu, just because it's quick and easy to edit. Unfortunately, my new job starts at 7am, and my brain isn't fully firing at 5:30 in the morning, so development has stalled. You'd think I'd be used to the early morning hours since I've been working there for two months now, but nope, not me! Maybe with the end of daylight savings time in the fall . . .
I'll try to get back to this, and post some results.
Thanks again!
08/21/2010 (4:45 pm)
Thanks for all the replies.I've been testing/tweaking the various equations using (*don't laugh*) Scratch scratch.mit.edu, just because it's quick and easy to edit. Unfortunately, my new job starts at 7am, and my brain isn't fully firing at 5:30 in the morning, so development has stalled. You'd think I'd be used to the early morning hours since I've been working there for two months now, but nope, not me! Maybe with the end of daylight savings time in the fall . . .
I'll try to get back to this, and post some results.
Thanks again!
#7
I know this is probably more involved than you want to get, but brain over this:
System from -50 to 50.
Anything under zero has a penalty. (Player doesn't do as much damage, falls over for the next turn, shoots self in foot, ect. Worse number is a worse effect. Higher number is a better "damage multipler"
-50 to -35 = Player hurts self, drops weapon, trips, ect
-35 to 0 = Player attacks enemy for less than 100% of attack strength
0 to 30 = Player attacks for full strength
31 to 50 = Player critically strikes for extra damage.
Player gains "focus" which would be a stacking bonus to hit chance until the next blow connects, to stop multiple frustrating chain misses in a short combat system like you seem to be going for.
Anything more than zero gives the player "fury" which decreases their ability to hit. For kicks and giggles, make the player deal a weeeeee bit more damage ;)
Note: The concept of focus and fury would likely be hidden to the player
So in the end, the equation would look more like:
hitChance = [rnd(-50, 50) + focus]
Offense = [(pWeap * pStr) - fury]
Defense = [(opArmor * (opDef + opStrength)) + focus]
Damage = Offense - Defense
If player hit:
+ fury
- focus
If a player missed:
+ focus
+ fury
If a player crit:
+ fury
- focus
If a player hurt themselves:
+ fury
- focus
Just tossing ideas around :D
Note: Your damage formulas seem pretty high... The player and opponent seem pretty evenly matched. That would make for a pretty tough game, assuming this isn't a PVP environment. I guess assume this is some kind of boss character formula x.x
08/30/2010 (10:26 pm)
I absolutely love the idea of weighted randoms. Just because it's closer to what the user actually expects. Missing or critting two or three times in a row is no fun (Okay, critting can kind of be)I know this is probably more involved than you want to get, but brain over this:
System from -50 to 50.
Anything under zero has a penalty. (Player doesn't do as much damage, falls over for the next turn, shoots self in foot, ect. Worse number is a worse effect. Higher number is a better "damage multipler"
-50 to -35 = Player hurts self, drops weapon, trips, ect
-35 to 0 = Player attacks enemy for less than 100% of attack strength
0 to 30 = Player attacks for full strength
31 to 50 = Player critically strikes for extra damage.
Player gains "focus" which would be a stacking bonus to hit chance until the next blow connects, to stop multiple frustrating chain misses in a short combat system like you seem to be going for.
Anything more than zero gives the player "fury" which decreases their ability to hit. For kicks and giggles, make the player deal a weeeeee bit more damage ;)
Note: The concept of focus and fury would likely be hidden to the player
So in the end, the equation would look more like:
hitChance = [rnd(-50, 50) + focus]
Offense = [(pWeap * pStr) - fury]
Defense = [(opArmor * (opDef + opStrength)) + focus]
Damage = Offense - Defense
If player hit:
+ fury
- focus
If a player missed:
+ focus
+ fury
If a player crit:
+ fury
- focus
If a player hurt themselves:
+ fury
- focus
Just tossing ideas around :D
Note: Your damage formulas seem pretty high... The player and opponent seem pretty evenly matched. That would make for a pretty tough game, assuming this isn't a PVP environment. I guess assume this is some kind of boss character formula x.x
Torque 3D Owner Daniel Balmert
Default Studio Name
The range of -3 to 3 is arbitrary, but you need to consider what is fun to the average player:
If combat lasts 5 turns on average, then missing more than 20% will feel bad.
However, if combat is a volatile encounter (each turn, you could be killed or you could destroy an enemy) having a miss chance ~33% wouldn't be so bad. You'll still win MOST encounters in one turn and it'll feel very positive.
In general, you should strive to simplify the amount of attributes in any game. What's the difference between Armor and Defense?
Also, if you're always multiplying by the weapon strength, then your growth will appear to slow down by the end of the game. Getting a sword with 4 strength is TWICE as good as a sword with 2 strength. Getting a sword with 22 strength isn't that much better than a sword with 20 strength, and it won't let you beat that end boss any better.