I’m making a plugin to assist me with the combat portion of my game, and while Epic have provided a few things like TakeDamage, DamageType, DamageEvent, etc., there a few more high level concepts that warrant exploration. I’m thinking of something like this:
This (probably a pawn) is capable of dealing damage. I can’t think of what they should have other than information for UI purposes, ie. name, team. A pointer to the controller would help as well so you can get the instigator.
Something capable of receiving damage. Should contain information about their hitpoints, armor (if any) and whether they’re destroyed or not. Should also obviously contain the main function to TakeDamage. TakeDamage should receive a DamageHit, it should also possibly receive an affected hitbox for localized damage.
Stores information about he damage type, dealer, and actual damage dealt.
That’s it for the exchange between dealer and receiver, but what about the mechanics of supplying that actual damage? For now lets stick with weapons.
A basic weapon is a blunt one. For the sake of being general, we store that information in an ammuniton type. It can Start Firing and Stop Firing.
Has a DamageType, damage per round, rounds per shot, speed, rounds per clip.
A projectile weapon has a projectile spawner, which will either be physically based where an actor is spawned or a simple line trace. A weapon can be drawn, holstered, firing, reloading, equipping or alt-firing (melee). A weapon has a cycle time (time between rounds), reload time, range, clips, max clip capacity, spread and kick.
When a weapon fires, it decrements the current ammunition count by rounds per shot, and fires a projectile (physical or traced). If a DamageReceiver is hit, it calls TakeDamage.
Any comments? Should I be adding to or changing any of these mechanics? I’m planning to account for networking too, so you can’t just shoot a weapon without accounting for cycle time, etc.