Home » MODDING HQ 1.13 » v1.13 Bug Reports » Fixed (?): passive AI
Fixed (?): passive AI[message #330930] Sat, 01 March 2014 04:36 Go to next message
Flugente

 
Messages:3509
Registered:April 2009
Location: Germany
Not a feature, just a fix, but likely very interesting to some people:

One can observe that the AI is very inactive, it doesn't send out that many groups. This is especially baffling on Insane. A likely reason is this gem:
BOOLEAN GarrisonRequestingMinimumReinforcements( INT32 iGarrisonID )
{
	INT32 iAvailable;
	INT32 iDesired;
	SECTORINFO *pSector;

	Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize );	/* added NULL fix, 2007-03-03, Sgt. Kolja */

	if( gGarrisonGroup[ iGarrisonID ].ubPendingGroupID )
	{
		return FALSE;
	}

	pSector = &SectorInfo[ gGarrisonGroup[ iGarrisonID ].ubSectorID ];
	iAvailable = pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites;
	iDesired = gArmyComp[ gGarrisonGroup[ iGarrisonID ].ubComposition ].bDesiredPopulation;
		
	if( iDesired - iAvailable >= gubMinEnemyGroupSize )
	{
		return TRUE;
	}
	
	return FALSE;
}
This looks innocent enough, but is very evil. The desired population of a sector is determined in TableData/Army/ArmyComposition.xml and is independent of difficultylevel or ini settings. This has the nasty effect that if one increases the difficulty-dependent enemy min group size (MIN_ENEMY_GROUP_SIZE_INSANE etc.), you are VERY likely to be to high for that condition to ever fulfilled! :scary: In effect, this hampers the army tremendously. So I've added this bit
// Flugente: The above check is insufficient. if we increase gubMinEnemyGroupSize (to, say, make the game harder), this check will never evaluate to true. Congratulations, you've broken the AI!
// Instead, if we have nobody here, but want someone to be here, then a minimum-sized group is in order.
if( iDesired > 0 && iAvailable == 0 )
	return TRUE;
which results in destroyed garrisons being replaced.

Another error is in
//The maximum number of reinforcements can't be offsetted past a certain point based on the
	//priority of the garrison.
	iMaxReinforcementsAllowed = //from 1 to 3 times the desired size of the normal force.
		gArmyComp[ gGarrisonGroup[ iDstGarrisonID ].ubComposition ].bDesiredPopulation +
		gArmyComp[ gGarrisonGroup[ iDstGarrisonID ].ubComposition ].bDesiredPopulation *
		gArmyComp[ gGarrisonGroup[ iDstGarrisonID ].ubComposition ].bPriority / 50;

	if( iReinforcementsRequested + ubNumExtraReinforcements > iMaxReinforcementsAllowed )
	{
		//adjust the extra reinforcements so that it doesn't exceed the maximum allowed.
		fLimitMaxTroopsAllowable = TRUE;
		ubNumExtraReinforcements = (UINT16)(max(0, iMaxReinforcementsAllowed - iReinforcementsRequested));
	}
		
	iReinforcementsRequested += ubNumExtraReinforcements;
. In effect, groups are again cut down, with no regard for the minimum enemy group size. This can have nasty effects, as there are instances where groups aren't moved because they are too small. I#ve adjusted the group size in that case.

I also looked into the problem that the enemy stops attacking if one stacks enough elite militia in towns. The AI does consider attacking those sectors, but deems its chance of success to low. It thus considers a bigger group size the next time it evaluates. I fear that, in extreme cases, an overflow might be present here, but my fix had... sideeffects, so I#m not touching that for now.

If someone wants to further increase the difficulty, I strongly advise to lower BASE_DELAY_IN_MINUTES_BETWEEN_EVALUATIONS_INSANE and EVALUATION_DELAY_VARIANCE_INSANE (or respective difficulty level modifiers), as these determine the frequency with which the queen sends out attack forces (she can only send out one per evaluation, apart from one-time events, like counterattacks). Also, edit the ArmyComposition.xml to increase the number of troops the queen wants in a town - if you increase the size for cities you already conquered, the enemy forces should be bigger. The compositions are basically forceloadouts that are then linked to sectorsin GarrisonGroups.xml.

The above fixes are committed in r6999.

Report message to a moderator

Captain

Re: Fixed (?): passive AI[message #330931] Sat, 01 March 2014 04:54 Go to previous messageGo to next message
Uriens is currently offline Uriens

 
Messages:346
Registered:July 2006
Thanks for fixing this.

Regarding full stacks of veteran militia; I've done some testing on this and full sector of 32 veterans will never be attacked if maximum size of enemy group is 32. However, when I increased maximum enemy group size to 40, they started attacking those sectors. It seems that it's not needed much to make 'D' army attack full veteran sectors. For example, if someone allows training of veterans, he only needs to increase enemy group size to be slightly higher then militia group sizes and the attacks will start coming in.

Report message to a moderator

Master Sergeant
Re: Fixed (?): passive AI[message #330936] Sat, 01 March 2014 11:06 Go to previous messageGo to next message
Parkan is currently offline Parkan

 
Messages:439
Registered:April 2010
Location: Russia,Sevastopol

I really hope this passive AI will be fixed because in almost all of my games in 1.13 mod enemy not attacking me even if i have a full city with light blue militia and 1-2 merc in sector.So around 80% of my games-enemy passive other 20%-active.Always playing on insane.

[Updated on: Sat, 01 March 2014 11:07] by Moderator

Report message to a moderator

Master Sergeant
Re: Fixed (?): passive AI[message #330938] Sat, 01 March 2014 11:22 Go to previous messageGo to next message
Gorro der Grüne is currently offline Gorro der Grüne

 
Messages:1448
Registered:March 2009
Location: Broadwurschd-City
@ Flug

is this fix a result of my email?




sorry I'm still "grippich" and not able to compose the next (very) big email


kleinCarolinchen: "howabout the volatiles?"

Report message to a moderator

Sergeant Major
Re: Fixed (?): passive AI[message #330941] Sat, 01 March 2014 11:43 Go to previous messageGo to next message
Gorro der Grüne is currently offline Gorro der Grüne

 
Messages:1448
Registered:March 2009
Location: Broadwurschd-City
Uriens
Thanksif someone allows training of veterans, he only needs to increase enemy group size to be slightly higher then militia group sizes and the attacks will start coming in.


nope

there are more settings involved,

that's the reason why I asked Flug whether it is a response to my mail and save + ini.

Report message to a moderator

Sergeant Major
Re: Fixed (?): passive AI[message #330946] Sat, 01 March 2014 14:10 Go to previous messageGo to next message
Uriens is currently offline Uriens

 
Messages:346
Registered:July 2006
I guess I had the other settings right.

I did run into bug Parkan is mentioning, though. Every time I increased max enemy group size to 64 or higher, 'D' would stop sending groups completely. However, when I would lower max group size to 40 or lower, they would start coming in.

Report message to a moderator

Master Sergeant
Re: Fixed (?): passive AI[message #330949] Sat, 01 March 2014 19:42 Go to previous messageGo to next message
Gorro der Grüne is currently offline Gorro der Grüne

 
Messages:1448
Registered:March 2009
Location: Broadwurschd-City
I had the no-Attack-thing with max-enemygroup-size = 32 and only 24 militia/sector

I tested and tested and finally I did no nothing and mail Flug

Report message to a moderator

Sergeant Major
Re: Fixed (?): passive AI[message #330950] Sat, 01 March 2014 19:50 Go to previous messageGo to next message
Gorro der Grüne is currently offline Gorro der Grüne

 
Messages:1448
Registered:March 2009
Location: Broadwurschd-City
Flugente

The above fixes are committed in r6999.


link available or yet to come??

Report message to a moderator

Sergeant Major
Re: Fixed (?): passive AI[message #330954] Sun, 02 March 2014 07:28 Go to previous messageGo to next message
Parkan is currently offline Parkan

 
Messages:439
Registered:April 2010
Location: Russia,Sevastopol

use SVN and compile exe.

Report message to a moderator

Master Sergeant
Re: Fixed (?): passive AI[message #330957] Sun, 02 March 2014 13:33 Go to previous messageGo to next message
Slax is currently offline Slax

 
Messages:1411
Registered:July 2006
Location: People riding polar bears...
Would someone clone Flugente and send him to Space Canada? To live and prosper... and mod JA2... forever.

Report message to a moderator

Sergeant Major
Re: Fixed (?): passive AI[message #330973] Sun, 02 March 2014 18:24 Go to previous messageGo to next message
Flugente

 
Messages:3509
Registered:April 2009
Location: Germany
Gorro der Gr

Report message to a moderator

Captain

Re: Fixed (?): passive AI[message #334033] Sun, 06 July 2014 20:58 Go to previous messageGo to next message
Parkan is currently offline Parkan

 
Messages:439
Registered:April 2010
Location: Russia,Sevastopol

Is it possible to add to game and game options a function that say to Strategic AI Always attack player controlled sectors without any checks(if player strong-attack anyway)?.This passive AI bug occur very often in my games.even after this patch.

Report message to a moderator

Master Sergeant
Re: Fixed (?): passive AI[message #334036] Sun, 06 July 2014 21:42 Go to previous messageGo to next message
Flugente

 
Messages:3509
Registered:April 2009
Location: Germany
That would require some serious bending of the AI (the code tries to exactly not do that). Unfortunately, the strategic AI is time-consuming to test and easy to break.

You can, however, increase the garrison sizes in the xmls, and lower BASE_DELAY_IN_MINUTES_BETWEEN_EVALUATIONS_INSANE and EVALUATION_DELAY_VARIANCE_INSANE (or respective difficulty level modifiers). Having the queen send out a new group every 5 minutes should keep you busy Smile.

Report message to a moderator

Captain

Re: Fixed (?): passive AI[message #334040] Sun, 06 July 2014 22:29 Go to previous message
Parkan is currently offline Parkan

 
Messages:439
Registered:April 2010
Location: Russia,Sevastopol

The thing is in many games in 1.13 mod i modified those settings in many ways.Sometimes my settings allowed to AI play normal,but if i try to play with same setting in new games or in new revisions-the game can be broke(in 80% of all my try to play times)and sometime play normal(around 20 % of my ames AI always attack me).

One thing bother me that in old revisions of 1.13 mod(like 2085)strategic AI always play normally(he attack my captured sectors always),but in revision at 4870 and above the AI started to play with thats bugs.Maybe in some of revision there was some addition to AI that broke this aggrressive mode?

Report message to a moderator

Master Sergeant
Previous Topic: Black screen when choose 30+ traits and view the personnel management
Next Topic: Having problem with long pauses between speech
Goto Forum:
  


Current Time: Sun May 05 19:24:32 GMT+3 2024

Total time taken to generate the page: 0.01058 seconds