Auto-break rules

Post Reply
Warg1
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 330
Joined: Thu Jan 25, 2018 9:53 pm

Auto-break rules

Post by Warg1 »

Looking for a rule clarification on auto-breaks. My understanding is that average troops autobreak if they fall below 50% of original value. In the picture below I had charged the light archers and they evaded and fell below the 50% level but did not break. What am I missing here please?

FOG2 Autobreak.png
FOG2 Autobreak.png (641.02 KiB) Viewed 1214 times
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28411
Joined: Sun Dec 04, 2005 6:25 pm

Re: Auto-break rules

Post by rbodleyscott »

If it was a campaign battle, then the quality word "Average" covers a range of actual quality values, which would have different autobreak points. Otherwise, it's a rounding issue - the engine uses only integer maths, which can produce rounding effects.

Here is the code that decides whether a unit is autobroken:

Code: Select all

// Determines whether a unit is autobroken due to losses. Returns 1 if autobroken, 0 if not. Autobreak point is <50% strength if Quality = 100, and is adjusted by 10% per 100 quality either side of 100
FUNCTION IsAutobroken(me)
{
	int ret;
	int surviving;
	int quality_bonus;
	int autobreak_point;

	ret = 0;

	surviving = GetAttrib(me, "TotalMen") * 1000;
	surviving /= StartingStrength(me);

	quality_bonus = GetQuality(me);
	quality_bonus -= 100;

	autobreak_point = 500 - quality_bonus;

	if (surviving < autobreak_point)
		{
			ret = 1;
		}

	return ret;
}
Richard Bodley Scott

Image
Warg1
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 330
Joined: Thu Jan 25, 2018 9:53 pm

Re: Auto-break rules

Post by Warg1 »

Thanks for the explanation Richard. I had been under the impression that quality was simply determined by the units classification ie average, raw, superior etc but it looks like there is more to it. Could you please tell me what the other factors that impact on 'quality' and are they variable during the game?
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28411
Joined: Sun Dec 04, 2005 6:25 pm

Re: Auto-break rules

Post by rbodleyscott »

Warg1 wrote: Thu Sep 03, 2020 11:08 pm Thanks for the explanation Richard. I had been under the impression that quality was simply determined by the units classification ie average, raw, superior etc but it looks like there is more to it. Could you please tell me what the other factors that impact on 'quality' and are they variable during the game?
Quality is fixed during a battle.

Quality is the average of Experience and Elan. In standalone battles, this will be as per the Squads file, unless an Epic Battle has code that tweaks it, or unless the game is played on Difficulty Setting 1 or 6, in which case the quality of both sides is tweaked in favour of the player or the AI respectively.

In Campaigns the results of previous battles affects the quality of units through the campaign.

average, raw, superior etc. are not fixed values but display terms that cover ranges of values.

Code: Select all

// Prints quality string
FUNCTION PrintQualityString(me)
{
	int quality;

	quality =  GetQuality(me);

	if (quality <= 40)
		{
			if (GetAttrib(me, "Elan") < GetAttrib(me, "Experience"))
				{
					PrintString("IDS_TT_DEMORALISED");
				}
			else
				{
					PrintString("IDS_TT_UNTRAINED");
				}
		}

	if ((quality >= 41) & (quality <= 60))
		{
			if (GetAttrib(me, "Elan") < GetAttrib(me, "Experience"))
				{
					PrintString("IDS_TT_DISHEARTENED");
				}
			else
				{
					PrintString("IDS_TT_RAW");
				}
		}

	if ((quality >= 61) & (quality <= 90))
		{
			if (GetAttrib(me, "Elan") < GetAttrib(me, "Experience"))
				{
					PrintString("IDS_TT_MILDLY_DISHEARTENED");
				}
			else
				{
					PrintString("IDS_TT_BELOW_AVERAGE");
				}
		}

	if ((quality >= 91) & (quality <= 110))
		{
			PrintString("IDS_TT_AVERAGE");
		}

	if ((quality >= 111) & (quality <= 159))
		{
			if (GetAttrib(me, "Elan") > GetAttrib(me, "Experience"))
			  {
			    PrintString("IDS_TT_ENTHUSIASTIC");
			  }
			else
			  {
					PrintString("IDS_TT_ABOVE_AVERAGE");
			  }
		}

	if ((quality >= 160) & (quality <= 210)) // Note: This section should start at cut off point for Impact Pistol not being cancelled by Impact Mounted.
		{
			PrintString("IDS_TT_SUPERIOR");
		}

	if ((quality >= 211) & (quality <= 250))
		{
			PrintString("IDS_TT_HIGHLY_SUPERIOR");
		}

	if (quality > 250)
		{
			PrintString("IDS_TT_ELITE");
		}
}
Richard Bodley Scott

Image
Warg1
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 330
Joined: Thu Jan 25, 2018 9:53 pm

Re: Auto-break rules

Post by Warg1 »

Thanks again for the explanation and sharing the relevant code. So effectively the classifications capture a potential range of values that are determinants of quality ie not all 'superior' troop are equally superior. Are there ways to determine what the units actual 'Elan' and 'Experience' are from the lists?
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28411
Joined: Sun Dec 04, 2005 6:25 pm

Re: Auto-break rules

Post by rbodleyscott »

Warg1 wrote: Fri Sep 04, 2020 11:15 am Thanks again for the explanation and sharing the relevant code. So effectively the classifications capture a potential range of values that are determinants of quality ie not all 'superior' troop are equally superior. Are there ways to determine what the units actual 'Elan' and 'Experience' are from the lists?
Those values are in the Squads file. Most of them use the standard values for both Experience and Elan:

Raw 50
Average 100
Superior 200
Elite 300

but a few use other values.
Richard Bodley Scott

Image
Warg1
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 330
Joined: Thu Jan 25, 2018 9:53 pm

Re: Auto-break rules

Post by Warg1 »

OK got it. For non campaign games the squads file will show you what they are the vast majority are the standard scores for each classification. It appears as if my original issue could have been a rounding error as it was not a campaign game. Thanks again for your detailed & prompt replies..really helps me to gain a better understanding of this great game.
Post Reply

Return to “Field of Glory II: Tech Support”