So I've been trying to map out a combat system and I have an idea I'm laying out that I'm looking for a sanity check on, as well as suggestions.

The idea is that all things that can do damage (weapons, spells, environmental traps, monsters that deal damage sans weapon) will have a CombatTalker() object attached that will contain information about the amount of damage and damage types (fire, frost, physical, magical, etc.), modifiers that it might have, and any special effects (apply DoT, blind, slow, etc.).

Everything that can take damage will have a CombatListener() object that takes that information and transmogrifies it with the receivers resistances and any special properties it may have.

The CombatTalker() will create a CombatPackage() from a collection class any time there is a collision, and send it to the CombatListener() on the collided objects, supposing it has one. The CombatPackage() is basically the raw data about the damage and effects. The CombatTalker() is a wrapper of sorts that generates the CombatPackage() based on the weapon (or whatever) base damage, then the specific details of that individual weapon, and sends it (like a network packet) to the CombatListener(). The CombatListener() unwraps the package, and in reverse applies the resistances then applies any relevant damage and effects.

I know some of that was slightly repetitive, but I was trying to outline the idea completely, which apparently took two paragraphs.

I know this might be slightly complex, but the creatures and players and weapons and spells can change over time, so there isn't just a pool of static data that can be attached to the item. It needs to be able to read stats from JSON, apply specific information about the damage and send it. The same goes on the other side in reverse.

Is there a reason that this is "too complex"? Am I considerably overthinking it, or is this a reasonable method for a combat system?


  • 1
    \$\begingroup\$ I've used a very similar architecture in two separate projects I did in the past. I didn't regret it. I just used more pragmatic class names, like Combatant (things that can receive damage) and simply Damage for what you call CombatPackage. \$\endgroup\$
    – Philipp
    Commented Jun 16, 2017 at 12:47
  • \$\begingroup\$ I've changed the names to make a bit more sense over the past few months, but mostly the architecture is still how I noted above. I'm feeling much more comfortable with it as I see it work and have extended it a bit to allow for additional features. \$\endgroup\$ Commented Jun 16, 2017 at 15:49

1 Answer 1


This feels right to me. CombatTalker() ...generates combatPackage()...--> combatListener()-->Processed-->output values

But it would be more efficient to just send the values stored in CombatTalker() as parameters for combatListener() instead of generating CombatPackage() and then sending over to combatListener().

So your process becomes CombatTalker()--> combatListener()-->Processed-->output values

(I program using javascript, but since this is a concept I feel I can help)

  • \$\begingroup\$ Yeah, I'd say it's language-agnostic. Thanks for the input. The main reason for DamagePackage is because there's processing of it on both sides, and while the data in the package is universal to the talker and listener, what they do with the data isn't entirely. You're right, though, it probably would be more efficient, though I was thinking about loading the DamagePackage from a JSON based on the talker's owner. The talker and listeners would be the same on all objects, and would apply info from statistics associated with the objects to the base damage package. \$\endgroup\$ Commented Nov 5, 2016 at 22:51
  • \$\begingroup\$ Wait so both sides are doing processes. I think it would be better to use CombatTalker() as a container of values (dmg done, dmg type, dmg effects,etc.) then use the listener as the processor. Why do you have to do processes from the talker? (asking out of curiosity) \$\endgroup\$ Commented Nov 6, 2016 at 3:44
  • \$\begingroup\$ The package contains four thing, a damage vehicle (weapon, monster, environment, etc), a damage array (how much damage to apply from each of the 12 elements), a damage effect (Damage over time), and a damage special (slow, blind, etc). The last two are optional, the array starts with the base Dave array from the weapon, adds in potential modifiers from the creature wielding the weapon, then sends it. The talker modifies the base package specifically to the actor before sending. \$\endgroup\$ Commented Nov 6, 2016 at 14:14
  • \$\begingroup\$ @JesseWilliams do you mind if we take this to github? We can discuss this there and visualize the ideas much easier \$\endgroup\$ Commented Nov 7, 2016 at 22:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .