[FIXED] C++ code--> combat calculation bug

Here we stuff all the bugs we've managed to squash/squish/squelch.
Locked
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

C++ code--> combat calculation bug

Post by stranf »

Uox3 formula to hit is:

(Attacker's weapon skill + 50) / ((defender's weapon skill + 50) * 2)

Running an excel sheet with an attacker at 100, defender at 85, and a different attacker at 81 skill with the same defender,

I should get a hit distribution of:


Attacker 1 to hit: 55% Defender to hit: 45%
Attacker 2 to hit: 49% Defender to hit: 51%


Fairly even distributions; however, in practice it seems skewed in favor of the higher skill quite a bit.

This could just be "random chance" as 50% could go either way, but is there a chance via JS to print the "to hit" rolls?

For example have the console print out the hit roll of each attack (attacker and defender alike) vs. the DC (as calculated by the formula):

Hit Roll: 75 DC: 55

This would be a fairly simple way to debug, as I'm assuming the hit roll is just a random # from 1-100 compared to the DC calculated by the formula. If you get a hit or a miss when it should be different, you know we need to track down a bug.
Last edited by stranf on Thu Sep 06, 2007 6:15 pm, edited 1 time in total.
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

Post by stranf »

I just went to the orc fort and luckily got 2 orcs swinging at me when I wouldn't auto-defend (I was attacking an orc that was fleeing...)


With my swordskill at 100, the enemy has a skill of 40-51

This gives me a 75-83% hit chance and the orcs a 30-33% hit chance.

I counted 100 swings by the orcs. They hit me 5 times that inflicted damage and 4 times where my PC played a "grunt" sound but no damage was inflicted. (there is a bypass in the C++ code posted on this forum, that if a greater amount of damage is absorbed by armor, the damage done should return a 1. I recieved zero damage for these hits.)

That gives the orcs a 5% hit rate not counting the 0 damage "grunt" sounds, or a 9% hit rate counting the "grunt" sounds.

This statistically does not add up to the 30-33% rate found in excel.
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

Post by stranf »

Edited 9/7/7


Looks like Grimson fixed this by matching the C++ to the stratics code. Something that people will notice is the Uox3 originally had the monsters swinging pretty fast...not a big deal because they can't hit. Now that monsters are hitting more, it becomes difficult for a GM warrior to kill a group of 4 or 5 orcs.

Don't worry, this should be much easier to fix than the previous code. Now we can tweak the .dfn values for the monsters and one can customize combat to be as easy or as difficult as they want. I'm really excited to play with this new update.
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

Hm. Can you verify that this is fixed, stranf, and possibly post a new bug if there are any other issues?
-= Ho Eyo He Hum =-
Locked