Need some advice for a modding attempt

Post Reply
companion
Private First Class - Wehrmacht Inf
Private First Class - Wehrmacht Inf
Posts: 9
Joined: Fri Jul 08, 2016 2:16 pm

Need some advice for a modding attempt

Post by companion » Tue Dec 24, 2019 7:26 am

I want to create a global mod (for personal use of course) that changes pike vs impact foot interactions as following:

On impact, impact foot is at disadvantage against (casualty-adjusted) "deep pike," is at parity against just "pike."
Impact foot may fall back after impact without cohesion loss against units with "pike" capabilities.

Is CloseCombatLogic.bsf the correct file to edit? Which lines should I pay attention to?
Any pointer to what to look for is greatly appreciated.

rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 22685
Joined: Sun Dec 04, 2005 6:25 pm

Re: Need some advice for a modding attempt

Post by rbodleyscott » Tue Dec 24, 2019 7:44 am

There is quite a lot you would need to mod to achieve that.

With regard to the first point you would need to tweak either the pike or the impact foot Impact POAs, but the change would need to apply specifically to that matchup only, otherwise it will have massive knock-on effects.

The code you would need to change would be either the Impact Foot or Pike POA code in the GetImpactPOA() function in CombatTools.BSF

I can't give you a specific line to mod, it won't be that simple, but those are the areas of code to look at.

With regard to the break off issue:

If impact foot are at a disadvantage vs pike at impact, and break off if they don't win, how will they ever beat them? (By flank attacks, you might say, but then you would need to rejig the points costs so that the Romans have an advantage in numbers of units.)

So, assuming that they only break off if they lose badly (as per normal), you just need to stop the pikes from following up. But they wouldn't follow up anyway if the impact foot charged.

You need to clarify what exactly you want to happen.
Richard Bodley Scott

Image

companion
Private First Class - Wehrmacht Inf
Private First Class - Wehrmacht Inf
Posts: 9
Joined: Fri Jul 08, 2016 2:16 pm

Re: Need some advice for a modding attempt

Post by companion » Tue Dec 24, 2019 9:21 am

rbodleyscott wrote:
Tue Dec 24, 2019 7:44 am
There is quite a lot you would need to mod to achieve that.

With regard to the first point you would need to tweak either the pike or the impact foot Impact POAs, but the change would need to apply specifically to that matchup only, otherwise it will have massive knock-on effects.

The code you would need to change would be either the Impact Foot or Pike POA code in the GetImpactPOA() function in CombatTools.BSF

I can't give you a specific line to mod, it won't be that simple, but those are the areas of code to look at.

With regard to the break off issue:

If impact foot are at a disadvantage vs pike at impact, and break off if they don't win, how will they ever beat them? (By flank attacks, you might say, but then you would need to rejig the points costs so that the Romans have an advantage in numbers of units.)

So, assuming that they only break off if they lose badly (as per normal), you just need to stop the pikes from following up. But they wouldn't follow up anyway if the impact foot charged.

You need to clarify what exactly you want to happen.
But pikes will follow up if they initiate the attack, correct?

Anyway, the practical effect that I want to see is for impact foot army (Roman, Celts, etc) to keep "bouncing off" pike phalanxes without incurring disadvantaged loss exchange during melee phase in a fashion similar to how ZOC-ing stationary lancer cavalry "bounces off" from the charging infantry right after impact without committing to melee.

The "generic winning pattern" I envision for the impact foot army is:
Force over-extension of enemy pike center while maintaining integrity of own retreating center.
Meanwhile the numerical advantage (in terms of # of maneuver units) of the impact foot army, in conjunction with over-extension of enemy center, and/or random patches of roughs or forests that were once behind own retreating center, would facilitate envelopment.

I think this better simulates the descriptions of battles where impact foot (usually Romans) faced off pike phalanxes such as Pydna and Magnesia than current FoG system where impact foot either disrupts pike on very first contact and absolutely mauls it or it fails to disrupt and gets mauled by pike during melee.

Oh and before I open yet another can of worms, I have absolutely no intention of forcing what essentially is my opinion unto other forum members here, which means I will not request the game to be patched in such and such ways; I merely posted this topic just to get some idea of effort/skill required for the modding.

rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 22685
Joined: Sun Dec 04, 2005 6:25 pm

Re: Need some advice for a modding attempt

Post by rbodleyscott » Tue Dec 24, 2019 10:25 am

companion wrote:
Tue Dec 24, 2019 9:21 am
But pikes will follow up if they initiate the attack, correct?
Yes
Anyway, the practical effect that I want to see is for impact foot army (Roman, Celts, etc) to keep "bouncing off" pike phalanxes without incurring disadvantaged loss exchange during melee phase in a fashion similar to how ZOC-ing stationary lancer cavalry "bounces off" from the charging infantry right after impact without committing to melee.

The "generic winning pattern" I envision for the impact foot army is:
Force over-extension of enemy pike center while maintaining integrity of own retreating center.
Meanwhile the numerical advantage (in terms of # of maneuver units) of the impact foot army, in conjunction with over-extension of enemy center, and/or random patches of roughs or forests that were once behind own retreating center, would facilitate envelopment.
So you will need to Mod the CheckBreakOff() function in CloseCombatLogic.BSF to make Impact Foot break off from Pikes if they don't disrupt them - similar to the code for cavalry.

Put the new code after

Code: Select all

					if ((IsFoot(me) == 1) && (all_foot == 1) && (loser == me) && (LostCloseCombatBadly(me, notional_turn) == 1))
						{
							try_break_off = 1;
						}
Richard Bodley Scott

Image

companion
Private First Class - Wehrmacht Inf
Private First Class - Wehrmacht Inf
Posts: 9
Joined: Fri Jul 08, 2016 2:16 pm

Re: Need some advice for a modding attempt

Post by companion » Sun Jan 05, 2020 2:22 pm

I hope everyone had a great holiday vacation!

This modding is a bit confusing to do with zero coding background but I managed to add an impact POA rule under impact foot against pike attributed units. It's not reflected in the unit info window but combat result prediction popups do reflect it.

However I'm having trouble with implementing withdrawal after impact.
To start with, I copied the cavalry code but tried to limit it between impact foot and pike like this:

if ((IsFoot(me) == 1) && (GetAttrib(me,"Impact_Foot") > 0) && (IsFoot(enemy) == 1) && (GetAttrib(enemy, "Pike") > 0))
{
rating = CalculateModifiedCloseCombatRating(me, nastiest_enemy, -1, 1);
rating *= AdditionalEnemiesModifier(me, 0);
rating /= 100;
if (rating < highest_enemy_rating)
{
try_break_off = 1;
}

And of course this does not seem to work. I tried some other variations to no avail.

Should I use something else other than getattrib? what is the meaning of "all foot"?

All these look like basic stuffs that I really should not bother people with but, well, I'm just unable to comprehend them at the moment.

rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 22685
Joined: Sun Dec 04, 2005 6:25 pm

Re: Need some advice for a modding attempt

Post by rbodleyscott » Sun Jan 05, 2020 3:07 pm

I will be more easily able to see what is preventing it from working if you send me the whole modded script.

Send me a PM and I will give you my email address.
Richard Bodley Scott

Image

companion
Private First Class - Wehrmacht Inf
Private First Class - Wehrmacht Inf
Posts: 9
Joined: Fri Jul 08, 2016 2:16 pm

Re: Need some advice for a modding attempt

Post by companion » Tue Feb 25, 2020 8:15 am

Really sorry for just vanishing. I was enjoying pike keils and Sun-king's impact foot galore in the meantime.

Returning to this little project of mine, I realized that the tile size in FOG2 is lot larger than I originally thought. I of course knew that the not-to-scale 3d models are just eyecandy but still, my eyes played tricks on my mind.
Thus, I too think that pushbacks are better than my original plan.
That said, I have three questions.

1. Is it possible to use pre-patch pushback frequency for specific matchups? I want to experiment with pre-patch frequency for when impact foot is one defending. I want to use current frequency for all other cases.
2. how do I remove(disable) pike square ability globally?
3. Is it possible to have extra cohesion dice roll when impact foot won an impact not apply to pikes? I might not have to fiddle with POA values if this can be done.

Thanks for sparing time to answer despite in a small, busy team.

Athos1660
Staff Sergeant - StuG IIIF
Staff Sergeant - StuG IIIF
Posts: 286
Joined: Wed May 29, 2019 3:23 pm

Re: Need some advice for a modding attempt

Post by Athos1660 » Tue Feb 25, 2020 8:59 am

companion wrote:
Tue Feb 25, 2020 8:15 am
Really sorry for just vanishing. I was enjoying pike keils and Sun-king's impact foot galore in the meantime.
This is the best excuse ever ! :-)
(end of my off-topic)

rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 22685
Joined: Sun Dec 04, 2005 6:25 pm

Re: Need some advice for a modding attempt

Post by rbodleyscott » Tue Feb 25, 2020 11:54 am

companion wrote:
Tue Feb 25, 2020 8:15 am
Is it possible to use pre-patch pushback frequency for specific matchups?
Not easily.
2. how do I remove(disable) pike square ability globally?
Put

return -2

after the variable declarations in the CHECK_ALL_FORMSQUARE() and DEPLOYCHECK_ALL_FORMSQUARE() functions in FormSquare.BSF

3. Is it possible to have extra cohesion dice roll when impact foot won an impact not apply to pikes? I might not have to fiddle with POA values if this can be done.
There isn't an extra cohesion dice roll, just a modifier on the existing cohesion test.

Whatever the mechanics of the interaction, the game is currently balanced so that pikes have a slight advantage overall vs legions unless they get flanked.

If you remove the cohesion test completely, pikes will always win the overall combat. (Cancel Roman Empire, we all now speak Greek).

If you want the modifier not to apply, which would be less drastic, change

Code: Select all

					if ((IsFoot(me) == 1) && (GetAttrib(enemy, "Impact_Foot") >= 50))
						{
							uniqueModifier = 1;
							PrintStringLiteralX(UIString, 0, "\n"); // v1.5.4 addition
							PrintStringX(UIString, 0, "IDS_CT_IMPACT_FOOT"); // v1.5.4 addition										
							Log("Fighting impact foot", me);
						}
in CohesionTest() in MoraleTools.BSF

to

Code: Select all

					if ((IsFoot(me) == 1) && (GetAttrib(enemy, "Impact_Foot") >= 50) && (GetAttrib(me, "Pike") < 100))
						{
							uniqueModifier = 1;
							PrintStringLiteralX(UIString, 0, "\n"); // v1.5.4 addition
							PrintStringX(UIString, 0, "IDS_CT_IMPACT_FOOT"); // v1.5.4 addition										
							Log("Fighting impact foot", me);
						}
Richard Bodley Scott

Image

companion
Private First Class - Wehrmacht Inf
Private First Class - Wehrmacht Inf
Posts: 9
Joined: Fri Jul 08, 2016 2:16 pm

Re: Need some advice for a modding attempt

Post by companion » Tue Feb 25, 2020 3:15 pm

rbodleyscott wrote:
Tue Feb 25, 2020 11:54 am

If you remove the cohesion test completely, pikes will always win the overall combat. (Cancel Roman Empire, we all now speak Greek).
Romans, Celts, Jews, all will be screwed, I am aware. Which is why I wanted pikes to overextend more easily against Impact Foot types by tweaking fallback/pushback.

Maybe I have a misleading bias: I tend to think that Impact Foots are more flexible than other types in terms of advances and withdrawals since they are rather cavalry-like in their reliance on charges.
Well, I just thought that overall, pikes should be more resistant from the front, more vulnerable to flanking, and impact foots more... liquid/rubberband enough to induce disruption in line integrity in opposing phalanx line, both spear and pike.

In any case, many thanks for the help. Now I know that modding fallbacks is out of my reach, I'll stick to small tweaks or unmodded rules.

Post Reply

Return to “Field of Glory II: Modding”