RFC: Yet Another Combat Mod

Haenlomal

It Wandered In From the Wastes
Hi all,

As most of you have noticed, combat in Fallout 2 hasn't been its strongest selling point. I've been working on a project in a rather on-and-off manner -- mostly off -- for the past four to five years in an attempt to overhaul the combat system. This is something I've kept under wraps for a few reasons:

1) I haven't exactly been working on this in a solid manner. RL takes a heavy toll.

2) Even then, there were some technical limitations in the engine that has stymied most of the little effort that I've put into the project.

3) As I'm sure all of you had noticed, the Unofficial Patch and Restoration Project are so interesting that I've been rather...distracted. :) Yeah, it's all killap's fault! That's the ticket! :P

Anyway, seeing the release of the new RP, to mention nothing of the excellent combat/ammo mods by Glovz and Magus, finally motivated me off my butt to finally finish...something. The result is what I'm tentatively calling Yet Another Combat Mod. The major purposes of this mod is twofold:

I) Tweak ammo damage values to something more appropriate -- this primarily concerns AP ammo.

II) Tweak combat to be more tactical than it currently is -- for example, knifing some poor isolated soul to death in the corner of the NCR shouldn't trigger every single cop to beat down on you -- at least initially. Rather, the cops should gradually be alerted as cops closer the crime scene raises the alarm and spreads the bad news. And what would happen if you somehow managed to get no witnesses? Then there shouldn't be any alarm raised!

Part II is purely scriptwork -- I have a pretty clear idea what to do, but it'll be intensive, since almost every critter script will need updating (or re-compiling at the very least, if I manage to get everything done in a header file), and I've been too busy (read: lazy) to do that. I'll around to it someday (and post something new once it's done.)

Part I was the bit that stymied me on a technical level, but I've now also managed to overcome that. What I need now is some input and comments on tweaking the final formula.

The New Damage Formula

One of the things that makes my mod different from the ones out there is how I calculate damage. Perhaps the most fundamental change is that instead of a DR modifier on the ammo, it is now a DT modifier. Therefore, the DR that you get is now solely from the armor. As for DT, generally speaking JHP ammo will not have any impact, but AP ammo will reduce it by 4 to 8, and FMJ ammo will reduce it by 2 to 4. Based on this, I've tweaked the original damage formula to two possible variations:

Formula 1

Code:
Damage = (1 - armor_DR) * ((raw_damage * (dmg_mult / dmg_div)) - (armor_DT - ammo_DT))

Formula 2

Code:
Damage = (1 - armor_DR) * ((raw_damage - (armor_DT - ammo_DT)) * (dmg_mult / dmg_div))

Original Formula (for reference)

Code:
Damage = (1 - (armor_DR + ammo_DR)) * ((raw_damage * (dmg_mult / dmg_div)) - armor_DT)

The above formulas assume that no critical hits was inflicted, and that the game is set to normal combat difficulty. The formula is adjusted in the same way as the original formula if either of these conditions isn't true.

As for the effects, generally speaking, overall damage is increased slightly, and JHP ammo still has a very slightly higher average damage. However, AP ammo is very close in average damage, and has a lower standard deviation, enough so that the probability is with AP ammo doing more damage with tougher armor types.

Please see the link below for the full details:

Edit: The spreadsheet is now obsolete. Please refer to this post for up-to-date information.

Some questions to ponder:

1. Which formula do you prefer? Or any suggestions for a better formula?

2. I've managed to change DR mod to DT mod. The engine will now treat what was the DR mod as a negative modifier to the armor DT instead. Is this a good move? Should I include both DR_ammo and DR_ammo modifiers (if possible)?

3. Should I limit (armor_DT - ammo_DT) to zero, or should I allow it to drop into negative values (i.e. raw_damage is increased?)

4. Currently, DR is applied to the raw damage before the damage multiplier. What do you think of reversing that? (i.e. Applying DR to raw damage, then multiplying the result by the damage multiplier -- only really impacts Formula 1).

Any questions, comments, and suggestions are welcomed.

Cheers,

-- The Haen.

Edit: Fixed typo in Original Formula
 
Before I can provide constructive criticism, I need to have an example of the values you intend to use.

If armor_DR is ever greater than 1 both Formula 1 and 2 would ultimately return a negative damage value, is this ok?

If ammo_DT is ever greater than armor_DT then -(armor_DT-ammo_DT) would actually work out to -[-value] which is equivalent to +value, is this ok? --- this would end up increasing the damage rather than reducing it

I have to go back to my note to check if you have the original formula correct, but that matters little if you intend to change it.

Can I safely assume that you have been able to identify everywhere in the engine that the values are retrieved, used, and/or modified/combined with other values? Because I myself am extremely interested in that information. :)

EDIT:
I looked over the spreadsheet and as I thought I am more partial to Formula 2, but your change of having ammo affect DT will cause crazy high values with a Critical hit. From my understanding Criticals cause DT values of armor to be reduced by 80% before they are used in the damage calculation.

EDIT:
You were obviously aware of the possible increase, I should read more carefully, I would limit it - no negatives.
 
This sounds very interesting. Although I generally understand how the damage calculations work, I'm not familiar enough with FO2's particular version to understand where the factor "dmg_div" comes from in the formulas you provided. However I never knew ammo modifiers only worked against an armor's damage reduction/threshold rather than against its overall damage resistance, so I would certainly say that in general you have a good idea for an improvement here.

Part II of your proposal is a good idea as well. The current gross assignment of teams to individual actors who have little in common except for the fact that they're standing on the same map has never made sense to me. You're right that changing this would be a lot of work, but I think the end result would be very rewarding.
 
Glovz said:
I have to go back to my note to check if you have the original formula correct, but that matters little if you intend to change it.

Well, I've left out a few details, such as multiplying dmg_mult by a critical hit multiplier and the game difficulty level. I've also factored (1 - (armor_DR + ammo_DR)) from the original equation, so due to the way the engine calculates the formula, my figures may be off by 1 in the spreadsheet. Other than that, though, things should be good.

Glovz said:
Can I safely assume that you have been able to identify everywhere in the engine that the values are retrieved, used, and/or modified/combined with other values? Because I myself am extremely interested in that information. :)

I wouldn't make that assumption if I were you. ;) From what I can tell through your posts, your knowledge of assembler exceeds mine, so I feel that me giving you pointers would be kinda like a cart dragging the horse. :oops:

Having said that, I'm fairly certain that the function that retrieves DR_ammo is given in offset 004791E0 in Fallout2.exe, at least if you have the v1.02D executable. There's only one place in the executable where this routine is called (Offset 0042499C). It takes one argument -- I think it's a hash reference to the weapon the critter making the attack is using -- and returns the DR_ammo value. (if it exists -- or zero otherwise, I think).

Glovz said:
EDIT:
I looked over the spreadsheet and as I thought I am more partial to Formula 2, but your change of having ammo affect DT will cause crazy high values with a Critical hit. From my understanding Criticals cause DT values of armor to be reduced by 80% before they are used in the damage calculation.

Interesting, I never knew that, though it should be obvious from my damage formula that I had tried to impose certain limits to the modifier. I thought that the critical hit modifiers were only applied to dmg_mult, and not armor_DT? If you can point out the offsets where a critical hit is applied against armor_DT, I'd be very grateful.

Endocore said:
This sounds very interesting. Although I generally understand how the damage calculations work, I'm not familiar enough with FO2's particular version to understand where the factor "dmg_div" comes from in the formulas you provided. However I never knew ammo modifiers only worked against an armor's damage reduction/threshold rather than against its overall damage resistance, so I would certainly say that in general you have a good idea for an improvement here.

Here's a rundown on how damage calculations work in Fallout 2. This represents my understanding through my own look at the assembly code, so I could very well be wrong about a few things.

At any rate, in vanilla Fallout 2, there are four separate modifiers, and you can see each of them if you view any ammo in your inventory. They are:

1) AC mod: This affects Armor Class (AC) rating of the armor. AC mod is always negative, and is applied against the target armor's AC value -- lower combined AC values means better chances of scoring a hit, which is capped at 95%. I have no plans to change this value.
2) DR mod: This impacts the Damage Resistance (DR) offered by the target's armor. This number can act as a positive or negative modifier. DR represents a percentage, and any incoming damage (and note that "incoming damage" has already been modified by other factors, btw) is reduced by this percent before being applied to the critter.
3) Dmg mod: This is a raw damage multiplier expressed as "%d/%d" in the inventory screen (for example, this value is "2/1" for 10mm JHP ammo). Internally, Fallout 2 stores the Dmg mod as two separate values, which I have called dmg_mult and dmg_div. As I understand it, in the event of a critical hit, dmg_mult is multiplied by a certain value depending on the nature of the critical. I plan to change this value to in an effort to maintain some sort of balance.

So how does all this come together in vanilla Fallout 2? Assuming a hit has been scored, damage calculation is a 7 step process.

1) A random number is picked between the max and min damage values of the weapon being fired.
2) If player has the Bonus Range Damage perk, the value of the rank of the perks is added to the damage.
3) Damage is multiplied by dmg_mult of the ammo used. If a critical hit was scored, dmg_mult is increased.
4) Damage is divided by dmg_div of the ammo, with any fractions being discarded.
5) Damage is further reduced by Damage Threshold (DT) of the armor.
6) The DR of the armor and the DR modifier of the ammo is combined together to form a percentage (capped between 0 and 100, for obvious reasons). This percentage is applied against the damage, reducing it by that amount (again, any fractions are discarded).
7) A few other perks, such as Living Anatomy, apply their damage here, though I'm definitely not 100% sure about this part.

Keep in mind that the engine doesn't necessarily do the above steps in the order I've presented. For example, in the assembly code the cumulative sum of armor_DR and ammo_DR is calculated well before step 2 is executed, though the value itself isn't used until step 6. Also, for burst weapons, steps 2 - 6 are repeated for each hit scored against the target.

As you can see, there is currently no ammo modifier against DT, which intuitively makes more sense to me than a DR modifier, hence my attempts to do something about it.

-- The Haen.

Edit: Clarified original damage calculation
 
My skill analyzing the engine is not as great as you make it out to be. :(

I can read and write assembly to an extent but I have never been good at tracing through complex code.

My understanding of the DT value being reduced comes from other peoples evaluations. I have always wanted to test this but I'm not sure how (if at all possible) to force critical hits.

A thread that I found interesting:
http://www.nma-fallout.com/forum/viewtopic.php?t=50758

Your breakdown of the original formula is correct. I only ever saw the flaw as being that DT reduced the damage value only after DR, and that there was not recognition of what type of ammo used against what type of armor.
 
Glovz said:
I have always wanted to test this but I'm not sure how (if at all possible) to force critical hits.
For single hits, a (very) simple hook script should suffice. In hs_afterhitroll.int, use
Code:
procedure start begin
    set_sfall_return(3);
end
Not sure what that'll do to bursts, and it'll probably interact oddly with traits/perks that effect criticals, but it should suffice for testing.
 
Oh, I see now. Armor Piercing/Bypassing critical hits reduce DT by 80%, but the critical hit multiplier is still applied to dmg_mult. I guess if an armor bypassing, damage multiplying critical hit occurs, then it's pretty much instant death for the critter. Not that this is a surprising result, if one really thinks about it. ;)

Thanks for the link, Glovz. That really helped clarify things, and should help further refine my own calculations.

-- The Haen.
 
Back
Top