Skip to main content
GameDev.net gamedev.net
🔒 Locked

Roguelike combat system

Started by DpakoH Feb 17, 2015 at 11:58 AM 9 replies 10.8k views
Original Post
DpakoH
DpakoH

Hello guys,

I am developing a Roguelike game as a hobby and I am at the point to decide about the combat system. For now it is very basic, each character has 4 attributes: Attack, Defense, Damage, Health. Only melee combat is implemented as follows:


if (Attack > Defense) then Health = Health - Damage

But I also like to implement ranged and spell attacks. So do you have any suggestions for combat system? I would like to keep it simple and fun, so novice players won't hate the game at once smile.png

Have a nice day!

Ashaman73
Ashaman73

This is already a good start:


h' = h - d

well, I would add a health scaling s like this


h' = (h*s-d)/s 
   = h - d/s

This means, that during the attack the health is virtually increased. E.g. a scaling value of 1.01 means, that the attack is executed vs 101% of the target health value.

Now you are able to define an armor value as X armor points mean a scaling of (100+X) or you can define it as ratio between attack and defense:


armor a is a value of >0
s = (100+a)/100

attack a>0 and defense d>0
s = (d+1)/(a+1)

Then just use different scales for different damage types, the armor variance could be used for magic resistence or piercing damage(ranged), whereas the attack/defense variance (where the weared armor is added to the defense value) could be used for melee.

Dragonsoulj
Dragonsoulj

if (Attack > Defense) then Health = Health - Damage
But I also like to implement ranged and spell attacks.

Since range is about accuracy (hitting the target) adjust your if statement to include a target hit check. Melee attacks can hit 100% if you want and your ranged and spell attacks can have an accuracy check. Damage would be the same for one-off attacks (some spells may have lingering effects).
Acharis
Acharis

You can download source code of roguelikes (most of the classic ones are open source) and see how it works. I did it before making my roguelike and it was extremely worth it.

Thaumaturge
Thaumaturge

if (Attack > Defense) then Health = Health - Damage
But I also like to implement ranged and spell attacks.

Since range is about accuracy (hitting the target) adjust your if statement to include a target hit check. Melee attacks can hit 100% if you want and your ranged and spell attacks can have an accuracy check. Damage would be the same for one-off attacks (some spells may have lingering effects).

Another option might be to limit ranged attacks with "ammunition": charges for wands, arrows for bows, perhaps mana for spell-casting, etc. Thus, while attacks still always hit (presuming an attack value higher than the target's defence value), the player has still to keep an eye on their "ammunition" counter--attempting to attack without ammunition would presumably be a wasted turn, and an opportunity for the enemy to close the gap or attack.

If you want to vary things just a little more, then you might give entities an "agility" value which replaces the "defence" value in your current to-hit calculation when using a ranged weapon. Thus a bulky, tough monster might be hard to damage with a melee weapon, but easily picked off at range, while a weak, agile monster might be a nightmare to hit with a bow, but trivial with a sword.

Wands might recharge at some rate (one charge per however-many turns, say) or become useless when drained, perhaps requiring the use of some item, special tile or resource to recharge. Arrows would presumably be found just as other weapons are.

MWAHAHAHAHAHAHA!!! My Twitter Account: @EbornIan
Orymus3
Orymus3

I like systems where magic is handled separately, such as when a fireball always deals its full 3 damage no matter the situation.

That would allow you to skip the need for a magical pts system, and intelligence-related stat, etc.

The spell just does its full effect.

At first, it may feel over-powered, and will slowly wave in efficiency as the melee gear becomes better, so you would have varying levels of usefullness preventing the player from just sticking to "one thing".

I think a roguelike trully succeeds when you want/need to do a bit of everything. It basically reinforces your will to participate/explore everything (game mechanics, areas, etc.)

Magical spells, when found, should still provide an edge so that the player is interested in finding them. Possibly, they could have a limited usage count (similar to scrolls, spellbooks, etc.) so that the player feels more like an adventurer than a wizard/fighter.

LorenzoGatti
LorenzoGatti

To extend this interesting automatic hit approach to ranged attacks, I would use the same formula with separate attributes (except Health): if Aim > Dodge then Health -= Weapon Damage. Ranged attack damage would mostly depend on the weapon, not on character skill and strength.

Typically, the large amount of content in a roguelike game entails many equipment-based, skill-based and magical bonuses to combat ability, combat damage, etc. and separating stats allows specializing such bonuses (e.g. a plain sword, no bonus to melee combat, an enchanted crossbow, increased ranged attack damage, and a differently enchanted crossbow, increased ranged attack ability).

Tthe quantities used in combat formulas (e.g. chance to hit in traditional rule systems) are usually derived from more general, intrinsic stats (e.g. in D&D chance to hit depends on Strength, character class and character level of the attacker, all used for many other purposes).

Omae Wa Mou Shindeiru
Dragonsoulj
Dragonsoulj

Tthe quantities used in combat formulas (e.g. chance to hit in traditional rule systems) are usually derived from more general, intrinsic stats (e.g. in D&D chance to hit depends on Strength, character class and character level of the attacker, all used for many other purposes).

Strentgh for melee, dexterity for ranged.
DpakoH
DpakoH

Thank you all for the answers, there are lot of useful ideas. When I come up with something I will share.

For now just a screenshot for my own motivation:

16m4owg.png

Orymus3
Orymus3

cute characters.

Thaumaturge
Thaumaturge

I'm not sure I trust that fellow at the bottom. There's just something about him that seems a little... untrustworthy... ;)

(More seriously, that looks like a decent start. Good luck with your game. ^_^)

MWAHAHAHAHAHAHA!!! My Twitter Account: @EbornIan

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.