TWiki Home Tharsis . Combat . CombatControllerDesign Tharsis webs:
Design | Guilds | Combat | Website
Combat . { Home | Changes | Index | Search | Go }
Separation of combat management code and player objects

The extraction of combat management code from living objects and insertion into self contained objects will provide us with the ability to centrally manage fights, opening up the possibility of a much more varied and interesting combat system.

This document is still being developed. Outstanding at this time:

  1. Completion of the sequence diagrams - these are very first cut.
  2. Incorporate starting combat with an attack that wins initiative

Table of contents

To Do

  1. Support initiative and surprise. We need something like this in an early incarnation of the controllers to provide the combat starter with a high percentage chance of getting the first swing.
  2. Allow queuing of combat commands. Eg player says "I want to stab in my next attack". This allows integration of the guild commands with combat. This can be used to provide the opening attack?

Objects involved in combat


Living objects will contain the code necessary for initiating combat and taking damage.

Data structures


Combat Daemon

The Combat daemon will be the central manager for handling the existence of combat. It will not manage individual fights - these will be delgated to Combat Controller instances. Methods for starting/stopping combat and obtaining a Combat Controller will form the core of this object.

Data structures


Combat Controller

A combat controller is responsible for managing a fight. This should equate to all the combat between a set of livings in a room, although it is feasible that the combat re-design will support distance attacks between rooms.

Combat controllers will come and go as combat is started and stopped as livings move around rooms.

The Combat daemon will be responsible for assigning a Combat Controller when combat starts, although the room may be able to provide a preferred combat controller description, allowing for rooms in which combat is substantially different from the norm.

Data structures



Rooms can provide the Combat daemon with a preferred Combat Controller to be used when combat occurs within the room.


Scenarios and Sequence Diagrams

Starting combat

A living attacks another living. The two livings were not previously in any combat. This includes agressive monsters attacking players some time after the player enters the environment around the monster.


Joining combat

A living attacks another living. The target is already in combat.


Fleeing combat

A living is in combat and attempts to leave the environment.


Combat controller

A round of combat


Rejoining combat

A living returns to a room containing a living with whom there is unfinished combat To Do


A living attempts to quit while in combat. To Do

Halting combat

Active combat for a living is forcably halted. To Do

-- FantoM - 11 Jan 2003

Nice specs, what are all the void stuffs? -- PumaN - 22 Jan 2003

The dotted lines are the returns from the function call. The text beside them is the return type. A void being the type indicating the function call does not return anything. I want them off the diagram. -- FantoM - 22 Jan 2003

Don't miss out on the fact that just cause one object starts combat on someone else, it doesnt mean opponent should become immediately aware of this intention. -- PumaN - 08 Feb 2003

Yes - this is an interesting point... At the time I did the sequence diagrams I was working under the assumption that at the time you notified the combat daemon of your entering combat that you had (or were about to) swung. Thus the opponent should be made aware.

I had not yet worked in the "start combat with this attack" part of it though.

In many cases combat begins with me advancing on you with obvious hostile intent. You could feasibly get the first swing, based on initiative... Surprise also comes into it.

-- FantoM - 10 Feb 2003

Couldn't fit this in elsewhere. It needs overlooking. most of it stolen from current attack code

the attack phase as I have it now. tweak it endlessly please.

got a target?
   if no, update vision (sort attackers after threat), pick the most dangerous looking guy, auto attack (setting)
check which weapon(s) to attack with
   count up weapon penalties
      two handed style
         check skills and abilities, perks etc
            (level of skill) = (penalty main/off hand)
            no level =     some   / great
            low level =    less   / alot
            medium level = little / some
            high level =   no     / little
            master =       no     / almost none
      one weapon style
         if second weapon is used as a shield then not so much penalties on the first hand
can you reach?
   two weapons.
      pick the longest one
      weapon distances
         melee vs melee =     no penalty
         melee vs polearm =   moderate penalty
         melee vs ranged =    can't reach, move in (setting)
         polearm vs melee =   moderate penalty
         polearm vs polearm = no penalty
         polearm vs ranged =  can't reach, move in (setting)
         ranged vs melee =    great penalty, move out (setting)
         ranged vs polearm =  moderate penalty
         ranged vs ranged =   no penalty
      calculate threat when moving. A threated spot is when the enemy you are closing in on can attack you
         threat dice moving in. success or not
            melee = great threat
            polearm = much threat
            ranged = little threat
         threat dice moving away
            melee = little threat
            polearm = no threat
            ranged = no threat
   general to hit modifier which adds some sense to hits and misses.
      melee =   near impossible to miss (unless drunk, effects etc), target can dodge/block/parry instead
      polearm = unlikely to miss
      ranged =  normal to hit
      longer ranged (not supported yet) = the further it gets the harder to hit, abilities and skills could be useful, as well as items (magical)
is target aware of combat/you?
   if not, surprise him and to_hit modifier is trippled
fatigue check
   the more fatigue the harder it will be to hit, there's no limit but you better rest if you start missing in melee combat. Enemy will be notified when a player looks tired (ability to conciel it?)
      fatigue taken for attacking
      then some extra per "swing", which will make dual weapon fighing easier, but will require some extra fatigue
      the heavier you are the more fatigue is taken. Dexterous players use less fatigue.
         you should be able to train the limit, but you need to keep training to stay "fit".
general modifier
   for spell boosts, skills, abilities etc
size modifier, enemy size vs your size becomes apparent
   same size = no modifier
   target bigger = more
   target small = less
start the attack
   roll to_hit dice
      two weapons = two separate attacks by default (but simultaniously) this might tire the player out faster so shield/parry with the second weapon wisely.
         combo attacks? scissor, round swing, whirlwind and so on. Better off as commands right?
      to hit = dice + range mod + general mod + size mod - weapon penalty - weapon range penalty - fatigue penalty
      the better you are at combat the less random the dice become?
   hit the target
      attack with attack dice
         attack = rate mod + str mod + general mod - weight mod - fatigue penalty
      target is aware
         no, free hit, target becomes aware now
            add attacker
         yes, target defends with defence dice
            *UNCLEAR*: defend style, parry/block(with armour/shield)/dodge. They are all quite different and often not equal. setting as now? In that case you need to be able to change it quickly.. and some clever auto picking is needed.
               Parry would be good when you are holding an extra weapon you are not attacking with. But you can also parry with your primary weapon if you want. Less chance
               Dodge, just step out of the way. depends on what you are carrying, your gear and all kinds of stuff
               Block, Take the hit right on and hope it doesn't score anywhere critical. Not very wise if you are not wearing any armour. Extra good if you use a shield, otherwise the hit might damage you some in any case (depending on str of hit and your armour).
            defence = dice + dex mod + general mod + armour mod? - weight mod - fatigue penalty (see unlcear above)
         attack vs defence
         where did you hit.
         critical dice
            critical = no idea. hit rate - fatigue mod something
            if critical, look up effect and apply it
   calculate dammage
      special dammage?
      dammage = base dammage + weapon etc + critical mod + str of hit blah blah
   deal dammage
   target died?
      partial corpse ownership kicks in (setting). If owner is busy corpse is free (example if he start attacking something else immideatly, or leave the room)
         who owns the corpse?
            point system
               dammage dealt percentage = much points in percentage (pets dammage is transfered to pets owner)
               killer blow = some points
   calculate exp
   collect score
   store stats (for party use, corpse ownership, stuff like that)
      transfer to apropriate places
         party stats
            exp gained
            dammage taken
            dammage given
            monsters killed
            time spent fighting
      most are truncated when controller dies?

Attachment: Action: Size: Date: Who: Comment:
StartingCombat.png action 20334 21 Jan 2003 - 12:43 FantoM Start combat sequence diagram
JoiningCombat.png action 13855 21 Jan 2003 - 12:44 FantoM Joining combat sequence diagram
LeavingEnv.png action 11943 21 Jan 2003 - 12:44 FantoM Leaving environment sequence diagram
CombatController.png action 49533 21 Jan 2003 - 12:44 FantoM Combat controller sequence diagram

Topic CombatControllerDesign . { Edit | Attach | Ref-By | Printable | Diffs | r1.16 | > | r1.15 | > | r1.14 | More }
Revision r1.16 - 18 Apr 2005 - 11:45 GMT - FreD
Parents: SearchResult?
Copyright © 2001 by the contributing authors. All material on this collaboration tool is the property of the contributing authors.
Ideas, requests, problems regarding Tharsis? Send feedback.