Combat Systems

Community Forums/General Help/Combat Systems

Sauer(Posted 2009) [#1]
Does anyone know any good articles about writing good combat systems for RPG's? I'm concerned with mostly the mathematics part and getting good numbers...

I have values like accuracy, attack, and defense, but I can never get good damage values. I'm concerned with how accuracy should be implemented for attacking and defending, and the relation between defending and damage.

I have looked online for answers but always get discussion about combat systems from the player perspective, not a coding one. Ideally I would like some examples to pull ideas from and implement different ideas from different combat calculations in my own game...

I'm not looking for someone to do it for me, just some ideas and discussion about the maths behind the system.

I hope that makes sense, thanks.


ubergeek(Posted 2009) [#2]
I'd be interested in this too. I've come up empty as well when searching for this.


Matty(Posted 2009) [#3]
In my experience, playing a range of pen-paper rpg/wargames and the occasional PC game, most combat systems have at their heart something like this:

% Chance to successfully 'hit' opponent, with modifiers to this based on the situation (will vary greatly with the type of environment/combat being represented)

% Chance of successful hit causing damage, with modifiers as above

If successful hit causes damage then deal 'x' amount of damage with x being a randomly determined figure between minimum value 'y' and maximum value 'z'.

The actual numbers being used depend upon what you want your system to feel like, what the setting is.


ubergeek(Posted 2009) [#4]
If successful hit causes damage then deal 'x' amount of damage with x being a randomly determined figure between minimum value 'y' and maximum value 'z'.

I think we're both looking for guidelines for figuring out xyz! It seems to be an endless cycle of tweaking and testing to get it right, but maybe there's some magic formula out there?


Sauer(Posted 2009) [#5]
What I usually do is this:

x = random number 1 through 10
if x<accuracy
hit
damage=player attack*(random number of weapon min/max) - player defense

The problem with this is it seems to be over simplified, and has limitations such as the max level has to be 10, and accuracy has no impact on the hit damage or have any relation to the enemy defense.

This is what I came up with yesterday... it uses the accuracy stat heavily and does not have the min/max idea. I feel like I'm getting better numbers AND I don't have to tweak it if the enemy is extremely more powerful or vice versa. I have a maximum level of 100 and get a steady increase in ability with each level.

I still need to check for a miss though, but I still have to figure that one out without using the stupid random number thing as above.

Here's my little combat tester code:
SeedRnd MilliSecs()
Repeat

;max level/rooms=100


Print "------stat values------"
mroom=Rand(0,9)  ;this is how powerful the enemy is.  level 0-9 in this case
mname$="Monster"

matt=Rand(mroom/2-10,mroom/2+10) ;attack
If matt<1 Then matt=1
macc=Rand(mroom/2-10,mroom/2+10) ;accuracy
If macc<1 Then macc=1
mdef=Rand(mroom/2-10,mroom/2+10) ;defense
If mdef<1 Then mdef=1
mhp=20

Print mname$
Print matt
Print macc
Print mdef

Print ""

patt=5 ;player attack
pacc=5 ;player accuracy
pdef=5 ;player defense
php=20

Print "Player"
Print patt
Print pacc
Print pdef

Repeat
	Print "------calculating damage-----"
	Print ""
	playerratio=(Float(pacc+1)/((mdef+1)))+Rand(pacc)
	monsterratio=(Float(macc+1)/((pdef+1)))+Rand(macc)
	Print "prat "+playerratio
	Print "mrat "+monsterratio
	playerdamage=Int(patt+playerratio)
	monsterdamage=Int(matt+monsterratio)
	Print "pdam "+playerdamage
	Print "mdam "+monsterdamage
	ag$=Input$("Again? ")
	If ag="n"
		Exit
	EndIf
Forever

Forever



Retimer(Posted 2009) [#6]
I don't think there's a general formula for 'rpgs', it all depends on what you have in your game and the character development style.

I always found an automatically generated level-based scale system for stats the easiest in the long-run.

Manually setting every stat for every entity is ....not necessary to put it lightly, and you can balance the reward much more easily with level-ratio generations.

It does take a bit of tweaking based on character development (leveling up, gear, etc if they exist in the game), but i've found once you set that up, and in relatively short amount of effort, you have an extremely simple balanced system to work with as a base.

Also, with a system like that you could easily setup similar features as in lotro or WoW with elites, giving the entity a bonus 1.2 multiplier for stats for example.


stayne(Posted 2009) [#7]
There's a thread about rpg combat here: http://www.blitzbasic.com/Community/posts.php?topic=76776#858651

Hope it helps a bit!


Sauer(Posted 2009) [#8]
Oh perfect thanks, now I can use this information to embellish my calculations I have now...

As Retimer was saying, I feel like I have a good base... it creates monsters with a steady gradient of difficulty for rooms 0-99 and never creates negative or extraneous values...