ID:18144
 
Keywords: design, haven
Coincidentally, this post title also happens to be the title of the combat music for The Haven Seed. Or rather, not coincidentally, but deliberately.

Combat in Haven uses what I call "Interval-Based Combat". Every "interval" is the rough equivalent of a "turn" in turn-based gaming, except to make things seem more natural for realtime combat like that in Haven, intervals are actually offset by random lengths of time from one another. Every combatant in Haven may make one attack (and a specific number of defence attempts) every interval... however, on every interval, you will automatically miss a ready opponent, as they will automatically defend successfully. (If your opponent is not ready, then you will automatically hit with every interval.)

This may seem odd at first, but don't worry, there's a catch. Based on your weapon skill compared to your opponent's weapon skill, you will have a randomly-selected number of intervals before your so-called "genuine interval". On your genuine interval, instead of automatically missing, the game will then perform an actual attack against your opponent. This attack can still miss, but unlike the automatic misses it performs all of the necessary opposed skill rolls in order to give you at least a chance of striking your opponent.

All combat is done automatically, with a "Combat" task (handled gracefully by the game's task-handling system, which actually treats PCs no differently than NPCs). Players retain movement control over their characters and may click on combatants at their leisure in order to specify their desired targets.

An attack on your "genuine interval" is resolved as follows:

The attacker chooses a random attack method, based on a wide list of possible swings and maneuvers -- attack methods range from "low kick" to "downsmash" to "sweep kick" to "pommel strike", and many, many more. Certain attack methods may be restricted by the attacker's custom attack strategy. During combat, the player may use certain commands to specify a more-specific attack that he would like to use against his opponent (the AI may also do the same), but otherwise your character will continue to fight the enemy using all of the tricks at his or her disposal, with complete autonomy.

The attacker selects a hit location, again randomly. This simulates noticing a gap in your opponent's defences and making a strike against that gap -- combatants are more than happy to make a strike against an outstretched leg instead of waiting for what could be a long time for the enemy to drop its guard on its torso and impale them through the heart. If you have a chance to inflict damage, you take it -- you don't just wait for a better opportunity to roll along. Certain attack types (as selected above) favour certain hit locations, and in addition to this the player (and the AI) may specify in their attack strategy which body parts may be attacked, allowing the typical "attack anywhere" behaviour to be overridden as necessary. Defenders will automatically "learn" what the attacker's strategy is, and will gain bonuses to their defence attempts as time progresses until the attacker becomes completely incapable of hitting at all -- this is because the enemy no longer needs to concentrate on protecting its whole body, just the parts that the attacker is concentrating on. Once the attacker changes strategies, the defender has to learn the new strategy (although selecting a really similar strategy will still allow the defender to use its already hefty defence bonus). Also, based on the defender's Armour skills, the defender will automatically know which parts of the body are vulnerable and better keep them out of the way -- this is simulated by "guiding" the attacker's blows towards armoured locations. (Ever tried kicking a man in the crotch? Unless you do it by surprise, it's near impossible. Men know quite well where they are vulnerable and take good steps to prevent certain vulnerable areas from being viable targets. ;-))

Once the hit location has been determined, the defender is now given the opportunity to select a defence. Like the attacker's attack method, the defender may select from a wide range of possible defences, again selected randomly with weighting based on the situation at hand and the specific attack type. Defenders will dodge, parry, block, duck, and jump over incoming blows, in varying forms of efficacy. These defences will actually cause the character to move around on the screen -- for instance, dodging an attack will have your character actually move to an adjacent tile, while jumping will actually cause your character to become a physical object in the game's physics system and actually rise off of the ground and return under gravity. All of these defences are called "active defences" and their intent is very specific: to avoid being hit at all. If the defence is successful, then the defender suffers no damage and the attack is an obvious failure.

If the defender fails to attack, the fun part begins: the damage resolution.

The damage is now rolled. Every single physical strike made by a human being inflicts a flat amount of damage (I use the term "flat" loosely, because it is still a random roll -- however, all attacks always use the exact same roll). However, the weapon used and the strength and perception of the attacker then augment this amount of damage by another flat value.

The damage is now multiplied by a constant factor based on the various parameters involved in the attack. This is called the "before multiplier", and increases the amount of damage that the attack will do, improving the attack's ability to penetrate armour. Attacks that are all right at causing damage to unarmoured opponents but terrible at penetrating armour will instead have a multiplier below 1.0 here -- in this case, the blow will be less capable of penetrating the armour.

Now come the "passive defences". First, the defender has an additional chance to dodge the attack, but not in an active way. The defender is generally a skilled opponent so even if the defender fails to completely avoid being struck altogether (i.e., the active defence), the damage of the attack is still reduced based on a roll by the defender's Dodging skill, penalised by how successful the attacker was on his own attack roll; the better the roll on the Dodging skill, the more damage is reduced from the attack (if the Dodging roll fails, the attack is a full-on successful hit with no reduction). This is called the "grazing reduction", because it simulates highly-skilled dodgers instinctively being capable of partially getting out of the way -- dodging, but not dodging far enough -- even if they didn't successfully avoid the attack altogether.

Next comes the "deflection". Certain forms of armour like steel plate or bug chitin are very hard. Other forms of "armour" like mages' robes and cloaks make it very difficult to detect where the defender's body is underneath all that flowing material and air. In both cases, the effect is the same: to offer a flat chance, even if the attacker hits where the defender is standing, for the attacker to completely bounce off or run through nothing but the air underneath the defender's clothes.

After deflection comes the "reduction". Some of the energy of a given physical collision is always dissipated in the form of waste energy -- heat, sound, and even compression waves in the material around the impact (like ripples in a lake). Armour, particularly metal armour, is designed to maximise this reduction, which immediately reduces the damage by a flat value based on the condition of the armour.

The fourth and final form of passive defence is the "absorption". If any damage still exists after the deflection and reduction have been applied, then the defender is guaranteed to have suffered at least some damage -- the armour has been penetrated and the defender will be injured as a result. Thankfully, however, the armour will still reduce the amount of damage suffered by a flat percentage (again based on the armour's condition) because it serves to absorb some of the force from the impact, taking the damage itself as opposed to allowing its meaty contents to take it.

After all four forms of passive defence have been resolved, the attack is multiplied once again, this time by the "after multiplier". The after multiplier almost always serves to return the final damage to the base damage (minus armour reduction) in the formula {before_mult * base_damage * after_mult = final_damage}; thus, if "before" is 2.0, "after" will be 0.5, such that inputting base_damage=50 will yield final_damage=50 if the target is unarmoured.

Finally, the defender suffers the impact in that body location. An injury is applied to the impact site, and this injury -- based from the weapon used -- also causes various side effects, like organ damage, bone breakage, and nerve trauma.


This combat, if you haven't been able to piece it together based on what is written above, is a very visual, visceral experience. Even though most attacks miss, the defenders will dodge all over the screen, jump over, slide under, and block attacks, and every attack will seem like a feint, a miss, or another near strike, the attacker trying anything to get in the upper hand. When the "genuine interval" rolls around and the defender is hit, blood will spatter and the defender may very well hors de combat from that one blow. Picture watching a kung fu guy kicking ass until he is finally run through -- time stands still, and the poor fool collapses in a heap once the sword is withdrawn.

This was mentioned only in passing above, but the number of combat intervals it takes to reach your genuine interval is based deterministically on your opposed skill versus your enemy. Between two fighters who are equally skilled, combat can last a very long time, with dodges and feints galore. Between a skilled opponent and an unskilled opponent, however, combat is very short and very brutal -- the skilled opponent will be achieving a genuine interval on nearly every interval, and will cut the poor sap to ribbons. Here is the example I use in the game's online help:

A peasant with no weapon skills charges a lone swordsman of the King's Guard, driven to the point of rebellion by the King's cruel taxation. The peasant's combat interval is 6. The interval of the swordsman is 1. The peasant manages to swing first, having a greater Dexterity score, but the attack is entirely ineffective as the peasant's genuine interval is not for another several swings -- the swordsman neatly steps aside. The swordsman's interval occurs immediately, however, and with the first swing, the man cuts down the poor peasant. The blow is devastating, and the peasant -- though not knocked unconscious -- is immediately downed, grievously-wounded, and helpless. The swordsman aims his bloodied weapon at the throat of the peasant, ready to deal a deadly blow if the peasant offers any further resistance.


But wait! I mentioned melee combat. Ranged combat also uses the intervals system, but unlike melee combat, every shot made is a genuine attack that has a chance to hit. Depending on the weapon you use and your skill, it may take a number of intervals before you have the opportunity to fire (the remainder of the time being spent aiming and/or reloading), but once you actually pull that trigger or loose that arrow, the game is on and the attack is very, very real.

Ranged combat is the great leveller of the battlefield, but thankfully, there is a balancing factor: if you are using a ranged weapon, your aim is ruined if you have to perform any form of active defence. If a melee combatant starts attacking you, consider yourself as good as dead -- so drop the pistol and draw your knife!
I don't understand the point of the "false" intervals. If the actor will automatically miss, why even bother resolving them?
I think they're intended to be run to display the animations, move the mobs, etc, even if they don't have any "real" effect...

Just a way to make the fight "sequence" more fleshed out and varied...

A glitz effect, basically...
This sounds really, really awesome. I wants to play!
Yep, they're intended to make combat seem more frenzied.

However, they also have a balance consideration: games like Dungeons and Dragons abstract a single attack per "round" of combat, with every "round" being a large number of feints, parries, blocks, dodges, etc., etc. which are all assumed to take place. This spaces out the combat and allows players to make tactical decisions. In an online medium, however, one genuine-chance-to-hit every single swing makes combat too quick and bloody; I figure this is a nice compromise, by making it seem as though the combat is a tangled swirl of melee (it's very possible for someone's friend to dodge into the path of an arrow, for instance!) yet also allowing the player several seconds at a time to make decisions with regards to any special tactics he/she wants to employ.

The only thing the player really has to do is keep himself in melee range of his opponents. For the most part, a dodge favours "sidestepping" as opposed to "backstepping", so unless a mitigating circumstance occurs the player will usually be in range of the opponent he wants to attack.

Incidentally, once audio is added, the battle spam would be more or less non-existent. Damage will be displayed by floating numbers. Until then it spams every single swing and miss... =/