VETERANS, is a game where you take control of an elite commando character. Characters can use different classes of weapons. And each weapon is designed to have its unique impact on the game play.
Needless to say, weapons play a major role in the game, because many of the game mechanics involve firefights. In this post, we will discuss a bit, but important details about the weapons design system: it what we call the damage component, which controls the amount of damage that a weapon inflicts. In VETERANS realism is not the primary concern, although some weapons exhibit realistic behavior: like bullets penetration on door and floors according to the target materials.
As in many other aspects of the game, the design went through a trial and error process in order to optimize the procedure.
The weapon system uses a component based architecture, new weapons are made from elementary building blocks: Input-Component, Damage-Component, ammunition, fire-rate, equip type, etc. A component may have its own attributes, for example the bullet physics component may have a custom ballistic coefficient (BC) in order to control the ability to overcome air resistance for bullets. Another example of simple components, is the one that define how quickly the player can reload his gun.
In order to “assemble” a new type of weapon, the designer produce a variety of combination from the existing components. Thus producing a type of weapons with different characteristics, and this can be done without the programmer’s involvement.
Some combinations are used to define a whole class of weapons: Pistols, Rifles, Shotguns, Automatic, mini-gun like, Melee weapons, etc. These classes are used as a starter samples for design.
Let’s re-focus on one component, present only in fire-arms: the damage component.
The damage component controls the amount of damage that a weapon inflicts. This component allow the artist to control the amount as well as the distribution of the damage.
The damage can be calculated by a very simple formula:
Damage = (Weapon damage * Skill) / Enemy resistance
This is the most basic calculation of damage. It has a single scalar value and the value is bound to a specific weapon type. In reality, damage calculations are way more complex, and there is also an inherent element of randomness in damage calculations.
In order to allow the artist to add chance calculations into the damage equation, we added a new damage component: the uniform damage. The uniform damage component is defined by a minimum and a maximum value that a weapon can inflict in a single shot. When the player shoot an enemy the component will generate a random number between the min and max values.
All the values are equally likely to occur. This is analogous to damage roll in classical RPG games. When testing the damage component we quickly realized that in order to have a more interesting effect we should be able to assign higher probability for certain values. For example the player has an 80% chance to incur normal damage and 20 chance to incur a critical hit.
The component should allow the designer to assign hit damage values, with chances of each damage not being equal. The component performs weighted random choice of the values.
Another important class of random distributions are bell curves, more formally known as normal distributions. Many random phenomena exhibit a bell shaped curve, in fact almost all, distributions in nature are normal.
Normal distributions are centered on a particular value, in our case the default damage value. It can deviate from the default value in either direction, but the extreme values (that are from the default value) are extremely unlikely as you can see in the curve. Naturally, we created a new component that allow weapons to exhibit this behavior.
After some iteration, we ended up creating a component that adds randomness. This component can have default distribution values (uniform, weighted, normal) and also it allows the artist to draw the distribution of the values as in a curve editor.