I’m taking a break from the technical stuff for a while and taking a look at game mechanics and the game combat engine. The fun stuff. After some spreadsheet jiu-jitsu, I came up with a basic combat model, which I think is feasible as a ‘version one’ effort. It is based on the following assumptions:
- Only two combatants
- Close quarters combat
- One combatant attacks first
- Combat rounds
- Combat stops when one combatant is dead
- Certain character attributes (such as Strength, agility and armour rating) affects the outcome.
To keep things simple, combat will involve only two combatants. This assumption may hold for quite a while. Handling melee style combat, with multiple characters hacking away at multiple monsters I’ll leave for later.
Close Quarters Combat
This version of the engine will assume the combatants are adjacent, so ranged weapons like crossbows, bows and spears are excluded for now. This scenario will be dealt with soon, but for now I will park it.
One Combatant Attacks First
As in real life, someone gets off the first shot, so the engine will calculate what I will call ‘initiative’ for both combatants, and the character with the highest initiative will attack first. Initiative will depend on the following factors:
- Character Level
In future, the following would also be added to the mix:
- How wounded the combatant is (both for attacking and defending)
- Effects of drugs, poisons or spells
Combat will consist of multiple combat rounds, during which each combatant will take turns in attacking, the order being determined by which character attacked first. So, after the “higher initiative” combatant has swung their axe, combat then occurs in rounds. This is not that realistic, but once again I am going for something simple. A better model, would factor in initiative at each round, based on wounds, morale and character level for instance. This implies that the current ‘health’ (hit points remaining) will not affect the combatants performance – also not realistic. To think that a combatant with 1 hit point left (near death!), can deal the same damage as a fully healed combatant is definitely not realistic!
Combat Only Stops When One Combatant is Dead
Combat will only stop when one of the combatants dies (their hit points reach zero). The engine will not factor in morale, or how wounded the combatant is. Future versions will enable combatants to flee or avoid combat based on various factors.
Character Attributes Effects on Combat
This aspect is fairly obvious and makes sense. The implementation is a bit trickier. After some experimentation and contemplation, I decided on the following approach:
- Character Attributes are a Modifier to some value (e.g item damage, potions effects on running speed)
- Modifiers are modelled with an equation
- Equations will be used (instead of tables) for all Modifier effects. This will save space and hopefully make it easier to make adjustments quickly.
This is what I have so far, and my next steps is to build it and see how it works with two monsters battling it out. My next post will explain Modifiers, Values, and also include specifics on the Modifier equation (hint: it’s a modification of the hyperbolic sinh function).