Home » MODDING HQ 1.13 » v1.13 Coding Talk » Trunk AI and improvements
Re: Trunk AI and improvements[message #360974 is a reply to message #360968] Thu, 20 August 2020 07:30 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r8891

Suppression fire improvement: disabled ubAdjacentSoldierCnt check as it doesn't work correctly, for example, when you load the game, tiles around soldiers have ubAdjacentSoldierCnt = 0 (until you move the soldier), which results in suppression greatly reduced since only tile with soldier is accounted and not tiles around him. Also some tiles have incorrect ubAdjacentSoldierCnt values, for example tiles can have high values even if there are no soldiers around, or one tile around soldier can have zero value while other tiles have correct value = 1.

Also improved adjacent tile gridno calculation to avoid out of bounds values.

As a result of this change, suppression fire should be more consistent and predictable now.



Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #360977 is a reply to message #360974] Fri, 21 August 2020 15:34 Go to previous messageGo to next message
Wien1938 is currently offline Wien1938

 
Messages:31
Registered:May 2017
Location: UK
Excellent!

Report message to a moderator

Private 1st Class
Re: Trunk AI and improvements[message #361035 is a reply to message #358729] Thu, 27 August 2020 12:40 Go to previous messageGo to next message
barra is currently offline barra

 
Messages:6
Registered:July 2017
@sevenfm I really like your (AI) improvements, they are flanking, taking cover, using granades and mortars etc., really good work so far and I can imagine AI work is a tedious task!
But they also show, atleast the first few days, when you are equipped with very limited range pistols/smgs, a slightly annoying behaviour.
It seems the AI trys to stay out of weapon range and at night even out of sightrange of your mercs. I dont know if I really like this kind of behaviour, because in my mind it seems a bit cheaty.
Where do the AI get the info of my mercs visibility and weapon range to be constantly out of range?
If they were out of range because their weapons were superior I would not complaint!
So the question is, why they stay out of weapon range of the player and therefor most often out of their own range? My thought would be the AI should try to come into their own weapon range to actually hit something!
While trying to come in reach of the mercs, its riskier for the AI to been hit by the player for sure, but thats excatly the behaviour I would prefer/expect.
This way there were even more action/movement in some battles.

A good example of the current behaviour would be to look at the Militia-AI fighting against the Soldier-AI, they bulk as soons as they could see each other!

The game would be a bit easier when SOME of the AI-Soldiers and/or militia would try to ambush the opponent, instead of staying at their place, but imo it would be also more fun to play. To counter the getting easier part one could f.e. simply tweak the damage resistance of them.

Maybe (if not already done in the code idk) this "aggressive" rush forward behaviour could be linked to/caused by the traits of them?!


Another general question would be: Is it possible to externalize or seperate the NCTH of grenades/mortars from the regular NCTH.
So the player could set another CTH for grenades then for regular shooting?!








Report message to a moderator

Private
Re: Trunk AI and improvements[message #361036 is a reply to message #361035] Thu, 27 August 2020 14:03 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
@barra
As for enemy AI, they don't use exact weapon range to determine position, instead enemy CTGT is checked, which does not depend strictly of weapon range, so I don't think that what you describe is what actually happens in the code. Anyway it's hard to say what happens without examining the actual enemy behavior in actual save. There are also some options that can have serious impact on AI behavior.
Speaking about ability to check enemy vision and hide - it's the same thing that a player can do, also if you don't like this behavior, just disable AI_BETTER_COVER.

Militia and enemy team use the same AI code, with maybe very few minor differences.

Grenades/mortars, as any thrown weapons, have the same CTH code in NCTH and OCTH, and it's separate from regular guns CTH, so there is no "NCTH for grenades" as far as I know.
There are also some ini options for various types of weapons, so you can have different CTH bonus/penalty for grenades/mortars etc.

[Updated on: Sat, 05 September 2020 17:52]




Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #361396 is a reply to message #361036] Mon, 28 September 2020 08:27 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r8895

Red AI:
- reload before suppression fire less often in dangerous situation, also check AP_MINIMUM so we don't reload when really low on APs (should help AI to react better and be more active in close combat)
- use CanNPCAttack() check only for sniper and suppression fire as only these actions need usable gun (for example, we don't need usable gun to be able to call reinforcements or throw grenade)
- when trying to step back to deploy mortar, check if we can actually reach the spot and have enough APs (for some reason this code only checked if there's empty tile behind us but never checked if we could actually reach it or have enough APs, so it could possibly cause problems with AI in rare situations)

Hopefully improved r8658:
- check weapon magazine size and chance to say phrase when using gun (so we check correct used weapon and not just object in main hand)
- always reset fSayAmmoQuotePending in InternalReduceAttackBusyCount() (so there should be now no situation when attack is finished without quote but fSayAmmoQuotePending is still set which could potentially cause strange behavior later)

Also, looking at the armed vehicle AI code, it also has code for mortar and code for stepping back to deploy mortar which is beyond my understanding. Looks like armed vehicle AI code needs total review and rework.



Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #361582 is a reply to message #361396] Fri, 16 October 2020 20:59 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r8901

Suppression/autofire tweaks for AI:
- new option AI_SAFE_SUPPRESSION (TRUE by default) adds additional checks for AI to avoid hitting friends when using suppression fire (AI will check if there are friends in general direction of fire which can be potentially hit)
- chance to use suppression fire depends on actual chance to hit and SUPPRESSION_EFFECTIVENESS option (so if you set SUPPRESSION_EFFECTIVENESS = 0, AI will only rarely use suppression fire if there is a chance to actually hit enemy, with SUPPRESSION_EFFECTIVENESS = 50 the chance to use suppression fire will be roughly halved)
- reduced short burst to 2 bullets (a code to prefer 2 short aimed burst instead of longer less aimed burst when soldier has enough APs for 2 bursts or weapon has no semi auto mode)
- improved code to use short aimed burst (higher chance when can possibly hit friends in shooting direction)



Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #361583 is a reply to message #361582] Fri, 16 October 2020 22:57 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r8902

EstimateStabDamage: updated code to better match actual damage calculation, removed bonus from breath damage as it can make HTH/melee attacks too attractive.

HTH/melee attacks:
- reduce stab attack attractiveness if target is not very close (max normal stab attack distance is about 3-4 tiles, after that penalty is applied)
- reduce stab attack attractiveness if soldier sees more than one opponent (stab attack against multiple opponents can be more dangerous)
- for HTH attacks, skills don't have effect on choosing attack type for boxers
- reduce HTH attack attractiveness if soldier sees more than one opponent

Autofire:
- allow to increase autofire bullets by reducing aim in NCTH if LIMIT_MAX_DEVIATION option is enabled (LIMIT_MAX_DEVIATION option makes suppression much more effective by reducing max bullet deviation without making all shots more accurate)



Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #361593 is a reply to message #361583] Sat, 17 October 2020 09:38 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r8904

AI speed optimization
FindNearestUngassedLand, FindNearbyDarkerSpot:
- optimization: don't check spots already checked in previous loop
- increase max distance to 35, reduce to 15 in realtime (try to prevent lagging in realtime)
ManSeesMan: only call SetNewSituation if location or level are different to reduce frequency of AI re-evaluation.

Interface/convenience improvements
Say TAUNT_RELOAD, TAUNT_OUT_OF_AMMO taunts if mag size > 4 or Chance(CHANCE_SAY_ANNOYING_PHRASE) (similar to how no ammo quote works now, to reduce annoying taunts when enemy soldier has weapon with low mag size).
Only allow radio animation on initial red alert, if sector is not jammed (to make the game faster).
Press ESC to stop dragging (small convenience feature).
Only show "suppression fire" message if target soldier cannot be seen after turning (to indicate that enemy soldier really uses suppression fire).

Misc improvements
SpotDangerLevel: also check Water and CorpseWarning for danger level = 1 (so that AI avoid moving into water or near fresh corpses unless in higher danger).
CanDragPerson, CanDragCorpse: use world movement cost instead of LOS check (it should be faster and possibly more correct).
Fixed bug when merc could not start dragging corpse while standing on it, because LOS check from tile to the same tile failed.

[Updated on: Sat, 17 October 2020 11:19]




Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #361625 is a reply to message #361593] Wed, 21 October 2020 00:22 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r8905

AI:
- improved civilian cower/run away code (should fix situation when civilian repeatedly cowers/stops cowering but does not run away)
- CancelAIAction: reset bNextAction and next action data, clear next action data before making decisions
- militia always try to spare grenades unless under attack or using flares



Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #361626 is a reply to message #361625] Wed, 21 October 2020 09:55 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r8907

Improved AI RPG use:
- check for friendly fire chance when using rocket launcher (looks like they never even cared about that before)
- only enemy team will try to use rocket launcher against single opponent in a room (militia should be more careful about destroying their towns)
- set min chance to hit 80% when deciding to use rocket launcher, except tanks or when shooting at tank (since there is higher chance to miss with RPG than with mortar/GL launcher, need really good CTH to shoot and not miss too much or hit friends etc)
- changed min chance to hit to use launcher/RPG so that experienced soldiers prefer higher chance to hit



Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #361659 is a reply to message #361626] Sun, 25 October 2020 12:08 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r8910

Improved code to spawn item and it's attachments when disarming bomb (previously it was possible that disarmed tripwire was not stackable with other tripwire items if ALLOW_EXPLOSIVE_ATTACHMENTS was activated).
Update sight after item transformation (for example, when changing scope magnification).

Improved EDB code: do not show PercentTargetTrackingSpeed and PercentDropCompensation when using OCTH.
Before:
https://i.imgur.com/nzEMt6m.png
After:
https://i.imgur.com/FR514BC.png

[Updated on: Sun, 25 October 2020 18:55]




Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #361706 is a reply to message #361659] Thu, 29 October 2020 19:24 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r8912

Added new option BUCKSHOT_SUPPRESSION_EFFECTIVENESS to Ja2_Options.ini, 50 by default, used both for NCTH and OCTH.
Previously only 50% of buckshot bullets were counted for suppression in OCTH and 100% when using NCTH, now the modders can have more control of it.



Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #361729 is a reply to message #361706] Sun, 01 November 2020 19:00 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
CalcBestShot()

// evaluate every tile for its opponent-damaging potential
for (bYOffset = -bMaxUp; bYOffset <= bMaxDown; bYOffset++)
{
	for (bXOffset = -bMaxLeft; bXOffset <= bMaxRight; bXOffset++)
	{
		// calculate the next potential gridno near this opponent
		sGridNo = sOpponentTile[ubLoop] + bXOffset + (MAXCOL * bYOffset);

		// this shouldn't ever happen
		if ((sGridNo < 0) || (sGridNo >= GRIDSIZE))
		{
			continue;
		}

		if ( PythSpacesAway( pSoldier->sGridNo, sGridNo ) > iTossRange )
		{
			// can't throw there!
			return;
		}
...
What this code does: if it randomly finds a spot around one of possible targets which is too far for throw, it just ends all calculations and exits, instead of checking other possible spots and other possible targets. As a result, AI will randomly decide not to use thrown attack at all if one of the tiles around one of the possible targets is outside of max throwing range.
This bug is in the code since vanilla.
Should be fixed in r8915.



Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #362361 is a reply to message #361729] Wed, 10 February 2021 22:35 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
sevenfm wrote on Tue, 09 February 2021 14:04
Cowering animations are buggy in the game, for example, cowering merc cannot stand up but can go prone, and if ordered to move will just stand up with buggy animations.
r8930 should fix:
- starting movement from cowering state
- switching stance from cowering state using 's', 'r', 'c' and 'p' keys, also page up/page down keys
- switching stance from cowering state using mouse up/down arrows or long RMB menu



Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #362364 is a reply to message #362361] Thu, 11 February 2021 21:23 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r8931 adds new AI code: advance to closest opponent using cover when in black state, if weapon range is too short or soldier has high morale or cannot attack from current spot or has no cover.
Also AI will try to cover path using smoke grenade if it's dangerous.

[Updated on: Thu, 11 February 2021 21:24]




Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #362366 is a reply to message #362364] Fri, 12 February 2021 07:32 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r8932
If you leave the game running for too long, guiBaseJA2Clock may overflow and result in the bug looking as this:
https://i.imgur.com/xUccnIj.jpg

The following solution was proposed by MH17:
UINT32 overflow_detection = guiBaseJA2Clock;
guiBaseJA2Clock += BASETIMESLICE;
 
// detect overflow
if (overflow_detection > guiBaseJA2Clock)
{
  MapScreenMessage(162, 0, L"guiBaseJA2Clock overflow detected!");
  for (gCNT = 0; gCNT < TOTAL_SOLDIERS; gCNT++)
  {
    gPSOLDIER = MercPtrs[gCNT];
    if (gPSOLDIER)
      gPSOLDIER->ResetSoldierChangeStatTimer();
  }
}

A better fix would require to correctly compare timer values after overflow everywhere in the code, but at least it fixes the problem with incorrect stats now.

[Updated on: Fri, 12 February 2021 09:50]




Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #362367 is a reply to message #362366] Fri, 12 February 2021 09:24 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r8934

Black AI:
- fixed bug when AI soldier was ordered to move to his current spot when trying to get closer
- check if soldier can find cover before disabling the attack

For some reason, previously if AI decided to get closer before shooting, it was ordered to move to the same spot:
if (!TileIsOutOfBounds(pSoldier->aiData.usActionData))
{
	pSoldier->aiData.usActionData = pSoldier->sGridNo;    // how it was supposed to work? aiData.usActionData should be the tile we move to
	pSoldier->pathing.sFinalDestination = pSoldier->aiData.usActionData;

	pSoldier->aiData.bNextAction = AI_ACTION_FIRE_GUN;
	pSoldier->aiData.usNextActionData = BestAttack.sTarget;
	pSoldier->aiData.bNextTargetLevel = BestAttack.bTargetLevel;

	DebugAI(AI_MSG_INFO, pSoldier, String("try to get closer, move to %d", pSoldier->aiData.usActionData));
	return( AI_ACTION_GET_CLOSER );
}



Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #362411 is a reply to message #362367] Tue, 16 February 2021 19:27 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r8936

New ingame option: Smart tree tops.
Allows to hide only trees that block view for visible soldier or cursor position.

https://i.imgur.com/Godfb9N.png



Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #362416 is a reply to message #362411] Wed, 17 February 2021 17:04 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r8939

Don't allow to select grey militia menu options, added check if action is available.
Start radio animation when giving orders to militia.
Militia should not change order to SEEKENEMY if given Hold order.

r8941

Optimized Smart tree top hiding code to reduce CPU load.

[Updated on: Wed, 17 February 2021 17:37]




Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #362460 is a reply to message #362416] Sun, 21 February 2021 15:24 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r8945

Various improvements to allow covert operations or hit and run tactics without morale/reputation penalties.

New option DEFEAT_MODE:
- 0: default, any lost battle is considered defeat
- 1: if enemy team was alerted
- 2: if at least one of retreating mercs is not covert
- 3: if at least one merc was killed in battle
- 4: if all mercs were killed in battle

MORALE_RAN_AWAY:
- apply penalty when retreating from sector only if enemy team was alerted
- improved check for mercs in sector (in my tests, original check didn't work properly for detecting retreating merc)
- no MORALE_HEARD_BATTLE_LOST penalty (it should be called separately if sector is lost to enemy)
- no reputation loss when retreating from battle (retreating to save merc lives is smart)

CheckForEndOfBattle:
- only apply morale and loyalty penalty if player was defeated (according to DEFEAT_MODE option)
- only play death music if player is defeated
- log defeat only when player was defeated
- clear aware status for enemy team, clear enemy kill counter

r8946

Small visual improvement: show flash light when throwing flares. It will not trigger interrupt, but may reveal for player enemy position.

[Updated on: Sun, 21 February 2021 18:27]




Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #362523 is a reply to message #362460] Tue, 23 February 2021 21:07 Go to previous messageGo to next message
Xafloz is currently offline Xafloz

 
Messages:98
Registered:December 2016
Hi sevenfm,

After a while I'm back in JA2 1.13 action and while having continuous blast while using the modpack (vfs_config.NO+IoV_Revised + JA2+AI ENG - r1888.exe) from certain moment quite regulary during militia turn there is a ctd with final massage (taken from game_log.log):

[6492.69] : ERROR : ========== Tue Feb 23 19:50:38 2021 ==========
File : ..\src\Core\vfs_string.cpp
Line : 210
Location : vfs::String::as_utf16

Invalid UTF8 character '×'=215 str16:AltSounds\Caliber\7.62×37mm Subsonic\case1.ogg

Any help would be appreciated.

Thanks in advance!

EDIT: I found that firing from SL9SD 7.62×37mm causes the ctd. How can I fix it?

[Updated on: Tue, 23 February 2021 21:17]

Report message to a moderator

Corporal 1st Class
Re: Trunk AI and improvements[message #362524 is a reply to message #362523] Tue, 23 February 2021 21:25 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
Xafloz wrote on Wed, 24 February 2021 00:07
Hi sevenfm,

After a while I'm back in JA2 1.13 action and while having continuous blast while using the modpack (vfs_config.NO+IoV_Revised + JA2+AI ENG - r1888.exe) from certain moment quite regulary during militia turn there is a ctd with final massage (taken from game_log.log):

[6492.69] : ERROR : ========== Tue Feb 23 19:50:38 2021 ==========
File : ..\src\Core\vfs_string.cpp
Line : 210
Location : vfs::String::as_utf16

Invalid UTF8 character '×'=215 str16:AltSounds\Caliber\7.62×37mm Subsonic\case1.ogg

Any help would be appreciated.

Thanks in advance!
Please provide a save just before the ctd happends.
Game log message is most likely irrelevant here.
This thread is about main trunk, not about 7609 or related modpacks, please post your bug reports in appropriate threads.
Actual +AI version for 7609 is ja2_7609en+AI_r1948.exe on my google drive, it's recommended to always use most recent version as it has most bug fixes.
Incorrect '×' symbol will be replaced in the next modpack version.



Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #362525 is a reply to message #362523] Tue, 23 February 2021 21:27 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
Xafloz wrote on Wed, 24 February 2021 00:07
EDIT: I found that firing from SL9SD 7.62×37mm causes the ctd. How can I fix it?
You need to search Data-IoV_Revised folder for '×' chars in xml files and replace them with 'x' char, this would fix the issue.
Or disable NWSS system in options and play with old sound.

[Updated on: Tue, 23 February 2021 21:30]




Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #362528 is a reply to message #362525] Tue, 23 February 2021 22:29 Go to previous messageGo to next message
Xafloz is currently offline Xafloz

 
Messages:98
Registered:December 2016
I've changed a few chars in:

AmmoStrings.xml
Items.xml
German.Items.xml
German.AmmoStrings.xml

and it does work. Brilliant

Thank you, and sorry for posts in the wrong thread.

Report message to a moderator

Corporal 1st Class
Re: Trunk AI and improvements[message #362549 is a reply to message #362528] Fri, 26 February 2021 14:30 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r8947

New militia order: Move to (works in realtime only, switches militia soldier to STATIONARY/DEFENSIVE), allows to quickly position militia before fight.
Fix: check if desired stance is possible when ordering militia to crouch/prone.
Green AI: reworked climb code (only climb up, only at the start of the turn, disable for STATIONARY).

Demo video:



Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #362563 is a reply to message #362549] Sun, 28 February 2021 18:30 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r8948

HandleSuppressionFire: improved code to calculate suppression shock, take into account 100AP / 25AP system, also new code should work better with high SUPPRESSION_SHOCK_INTENSITY values.
Removed AP_SUPPRESSION_SHOCK_DIVISOR option, as the code will now correctly divide AP value by 4 when using 100AP system, and overall suppression shock can be tweaked with SUPPRESSION_SHOCK_INTENSITY.
This should make switching to 25AP system easier as one less option needs to be modified.



Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #363006 is a reply to message #362563] Mon, 26 April 2021 13:01 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r8980

Various fixes and improvements:
- exploit fix: don't allow "handcuff" and "apply item to others" cursors to reveal position of invisible enemy
- fixed vanilla exploit (detect invisible enemy by using plotted path)
- no sector ambients in cutscenes (so no more dog barking in Deidranna's palace)
- fix Deidranna endless clock in cutscene (she can kill Elliot now)

Fixes by Shadooow:
- fix for black windows (Orta) not blocking vision properly
- fix for incorrect cursor when using wire cutters
- fix: allow interrupts after door opening (still only door opener is checked, so there is no effect from placing more mercs behind him, also diagonal door opening is still nothing more than exploit for player since enemy can never get interrupt in this case)
- fix: female and big male body types being transparent when climbing up roof
- small fix in TurnSoldier code
- fix for vision not being updated in many situations
- fixes for bug when you sometimes got vision inside building when climbing from the roof
- fix: CTRL+U cheat command not replenishing energy properly
- EVENT_SoldierBeginBladeAttack: initialize attack data before other calculations, set bTargetLevel to soldier's level as melee attacks don't work between levels (should fix various problems with melee attacks for mercs and creatures)
- fixed AP cost shown at the cursor when pressing ALT during RUN mode since game doesn't allow to "reverse run" and forces walking
- shows walking cursor instead of running if ALT is held
- fix: erase path after switching active merc with mouse wheel
- fix: path not being erased and recalculated when changing selected soldier via SPACE button
- fix: display of merc AP in case he started with value over 99 new APs are lower than that
- fixed queen alternative gridno feature spawning her behind walls in basement instead of in front of the throne in palace
- fixed queen alternative gridno feature triggering even when palace was cleared
- added missing sanity checks when Climbing/Jumping via UI button
- fix: mechanical units are not a valid blood donors

Removed unused options: ARMY_USES_TANKS_IN_ATTACKS, ARMY_USES_TANKS_IN_PATROLS, ARMY_USES_JEEPS_IN_ATTACKS, ARMY_USES_JEEPS_IN_PATROLS, ARMY_USES_ROBOTS_IN_ATTACKS, ARMY_USES_ROBOTS_IN_PATROLS (by rftr).

New SCI can be found here: https://jenkins.maeyanie.com/job/JA2%20SCI/
New exe can be downloaded from the link in the sig.

[Updated on: Mon, 26 April 2021 13:06]




Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #363085 is a reply to message #358729] Sun, 02 May 2021 15:49 Go to previous messageGo to next message
Anderson is currently offline Anderson

 
Messages:5
Registered:December 2019
Hi,

I use JA2-Unstable-r8990-g2589 and Ja2_r8997.exe and I have DYNAMIC_OPINIONS = FALSE but still, there is information about improvement merc. opinions after shooting somebody. And I have Stephan and Meltdown and they don't comment on each other progress. Isn't there any problem with this?

Thanks for the answer in advance.

Report message to a moderator

Private
Re: Trunk AI and improvements[message #363086 is a reply to message #363085] Sun, 02 May 2021 16:28 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
Anderson wrote on Sun, 02 May 2021 17:49
Hi,

I use JA2-Unstable-r8990-g2589 and Ja2_r8997.exe and I have DYNAMIC_OPINIONS = FALSE but still, there is information about improvement merc. opinions after shooting somebody. And I have Stephan and Meltdown and they don't comment on each other progress. Isn't there any problem with this?

Thanks for the answer in advance.
Please report it in the bugs section:
http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=22776&start=0&



Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #363205 is a reply to message #363086] Tue, 11 May 2021 20:45 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r9017

A bunch of fixes and improvements (by Shadooow):
Fix for various crashing and merc placement issues when getting ambushed.
Fix: items stacking with those that player cannot take from sector inventory when using CTRL+LMB from merc inventory.
Fix for filling canteens during combat.
Fix for for autobandaging sometimes hang indefinitely.
Fix for leaving merc never reaching final sector until current battle is finished.
Fix for randomly shooting in wrong direction because the game activates spreading code by mistake.
Fix for not enough action points error message not appearing when using consumable without enough AP in turn based mode. (The message got overriden with another one -> "Huh?")
Additionally fixed empty canteens to consume AP just to do nothing. Empty canteen now throws the Huh? error.
Fix: small GUI issue where the body silhouette in merc inventory turned dark after moving applicable item onto it and then out of it.
Fix: GUI issue where the body silhouette wasn't lit up with some of the new consumable items such as energy drinks, etc. Also, empty canteen will no longer lit up the body silhouette anymore.
Fix for incorrect highlighting attachments + lots of efficiency improvements.
Efficiency improvements for code dealing with attachments validity to fix any potential lag issues.
Another efficiency improvement for attachments validity check function - will not check all items in inventory to be a valid gun/ammo for tested item if the tested item is attachment/hidden addon.
Significant improvement for the inventory panel item highlighting code on map screen. There is also a fix for wrong items highlighted when changing currently selected merc.
Old code was constantly running update for highlights several times a second. Now it only happens when the mouse position first finds or loses an item in inventory.
Unified the highlight behavior with currently held item in cursor to only ever highlight compatible items for that item (was the case in tactical, not in map screen)
Enabled the body silhouette in map screen to be lit up when hovering/holding consumable item just as it happens in tactical mode
Feature: displaying action points in upper right corner of the merc portrait on map screen if the merc is in sector under attack and turn based mode.
Fix for assertion failure when right clicking on merc assignment.
Fix for Dynamic Opinions feature not respecting ini setting and not allowing it to be disabled easily.
Reverted optimization code which prevented 40mm grenades to load if <attachment> tag is not set in mod (note: to enable this optimization back all mods should have <attachment> tag set for all GL grenades and mortar shells).
Fixes some old traits not having any popup text or showing "No bonuses" during IMP character creation.
Fixes:
- robot has no (dynamic) opinions anymore. For now I allowed other mercs to have opinion about robot, but that is also a bit odd
- fixed Not Enough Action Points error triggering needlessly, when doing stuff like reloading ammo, using consumables or changing attachments in map screen during battle with mercs that are not in the sector where battle is occurкing
- fix for RPCs sometimes repeating last spoken line after victory in the sector
Fixes NPCs going back to cower animation after collapsing which also caused them not to die properly.
Fix for switch weapon shortcuts taking more AP than doing it manually when inventory costs are enabled.
SHIFT+k shortcut on map screen to use same code as in tactical. Made ALT and CTRL +SHIFT+k shortcuts work on map screen.
Allowed moving items between mercs in map screen during combat for mercs that are not in the sector where battle is occurring.
Allowed inventory management in map screen with inventory costs feature enabled. Actions points will be deducted as expected.
Fix for drugged icon not displaying on merc portrait immediately when taking drug from map screen.
Fix for playing full burst firing sound with less bullets than the usual for the gun burst fire in chamber.
Fix for "bullets too high" sanity check in tilesets with non-zero floor height causing bullets to disappear when firing at roof from too steep degree (the game incorrectly treated bullet as "too high so out of the world" because of not zero height of the floor in sectors with cliffs).
Fixed function PickPocket to work with MOLLE type of LBEs.
Changed code that handles putting medical kit from merc inventory into his main hand to respect pockets restrictions to avoid putting gun into medkit only pocket etc.. Writes an error in case that medical kit cannot be put into hands due to no suitable place for currently held items.
Fix for using items on enemies on roofs from inside room below. This includes multiple actions like first aid kit, blade or punch that shown path into room below enemy on roof and even allowed to stab from there (with zero chance to hit) or punch from there (clocks running for minute).
If refilling canteen makes merc to automatically drink, drinking should make merc to automatically refill canteen - which gives player a way how to refill empty canteen while in battle (refilling code is applied only to "drinking" interactive action, and only for current merc).

Also some fixes by rftr:
ASD deployment fix:
- fix: robots, jeeps, and tanks now appear in garrison reinforcement and patrol groups (if the ASD and these units are enabled)
- fix: ASD continues to purchase jeeps if tanks are disabled
- removed some magic numbers in Strategic AI.cpp
Fix: incorrect variable initialization for number of robots in squad.
Fix: enemy counter not updated correctly when turncoat feature is used.
More turncoat-related fixes and tweaks:
- added "recruit turncoat" to the talk menu
- recruiting turncoats now costs AP (AP_TALK in APBPConstants)
- fixed groups not decrementing soldiers when activating turncoats
- fixed a hang when activating a sector with 100% turncoats in realtime

Small fix by noooooo:
Fix: No longer get individual militia email when individual militia is disabled.

Small fix by serg:
Incorrect initialization (copy-pasted code was zeroing vector arrays inside structure which resulted in errors later).

Minor fixes and improvements by sevenfm:
Fix incorrect CTH message for [F] key when not using gun (was using NCTH message with gun stability instead of OCTH message with CTH).
Only show "sniper" message when shooter uses sniper rifle (the definition of "sniper" shot is debatable, previously any single shot in red state could result in "sniper" message which looked strange sometimes).
Disabled "sniper" message for vehicles.

As always, new SCI can be found here: https://jenkins.maeyanie.com/job/JA2%20SCI/
New exe can be downloaded from the link in the sig.



Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #363633 is a reply to message #363205] Fri, 27 August 2021 20:54 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r9156

ADD_SMOKE_AFTER_EXPLOSION option now works better, it will check if default SMOKE_GRENADE item (151) is valid hand grenade, and if not then search for first useful smoke hand grenade in items, and only use correct smoke grenade item, to avoid bug in Aimnas if item 151 was changed to something different.

[Updated on: Fri, 27 August 2021 21:13]




Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #363634 is a reply to message #363633] Fri, 27 August 2021 21:38 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r9157

Added timer fix suggested by Terapevt to avoid incorrect signed/unsigned comparison later:
guiBaseJA2Clock += BASETIMESLICE;

// Terapevt suggested fix
if ((INT32)guiBaseJA2Clock < 0)
	guiBaseJA2Clock = 0;

// detect overflow
...
This can possibly fix some rare quest related bugs.



Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #363745 is a reply to message #363634] Thu, 23 September 2021 21:22 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r9167

AI flanking:
- avoid moving too far from noise spot, except for CUNNINGSOLO
- avoid moving too close to enemy vision range

These changes should make AI flanking faster, also prevent flanking soldiers from appearing in enemy view.
Limiting max flanking distance for most of soldiers allows to make AI attacks more consolidated in some cases.



Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #363821 is a reply to message #363745] Mon, 04 October 2021 21:01 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r9172

New option NEW_SUPPRESSION_CODE:
- new base suppression tolerance calculation, based on soldier's morale and experience level
- disabled bonus from nearby friendlies as this should affect morale already and also enemy is nearly always outnumbering mercs
- disabled squadleader's bonus to suppression tolerance as it should already affect morale and effective level
- suppression resistance reduces AP loss from suppression instead of modifying tolerance

In general, this change should make suppression more balanced and make situations with enemy having max tolerance less frequent.



Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #363826 is a reply to message #363821] Tue, 05 October 2021 14:04 Go to previous messageGo to next message
Ortis is currently offline Ortis

 
Messages:18
Registered:April 2015
Hello!
1. I have 7609en+Modpack installed(from your Modpack link) Can I somehow apply the NEW_SUPPRESSION_CODE to that?
2. When you realese a newer version of the Modpack, can I update without having to reinstall Ja2?
3. I have a possible bug: A merc says he can see the enemy, and there is the number on his portrait showing that he does. However the enemy is invisible.
Also, I can hear the enemy fire but no bullets ever hits.

I have a save but don't know how to attach it

Thanks for a great mod

Report message to a moderator

Private
Re: Trunk AI and improvements[message #363827 is a reply to message #363826] Tue, 05 October 2021 14:11 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
Ortis wrote on Tue, 05 October 2021 16:04
Hello!
1. I have 7609en+Modpack installed(from your Modpack link) Can I somehow apply the NEW_SUPPRESSION_CODE to that?
2. When you release a newer version of the Modpack, can I update without having to reinstall Ja2?
3. I have a possible bug: A merc says he can see the enemy, and there is the number on his portrait showing that he does. However the enemy is invisible.
Also, I can hear the enemy fire but no bullets ever hits.

I have a save but don't know how to attach it

Thanks for a great mod
1. NEW_SUPPRESSION_CODE in the trunk is the partial implementation of suppression code from 7609+AI.
2. It may work, but better save vanilla ja2 folder somewhere and use it to copy new installation and unpack modpack over it. Ja2 is portable, you don't need to install it, just copy.
3. I need a save just before the bug appears, to find out why it happens. You can post link here to uploaded file to dropbox or google drive or something.
4. Better post 7609+AI related in the appropriate thread http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=21864, this thread is for trunk improvements.



Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #363828 is a reply to message #363827] Tue, 05 October 2021 14:49 Go to previous messageGo to next message
Ortis is currently offline Ortis

 
Messages:18
Registered:April 2015
Ok thanks!
Problem nr 3 fixed itself when I reloaded the save. Sorry probably should have tried that before posting

Report message to a moderator

Private
Re: Trunk AI and improvements[message #363868 is a reply to message #363828] Thu, 14 October 2021 11:41 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r9177

Removed option AI_DECISION_INFO (to activate AI and quest logs just create "Logs" folder in the game root folder).
Added quest debug logging to Logs\QuestInfo.txt, will log facts, quests change, NPC interaction, NPC actions, boxing quest etc.
Example of Fatima/rebels quest:
Toggle Spoiler
Note: <id> means profile id, matches MercProfiles.xml, [id] means tactical id, which is the same id used in AI logs.
Also don't forget you can always use built in quest debug system in 1.13, activated by pressing F11 in cheat mode.

[Updated on: Thu, 14 October 2021 21:03]




Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #363871 is a reply to message #363868] Fri, 15 October 2021 08:59 Go to previous messageGo to next message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r9181

Morale changes for AI soldiers:
- use bMorale for both player and AI
- use morale as a base for tolerance for AI soldiers
- enable morale loss for AI soldiers
- increase morale for AI soldiers when new turn starts
- set morale = 60 + 2 * bExpLevel + Random(20) when creating AI soldier

NEW_SUPPRESSION_CODE: reduce shock when firing gun.
AI_NEW_MORALE: limit AI morale depending on morale and shock level.

As a result of these changes, AI soldiers now have morale which can be reduced by suppression and restores over time if AI soldier is not under fire.
When AI soldier has low morale because of heavy suppression fire for several turns, his suppression tolerance is reduced and also his AI morale is reduced, so he becomes less aggressive and will likely try to hide, after some turns he will restore morale and become more aggressive.
Also, morale modifiers will work both for player and AI now, so AI soldier with low morale because of heavy suppression in previous turns will have his marksmanship reduced.

Also if your soldier is under heavy fire, you can shoot at enemy with autofire to reduce your suppression shock (long bursts from loud weapon are most effective).



Left this community.

Report message to a moderator

Lieutenant

Re: Trunk AI and improvements[message #363872 is a reply to message #363871] Fri, 15 October 2021 12:15 Go to previous messageGo to previous message
Deleted.

 
Messages:2689
Registered:December 2012
Location: Russian Federation
r9183

NEW_SUPPRESSION_CODE option:
- use effective experience level when calculating base suppression tolerance, so nearby squad leaders may raise effective level and help fight suppression
- increased base value, so now level 1 merc with 50 morale will have 7 base tolerance, previously it was 3 which was a bit too low
- if NEARBY_FRIENDLIES_AFFECT_TOLERANCE option is active, nearby friends can help increase suppression tolerance, up to +-5 points added depending on distance, only for merc bodytypes

So, if NEARBY_FRIENDLIES_AFFECT_TOLERANCE, for each conscious and alive friend nearby, merc receives +1 point of suppression tolerance, up to 5 points total from all friends.
This value depends on distance, so if friend is farther than day vision range / 4, bonus is reduced up to 1/4 at max range.
Also the code will check if merc and friend can see each other, so they should be in contact.
If friend is cowering or unconscious, bonus is -0.5, if friend is dying, bonus is -1.0, so being around suppressed, unconscious or dying friends actually reduces suppression tolerance.

So, with SUPPRESSION_TOLERANCE_MAX = 18 by default, having 100 morale and 10 effective experience level (with possibly added bonuses from nearby squad leaders) will result in 18 * 3 / 4 = 13 base suppression, which can be increased by having friends nearby to max tolerance level 18.
That means, early in the game it's best to keep mercs close together in small groups with a squad leader in each group.
High level mercs with high morale and personality/background which can help fight suppression (dauntless, aggressive) may act alone.



Left this community.

Report message to a moderator

Lieutenant

Previous Topic: Ja2+AI: FAQ
Next Topic: Experimental Project 7
Goto Forum:
  


Current Time: Wed Feb 01 20:51:44 EET 2023

Total time taken to generate the page: 0.01560 seconds