Combat in LabMUD

Post Reply
User avatar
Site Admin
Posts: 188
Joined: Fri Dec 05, 2014 10:51 am

Combat in LabMUD

Post by Japheth » Wed May 27, 2015 2:24 am

Note: The text in this post is no longer true, but is retained for historical purposes. See the post below for the details in LabMUD.
Japheth wrote:I figured that a bit of news might be received well by you all, and I haven't really given much details in the past about what I'm actually doing for the combat system, so this post is about explaining how it all comes together.

Firstly, for the purposes of this discussion, I'm only talking about melee combat. While I had initially intended to roll ranged and melee combat into the same system, I've pulled back from that at the moment because it was really making things far more complicated than they needed to be. Ranged combat will work WITH melee combat but not necessarily use one unified system, and I won't be talking about ranged combat in this post.

So first things first, with combats themselves. Unlike the RPI Engine where combat was mostly captured at an individual level, combats are an actual THING - there is a "Combat" object (in the programming sense) that is keeping track of who is in the fight and what they are doing. There could eventually be different kinds of combat objects that spin up in different circumstances - for example, eventually you may be able to start a fight that is a "Duel" where it actually tracks points for combatants based on hits or something, or someone can "Win" the combat when first blood is spilt. The default kind of combat will be the kind where people are trying to kill one another and there are no rules or win conditions.

In order to start fighting someone, you use the ENGAGE command. This puts you into combat with that person, and may put you into combat with other people - it is likely that when you engage a party, the default behaviour of the party will be for everyone to jump in and help you. I'm not yet decided as to whether it will be opt-in or opt-out. Similarly, your own party will probably also engage other people. You'll also be able to ASSIST a target, which will automatically pick a target that they are fighting to engage. This means you don't have to worry about figuring out keywords in a heated combat situation (particularly as you're likely to have DUBed your friends anyway, so you already know a unique keyword or two).

Once in combat, you have a target, a distance to your target, an offensive advantage and a defensive advantage. Targets can be people OR objects, so you can actually have a fight where you're trying to physically destroy something in the room and other people are guarding it or trying to stop you. You can only have one target at the moment, but in the future there may be the ability to have multiple targets for the purpose of certain moves or abilities that target more than one person or thing at a time.

Distance to your target is expressed as one of the following values, in ascending order of distance: Intimate, Very Close, Close, Arms Length, Long, Very Long and Extreme. These are abstract and essentially represent how close in melee terms you are to your opponent. Certain moves and weapons only work at particular ranges and attempting to move to a more advantageous range is one of the things you might do in combat (more on that later). When you engage someone, extreme range is the default range, unless you attack someone from hiding, in which case the results of an opposed spot vs stealth check will determine how close you begin. If you intervene in another fight where you are trying to guard someone else, you will interject yourself between your target and their target by default.

Advantage starts at zero for both offense and defense and represents a bonus or penalty to attack and defense rolls respectively. One strategy in combat may be to vie for maximum advantage before attacking, rather than simply making lots of attacks (particularly against an opponent who can counter attack you). The outcome of the attack vs defense roll CAN result in relative advantage changing - so for instance making an attack on someone and doing poorly while they parry and do well might result in them applying a penalty to your defensive advantage, so their next swing is harder to defend (you're off balance), or they might dodge out of the way and give themselves offensive advantage (they dodged to your flank). Some moves will try to increase your own advantage, others may try to decrease those of your target.

So, what are all these "moves" that have been talked about until now?

Every action in combat is called a Move. Some of them are active moves (things you do to someone) and others are reactive (things you do when someone uses an active move on you). Everything from swinging a weapon, retrieving a dropped weapon, trying to disarm somebody, punching someone in the face, closing to intimate range to shank someone, trying to flee, throwing dust in somebody's eyes, casting a spell...these would all be moves.

So where do moves come from? A variety of sources. First of all, your race determines some moves - Mekillots are going to have different moves than Humans, all other things being equal. After race, the next source is items - having a polearm in your hand gives you access to polearm specific moves for instance. Having a shield gives you shield related moves. The room is another source - being able to kick dust in someone's eyes is contingent on being in a location where dust is available. A trash-filled alley might give you the opportunity to create space between you and someone by toppling a trash can between you and they. Spells would be another source - having a Stonefist spell might give you a special punch, or you might have a "parry" skill that works by you "Air Bending" a gust of air at their weapon. Finally, I intend to create a system of fighting styles (more on that later) where a fighting style can give you special moves too.

Every time you get an opportunity to act in combat, you choose a move to use, and your target may elect to use a move in response (not all moves are necessarily opposed, nor are all targets able to respond all the time). So how do these moves get picked? Well, the system is a combination of automatic and manual.

Firstly, every combatant has a thing called a "Combat Strategy". Which combat strategies are available to you is determined by a wide variety of factors such as skills, fighting styles, races, spells (more or less the same things that moves are determined by, really). By default, a non-combatant human might have "Aggressive Amateur" and "Defensive Amateur" as their two choices for instance. In the absence of them making any active choices, these two styles would automatically select moves each action that suited some criteria that the strategy set. Aggressive might be more inclined to make attacks without seeking advantage, whereas defensive might prioritise not getting hit and only attack when advantage is overwhelming.

You can switch between these strategies in combat, so that's one way of reacting. You might start out with an extremely defensive style that focuses on disarming your opponent - and then, once you do, switch to a hyper-aggressive strategy where you close in and try to murder their face off. You might be a secret mage using a mundane only strategy and then the situation turns for the worse and you decide you need to pull out the spells to win, and switch there.

There will be some ability for people to actively pick moves though, for instance you might be able to enter a command like DISARM, which will override your next move selection and pick a disarm move (if you have one). Similarly there would be other commands to push you down particular paths. Spells would definitely all be able to be selected as active options. Responses to these moves are generally always going to be automated.

Now, the time between these actions is configurable at a MUD level, I would probably intend to have the average action be around the 10 second level. This is too tight for individually emoting each action but I personally feel combat should feel a little rushed and adrenaline fuelled, particularly with a deadly wounds system like FutureMUD has. Other MUDs could configure this to be longer if it suited them.

Every move has a property called "Recovery Difficulty" - one for pass, one for failure. After making an active move, you roll a recovery check (which could be against any skill or stat - in LabMUD for the moment it is based on intelligence and dexterity) at a difficulty level set by the move. Your degree or success or failure influences how soon you will make your next move. So for instance daggers might have a very easy recovery test, so you'd get much less than 10 seconds before your next move, whereas something like a two handed sword might be near impossible to pass. Other moves such as closing space or retrieving a lost weapon or whatever would similarly have their own difficulties.

I'm also planning to have the ability for combat to spill over into another room - say every time a contest of "One person tries to move closer, another yields ground" happens there is a chance to spill over through an exit. You could set a flag so that you won't ever move through an exit while fighting, but it might impose a penalty (you have less options to yield ground, so you can be cornered). Similarly, you may be able to actively direct which direction you're trying to take a fight in - you might be trying to push an opponent towards and exit or falling back that way yourself. This may allow you to push people towards an ambush or beat a fighting withdrawal towards a known fallback point.

I haven't quite worked out how I want flee to work yet but it will probably be very similar to the RPI Engine for now. I have something in mind in terms of an automatic "Pursuit" system, but we will open without it. In the interim I will put a short 5-10 second timer on re-engaging someone in combat if they flee so they have a chance to actually get away.

Where am I up to now with all of this? Well, I have a few of the more important move-types in, such as attacking with a weapon and some basic defenses, as well as moving ground. I have the basic commands about getting into combat but not a lot of the active choices in (though they'll be pretty quick once everything else is in). I've also put a lot of "You can't do that in combat" type restrictions on actions throughout the codebase.

The strategies are still really dumb and the NPC AI to use them well isn't there yet, but it's coming together. At the moment, I can kind of thrust NPCs together to flail at each other until one of them dies or things crash, but I'm working on it. There's also a shit load of building to go into it all, but Wolfsong has mostly done that for me.

Still not quite where I need to be for it to be ready for people, but once I've mangled enough NPCs and it's not crashing ALL the time, I will start letting guests battle each other in the guest lounge, and use the testing data to make the first round of balancing, bugfixing and improvement. Then any further testing will be done in game by actual PCs.

User avatar
Site Admin
Posts: 188
Joined: Fri Dec 05, 2014 10:51 am

Re: Combat in LabMUD

Post by Japheth » Wed Feb 10, 2016 5:39 am

Hi everyone,

I thought I'd give a bit of a quick overview and preview of how combat wound up getting implemented in LabMUD. I have walked away from the model described above, and I ended up reimplementing the whole system. That being said, melee combat is basically done now.

Refresher on FutureMUD Concepts

If you've kept up to date and have a photographic memory, you might want to skip this section, where I will go over a few "Core Concepts" from FutureMUD which have been mentioned before, but will be referred to in further discussion without explanation. I'll assume going in that you the reader are familiar with either the RPI Engine (SOI or Atonement flavours) or the Armageddon Engine.

Skills and Attributes

These work very similarly to the RPI Engine or Armageddon versions for the purposes of this discussion, and have been setup with fairly similar numeric values in LabMUD.

Skill Checks

See this link for an explanation of skill checks if you are unfamiliar.

Wounds and Injuries

See this link for an explanation of the wound and injury system in FutureMUD.

The basics

Combat Initiation

There are three main ways in which you initiate combat with someone: HIT, SPAR, and FIRE

Using the HIT command begins what would be considered an ordinary combat - you are engaging somebody and attempting to attack them no holds barred. This kind of combat is called a "Standard Combat".

Using the SPAR command (which must be ACCEPTed by the target) begins a sparring bout, which is a special kind of combat with more restrictive rules. These are touched on later.

Using the FIRE command (after having AIMed at someone or something) begins an ordinary combat by ranged attack. Although it begins differently, this kind of combat is a Standard Combat and functions in the same way.

There may be additional kinds of combat added lately, most likely through the SPAR command. For example, I may add a SPAR <Target> FIRSTBLOOD option that begins a spar to first blood. It is quite easy to extend.

Combat Ending

Standard Combats end when all combatants agree to end the combat, when all remaining combatants are unengaged (because their targets are dead for example), or when all parties escape the combat.

Combatants can propose a truce with the STOP command. In a Standard Combat, the opponents must agree to this. This functions in a very similar manner to the RPI Engine stop command.

One difference of a Spar to a Standard Combat is that in a Spar, STOP is automatic; it does not need to be accepted, anyone typing STOP immediately bows out of the combat.

Combatants also immediately leave a Spar if they are incapacitated; whether knocked unconscious, paralysed or greviously injured. Standard Combats do not automatically end in these circumstances.

Combatants can choose to try to forcefully leave a combat by using the FLEE or WITHDRAW commands.

The FLEE command is more likely to succeed at getting away but the fleeing individual has no control over where they flee to, and they do not attempt to keep fighting while fleeing: they only look for opportunities to flee.

The WITHDRAW command is a controlled movement of the combat to another room. It is relatively unlikely that a combatant who is being actively pursued would escape with WITHDRAW, but the combat can be drawn out to another location. This might be used to draw an opponent into an ambush, fight somewhere more favourable, or just open up options for a subsequent FLEE attempt.

Success of FLEEing or WITHDRAWing depends on the opponents intentions, relative speed and some skill. Combatants can elect in their combat settings as to whether they will pursue fleeing opponents to new rooms, whether they will only attempt to stop the initial flight, or whether they let them go. This can also differ if you're in group combat (perhaps you do not want to flee away from the main group).

It should also be noted that fleeing just one room won't always end a combat, particular against someone with ranged weapons. You may need to flee more than one room before you're free of combat. When you do escape there is a short delay before people can engage you again, to allow you to actually get away, being as you already "got away" in a fair sense in the combat itself.

Combat Happening

At the moment combat happening more closely resembles the RPI Engine than the Armageddon Engine - that is, once in combat, your character is mostly fighting in an automatic fashion based on decisions you have made about your combat settings, rather than an auto-attack with optional "extras". This state of affairs is only temporary until I get around to implementing such manual actions, and they aren't far away.

Each time you get an action in combat, your character will do some kind of "Combat Move". This could vary from swinging a melee weapon to readying a weapon to casting a spell. Some combat moves are opposed and others are not - for example, there is the option for people to oppose you retrieving an item you have dropped (wrestling for a disarmed weapon), but drawing a new weapon is not opposed.

Weapon attacks are determined by weapon type, and each weapon type has a number of its own. These attacks have their own difficulties (both to use, and each type of defense) as well as speeds, damage profiles, special effects and echoes. Additionally, they can target different areas of the body.

For example, an overhead swing of a sword might be a slow, high damage attack that is easy to dodge but hard to parry, and tends to hit higher-up bodyparts. I aim for each weapon type to have around a dozen different attacks, some of which may require particular levels in skill or even fighting styles.

Unarmed attacks are determined by race and skills, and have similar kinds of properties to weapon attacks.

Eventually, psychic and magic attacks will be added to the repertoire, as well as psychic and magic forms of defenses (parrying with your mind, blocking an attack with a pillar of earth ala Earthbending in Avatar, etc).

There are a couple of special manual combat modes you can enter as well, these are FULLDEFENSE, WARD, and CLINCH. These are toggled on and off by use of the command, and stay active until turned off.

FULLDEFENSE sacrifices almost all attacks for bonuses to defense. In this mode, the only kind of attacks the combatant will look to do are those that give them a defensive advantage or restore some previous imbalance.

WARD is designed for fighting with weapons with long reaches, such as spears or swords. Ward is a relatively defensive style that focuses on ripostes and counterattacks, and is also fairly strong on the defense. Essentially attacks will be foregone, but powerful moves are made when opponents attempt to get close enough to attack (particularly if they fail).

CLINCH is the opposite of warding, where one tries to get up close and personal with the opponent and make swift, dangerous strikes that are hard to oppose. A fighter using CLINCH will attempt to gain position on an opponent, then when they have position, their attacks will be incredibly fast and target vital areas and be hard to block. Opponents can make a counter-move that ends the clinch. Clinching is more successful with shorter reach weapons.

It should also be noted that WARD and CLINCH also work with unarmed attacks, as combatants can have natural reaches on their own.

Combat Settings

More information coming soon.

Posts: 22
Joined: Tue May 05, 2015 12:27 am

Re: Combat in LabMUD

Post by Tepes » Wed Feb 10, 2016 9:18 pm

This all sounds awesome.

User avatar
Site Admin
Posts: 188
Joined: Fri Dec 05, 2014 10:51 am

Re: Combat in LabMUD

Post by Japheth » Mon Feb 22, 2016 12:06 am

This morning I have a brief addendum to the previous post on defense types. There are three primary defenses, which would be familiar to most of you: block, parry, dodge. Additionally, there is one other special defense type (ward) and there will be others added (magic/psychic ones for example).

If you do not specify a preference, the default order of preference for defenses is as follows:
  1. Ward
  2. Block
  3. Parry
  4. Dodge
However, the game will consider the difficulty of each defense in making this decision. If you COULD block or parry it would prefer to block, but if it is significantly harder to block, it will skip over it. Ward however will always be chosen first if you're in WARD mode.

You can also override this preference entirely, and specify that you will always do a particular defense. This setting is absolute - if you specify a preference, it will always do that (maybe you're a masterful dodger and you want to dodge in all circumstances).

One quick note before diving into the specifics is that in FutureMUD, all defense types cost stamina to use, so an exhausted opponent is not going to be defending well.

Each defense type has some distinct advantages and disadvantages:


Warding is essentially using your weapon's reach and fancy footwork or controlled ceding of ground to keep an opponent from attacking you at all. An opponent has to have the nerve to risk being struck by your weapon to get close enough to attack you.

One advantage of warding is that if you fail, you still get a regular defense - so effectively while you are warding, you get two defense checks. The difficulty of the warding check is based on relative reach - if you have significantly longer reach than your opponent, you are more likely to succeed.

One disadvantage of warding is that your opponent can ignore your successful ward check anyway, although they risk being struck for doing so. In LabMUD, they have to pass a skill check based on their Melee Combat skill and Willpower stat, which represents a combination of their familiarity with combat in general as well as their sheer bravery.

If they manage to make the check (and they don't have the RISKY combat flag in their "prohibited" combat settings list), they will still make their attack, although the warder gets a free attack against them. These attacks are chosen from a special ward-only list, so the builder can make particular weapons more or less appealing for warding in general by controlling which attacks go on this list.

A further disadvantage is that if your ward check fails and they attack anyway, or they manage to ignore your successful ward, you can't use the parry defense against the subsequent attack if you're being flanked - only block or dodge. This is because in that circumstance, the assumption that you can use footwork and ceding ground is invalid, and you're relying more on the weapon itself to ward.

In LabMUD, spears and polearms will be great for warding, swords a little less so but still good, and other weapons only mediocre despite reach. There are unarmed-specific warding attacks as well.


Blocking is the act of using a shield to deflect or absorb an incoming blow. Obviously, you must have a shield in order to block. Overall, blocking is very easy: it's quite easy to raise a shield to block an incoming blow, particularly if you have a big shield. This is the main advantage of blocking, the fact that it's relatively low skill and quite easy. In LabMUD, blocking will check against the Shield Use skill (which will also be used for shield-based attacks, hence why it isn't just called Block).

Different types of shields provide different bonuses to block (bucklers might be a small bonus, tower shields might be a large bonus). Additionally, shields are best at blocking attacks on the side that they are being worn - you get a substantial bonus to blocking attacks that target a bodypart on the same side of your body, even bigger if it is in the "middle". On the flip side, there is a penalty to blocking attacks on the non-worn side of the body, the back, and the feet. The penalty is such that you will almost certainly elect to parry or dodge if leaving it to the default algorithm in those circumstances.

So blocking is fairly likely to succeed when chosen at any rate. What then is its disadvantage? Well, for one, the shield itself takes damage when hit. Item damage will be enabled in LabMUD, so every time your shield gets hit it absorbs the damage you would've otherwise taken. This means over time the shield will become damaged and may break.

Another disadvantage is that shields may not entirely absorb very large blows: a particularly damaging attack might overflow from the shield onto the limb carrying the shield. Thus, if you try to block a Giant swinging a tree at you, sure, you may deflect the attack - but you'll probably break your arm or your shoulder in doing so, and the shield will probably break (but better that than being squished outright, right?).

The above disadvantage does have an occasional upside though: slashing weapons have a high chance to lodge in the shield and get stuck when they do a lot of damage to it. This might be a reason to use a softer material shield (like wood), where you trade off damage to the shield for chance to disarm an opponent.

A final disadvantage is that blocking is relatively stamina-heavy defense. Combine that with the high probability you're going to be at least taking a little bit of pain from big blows, and it takes a high-will, high-stamina fighter to use a shield well.


Parrying is the art of using your weapon to deflect an incoming blow. In order to parry, you must be wielding a weapon. Each weapon type can nominate its own skill used in parry checks - in LabMUD, all weapons use their own skill for parry. For example, the Sword weapon type uses the Swords skill both to attack and to parry. Weapon types also nominate their own bonus to parrying: Swords are the best class of weapons to parry with, followed by Parrying Daggers (not to be confused with ordinary Daggers). Weapons like Axes and Clubs are bad choices for parrying.

One advantage of parrying is that in the case of a tie on the opposed check, the defender wins. This is not the case with dodge, so when you get to the higher levels of skill this is a huge advantage (sword fights between two highly skilled opponents will have a very low hit ratio and lots of parries). Parrying also tends to be easier against attacks that target extremities and attacks that come in a wide arc, but are slightly harder against attacks like thrusts.

Another advantage of parrying is that if you beat the attacker by a fair bit on the opposed check, you have a chance to disarm them, and you also have a chance to give them a temporary "Defense Disadvantage" effect that gives them a penalty to their next defense roll.

An additional advantage is that parrying is reasonably forgiving even if you fail: even a failed parry check will still deflect at least some of the incoming damage. This can be particularly effective if you have an armour type that is strong against shallow-angle attacks (topic of a different post).

The primary disadvantage of parrying is that the weapon itself usually takes damage. Weapons are generally not designed to take a lot of damage (in comparison with shields anyway) and so you can easily break a weapon with a parry against a particularly devastating attack. Some weapons will also be specifically designed to break parrying weapons (these may or may not feature in LabMUD, you'll have to wait and see).

Parrying will probably be the domain of high-skill combatants with very good weapons and deep enough pockets to maintain their high-end gear.


Dodging is the act of getting out of the way of an attack. Dodging is the last line of defense: you don't require any special skill, mode, or item to dodge, you can basically always do it (though you have to be able to move). Dodging in LabMUD uses the Melee Combat skill: the reasoning for this is that dodging is largely based on instinct and combat training. The better you hone your instincts with training or combat experience, the better you are at dodging (as well as many other things that use that skill).

The primary advantage of dodging is that if you succeed, you don't get hit at all. None of your items take any damage, you take no damage. It is a zero-cost method of defense in the grand scheme of things.

Another advantage of dodging is that even if you fail, you still reduce the damage of the attack a little bit (not by as much as when you parry, but by a lot more than when you block). The very act of attempting to get out of the way is at least a little defense against what is coming.

A final advantage of dodging is that if you soundly beat the attacker in the opposed check, you can place yourself in a flanking position, or give yourself an "Offensive Advantage" effect that gives you a bonus to hit on your next attack.

The disadvantage of dodge is probably the lack of sources of bonuses (like good items) and its relative difficulty (it is usually the hardest of the defenses). That being said, in LabMUD many big slow attacks (haymaker punches, overhead swings) are actually easy to dodge.

User avatar
Site Admin
Posts: 188
Joined: Fri Dec 05, 2014 10:51 am

Re: Combat in LabMUD

Post by Japheth » Mon Feb 22, 2016 12:31 am

In my previous post I touched on the concept of "flanking" in melee combat. I realised I hadn't explained this particular element of combat so I will do so here.

There are three basic states with regards to flanking:

1) Not Flanking - the default stance
2) Flanking
3) Rear Attacking

When flanking or rear attacking, the defender has a penalty to their defense. Additionally, some attacks may only be possible when you are in a flanking or rear attack position.

The facing also affects which bodyparts tend to get hit as well, so an attack from the front cannot hit the "lower back" hitloc for example, but a flanking or rear attack could. A rear attack couldn't stab somebody in the eye however. Some of these "rear" locations are pretty juicy and full of vital organs as well, so it's a tempting location to attack someone.

Some attacks and some defenses have a chance to "improve" your flanking position against somebody. For example, a good dodge and some attacks will put you into a flank if you're not flanking, or rear attack if you're already flanking.

Most regular attacks however will worsen the flanking position of the main opponent for free, so in an ordinary 1v1 combat, you're unlikely to stay at somebody's flank: they will be constantly turning to face you. However, because most attacks tend to improve facing for only one opponent, it can be very effective in combat when you outnumber someone: the person not being targeted will probably wind up on the flank.

You can disable flanking by putting the FLANKING flag in your "Prohibited" combat settings, which means you won't seek to gain a flank on someone. You will still oppose other people flanking you though. In this way you could for example fight as a Bushido warrior who would never attack an opponent anyway except facing them.

User avatar
Posts: 66
Joined: Thu May 07, 2015 7:10 am
Location: Somewhere.

Re: Combat in LabMUD

Post by Onasaki » Tue Feb 23, 2016 12:02 am

Sounds like some fun. So, uhh... I tend to logon and chill in the guest room a couple times a week. If you need a test subject, let me know, Japh! (Just sitting around until you're really ready to throw us into the hobo arena)
I have two forces by my side,
One's the truth and One's a lie
Which one's which I cannot tell
This Enigma is my Hell

Post Reply