Home » MODDING HQ 1.13 » v1.13 Feature Requests » Reducing AI friendly fire
Reducing AI friendly fire[message #350330] Fri, 14 July 2017 22:24 Go to next message
Bananarepublic

 
Messages:38
Registered:October 2013
Hello, is it possible to alter AI behavior to prevent soldiers from attacking "dying" enemies? As it is now your miltia (and sometimes the enemy army) will all bunch up against one soldier and burst fire everything in their path, often resulting in lots of friendly deaths. Some veteran soldiers with some sort of death wish, no doubt, even run up to melee range while 5 rookies teamkill them from behind.

My suggestion is to make them stop shooting a soldier when it's already out of combat to reduce this. Also when all enemies are on a dying state combat automatically ends; there's no need to manually kill each of them.

Is there like a check for target hp in the ai code?

[Updated on: Fri, 14 July 2017 22:28]

Re: Reducing AI friendly fire[message #350331 is a reply to message #350330] Fri, 14 July 2017 23:21 Go to previous messageGo to next message
silversurfer

 
Messages:2156
Registered:May 2009
I believe Sevenfm already makes the AI ignore targets in dying state in his experimental exe. I wonder if he ever manages to keep track of all the changes he has done so he can incorporate them in the main trunk. big grin



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Re: Reducing AI friendly fire[message #350332 is a reply to message #350331] Fri, 14 July 2017 23:44 Go to previous messageGo to next message
Bananarepublic

 
Messages:38
Registered:October 2013
Oh, that's great to know!
Re: Reducing AI friendly fire[message #350333 is a reply to message #350331] Fri, 14 July 2017 23:46 Go to previous messageGo to next message
sevenfm

 
Messages:1324
Registered:December 2012
Location: Under the Mountain
As for friendly fire problem, there are 2 possible solutions:
1. Disable friendly fire completely for AI in LOS.cpp. Effective, but it doesn't look nice when bullets pass through people without hurting them.
2. Add code for AI to avoid friendly fire more effective. This is implemented in Ja2+AI:
- new calculation to stop shooting in Black state when there's high chance of friendly fire (DecideActionBlack in DecideActions.cpp)
- taking into account friendly fire when searching for best cover/attack spot (FindBestNearbyCover in FindLocations.cpp) by reducing "cover value" for possible spots with high friendly fire chance on possible targets
- taking into account friendly fire when choosing best target for attack (CalcBestShot in Attacks.cpp)
This approach is much more complex but results in better looking and more "realistic" AI behavior.

Avoiding shooting at dying enemies is completely different problem.
I think it should be penalized already in the main trunk, also there should be code in DecideActionBlack since vanilla that forces AI to take RED decision if the only possible target is dying.
Also, in my experience strict solutions (like disabling shooting at dying targets completely) doesn't work well for AI, for example if AI has only one dying target and cannot find way to other opponents it will likely just sit and wait until it dies, and also there are zombies (not sure if they can restore health in dying state and resurrect that way).



Stable 7609+fix (06.09.2017)
Stable 7609+AI (r512 19.09.2017)
Improved weapon sounds, Ambient sounds, LoadScreenHints for Ja2+AI
Youtube channel
Win8+ fix


Re: Reducing AI friendly fire[message #350344 is a reply to message #350333] Sun, 16 July 2017 17:39 Go to previous message
Bananarepublic

 
Messages:38
Registered:October 2013
Oh i see. I thought they would ignore the guy and look for other things to do. I''ll have to give +ai a try after i finish this playthrough big grin
Previous Topic: Early Vehicle and Fuel
Next Topic: Likely crazy but... Voxels in JA2?
Goto Forum:
  


Current Time: Wed Sep 20 08:34:32 EEST 2017

Total time taken to generate the page: 0.00848 seconds