Tryin’ a catch me settin’ dirty

I’ve been working on the core combat mechanics for the past week or two, and have finally got things feeling decent – at least to start with.  I wanted to do something modular so that over time it would not only be easy to tweak, but also easy to add additional features.  So, here’s a sample of what I have so far:


The base element here is the DamagePackage, which contains information about the raw damage amount (DamageArray – from each of the 12 possible elements of damage), the cause of the damage (DamageVehicle – e.g., weapon, creature, trap, environment, effect), any damage effects which would include damage over time (DoT) type effects, and any special effects from the attack (chance to be set ablaze, frozen, sleep, silence, etc.).

There is a slight error with the diagram above, as I’m typing this all out – the CharacterStats are brought in on the Talker and Listener levels.

At any rate, the DamagePackage moves to the DamageTalker, which takes in the attackers stats for any modifications, then sends the package along to the DamageListener on the attacked actor.  The Listener works in reverse, unpacking the information from the package, applying resistances and such from the attacked actor’s stats, then applies that modified damage package to the actor itself.

The beauty of this system is it’s flexibility.  The downside is that different components reside on different levels of the actors and their equipment.  For instance, on the player, the stats and the listener are on the root, but the talker and all of it’s constituent parts live on each weapon (or spell).  For a non-humanoid creature, almost everything lives on the root level.  Except listeners – the listener must always reside on the same layer that the collider lives on.  Well, it doesn’t have to, but it makes things worlds easier.  So…  this is something I’m trying to figure out.  Though honestly, I could probably package this up for the Unity Asset store once I get it all cleanly situated.  I’m happy with where it’s at now, but it has a LOT of work still ahead of it to be a nice, simple-to-use package.

DoLevelUp() function

Of course, the system needs to be set dirty whenever an actor’s stats change, or when weapons/armor are swapped out that might impact stats.

Leave a Reply