zwanzig_zwoelf
Guest
My code is based on my development ideas (I have in mind some sort of a FPS/RPG mix), so they might not fully apply to yours, but may give some ideas concerning the gameplay and stuff. Though I am still a noob in coding.I have this formula:
baseDamage = damage (16) on minDistance (1000 meters). distanceMod is a current distance to the target. Modified by slight random (between 0.9 and 1.1). bodyPartMod - depending on a limb (head|torso|hands|legs). armorType - the amount of damage armor allows to get (still overthinking that one). modDamage - damage modifier (e.g. with weapon upgrade).
function Damage () {
damageFinal = baseDamage * modDamage * randomMod * armorType * bodyPartMod / (distanceMod / minDistance);
}
You are right, of course armor will also play a role at the enemy side of it, I just thought about the player side of it Handling of armor is actually a very nice topic that I have not researched yet. I do not really now what is the most common system, but something like this may be used?:
damageDealt = Mathf.Max(0.5 * damageDealt, (damageDealt - armorValue)), for example I have a armor with value 5, someone hits me hard with 30, I absorb 5 of those resulting in 25 damage dealt. We must use som kind of threshold as well otherwise the character can absorb infinite blows from a weak enemy. But like I said I have not researched this so this just from the top of my head.
We are on the same page regarding using a random element to the dealt damage, I think that is needed for "realism" and suspense.
I probably won't use something like bodyPartMod since then we go towards relying on the skill of the player (FPS style) more than relying on the skill level of the character we play, it is definitely tempting (everybody likes headshots I guess) but will cripple the roleplaying aspect of it I think.
I think it also is a bit harsh to use a linear dependency for calculating the impact of the distance to the target. If we use that we might force the player towards keeping close to the enemy with a ranged character for increased hit damage. If one chooses to be a ranged character I assume they want to stay away from the enemy and not use heavy armor and such, forcing them to be close to maximize damage will put them in danger in a way not really suited for the chosen character type.
A modifier that I had in mind is to use elemental arrows, as in fire, ice, wind, earth and spirit, to add damage over time once hit unless the character is immune to said element. Might just use enchanted bows instead for the same effect, but some form of magical modifier at least.
If a sort of crafting system would be implemented (thinking of doing a bare bones one, not really sure) you could combine poisonous herbs with arrows to make poison arrows, but we will see about that.
I appreciate the discussion, this is gold to me for making the best possible game
The linear distance modifier could be called an 'awesome button' by some players, because it may actually help out a player with little ammo left. The tests will show how it works - for now, I am still implementing.