Wednesday, April 4, 2007

ViM 0.1.200 update.

Not quite ready to do up the shield block post, so here is a little bit of a general update. :D

Well I have spent some time working through the character class feat trees and I am down the the file three classes: Paladin, Ranger, and Spellsword. (The monks is done just not on the site yet.) So I figured I would finish off the feat trees for those three remaining classes and see if I can get the entire feats.2da file finished of for the 0.1.200 patch. What does this mean?

Well it means you would be able to make any class/race combination, but the classes abilities may not be completely implemented yet. I am still planning on having the Saydh and the Warrior completely operational for players for the 0.1.200 patch, but the option of playing any class/race combination will be available. The main reason I want to do this is to reduce the number of patches that require a user download. If I can make most of the work server side, then things will be a lot smoother for the players in the end.

I am still waiting on the 1.06 patch from Obsidian to become available in beta. Yeah, I plan on using a beta patch for development so I can get a head of the game. When that patch comes out, then I will be focusing on getting the ViM patch up and ready. I would like to time it so the the ViM patch is only a week or two post the 1.06 patch from OEI. We will see how that works out.

On a somewhat related note, I have been placing most of my recent work up on the ViM website (http://www.veiled-in-mists.org/) so if you haven't gone there in a while, plenty there to see now. Once I have all of the classes and races up on the site, expect the manual to follow along. I don't intend to include all of the feats and their descriptions in the manual, but they will be available as a separate download.

Anyway, enough ramblings on this subject for now. Just wanted to keep you guys up-to-date on future plans.

Monday, March 19, 2007

Basics of Combat, Volume 6, Dealing Damage

Since we have taken a look at the math behind the chance to hit with a physical attack, let us take a look at the damage dealt.

So the Scar-Eye Goblin Whelp managed to hit our poor first level warrior. Fir now, let's assume that the hit was neither a glancing blow nor a critical hit. The goblin is wielding a Copper Dagger, which is a piercing weapon, and has a the Strength score of 16.

First thing we need to do is determine the goblins Attack Power, or AP. Attack Power is bonus damage from your level and your attributes that are applied to your hit. Now our goblin is a level 1 MOB and therefore has the base attack power of level times 0.8. So the AP numbers look like this.

Level Bonus: 1 * 0.8 = 0.8
Strength Bonus: 16 / 5 = 3.2

Now you simply add these two values together and drop the fractions to determine how much damage is added to the weapons' damage range. In this case, the AP for the goblin would be:

0.8 + 3.2 = 4

If you have spell effects, feats, or item properties that increase damage by a static amount, those values are directly added to the AP.

Now we need to determine the damage dealt by the weapon. In this case our goblin is using a Copper Dagger which has the damage range of 1 to 4 points of damage base. So the script would then determine a random number between 1 to 4 and then add the AP to that attack. In this case the goblin got a massive 4 on this damage roll, so the total damage dealt to the warrior is 8 points. The next step is to apply the damage multiplier.

Since the goblin is not a mini boss or a boss MOB, nor is he able switch to different combat modes, he has the total damage multiplier of 1.0. So he deals full damage. For some MOBs and player characters this value can be increases or decreased based on combat modes or buffs applied to them. Critical hits increase the damage multiplier by 0.5 and Glancing Blows decrease the damage multiplier by 0.5. If you acquire a weapon that has the Increases Damage by X% ability, this is also included in the damage multiplier.

So in the end, the damage from the attack is 8 points of Piercing damage.

Now, the warrior is currently wearing armour that mitigates some of the damage being dealt by the goblin's attack. Since he is a new first level warrior, he only has his starting equipment, a Copper Breastplate. This chest armour provides him with the Armour Value, or AV, of 140. Since he has the Dexterity score of 14, he gains the total of 70 more AV form this attribute. This gives our warrior the total AV score of 210. This value can be further modified by your combat mode, spells, feats, or items.

Now this AV value is then divided by the level denominator which is determined using the following formula:

500 + ((75 + (Attacker's Level * 10)) * Attacker's Level)

Since the goblin is level 1, the AV divisor is 585.

The warriors Armour Value is then divided by this value to determine the percentage of the damage negated by his armour. So the final damage mitigation would be:

210 / 585 = 0.358 (or rough 35% when we drop the fractions)

We then determine that 35% of the damage done is:

8 * 0.35 = 2.8 (2 when we drop fractions)

So the final damage done to the warrior is 6 points or Piercing damage.

Next post we will touch on shield blocks and the chance that they will occur. Until then, see you in the game!

Friday, March 16, 2007

Basics of Combat, Volume 5, Glancing Blows and Critical Strikes

Todays posting will cover 2 topics, Glancing Blows and Critical Strikes. Glancing blows represent a hit, but not a very solid one. In these cases the target only receives 50% of the damage from the attack before damage negation from AV is taken into account. Critical Strikes deal 50% more damage to the target before damage negation is applied. I should make note that the Glancing Blow range is notably higher than the critical strike range. This, of course, goes both ways. So let us start off by looking at the formula for glancing blows.


The value for the glancing blows range is based off of the Target's Dexterity, Dodge, and Parry values. Since we have these values already determined, let's take a look at the formula:

Glancing Blow = (Target's Dexterity / 12) * (Dodge Chance + Parry Chance)

So if we take our level 1 warrior again, we have the following numbers:

Dexterity = 14
Dodge Chance = 3
Parry Chance = 9

So the formula, with numbers, would look like this:

(14 / 12) * (3 + 9)

1.17 * 12

14.04

Remember to truncate all fractions, so the final value is 14. There is a 14% chance that the attack will only be a glancing blow.

So now we are left with the last figure to determine we can slap it together to get our hit tree, and that is the Critical Strike chance. Like Glancing Blows is entirely based on statistics for the defender, the critical strike chance is entirely based on statistics from the attacker. In this case we are looking at the Attacker's Offense skill and Intelligence Attribute. The first step is to determine the final Offense skill value for the attacker, in this case a Scar-Eyed Goblin Whelp. The whelp has the skill of 10, the Dexterity of 14, the Strength of 16, and no direct bonuses to his Offense skill. So the formula to figure out his final skill value would look like this:

10 + (((14 + 16) / 2) * 1.75)

10 + 26.25

So the total for the skill is 36.25. Now the attacker also gains a bonus to his critical strike value equal to his Intelligence attribute divided by 10. The Scar-Eyed Goblin Whelp has the Intelligence attribute of 12 so he gains a 1.2 bonus to this critical strike score. Let's now take a look at the formula used to calculate the attacker's critical strike value:

3 + Intelligence Bonus + (Total Offense Skill / 60)

So the goblin's values would look like this:

3 + 1.2 + (36.25 / 60)

4.2 + 0.604

So the final value would be 4.806. Dropping the fractions would give us the critical strike chance of 4%, or almost the minimum value of 3%.

So now we have formulas to figure out all stages of the combat hit roll. So let's put it all together. First we need to start off with determining the goblin's chance to hit the warrior, since in our example we determined the warrior's chance to hit the goblin. Use the formula posted in Volume 2 of the Basics of Combat we know that the goblin's to-hit chance against the warrior is 12%. So we start by subtracting 5 from that to get the to-hit value that needs to be tracked by the script, or 7%. So the tree would look like this:

1 - 7 - Miss
8 - 16 - Parry
17 - 19 - Dodge
20 - 33 - Glancing Blow
34 - 91 - Standard Hit
92 - 95 - Critical Strike

So there you have it. The combat script would then take a random number between 1 and 95. Compare that number to the chart above and that would determine the type of hit scored against our poor warrior.

Next posting we will take about damage determination. Until then, see you in the game!

Wednesday, March 14, 2007

Basics of Combat, Volume 4, Dodge

Yesterday I posted about one mechanism used to avoid damage even after a hit has been successful. Today, we are going to take a look at the other mechanism, Dodge chance. The two mechanisms actually use the same formula to determine the percent chance of success. The difference between the two is Parry uses Strength as it primary attribute and Dexterity as a secondary and Dodge in the reverse. Dexterity is much more important to your Dodge chance than Strength is. So let's take a look at another example shall we?

Once again our 1st level warrior (getting rather attached to him) is facing off against a big mean, and notably ugly, Scar-Eyed Goblin Whelp. The warrior hasn't had a chance to improve his dodge skill so it starts off at the value of 1. He has a 14 in Dexterity, an 18 in Strength, and no other bonuses to Dodge, so this gives him the early numbers of:

Skill - 1
Bonuses - 0
Dexterity Bonus - 24.5 (14 * 1.75)
Strength Bonus - 1.5 (18 / 12)

The calculation for the Target's dodge chance modifier would look like this:

(1 / 5) + 24.5

So his final skill for Dodge is, 24.7. His Strength bonus is taken into account later.

Now the stats for the Scar-Eyed goblin haven't chanced since the last time he attempted to hit our hapless warrior. Since he is a MOB (Monster OBject) he, therefore, has a skill value equal to its effective level (1) times ten, so this Offense skill is 10. Offense is equally dependent on two attributes, both Dexterity and Strength. So it gains a bonus equal to the average of these two scores. Now our little goblin isn't the strongest nor the most agile of the species, as such, his Strength is a 16 and his Dexterity is 14. Nor has his race developed any bonuses to offense since the last attack (nor than they discovered deodorants either). So, in the end, his stats are as follows:

Offense Skill - 10
Offense Bonus - 0
Strength and Dexterity bonus - 26.25 (15 * 1.75)

So the goblin's total Offense score would be:

(10 / 5) + 26.25

Giving the final value of 28.25.

So Dodge uses the following formula to determine your chance at avoiding an attack:

Dodge = 5 + Target's Strength Bonus + (Target's Dodge Skill - Attacker's Offense Skill)

So to fill in the numbers it would look like this:

5 + 1.5 + (24.7 - 28.25)

Leaving us with the final value of 2.95 or the final value of 2, since NWN2 drops fractions. This value is actually below the minimum dodge/parry chance so our warrior gets a helping hand up to the minimum value of 3%. So our warrior has an additional 3% chance to avoid all damage dealt from the Scar-Eyed Goblin Whelp.

Once again, for those of you who enjoy easy numbers:
1) For every 5 skill points in your chance to dodge is modified either up or down by 1%.
2) For every Dexterity point your chance to dodge is modified either up or down by 1.75%.
3) For every Strength point your chance to dodge is modified either up or down by 0.08%.

Next post we will be looking at the chance of only getting a glancing blow. But for now, see you in the game!

Tuesday, March 13, 2007

Basics of Combat, Volume 3, Parry

So yesterday we took a quick look at the math behind the To Hit chance for melee combat. Now we are going to take a look at how the target's chance at parry chance is calculated.

Both dodge and parry allow the target to completely avoid the damage from an incoming attack, even though that attack counts as a hit. Both parry and dodge used the same formula, but some of the numbers are different. In the case of the parry skill, Strength is more important, and in the case of the dodge skill, Dexterity is the key attribute. Keep in mind that both of these skills do make use of both attributes and both of these skills are directly opposed by you opponents offense skill. We will touch on the target's Dodge chance next posting.

Let's start with the Parry skill, since it comes first on the To Hit roll tree. Like all skills, parry gains a bonus from the Strength attribute equal to 1.75 times the value. Now you also get a bonus to your parry skill equal to your Dexterity skill divided by 12. Then all of the various bonuses for items and abilities are then added. Let's take another look at our first level warrior.

Remember that he hasn't had a chance to increase any of his skills and he has an 18 in his Strength attribute. Unfortunately, the cost for having a high Strength is a lower figure in most other attributes and our little warrior friend only has a 14 Dexterity score. This means this stats are as follows:

Parry Skill - 1
Parry Bonus - 0
Strength Bonus - 31.5
Dexterity Bonus - 1.2

So to figure out the Warriors total parry skill, it would be as follows:

(1 / 5) + 31.5

Or, in other words, the total parry skill would be 31.7. The Dexterity bonus will come in later.

In order to determine our warrior's parry chance we now need to determine how is opposed by the attacker's offense skill. Queue the Goblin!

Ok, so the goblin is, as previously mentioned, a MOB (Monster OBject) and therefore has a skill value equal to its effective level (1) times ten, so this Offense skill is 10. Offense is equally dependent on two attributes, both Dexterity and Strength. So it gains a bonus equal to the average of these two scores. Now our little goblin isn't the strongest nor the most agile of the species, as such, his Strength is a 16 and his Dexterity is 14. Goblins also don't gain any racial bonuses to Offense (aside from their smell) nor is he lucky enough to have any magical items. So his stats are as follows:

Offense Skill - 10
Offense Bonus - 0
Strength and Dexterity bonus - 26.25

So the goblin's total Offense score would be:

(10 / 5) + 26.25

Or, in the end, the total of 28.25.

Now let's throw these numbers into the following formula to determine the warriors chance to parry an attack from the Scar-Eyed Goblin:

Parry Chance = 5 + Target's Dexterity Bonus + (Target's Parry Skill - Attacker's Offense Skill)

So the values would be:

5 + 1.2 + (31.7 - 28.25)

5 + 1.2 + 3.45

So the final parry chance would be 9.65, since the NWN2 engine truncates all fractions, the final parry chance would be 9%. Since value is over the minimum parry chance of 3%, we keep it instead. :D

So even if the goblin hit the warrior, it would still have 9% chance to avoid any damage.

Again, for those of you who enjoy the quick numbers:

1) For every 5 skill points in your chance to parry is modified either up or down by 1%.
2) For every Strength point your chance to parry is modified either up or down by 1.75%.
3) For every Dexterity point your chance to parry is modified either up or down by 0.08%.

Next time we will take a look at a target's dodge chance. Until then, see you in the game!

Monday, March 12, 2007

Basics of Combat, Volume 2, To Hit Chance

Because of the built in (and as I found out you can't disable it) mechanism that you always miss on a roll of a natural 1, this means, no matter what I do, there is a base 5% miss chance already in the system. This 5% would also mean there is no possibility of my script executing, simply because the weapon never hit the target and therefore never fired the On Hit Cast Spell mechanism. Taking this into account, the rest of the hit chance is going to be based out of 95 rather than 100. Although this isn't 100% accurate since two layer chances are multiplicative and I am making them additive, I really don't want to do the math and this is a heck of a lot easier. With that out of the way, on to a preview of how the ViM To-Hit system works...

Step one is to determine the miss chance due to level difference. This value forms the base that is then modified by the attacker's weapon skill and the defender's defense skill. This value is derived from a very simple chart:

Level Difference - Miss Chance
3 or more levels lower - 5%
2 levels lower - 7%
1 level lower - 12%
Same level - 15%
1 level higher - 25%
2 levels higher - 40%
3 levels higher - 70%
4 or more levels higher - 95%

Once you have the base miss chance, you then have to calculate the attacker's weapon skill. This is done the same method as all other skills in ViM. You take their skill value, then add associated attribute(s) value times 1.75, and then any modifiers from abilities, racial bonuses, items, etc. In this case, lets take a level 1 warrior that has no racial bonuses and is using a longsword. Let us also assume that he picked up the Weapon Focus ability in One-Handed Slashing. It is also assumed that the character has just been created and has not increased his skill level. The only attribute that we are concerned with is the warrior's Strength, in which he has an 18, since he is using the One-Handed Slashing skill.

So the numbers work out as follows:
Skill Level - 1
Weapon Focus Bonus - 10
Racial Bonus - 0
Attribute Bonus - 31.5
Item & Spell Bonuses - 0

No you take the total skill level 11 and divide that by 5 to get the base skill level. To that value you add the ability modifier, so the Warrior's total skill level in One-Handed Slashing is 33.7.

Now let's take a look at the poor Scar-Eyed Goblin Whelp that said warrior is beating on. Since the Whelp is a MOB (Monster OBject) he automatically has 10 times is effective level as a skill, so in this case it is 10. The two attributes associated with the Defense skill are Constitution, in which he has a 16, and Dexterity, in which he has a 14. So for defense you use the average of those two attributes and that result is then multiplied by 1.75 to get the attribute modifier, which gives us 26.25. Scar-Eyed Goblins are not lucky enough to have any bonuses to Defense.

So the numbers for the goblin are:
Skill level - 10
Racial Bonus - 0
Attribute Bonus - 26.25
Item & Spell Bonuses - 0

Start by dividing the goblin's skill by 5, giving you the base of 2 and then add the attribute modifier, so the goblin's total defense skill is 28.25.

Since the goblin and the warrior are the same level, 1, the base miss chance is 15%. The modifier to this base is determined by subtracting the attacker's final weapon skill from the defender's final defense skill. The result is then added to the base miss chance to get your final miss chance. So that would be:

15.0 + (28.25 - 33.7)

In other words the final miss chance would be 9.55%, which rounds down* to 9%. Since the engine has a build in 5% miss chance (which means it is the minimum miss chance allowed) then the script has to handle the top 4%. So this becomes the first section of the to-hit roll. The rest of the sections of the to hit roll are made up of parry, dodge, and finally critical chances. The calculations used to determine those values will be discussed later. :)

For those of you who like simple numbers, here is a basic run down:

1) For every attribute point your hit chance is modified up or down by 1.75%.
2) For every 5 skill points your hit chance is modified up or down by 1%.

I hoped that you enjoyed the first discussion of combat with numbers and I hope to see you in the game!

*The Electron engine, as far as I know, truncates fractions when converting from float to integer, so all formulas should assume that they are rounded down.

Friday, March 9, 2007

Basics of Combat, Volume 1, An Overview

Veiled in Mists doesn't use the AC / Base Attack system built into Neverwinter Nights. Well that isn't entirely true, it does but the attack value is really high and the ac is really low so you and the creatures always hit. In its place is a customized system based around the damage reduction system used in most modern MMORPGs (like WoW, EQ, DAoC, etc.). These systems use an armour value to determine how much damage is negated from each attack. This is the system that I have chosen to apply to Veiled in Mists and this is the first posting of a series that will discuss this system. In this posting I am just going to cover an overview of new combat system and how it is basically implemented.

Now since I can't entirely remove the base NWN2 combat system from the engine, not without having the source code to edit and recompile and even then now sure I could do it, I have to work around it. The old NWN2 system uses an attack bonus and armour class to determine a miss/hit style of combat. This works well in low level CPRGs and in the pen and paper game, but balancing it for a high level PW construction can be troublesome. It also isn't very flexible, when all things are considered. So, as mentioned above, I have decided to go with a customized combat system.

Now the first step in circumventing the built in NWN2 system is to make use of a customized On Hit Cast Spell weapon property. This property would be linked to a spell script that would be the focal point of the new combat system. Since I want this new system to work in place of the old, including miss chance, I had to reduce the chance that the PC or MOB would miss to the lowest available in NWN2, 5%. This meant applying a AC penalty and To Hit bonus to all creatures and players. So now the NWN2 combat system only missing on a natural roll of a 1 on the D20 random number generator, or a 5% chance to miss (yes this was included in the calculations for miss chance and will be discussed later).

Once this was one, a custom On Hit Cast Spell function was added to the 2da files and a script was associated with the property. When the weapon impacts on the target (on a roll of anything higher than 1) then the script executes. The script then handles all of the calculations to determine if you character missed anyway (if you have a missing chance > 5%) or if your hit was a critical. The script then passes that data onto another function that deal out the appropriate damage and then to another function to determine if anything special is also meant to occur, like armour reduction from sunder or damage reflection, etc.

So this is the basic foundation of the new combat system. From here I will get into the meat of the functions, such as calculating armour value, hit chance, parry chance, and all of that jazz.

Until next time. See you in the game!