• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 20:36
CEST 02:36
KST 09:36
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
BGE Stara Zagora 2025: Info & Preview20Code S RO12 Preview: GuMiho, Bunny, SHIN, ByuN3The Memories We Share - Facing the Final(?) GSL46Code S RO12 Preview: Cure, Zoun, Solar, Creator4[ASL19] Finals Preview: Daunting Task30
Community News
[BSL20] ProLeague: Bracket Stage & Dates6GSL Ro4 and Finals moved to Sunday June 15th12Weekly Cups (May 27-June 1): ByuN goes back-to-back0EWC 2025 Regional Qualifier Results26Code S RO12 Results + RO8 Groups (2025 Season 2)3
StarCraft 2
General
BGE Stara Zagora 2025: Info & Preview Magnus Carlsen and Fabi review Clem's chess game. Jim claims he and Firefly were involved in match-fixing GSL Ro4 and Finals moved to Sunday June 15th Serious Question: Mech
Tourneys
Bellum Gens Elite: Stara Zagora 2025 SOOPer7s Showmatches 2025 Cheeseadelphia 2025 - Open Bracket LAN! $25,000+ WardiTV 2025 Series Sparkling Tuna Cup - Weekly Open Tournament
Strategy
[G] Darkgrid Layout Simple Questions Simple Answers [G] PvT Cheese: 13 Gate Proxy Robo
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 476 Charnel House Mutation # 475 Hard Target Mutation # 474 Futile Resistance Mutation # 473 Cold is the Void
Brood War
General
[BSL20] ProLeague: Bracket Stage & Dates BW General Discussion Will foreigners ever be able to challenge Koreans? BGH auto balance -> http://bghmmr.eu/ I made an ASL quiz
Tourneys
[BSL 2v2] ProLeague Season 3 - Friday 21:00 CET [ASL19] Grand Finals [Megathread] Daily Proleagues Small VOD Thread 2.0
Strategy
I am doing this better than progamers do. [G] How to get started on ladder as a new Z player
Other Games
General Games
Nintendo Switch Thread Mechabellum Stormgate/Frost Giant Megathread Monster Hunter Wilds Path of Exile
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
LiquidLegends to reintegrate into TL.net
Heroes of the Storm
Heroes of the Storm 2.0 Simple Questions, Simple Answers
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
Vanilla Mini Mafia TL Mafia Community Thread
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine Vape Nation Thread European Politico-economics QA Mega-thread
Fan Clubs
Maru Fan Club Serral Fan Club
Media & Entertainment
Korean Music Discussion [Manga] One Piece
Sports
2024 - 2025 Football Thread Formula 1 Discussion NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Cleaning My Mechanical Keyboard
TL Community
The Automated Ban List
Blogs
Heero Yuy & the Tax…
KrillinFromwales
Research study on team perfo…
TrAiDoS
I was completely wrong ab…
jameswatts
Need Your Help/Advice
Glider
Trip to the Zoo
micronesia
Poker
Nebuchad
Info SLEgma_12
SLEgma_12
Customize Sidebar...

Website Feedback

Closed Threads



Active: 19006 users

Math genius needed for game making

Blogs > shannn
Post a Reply
Normal
shannn
Profile Blog Joined May 2010
Netherlands2891 Posts
Last Edited: 2012-01-06 10:22:08
January 06 2012 09:54 GMT
#1
Hello dear reader!

If you're here because you feel you're a math genius :D GREAT! else not so great but thanks for reading!
I'm currently making an indie RPG game and I'm at the point of my battle system in my game that I need to have a formula to calculate the amount of damage inflicted on the target.

I have my own thought up formula for calculating damage which works decently but damage is significantly different within each level and I figure that there are math geniuses here on TL that could very likely think up of a better way (or a programmer :D).

So I'm asking you as a math genius if you can think of a decent formula with the above attributes in mind that doesn't increase exponentially for each level. I will use the same for magic attacking and healing spells, just have to switch some modifiers then I think. So help me out! :D

My current formula is the following:
( ( (CharAttackingLevel * 10 ) + ( CharAttackingLevel * CharAttackingPower ) + ( CharAttackingLevel * CharAttackingBasePower ) ) - ( ( CharDefendingLevel * CharDefendingDefense ) + ( CharDefendingLevel * CharDefendingBaseDefense ) ) ) + RandomDamage

Notes:
CharAttackingLevel: Character level that's attacking
CharAttackingPower: The amount of attack power the character that's attacking has
CharAttackingBasePower: The base amount of attack power of the character attacking
RandomDamage: random number between 0 and 10 x CharAttackingLevel
CharDefendingLevel: Character level that's defending.
CharDefendingDefense: The amount of defense power the character that's defending has.
CharDefendingBaseDefense: The base amount of defense power of the character attacking

I tried to attack with my characters a couple of dozen times and it seems pretty random.
However it's quite significantly random as in the more attack power combined with level against lesser base defense the more damage significantly a character does and I prefer to avoid this as I'll also use this formula for my monsters against my characters.

Reason for this is because a level 3 character did a 98 damage (crit?) while a lvl 1 did 12 damage and they have same amount of attack power / defense power against a level 1 target monster. The difference is the level that they're attacking with obviously and because of the high modifier I listed.

Feels like once a character hits lvl 5 it's already hitting 500+ or more with basic stats.
And it can occur that the amount of damage it generates can become negative.
I want to have a decent formula but I don't know how to think up of one and that's where you math genius come along! :D So help me out

**
http://www.teamliquid.net/forum/viewpost.php?post_id=6321864 Epic post.
Silidons
Profile Blog Joined September 2010
United States2813 Posts
January 06 2012 10:10 GMT
#2
i've never seen how a video game is made in my life, but it seems there would be a problem with the last line + RandomDamage when you stated that RandomDamage= random # 0-10xCharAttackingLevel. That means for lvl 1's they either get +1 or +0 no matter what random number they pull.

seems odd to me also how you take into account both the CharDefendingDefense + the CharDefendingBaseDefense. Wouldn't it be much easier to completely take out the CharDefendingBaseDefense and just go purely off of CharDefendingDefense?
"God fights on the side with the best artillery." - Napoleon Bonaparte
mrafaeldie12
Profile Joined July 2011
Brazil537 Posts
January 06 2012 10:13 GMT
#3
Well if you're going to add a random number you can't really complain about damage being irregular!!!You need to add a variant between a range(maybe it increases with level or w/e),usually most programming languages can generate a sudo random number within a certain rage with a function.

But for starters,try organizing your thread and putting the Problem up front,the information is quite disperse amidst your paragraphs!
"..it all comes thumbling down thumbling down thumblin down"
shannn
Profile Blog Joined May 2010
Netherlands2891 Posts
Last Edited: 2012-01-06 10:25:50
January 06 2012 10:19 GMT
#4
@Sillidons:
the randomDamage is the generated random number ranging from 0 till 10 times attacker level.
So for a level 1 it's always going to be from including 0 till excluding 10 (0 - 9 will be the additional random damage for a level 1 and 0-18 for level 2 etc)

Well I was thinking if the user has no attacking power from items then he won't do any damage. The base attacking power would make it so that the attacker at very least does some base damage.

@mrafaeldie12:
I'm not complaining about irregular damage Just wanted a better formula as I'm not a math genius myself :D

Okay thanks for the tip! :D will put up the problem on top :d
http://www.teamliquid.net/forum/viewpost.php?post_id=6321864 Epic post.
jrkirby
Profile Blog Joined August 2010
United States1510 Posts
January 06 2012 10:24 GMT
#5
Every k is a constant that you define by experimentation.

Defence% = (1- ( 1/(k * CharDefendingDefense) ) )

RawRegularDamage = sqrt ( k * CharAttackingLevel * CharAttackingPower )

PeircingDamage = sqrt ( k * CharAttackingLevel * CharAttackingBasePower )

Defence = k * ( k * CharDefendingLevel + CharDefendingBaseDefense )

FinalRegularDamage = RawRegularDamage - Defence (can't be less than 0)

FinalDamage = (FinalRegularDamage + PeircingDamage + RandomDamage) * Defence% (then round)


A system based off both wc2 and wc3 damage systems, I've read about them both and incorporated what i thought was the best way to take your inputs and apply what i know from them and two rules:

Make things simple (for yourself), so try not to have many operations in one equation.

Make things linear (or less). if you multiply two variables together squareroot before doing anything else.

I'd love to hear if this system helps. You had alot of variable you wanted to include, I wasn't sure how you wanted them to work, but i tried my best to make an equitable system.
shannn
Profile Blog Joined May 2010
Netherlands2891 Posts
January 06 2012 10:30 GMT
#6
On January 06 2012 19:24 jrkirby wrote:
Every k is a constant that you define by experimentation.

Defence% = (1- ( 1/(k * CharDefendingDefense) ) )

RawRegularDamage = sqrt ( k * CharAttackingLevel * CharAttackingPower )

PeircingDamage = sqrt ( k * CharAttackingLevel * CharAttackingBasePower )

Defence = k * ( k * CharDefendingLevel + CharDefendingBaseDefense )

FinalRegularDamage = RawRegularDamage - Defence (can't be less than 0)

FinalDamage = (FinalRegularDamage + PeircingDamage + RandomDamage) * Defence% (then round)


A system based off both wc2 and wc3 damage systems, I've read about them both and incorporated what i thought was the best way to take your inputs and apply what i know from them and two rules:

Make things simple (for yourself), so try not to have many operations in one equation.

Make things linear (or less). if you multiply two variables together squareroot before doing anything else.

I'd love to hear if this system helps. You had alot of variable you wanted to include, I wasn't sure how you wanted them to work, but i tried my best to make an equitable system.

Hey man, :o I figured 3d games would have complicated formula's :D I can work with that thanks man!

Thanks for the tips, much appreciated :D will post later how the formula has worked out :D
http://www.teamliquid.net/forum/viewpost.php?post_id=6321864 Epic post.
UniversalSnip
Profile Blog Joined July 2010
9871 Posts
Last Edited: 2012-01-06 10:40:35
January 06 2012 10:39 GMT
#7
I don't know why you want both character attacking level and character attacking power to be factored into the equation. Presumably higher level characters will have higher attacking power from items or something, so you have double scaling on the damage and this makes the numbers much harder to fine tune. Instead, just make levels add to your attacking power stat and take raw character level out of the equation, this is how it works for almost every game ever, it'll simplify things and make then numbers much easier to fine tune and less prone to huge variation. Same goes for defense.
"How fucking dare you defile the sanctity of DotA with your fucking casual plebian terminology? May the curse of Gaben and Volvo be upon you. le filthy casual."
shannn
Profile Blog Joined May 2010
Netherlands2891 Posts
January 06 2012 10:42 GMT
#8
On January 06 2012 19:39 UniversalSnip wrote:
I don't know why you want both character attacking level and character attacking power to be factored into the equation. Presumably higher level characters will have higher attacking power from items or something, so you have double scaling on the damage and this makes the numbers much harder to fine tune. Instead, just make levels add to your attacking power stat and take raw character level out of the equation, this is how it works for almost every game ever, it'll simplify things and make then numbers much easier to fine tune and less prone to huge variation. Same goes for defense.

I see, that is indeed better. I don't want to fine tune numbers on things like this
Thanks for the suggestion. Will change the equations then.
http://www.teamliquid.net/forum/viewpost.php?post_id=6321864 Epic post.
jrkirby
Profile Blog Joined August 2010
United States1510 Posts
January 06 2012 10:50 GMT
#9
On January 06 2012 19:39 UniversalSnip wrote:
I don't know why you want both character attacking level and character attacking power to be factored into the equation. Presumably higher level characters will have higher attacking power from items or something, so you have double scaling on the damage and this makes the numbers much harder to fine tune. Instead, just make levels add to your attacking power stat and take raw character level out of the equation, this is how it works for almost every game ever, it'll simplify things and make then numbers much easier to fine tune and less prone to huge variation. Same goes for defense.


Honestly I would have taken many of his variables out as well, such as character level. But he said he wants to use them. So I thought of an interesting way to include them using concepts I learned from famous games. And since I didn't know how his game worked, I added many spots for him to add constants to tweak the system appropriately.

Also, @OP, if instead of just adding the random damage, you could take it out, and then at the end choose a number between FinalDamage/2 and FinalDamage. This is a trick in wc2's damage system. But in the formula I told you to just add it in near the end because that was what you were doing originally.
Talin
Profile Blog Joined September 2010
Montenegro10532 Posts
Last Edited: 2012-01-06 10:56:02
January 06 2012 10:50 GMT
#10
Is there a design reason why you're coming up with this obscure, convoluted way of calculating damage that the player will probably never understand and be able to consider as part of his strategy during combat without doing extensive math?

You don't need a math genius at all, you just need to keep things simple because that is the foundation of good game design. A few good guiding principles:

- Things should be kept simple to the point where a player can both understand level progression AND be able to instantaneously tell how much damage will his characters' attack deal to the creature, without consciously doing math.
- Don't add arbitrary attributes that increase the complexity of calculations but don't add to the depth of gameplay (in particular, most attack skill / defense skill stats I've seen in various games I played have been completely redundant and could have been easily avoided).
- Keep the numbers low, preferably in double digits, so that the human brain can process calculations spontaneously without requiring the player to actively think about it and distracting him from the game experience.

Consider this situation:
- Your character does 5-7 damage with his Broadsword. The opponent has 10 health and 3 armor (damage reduction). You instantly know, without having to consciously consider it, that you'll be able to do 2-4 damage to the opponent, it's extremely intuitive.

With more complex calculations, you usually have to make a choice between revealing how the mechanics work - which will cause your players to actually work out the calculations before / during combat (if turn based) or during the leveling process when they make their choices regarding character progression - OR hiding the mechanics behind simple tooltips like 'this attack will cause 37-54 damage to this creature" (where the game does the calculations under the hood, and only displays results to the player) - in this case, the player has no real understanding of the mechanics of the game and the decisions he makes.

Do yourself a favor and don't follow the flawed design philosophies of the 90s RPGs. Simplicity is your friend!
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
January 06 2012 10:52 GMT
#11
that is not what a mathmatician do. sorry
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
shannn
Profile Blog Joined May 2010
Netherlands2891 Posts
Last Edited: 2012-01-06 10:57:34
January 06 2012 10:54 GMT
#12
On January 06 2012 19:50 jrkirby wrote:
Show nested quote +
On January 06 2012 19:39 UniversalSnip wrote:
I don't know why you want both character attacking level and character attacking power to be factored into the equation. Presumably higher level characters will have higher attacking power from items or something, so you have double scaling on the damage and this makes the numbers much harder to fine tune. Instead, just make levels add to your attacking power stat and take raw character level out of the equation, this is how it works for almost every game ever, it'll simplify things and make then numbers much easier to fine tune and less prone to huge variation. Same goes for defense.


Honestly I would have taken many of his variables out as well, such as character level. But he said he wants to use them. So I thought of an interesting way to include them using concepts I learned from famous games. And since I didn't know how his game worked, I added many spots for him to add constants to tweak the system appropriately.

Also, @OP, if instead of just adding the random damage, you could take it out, and then at the end choose a number between FinalDamage/2 and FinalDamage. This is a trick in wc2's damage system. But in the formula I told you to just add it in near the end because that was what you were doing originally.

Yea I've simplified things and now I'm only using 2 variables which is attacking power and defending power.


On January 06 2012 19:50 Talin wrote:
Is there a design reason why you're coming up with this obscure, convoluted way of calculating damage that the player will probably never understand and be able to consider as part of his strategy during combat without doing extensive math?

You don't need a math genius at all, you just need to keep things simple because that is the foundation of good game design. A few good guiding principles:

- Things should be kept simple to the point where a player can both understand level progression AND be able to instantaneously tell how much damage will his characters' attack deal to the creature, without consciously doing math.
- Don't add arbitrary attributes that increase the complexity of calculations but don't add to the depth of gameplay (most attack skill / defense skill stats I've seen in various games I played have been completely redundant and could have been easily avoided).
- Keep the numbers low, preferably in double digits, so that the human brain can process calculations spontaneously without requiring the player to actively think about it.

Consider this situation:
- Your character does 5-7 damage with his Broadsword. The opponent has 10 health and 3 armor (damage reduction). You instantly know, without having to consciously consider it, that you'll be able to do 2-4 damage to the opponent, it's extremely intuitive.

With more complex calculations, you usually have to make a choice between revealing how the mechanics work - which will cause your players to actually work out the calculations before / during combat (if turn based) or during the leveling process when they make their choices regarding character progression - OR hiding the mechanics behind simple tooltips like 'this attack will cause 37-54 damage to this creature" (where the game does the calculations under the hood, and only displays results to the player) - in this case, the player has no real understanding of the mechanics of the game and the decisions he makes.

Do yourself a favor and don't follow the flawed design philosophies of the 90s RPGs. Simplicity is your friend!

I have no idea how the 90s RPGs work tbh. I'm literally just thinking it on the fly and then simplify after.
With input from you lovely TL people I can work much better on things I don't really want to think a lot about :D
http://www.teamliquid.net/forum/viewpost.php?post_id=6321864 Epic post.
micronesia
Profile Blog Joined July 2006
United States24639 Posts
January 06 2012 11:20 GMT
#13
On January 06 2012 19:50 Talin wrote:
Do yourself a favor and don't follow the flawed design philosophies of the 90s RPGs. Simplicity is your friend!

I'm not going to say I disagree with your proposed style of damage calculation, but I'm not sure if I agree that the way the "90s RPGs" did it was necessarily bad either. Being able to calculate details regarding the damage you can do is not necessarily part of a well designed battle system.
ModeratorThere are animal crackers for people and there are people crackers for animals.
UniversalSnip
Profile Blog Joined July 2010
9871 Posts
January 06 2012 11:36 GMT
#14
If you are using spells, you might also want to give some thought to how you will calculate damage from those. The player will expect a different set of factors to be represented in a spell than in an attack.

A simple way of setting priorities for what you expect out of your combat formulas might be as follows:

1) You want them to represent everything the player expects will be contributing to the end result, and nothing that they won't. For example, a player will be very disconcerted if their axe isn't taken into account in the attack calculations, and confused if it is taken into account when casting a healing spell. Think about what the player expects to happen, and try to make the formulas represent that in a simple way.

2) Keep the formulas simple so that you understand them, so that you can more easily tune them, and to ensure that you are not including unnecessary factors that don't fit with point number one.

3) Make the formula scale properly so you don't have people rocketing ahead of the curve or falling behind it.
"How fucking dare you defile the sanctity of DotA with your fucking casual plebian terminology? May the curse of Gaben and Volvo be upon you. le filthy casual."
Rice
Profile Blog Joined July 2007
United States1332 Posts
January 06 2012 11:49 GMT
#15
I don't think a math genius is what you want here tbh...
Freedom will be defended at the cost of civil liberties.
Osmoses
Profile Blog Joined October 2008
Sweden5302 Posts
January 06 2012 12:03 GMT
#16
This seems googlable.

This seems relevant.
Excuse me hun, but what is your name? Vivian? I woke up next to you naked and, uh, did we, um?
shannn
Profile Blog Joined May 2010
Netherlands2891 Posts
Last Edited: 2012-01-06 12:20:30
January 06 2012 12:06 GMT
#17
On January 06 2012 20:36 UniversalSnip wrote:
If you are using spells, you might also want to give some thought to how you will calculate damage from those. The player will expect a different set of factors to be represented in a spell than in an attack.

A simple way of setting priorities for what you expect out of your combat formulas might be as follows:

1) You want them to represent everything the player expects will be contributing to the end result, and nothing that they won't. For example, a player will be very disconcerted if their axe isn't taken into account in the attack calculations, and confused if it is taken into account when casting a healing spell. Think about what the player expects to happen, and try to make the formulas represent that in a simple way.

2) Keep the formulas simple so that you understand them, so that you can more easily tune them, and to ensure that you are not including unnecessary factors that don't fit with point number one.

3) Make the formula scale properly so you don't have people rocketing ahead of the curve or falling behind it.

Ya I did like Talin said and just did attacking power - defense to start simple for attacks. And then I coded each level will now give a constant amount of attacking power and defending power to the player/monsters.
This way it's simple to keep track of the amount of damage they'll take/receive and what a player can expect.

I'll actually do the same with magic power except the constant amount that is added each level is higher than attack.

And sorry guys for those saying that a mathematician doesn't do this :D It looks like math so I asked for a mathematician

Anyways, I thank everyone for giving their input. It has been really helpful so far ^^

Edit:
I've actually been to some other site that gave similar answers (stackoverflow *cough*). It was just too much for my head at the time.
Hmm should probably go rest and stop coding for few hours ^^

Thanks for the link. Will be helpful!
http://www.teamliquid.net/forum/viewpost.php?post_id=6321864 Epic post.
-_-Quails
Profile Joined February 2011
Australia796 Posts
January 06 2012 13:01 GMT
#18
I started writing a comment, then realised it was turning into a wall so I've put in spoilers. Got a little carried away.

Pretty much I agree that rough calculations on the player side should be possible on the fly, but don't think there's any need for players to actually see the inner workings of combat or be able to completely predict the outcome. A system that is conceptually simple with a lengthier implementation is likely to be easier to fine tune or extend than the simplest system you can implement. And your first-try system is a decent enough starting point when rewritten for simplicity.

Simplifying what is there:
+ Show Spoiler +
Unless there's a concrete reason to have ***BasePower values seperate to ***Power values then there should only be ***Power, with ***BasePower used as the initial value then modified as you level.

This yields:

Damage = ( (CharAttackingLevel * 10 ) + ( CharAttackingLevel * CharAttackingPower ) + RandomDamage) - ( CharDefendingLevel * CharDefendingDefense )

Given your definition of the random damage component this can be rewritten as:

Damage = CharAttackingLevel * ( CharAttackingPower + Random[Range=11..20] ) - CharDefendingLevel * CharDefendingDefense

This formula is a decent start because it is very simple (though it was initially written in a more complicated than necessary manner), and very modifiable.


Comments on random damage
+ Show Spoiler +

The Random function you use and the range assigned are the first things to look at finetuning. Personally, I might consider using a probabilistic function instead of a random number generator and using that to edge the damage towards the low end. That would give scope for "lucky" items to be used to increase the chance of doing a critical amount of damage. I might also have a seperate function for the defending character to boost their defense in the same way. Because I hate the player, I would probably give a chance that you mess up an attack or a defense to the random function.

This would give something like:

Damage = CharAttackingLevel * ( CharAttackingPower + CharAttackingModifier ) - CharDefendingLevel * ( CharDefendingPower + CharDefendingModifier )
Where the modifiers are random or probabilistic functions whose ranges and distributions are adjusted by any factor that you want to affect the outcome.

Armour would shift the range of the defense modifier towards the positive and piercing damage might cause the armour bonus to be ignored.

All the complicated maths is hidden in the modifier functions and all the player needs to know is that item X will make critical hits 3x more likely, or bronze armor reduces damage by 2, or fighting in a tree makes dwarves more likely to miss because they're freaked out by heights. Because the modifiers can be different for every character you should have a lot of scope for balancing fights at various levels.

Level1 damage vs Level 3 damage
+ Show Spoiler +
You got such a big increase between level 1 and level 3 because you multiply everything by the attacker or defender level. Level 3 in your original equation would always have at least 20+2*attackingpower more damage than the level 1 disregarding random. To avoid this then you could use the modifier to reduce the rate of damage increase (perhaps including a logarithmic part) or preferably restrict the use of the level in damage calculation.

Example:
Damage = ( CharAttackingLevel * CharAttackingPower) + CharAttackingModifier - ( CharDefendingLevel * CharDefendingPower ) + CharDefendingModifier

The random part is no longer magnified greatly at higher levels, though you're free to have level modified components in it.

I would actually prefer for levels to not be directly used in damage calculation, and to use them when modifying stats like the attack power instead.
Damage = CharAttackingPower - CharDefendingPower + GreatSecretCombatModifier

With somthing like:
LevelUp
Prereqs:
Delta(Character{Level,AttackingPower,DefendingPower})
Postconditions:
Level' = Level + 1
CharAttackingPower' = CharAttackingPower + Level
CharDefendingPower' = CharDefendingPower + Level
[ AttributeName' = new value of AttributeName]


Complicated 3D stuffz
+ Show Spoiler +
Your damage function should be about as complicated as your fight. If there are lots of different types of item you can use to attack with/defend with/help your character to win and lots of ways to reliably use the terrain to get an advantage then your modifier function should be complicated enough to take all of that into account, whereas if there are few factors affecting a fight it should be extremely simple. Whether there is any need for a 3D component to enter into it depends on whether the orientation and inclination of a player or attack is affected by it.

Something like Tekken uses a simple slightly-more-than-2D approach to determine if blocks will work. That kind of system can be implemented easily enough by having attack-high and attack-low being calculated slightly differently (a helmet might not figure into defense against a low attack).

Unless your player has a huge amount of control over the way they attack and defend there's no point in trying for full 3D fighting. If a player can reliably move around their opponent in every dimension and hit any weak spot they find then having a fully three-dimensional combat system would definitely be justified - with characters, weapons and armor defined for damage or defense at any point and 3D physics used to calculate the forces between sword and shield, etc. At this point you would be simulating combat as if the player was the character and had the control to deliberately aim for the joins of a suit of armor.

If your controls aren't that fine, then you can save yourself a lot of effort. I have yet to play any game that gives you the degree of control that would make such a combat system shine.


"I post only when my brain works." - Reaper9
Kleinmuuhg
Profile Blog Joined September 2010
Vanuatu4091 Posts
January 06 2012 13:23 GMT
#19
okay :

CharAttackingLevel: CAL
CharAttackingPower: CAP
CharAttackingBasePower: CABP
RandomDamage: RD
CharDefendingLevel:CDL
CharDefendingDefense: CDD
CharDefendingBaseDefense: CDBD

Your formular :
( ( (CAL* 10 ) + ( CAL * CAP ) + ( CAL* CABP ) ) - ( ( CDL * CDD) + ( CDL * CDBD ) ) ) + RD

= CAL * (10+CAP+CABP) - CDL *(CDD + CDBD) + RD

This makes it pretty obvious why the CAL has such a huge impact (and maybe easier to find a better solution)

Now how to change this?
Well Im not sure , you could try these ideas :

1.Idea switch any of (10+CAP+CABP) with CAL and try if it works better
CAP *( 10 + CAL + CABP ) - CDL *(CDD + CDBD) + RD More emphasis on CAP , less on CAL
CABP* (10+CAL+CAP) - CDL *(CDD + CDBD) + RD Neither CAL nor CAP change the outcome dramatically
10 *(CABP +CAL+CAP) - CDL *(CDD + CDBD) + RD
Problem: Damage can still become <0 , but Im sure there is a programming trick where you can say if Damage
becomes negative => Damage = 0

2. Idea This"-" sucks, try using "/"

[ CAL * (10+CAP+CABP) / CDL *(CDD + CDBD) ] +RD this of course gives you comma numbers, so idk if you can
round them up


I just read you changed your system. So all of this will be pretty useless. Anyways GL coding.
This is our town, scrub
-_-Quails
Profile Joined February 2011
Australia796 Posts
January 06 2012 13:34 GMT
#20
On January 06 2012 22:23 Kleinmuuhg wrote:

2. Idea This"-" sucks, try using "/"

[ CAL * (10+CAP+CABP) / CDL *(CDD + CDBD) ] +RD this of course gives you comma numbers, so idk if you can
round them up



Using '%' instead of '/' returns an integer.
"I post only when my brain works." - Reaper9
freelander
Profile Blog Joined December 2004
Hungary4707 Posts
January 06 2012 14:23 GMT
#21
On January 06 2012 19:52 evanthebouncy! wrote:
that is not what a mathmatician do. sorry


lol so true
neither programmers..
And all is illuminated.
freelander
Profile Blog Joined December 2004
Hungary4707 Posts
January 06 2012 14:27 GMT
#22
by the way I think that using the level of the attacking character is plain out retarded designwise. why would you do that?

you should just use the attack stats, which will naturally grow with a levelup. one more step forward simplicity..
And all is illuminated.
adwodon
Profile Blog Joined September 2010
United Kingdom592 Posts
January 06 2012 15:54 GMT
#23
On January 06 2012 23:27 freelander wrote:
by the way I think that using the level of the attacking character is plain out retarded designwise. why would you do that?

you should just use the attack stats, which will naturally grow with a levelup. one more step forward simplicity..


Some games will give you a bonus when facing lower enemies etc

I think just using the level isn't good though, instead just use the different charLvl - mobLvl to get some kind of multiplier ie 1.0, 1.1, 0.8 and just multiply the stats by that factor, simpler.

As far as tuning your numbers, don't be lazy, do it yourself.
People get to understand formulas by playing around with them and using them, not because they have some sort of magical innate ability.

Just make an instance where you can easily change the stats and play around to see what happens.
shannn
Profile Blog Joined May 2010
Netherlands2891 Posts
January 06 2012 16:23 GMT
#24
On January 06 2012 23:27 freelander wrote:
by the way I think that using the level of the attacking character is plain out retarded designwise. why would you do that?

you should just use the attack stats, which will naturally grow with a levelup. one more step forward simplicity..

If you actually read the comments I did that after some input from others already.

Then you'd have saved yourself time from actually asking and would know I had 0.0 experience in actually making a damage formula since it's actually my first game.

On January 07 2012 00:54 adwodon wrote:
Show nested quote +
On January 06 2012 23:27 freelander wrote:
by the way I think that using the level of the attacking character is plain out retarded designwise. why would you do that?

you should just use the attack stats, which will naturally grow with a levelup. one more step forward simplicity..


Some games will give you a bonus when facing lower enemies etc

I think just using the level isn't good though, instead just use the different charLvl - mobLvl to get some kind of multiplier ie 1.0, 1.1, 0.8 and just multiply the stats by that factor, simpler.

As far as tuning your numbers, don't be lazy, do it yourself.
People get to understand formulas by playing around with them and using them, not because they have some sort of magical innate ability.

Just make an instance where you can easily change the stats and play around to see what happens.

I know but asking for a very simple formula and try not tune too much would be much better and it can't hurt asking :D

Anyways I've actually made a separate project and just logging the values of each level's damage and stats vs other levels in the console for each touch input (so that I can generate multiple outputs).

This lets me see the damage output much better and faster by just watching it in the console and generate new damage outputs :D
http://www.teamliquid.net/forum/viewpost.php?post_id=6321864 Epic post.
THE_DOMINATOR
Profile Blog Joined April 2010
United States309 Posts
January 06 2012 17:05 GMT
#25
as someone already said modulo that shit!
DOMINATION
Excalibur_Z
Profile Joined October 2002
United States12235 Posts
January 06 2012 18:28 GMT
#26
You would probably do well to study some other games and see how they did it. Final Fantasy 6 for example used level^2 / 256 as part of its damage calculation. http://www.gamefaqs.com/snes/554041-final-fantasy-iii/faqs/13573

The calculation doesn't have to be exactly transparent (years of study went into FF6's system, for example) for the damage to be somewhat predictable, all you have to do is see to it that the numbers scale up appropriately as the game progresses. That is, level 3s probably shouldn't be doing 8x the damage of level 1s or you end up with insane numbers as levels increase.
Moderator
Sufficiency
Profile Blog Joined October 2010
Canada23833 Posts
January 06 2012 20:34 GMT
#27
First of all this is not math at all. It's just experimentation.

Also, is the problem with how the "random damage" is generated, or is there something else? For the random damage part, just use a uniform distribution from A to B.

Say the "fixed damage" calculated from your formula is D. Then you can make A = -0.2D and B = 0.2D. Then your character will always do 80% to 120% of the "fixed damage".

It's also interesting to allow a character to modify the random damage part (similar to HoMM series).
https://twitter.com/SufficientStats
Zocat
Profile Joined April 2010
Germany2229 Posts
January 06 2012 21:16 GMT
#28
You approach the problem from the wrong angle. Or you dont post enough information

First you need to set some goals - aka design. And from there you find the needed formulas (that part is the math part - and contrary to what people said - it IS what mathematicians do).

Until now we know:
- Charlevel should be important
- Attack/Defense Power (an item attribute?) should play a role
- There should be a random component

What you should think of:
How many levels are there in game? 10? 20? 100? 256? 1000?
How big is the health pool? How does it change over levels? How many hits should it take to kill an enemy when both have the same level? How many hits when the level is different? Does this change (i.e. 5hits for 2 lv 1 chars fighting, 10hits for 2 lv 100 chars fighting)? How important should the random factor be?

Random thoughts:
Your RandomDamage looks horrible. Between 0 and Charlevel*10. Variance is way to high. i.e. a lv 100 char:
1, 2 vs 999, 1000 (depending how the HP scales this is a huge issue). Take Sufficiency's approach with his D.

CharAttackingBasePower vs Level:
Why do you need both? Both increase when a level up occurs (I assume). So you can eliminate one stat? If it's class dependant use a class modifier.
Grndr101
Profile Joined March 2011
Belgium125 Posts
Last Edited: 2012-01-11 06:55:33
January 11 2012 06:47 GMT
#29
So an idea about your design here. What a lot of games do is keep a list of attributes for different mobs at different levels, and also for characters.

This would look like this:

MainCharacter(level1(attack, defence, health,.. other attributes), level2(..),.... ..., levelMax(....))

Same for others, while this looks cluttering, a list like this is actually quite efficient in terms of speed and size. It also keeps your game less cluttered instead of using formulas based on level.

You'd simply have to have a function where it retrieves the useful char info and uses it in damage calculation. This also allows you to adjust your stats for items, buffs etc. pretty easily. Just pull out the base stats for level, then apply equipment buff/debuffs and you have an instance of the character ready for combat.

Just some thoughts here, tell me if I'm wrong about sth I said, I am not a professional.

EDIT: lol this got me even more fired up to get into programming again, so much fun designing a game
Normal
Please log in or register to reply.
Live Events Refresh
OSC
00:00
OSC Elite Rising Star #15
NightPhoenix vs HiGhDrALIVE!
Jumy vs TBD
Percival vs sebesdes
PAPI vs MilkiCow
YoungYakov vs TBD
ArT vs ReBellioN
xJustxJordanx2
Liquipedia
Replay Cast
00:00
StarCraft Evolution League #12
CranKy Ducklings96
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
NeuroSwarm 175
Livibee 64
Vindicta 31
StarCraft: Brood War
Artosis 826
910 26
Backho 25
Icarus 4
Dota 2
LuMiX1
League of Legends
JimRising 578
Counter-Strike
Fnx 1866
taco 370
Foxcn267
Super Smash Bros
C9.Mang0724
hungrybox488
Other Games
summit1g10856
shahzam1251
ViBE265
KnowMe28
PPMD25
Organizations
Other Games
gamesdonequick842
BasetradeTV61
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 18 non-featured ]
StarCraft 2
• Berry_CruncH294
• davetesta64
• HeavenSC 26
• Migwel
• AfreecaTV YouTube
• sooper7s
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
StarCraft: Brood War
• RayReign 21
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota22772
League of Legends
• Doublelift4985
Other Games
• Scarra1220
• imaqtpie1166
Upcoming Events
Bellum Gens Elite
9h 24m
WardiTV Invitational
13h 24m
BSL 2v2 ProLeague
18h 24m
Replay Cast
23h 24m
CranKy Ducklings
1d 9h
SC Evo League
1d 11h
Bellum Gens Elite
1d 11h
Fire Grow Cup
1d 14h
CSO Contender
1d 16h
BSL: ProLeague
1d 17h
StRyKeR vs MadiNho
Cross vs UltrA
TT1 vs JDConan
Bonyth vs Sziky
[ Show More ]
Replay Cast
1d 23h
SOOP Global
2 days
Creator vs Rogue
Cure vs Classic
SOOP
2 days
Classic vs GuMiho
Sparkling Tuna Cup
2 days
AllThingsProtoss
2 days
Fire Grow Cup
2 days
BSL: ProLeague
2 days
HBO vs Doodle
spx vs Tech
DragOn vs Hawk
Dewalt vs TerrOr
Replay Cast
2 days
Replay Cast
3 days
Replay Cast
4 days
WardiTV Invitational
4 days
WardiTV Invitational
4 days
GSL Code S
5 days
Rogue vs GuMiho
Maru vs Solar
Replay Cast
5 days
GSL Code S
6 days
herO vs TBD
Classic vs TBD
The PondCast
6 days
Replay Cast
6 days
Liquipedia Results

Completed

CSL Season 17: Qualifier 1
DreamHack Dallas 2025
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
BSL Season 20
KCM Race Survival 2025 Season 2
NPSL S3
Rose Open S1
CSL Season 17: Qualifier 2
2025 GSL S2
BGE Stara Zagora 2025
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
ECL Season 49: Europe
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025
YaLLa Compass Qatar 2025
PGL Bucharest 2025
BLAST Open Spring 2025

Upcoming

CSL 17: 2025 SUMMER
Copa Latinoamericana 4
CSLPRO Last Chance 2025
CSLPRO Chat StarLAN 3
K-Championship
SEL Season 2 Championship
Esports World Cup 2025
HSC XXVII
Championship of Russia 2025
Murky Cup #2
NC Random Cup
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.