Damage Resistance Calculations broken?
Moderator: Zyx
Forum rules
Please read the Forum rules and policies before posting.
Please read the Forum rules and policies before posting.
Damage Resistance Calculations broken?
Okay, I downloaded CSB again and building up my party, got Sonja to level 12 ninja in a couple of hours on reaching the water elementals using the rope. Incidentally, it DOES reduce the damage she takes from ALL sources of damage. For example, I throw a level 4 fireball into a wall, and she only takes 50 damage when all my other guys take 250 damage. And the water elemental will only usually deal single-digit damage to Sonja.
Problem is, the damage resistance from skills, attributes and equipment sometime seems to be broken or disabled. I ran a save again and the elemental was doing up to 80 damage to Sonja. I threw a level 4 fireball at the wall, everyone got 400 damage. Then after a half hour, the damage resistance seemed to work again, Sonja taking the single-digit damage from our elemental and 50 damage from the level 4 fireball... I didn't change any options or do anything different.
I just found this to be very odd.
Problem is, the damage resistance from skills, attributes and equipment sometime seems to be broken or disabled. I ran a save again and the elemental was doing up to 80 damage to Sonja. I threw a level 4 fireball at the wall, everyone got 400 damage. Then after a half hour, the damage resistance seemed to work again, Sonja taking the single-digit damage from our elemental and 50 damage from the level 4 fireball... I didn't change any options or do anything different.
I just found this to be very odd.
- Paul Stevens
- CSBwin Guru
- Posts: 4319
- Joined: Sun Apr 08, 2001 6:00 pm
- Location: Madison, Wisconsin, USA
Ok the problem with the damage resistance not being calculated seems to happen when I first load the game. That is, it was working earlier when I saved the game but not working later when I loaded it up again. I'm not sure how to get the savefile I'm working with onto the web however. Maybe I should get an account here, not that I'll be posting a whole lot.
-
- Novice
- Posts: 19
- Joined: Sun Jan 30, 2005 2:42 am
- Location: Location: Location: Location: Location: Location: Location: Location: Location: Location: Location:
- Paul Stevens
- CSBwin Guru
- Posts: 4319
- Joined: Sun Apr 08, 2001 6:00 pm
- Location: Madison, Wisconsin, USA
-
- Novice
- Posts: 19
- Joined: Sun Jan 30, 2005 2:42 am
- Location: Location: Location: Location: Location: Location: Location: Location: Location: Location: Location:
I didn't run the game in record mode, so forgive me if I don't have that information. Also, I would have sent the savefiles to you but for the fact that your e-mail doesn't show in your profile or a forum search, although I could be using the forum search incorrectly. It's just really annoying though, since the usually only randomly begins when I load the game I wonder if it has more to do with something esle on my computer than CSB itself, but it seems to save this problem to the savegame so I suppose it's worth a try.
-
- Novice
- Posts: 19
- Joined: Sun Jan 30, 2005 2:42 am
- Location: Location: Location: Location: Location: Location: Location: Location: Location: Location: Location:
I guess you're right about on-forum e-mail not allowing attatchments as I just checked yours. Anyway, I've finally got two savegames with working damage resistance and one with the malfunctioning damage resistance. I just checked again for the save where damage resistance isn't working correctly, apparently it's not just damage resistance from skills that isn't working but also damage resistance from armor and I suspect attributes as well. My guess is the problem is where overall damage resistance is calculated or whatever, but the only exception might have been the magic shield. The problem is, I can never tell if the magic shield ever actually provides damage resistance or not; I had that problem of seeing damage resistance from the shield playing DM on the Amiga too. If it does reduce damage it only seems to reduce it by about half on average, who knows.
- Paul Stevens
- CSBwin Guru
- Posts: 4319
- Joined: Sun Apr 08, 2001 6:00 pm
- Location: Madison, Wisconsin, USA
-
- Novice
- Posts: 19
- Joined: Sun Jan 30, 2005 2:42 am
- Location: Location: Location: Location: Location: Location: Location: Location: Location: Location: Location:
There are actually 2 more things that help me ID the problem. First, slamming a door on my party's head will cause damage like nobody has skills or helmets in the bugged game, whereas in the game where calculations are normal helmets DO protect against doors while Sonja's skills also reduce damage to 5-6.Gambit37 wrote:Hmmm.. this all seems very strange. The game has a certain amount of randomness thrown into it's calculations, how can you possibly tell that something is broken against simply being a random spike?
I also just tested by running into walls. In the bugged game the characters take 2 damage running into the wall while the ok game they take only 1 damage.
Fireballs at the wall also helped to determine this.
Also, just watching the damage my characters took from the water elemental helped ID the problem; it was suspicious to me when the damage Sonja took went from single digits on average to 70+ damage.
And Paul, I found your e-mail. DOH! I wish I thought of looking there earlier.
EDIT: Just re-tested, running into the wall doesn't look like a good testing idea after all, sorry about that.
-
- Novice
- Posts: 19
- Joined: Sun Jan 30, 2005 2:42 am
- Location: Location: Location: Location: Location: Location: Location: Location: Location: Location: Location:
Ok I think I have an idea what might be causing the damage resistance to vary so much. I've been training Stamm today and noticed that his damage resistance went down, up, down, up, then down again just like with Sonja. More importantly, the damage resistance for Stamm changed at the same rope-climbing skill levels as it did for Sonja! I think we've got some integer or floating-point variable wrapping around at regular intervals. One such point seems to lie somewhere between
0x001e0000
and
0x00200000
For both Sonja and Stamm the damage resistance seemed non-existant at 0x001e0000, but it improved back to normal somewhere around 0x001f0000. Also, the rope-climbing skill is listed as skill number 8. Hope this helps.
0x001e0000
and
0x00200000
For both Sonja and Stamm the damage resistance seemed non-existant at 0x001e0000, but it improved back to normal somewhere around 0x001f0000. Also, the rope-climbing skill is listed as skill number 8. Hope this helps.
- Paul Stevens
- CSBwin Guru
- Posts: 4319
- Joined: Sun Apr 08, 2001 6:00 pm
- Location: Madison, Wisconsin, USA
There were some relatively recent changes in exactly
this area. While stepping through the code using your
savegame4 I came to the point where a this recent
correction was made.
You did not say what version of CSBwin you are using.
Could you try the most recent version to see if things seem better?
In any case that is the version I will want to fix if is still broken.
http://dianneandpaul.net/CSBwin/CSBwin98v29.rar
this area. While stepping through the code using your
savegame4 I came to the point where a this recent
correction was made.
You did not say what version of CSBwin you are using.
Could you try the most recent version to see if things seem better?
In any case that is the version I will want to fix if is still broken.
http://dianneandpaul.net/CSBwin/CSBwin98v29.rar
-
- Novice
- Posts: 19
- Joined: Sun Jan 30, 2005 2:42 am
- Location: Location: Location: Location: Location: Location: Location: Location: Location: Location: Location:
-
- Novice
- Posts: 19
- Joined: Sun Jan 30, 2005 2:42 am
- Location: Location: Location: Location: Location: Location: Location: Location: Location: Location: Location:
I DL'd the 9.8v29, but it doesn't seem to have changed the character damage resistances from what they were before. Also, I'm a little confused about that download because it only uncompressed to release notes and the sword icon labelled 'CSBwin'. Is that all there should be to it?
EDIT: I was previously using the version that just said "version 9.8".
EDIT: I was previously using the version that just said "version 9.8".
The official release is 9.8 on the encyclopaedia website
As you may notice Paul is highly active in bug fixing, and other people *cough zyx* are equaally active in asking for things : )
So basically Paul makes each new version that has a bug-fix or added feature available on his webspace (just the core csbwin.exe engine), but since the changes could generate further bugs he doesn't put them up officially
As you may notice Paul is highly active in bug fixing, and other people *cough zyx* are equaally active in asking for things : )
So basically Paul makes each new version that has a bug-fix or added feature available on his webspace (just the core csbwin.exe engine), but since the changes could generate further bugs he doesn't put them up officially
- Paul Stevens
- CSBwin Guru
- Posts: 4319
- Joined: Sun Apr 08, 2001 6:00 pm
- Location: Madison, Wisconsin, USA
- Paul Stevens
- CSBwin Guru
- Posts: 4319
- Joined: Sun Apr 08, 2001 6:00 pm
- Location: Madison, Wisconsin, USA
I found a basic flaw in the logic.
When a hero attacks a small adjustment is made to damage resistance.
This can be positive or negative depending on the attack type. The adjustment
is in effect until the attack "recovers", that is until the hero can attack
again (in other words, while the attack button is greyed out). Then the
adjustment is subtracted again.
Now here is the problem. Some attacks (under some circumstances that
I don't understand) have no "timeout". You can attack again immediately. In
these cases the adjustment is made to the damage resistance at the time of the
attack but because there is no "timeout" the adjustment is not deleted.
This is true for your first character when using "PUNCH", for example.
The result is that if every time you do a PUNCH the adjustment is incremented
and eventually gets so big that it goes negative. Then is suddenly changes from
maximum to minimum.
This adjustment was probably intended for things like PARRY to reduce
damage for awhile. Or for stab, to increase damage while you are out of
position and not defending. The graphics file has the adjustment for each
attack type.
The origianl plan was probably to use it for other things because it is a full
16 bits and they add and subtract rather than set and clear. But it is only
used for this one thing. So I think I will fix it by changing it to Set/Clear.
But I am going to sleep on it before making any changes.
When a hero attacks a small adjustment is made to damage resistance.
This can be positive or negative depending on the attack type. The adjustment
is in effect until the attack "recovers", that is until the hero can attack
again (in other words, while the attack button is greyed out). Then the
adjustment is subtracted again.
Now here is the problem. Some attacks (under some circumstances that
I don't understand) have no "timeout". You can attack again immediately. In
these cases the adjustment is made to the damage resistance at the time of the
attack but because there is no "timeout" the adjustment is not deleted.
This is true for your first character when using "PUNCH", for example.
The result is that if every time you do a PUNCH the adjustment is incremented
and eventually gets so big that it goes negative. Then is suddenly changes from
maximum to minimum.
This adjustment was probably intended for things like PARRY to reduce
damage for awhile. Or for stab, to increase damage while you are out of
position and not defending. The graphics file has the adjustment for each
attack type.
The origianl plan was probably to use it for other things because it is a full
16 bits and they add and subtract rather than set and clear. But it is only
used for this one thing. So I think I will fix it by changing it to Set/Clear.
But I am going to sleep on it before making any changes.
-
- Novice
- Posts: 19
- Joined: Sun Jan 30, 2005 2:42 am
- Location: Location: Location: Location: Location: Location: Location: Location: Location: Location: Location:
- Paul Stevens
- CSBwin Guru
- Posts: 4319
- Joined: Sun Apr 08, 2001 6:00 pm
- Location: Madison, Wisconsin, USA
CSBwin version 9.8v30 is posted. Here is what I wrote in it.
You can see that word64 is used on a par with ShieldStrength
and PartyShield. The limits at the end cause a clipping. THe result
is that when word64 is less than -200 or greater than 200 the effects
are clipped and any shield effects are totally lost.
I am convinced that this was in the original code and not introduced
by my translation.
Code: Select all
i16 word64; // In the original it appeared that this was
// intended to hold an adjustment to damage
// resistance. When an attack was made by a
// character a positive or negative value was
// added to this word. When the attack expired
// (when the character's attack was no longer
// disabled) the adjustment was subtracted.
// Unfortuately, some attacks required no time
// for recovery. In such cases the adjustment
// was made when the attack occurred but, since
// it never timed out, the adjustment was never
// canceled. When a player did hundreds of these
// attacks the adjustments added up until they
// overflowed. Then the value suddenly changed
// from +32767 to -32768. It was not too terrible
// because the final computation was limited to
// to the range (0, 100). But it was noticeable
// and probably hid smaller effects of armor, etc.
// Since this word is used for only this one thing
// and since only one adjustment can be in effect
// at a time I have changed it to set the value
// and clear the value instead of adding and
// subtracting. Wish me luck.
Here is the computation that uses the word describe above.
D7W = sw( D7W
+ pcA3->word64
+ pcA3->shieldStrength
+ d.PartyShield
+ D6W);
D0W = ApplyLimits(0, D7W >>1, 100);
and PartyShield. The limits at the end cause a clipping. THe result
is that when word64 is less than -200 or greater than 200 the effects
are clipped and any shield effects are totally lost.
I am convinced that this was in the original code and not introduced
by my translation.
-
- Novice
- Posts: 19
- Joined: Sun Jan 30, 2005 2:42 am
- Location: Location: Location: Location: Location: Location: Location: Location: Location: Location: Location:
The good news of the update is that damage resistance doesn't oscillate anymore. The bad news is, my characters no longer have the truly rediculous levels of damage resistance they used to!
Haha, actually, thanks for the fix. Really! It's good to have armor, shields and the like useful once again. I can see fire resistance acting the way it's supposed to now, relatively as Gothmog and Stamm don't take quite as much fire damage as my other guys.
Haha, actually, thanks for the fix. Really! It's good to have armor, shields and the like useful once again. I can see fire resistance acting the way it's supposed to now, relatively as Gothmog and Stamm don't take quite as much fire damage as my other guys.
- Paul Stevens
- CSBwin Guru
- Posts: 4319
- Joined: Sun Apr 08, 2001 6:00 pm
- Location: Madison, Wisconsin, USA