FUNCTION ModifiedCloseCombatDamage

Post Reply
eblingus
Lance Corporal - Panzer IA
Lance Corporal - Panzer IA
Posts: 10
Joined: Sat Jan 11, 2020 2:01 am

FUNCTION ModifiedCloseCombatDamage

Post by eblingus »

The manual says that "100 POA difference is roughly equivalent to a 33% combat modifier." but FUNCTION ModifiedCloseCombatDamage multiplies POA by 16, not 33. Is there something I am missing?

Also, is there a way to run the .BSF files through a tool to step through the code, like I would do if I was de-bugging it? I have tried a few C language tools, but none understood the .BSF files very well, and it was too much work to translate. I would like to step through the .BSF files to understand how this game does it's math better.
Thanks.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28274
Joined: Sun Dec 04, 2005 6:25 pm

Re: FUNCTION ModifiedCloseCombatDamage

Post by rbodleyscott »

eblingus wrote: Mon Feb 17, 2020 5:28 pm The manual says that "100 POA difference is roughly equivalent to a 33% combat modifier." but FUNCTION ModifiedCloseCombatDamage multiplies POA by 16, not 33. Is there something I am missing?
The initial value of the damage variable in that function is 50. 16 is of course 33% of 50.
Also, is there a way to run the .BSF files through a tool to step through the code, like I would do if I was de-bugging it? I have tried a few C language tools, but none understood the .BSF files very well, and it was too much work to translate. I would like to step through the .BSF files to understand how this game does it's math better.
Thanks.
There is a primitive debugger, but I have rarely used it. See

http://archonwiki.slitherine.com/index.php/Scripting

Near the end.
Richard Bodley Scott

Image
eblingus
Lance Corporal - Panzer IA
Lance Corporal - Panzer IA
Posts: 10
Joined: Sat Jan 11, 2020 2:01 am

Re: FUNCTION ModifiedCloseCombatDamage

Post by eblingus »

Sorry, I should have posted the code for FUNCTION ModifiedCloseCombatDamage
the relevant sections are:
damage = 50;
and
// Modify according to net POA
POAmodifier = 16 * POA;
POAmodifier += 10000;
POAmodifier /= 10;
damage *= POAmodifier;
damage /= 1000;

If I put in POA = 100 then:
POAmodifier = 16 * 100; = 1600
POAmodifier += 10000; =11600
POAmodifier /= 10; =1160
damage *= POAmodifier; = 50 * 1160 = 58000
damage /= 1000; =58

58 is 1.16 * 50, not 1.33 * 50, so a 16% increase for POA 100.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28274
Joined: Sun Dec 04, 2005 6:25 pm

Re: FUNCTION ModifiedCloseCombatDamage

Post by rbodleyscott »

You are of course correct, my original explanation was given without much thought and was wrong. For which I apologise. It is several years since I wrote the relevant code, and it took a while for me to figure it out again.

The proper explanation is as follows:

After netting out the POA for both units, net POA work both ways. If one unit is on +100 net POA, the opposing unit is on -100 net POA.

Your unit has +100 net POA which gives it a 16% advantage.

The enemy unit has -100 net POA which gives it a 16% disadvantage.

Overall, therefore, your unit has a net 32% advantage (approximately).

In fact it isn't as simple as that, the real advantage in terms of modified "damage" in this case is ((1.16 / 0.84) - 1) * 100 = 38%

The tooltips report it as 32% to keep it simple. It is easier for most players to remember that each +1 Net POA gives approximately 0.32% advantage, than to have to consider that the actual amount of advantage per net POA is on a sliding scale depending on the actual net difference.

Moreover, the figures shown for the % modifiers are only a guideline. The bottom line is the Win: Draw: Loss prediction, which is based on running the actual combat calculation 1000 times and totalling up the % of Wins, Draws and Losses. The other stuff is just to help players understand why the Win:Draw:Loss chance is as it is.
Richard Bodley Scott

Image
Post Reply

Return to “Field of Glory II: Modding”