August 5, 2015 at 1:30 pm #160
This first post is reserved for the agreed upon elements of the combat system design. The rest of the thread is for proposal and discussion of various elements or reference to other threads of the same.August 5, 2015 at 1:57 pm #161
Here is the first part of my code-level focused proposal for a combat system.
First, only PC/NPC/monster objects will have strength, dexterity, and intelligence properties that will act as single value containers to be referenced or changed by various systems and scripts. Given the simplicity of these attributes, it is easy to add more “attribute” properties to objects without major underlying codework.
Second, every weapon object will have properties for min/max damage, weapon type (1-handed sword, 2-handed axe, bow, etc), hand-hold positions, and a field for optional special scripts (bonus fire damage, poison attack, area of effect damage script, etc.)
Third component is a database for weapon type details including the various weapon attack styles for a weapon type with each style having its own animation, damage type, ranged weapon flag with projectile object reference field, and special script (for non-attack styles like the defensive staff spin or back flip; or special attack scripts like area of effect damage from fire arrows or armor reducing effects).
Next I will describe the function pathway.
First an NPC or the player initiates an attack action. This activates the attack function with parameters from the weapon object and the attack style. The function first looks like the details about the attack style from the style database. The animation is then initiated.
The combat system itself will have various settings that control the behavior of it. One of these settings is whether the hit detection is based on collision or skill/die roll. If it is a die-roll based system, you enter a reference to your hit function. A default one will be coded as a base model for projects to adapt.
Once a hit has been registered, the damage part of the function is used with references to various details from the attacker, the opponent hit, and the weapon. A draft of the equation follows:
Damage = Base weapon damage (random number between min and max damage) X Skill/Attribute(i) X Attribute Factor(i) X Opponent Damage Type Modifier (only applied if damage type from weapon style matches damage type vulnerability/resistance of opponent) – Opponent’s Armor at the point of contact (some opponent’s have higher armor at certain areas; note armor equals zero if damage type modifier is negative)
Note that an opponent might be terrain or an object.
Note also that all special scripts are initiated after hit detection and are told whether a hit was made. Your function can then use this information as needed in case you only want the script to work upon a hit or if area of effect might cause damage without the weapon/projectile hitting anything.
August 5, 2015 at 9:47 pm #164
- This reply was modified 2 years, 6 months ago by Iceblade.
Just like weapons, armor will need to have their own type, attachment positions (which bone will they attach to on the model), deformation (if we are using different shaped models, will need to deform armor to “fit” the wearer), and special scripts (resistances, weaknesses, etc, probably partially derived from their type).
Shields and blocking/parrying can also modify the effect of combat, especially when relying on collision.
Join me in New Britannia!
You must be logged in to reply to this topic.