MechWarrior 5: Mercenaries
0 of 0

File information

Last updated

Original upload

Created by

Oraeon1224

Uploaded by

Oraeon1224

Virus scan

Safe to use

Tags for this mod

About this mod

DO NOT USE WITH OTHER JJ MODS:
This mod changes the AI behavior of ALL AI pilots (not just lights) for MW5 to behave more like a real pilot and use jump jets. The CIRCLE OF DEATH IS OVER. This mod will continue to expand the AI logic to make it feel more like a true pilots and battletech. 5.0 introduces new role specific behavior, torso twis

Permissions and credits
Changelogs
TableTopRulez AI MODThis mod alters the AI for the game to better approximate battletech TT and Strategy computer game.  It now includes both Light, Medium, Ranged, and LRM boat combat AI upgrades.  All mechs will now use their jumpjets and human like strategies that are based off of speed, JJ, and weapon loadout.  Be aware jumpjet burntime increased for AI, so if you want lore-based jumps try not to use for >2seconds.
**********************************************************************************
MOD INSTALLATION:
Unzip the Mod file.  And copy the TTRulez_AI folder to  MW5Mercs/MW5Mercs/Mods
STRONGLY RECOMMEND USING THE Either NAVID or TTRulez Rescale mod (MercTech friendly).  It makes the AI perform better in cities.
STRONGLY RECOMMEND USING TTRulez Sensor Mod: Makes the AI use ranged correctly.

https://www.nexusmods.com/mechwarrior5mercenaries/mods/112Do NOT install with another JJ mod it will conflict and not work.

Moved alternative mods to the Difficulty mod page: https://www.nexusmods.com/mechwarrior5mercenaries/mods/154
--Advanced sensor mod, Vehicle AI mod, etc...

***************************************
I was suprised how simplistic the algorithms were for this game when I looked behind the curtain.  They are well programmed, just not very sophisticated.  General the AI senses a combat target and enters a selection tree called BTService_PickCombatTactic.  This pathway evaluates the mechs weight and engagement ranges.  Generally lights default to Hit&Run.  If not Hit&Run the game queries the optimal weapon range of the mech (Averages the weapons). If optimal range is >/= 180m the AI checks if the mech has LRMs only.  If the mech has LRMs only then the mech defaults to Indirect AI.  Otherwise the tactic is set as Ranged AI. If the optimal engagement range is <180m the system check the mech weight class.  If the mech is medium it selects Mobile AI.  If heavy or assualt it select Tank AI.  This is fairly elegant.  Unfortunately the vanilla AI routines were circles set around the AI and not the target and basically create circling at close range regardless of the algorithm--this makes the AI basic and similar to older MW titles.I altered EQS files to adjust situation pathfinding behavior (AI vision focus basically), along with increasing AI branching logic probably a 100x vanilla.  Then based on my custom scoring systems the AI assigns locations a numerical score and the AI moves to the best scored location.  However, behavior is hard to predict in game so refinement will take time.  Please feel free to post any errors you see on the NexusModPage.  Please also post suggested AI behaviors you would like to see improved or would consider realistic.  I have already made many updates based on prior suggestions.
******************************************
v 4.0 Added additional mech features. Including sensing target damage levels and weight class to adjust attack routines. Slow JJ mechs using JJ to skim towards target. Lights aggressively engaging lights and will skim if outside range from badly damaged assaults.
v5.0 Adds LancemateAI role specific behaviors to the enemy.  Should make them behave more like their TT counterparts.  If any issues revert to v4
v5.1 Updates roles for MercTech.  Bug fixes. New damage service/sensor that improves CPU and individualizes behavior.  New JJ node replaces behavior tree for less stuck mechs better efficiency and more individualized behavior.
v5.2 Minor bug fixes to HitandRun
v5.6 New AI overheating behavior for mercTech and Biomes mod. AI now senses overheating and will move to cover and if high enough heat will hold fire until it cools down. Should allow more aggressive firing in the future.
v5.9 Bug fixes. Improved damage sensor so it makes an emergency check for critical damage at 5 seconds and 10 seconds instead of just at 10 seconds.  That way if getting hammered doesn't keep taking damage for 10 seconds before reacting. Also made abort for aggressive behaviors (flanking, light mech killer, etc...) if the AI is cored and near death so they go more defensive.

************************************************
JUMPJET UPDATES: DOESN'T WORK WITH OTHER JJ MODS
************************************************
1. Jumpjet accelerations in both the horizontal and vertical axis are now true to tabletop and much more rapid (occuring over 2 seconds instead of 3).  This makes them more defensive.
2. Old system was dumped in 3.3.  It now uses a virtual velocimeter to detect falling velocity.  Like a human the AI now senses if it is falling too fast and fires JJs until its decent slows.  This conserves JJ use and hopefully eradicates fall damage. Also removes skipping on the ground.  I tested them falling from 230m and they didn't take leg damage so hopefully will work out in game.
3. JJ EQS sensor system.  Now avoids jumping off heights of >70m and should also avoid jumping into buildings.  Should improve realistic JJ use.
4. NEW 4.5: Mechs GETTING STUCK on the landscape should now be fixed.  I found another flaw in my old system. Completely redisigned and in 5 instant actions no stuck mechs.  Also a stupid error with lights that caused them to get in a loop.  Now fixed.
5. NEW 4.5: PGI set gravity in the game to 25m/s2 earth is 9.8m/s2.  This was smart because it creates the illusion of 10m tall mechs falling at the visual rates relative to the horizon the same as a person.  However, this is not realistic and also makes it much easier for them to suffer leg damage.  The mechs now set their personal g force to 1g (9.8m/s2).  This lets them have good leg damage avoidance even at decent heights without massively increasing JJ burn time.  I think this is the final hurdle to removing leg damage except from extreme falls.  They do look a bit more floaty coming down. The rescale mod helps with this.  Lancemates will not have G changed until I update that system.
6. NEW 4.6: Error on light mechs JJ that had them get stuck. Now fixed. Thanks KnightCole and Yrrot
7. NEW 5.93: Finally fixed the doublejump error on the JJ. I had to build a new JJ node and quit using PGI version for 4.6 to fix the errors in my old system.  If aborted a branch during a jump the JJ could get stuck in the on position.  Thanks to Yrrot explanation on abort nodes I built a fix to turn them off if aborting.  Appears to now be a thing of the past.  Light mech behavior looks much better now and they get stuck less.  Alot of the other mechs jumps don't look as impressive now but are more true to lore.
***********************************
HitAndRun UPDATES:
***********************************
Default Light mech behavior (HitAndRun) had no AI behavior for defensive use of jumpjets or dodging--only 2 behavior nodes.  It would run a query for allies within 300m and then try to move to them and circle them.  Or if no allies were close it would query the target and run straight at them, and then stay in the classic circle of death.  PGI had an abandoned strategy for true hit and run, that was left in the blueprint.  I used their basic idea and now I have it functional and expanded. My general approach is to have 2 paths one that uses jumpjets to find cover and disengage, and another for mechs without jumpjets that puts a premium on quickly getting out of weapon range in the least number of moves to minimize damage taken.

1) AI queries the target and moves to engage them as per vanilla, if shot during approach they now dodge if no jumpjets (as per feedback from prior version), or use their jumpjets to dodge incoming fire.  This behavior is randomized.
2) If they get to too close to the target they will use jumpjets to jump behind the target, or if they have no jumpjets run away in a vector behind the target looking for cover or getting in the rear arch--similar to fighter jet doctrines.
3) They will then reengage the target preferentially in the rear quadrants for another pass
4) If they are heavily damaged they will prefer to seek cover and exit weapon envelopes before reengaging from another angle. 
5) AI assess if a heavy or Assault ally is engaged within 1400m.  If this is true they make shorter attack runs and will dodge fire less--more aggressive.  Thanks to Trenchbird for the feedback.
6) Made it so slower light mechs like the urbamech and panther now default to the Ranged AI and do not use Hit and Run.
7) There was a loop where the AI would keep trying to run away until you killed them if you were chasing in a faster mech--too easy.  I built a new sensor so they can tell if they are being chased for too long and will turn and fight.
8) NEW 4.0: If allies are near Light mechs detect the enemy mechs weight class.  2 things may happen.
   --If it is a Light they will attack very aggressively to keep them away from allies unless severely damaged.  They should keep lights off the heavies now.
   --If it is a Heavy or Assault who has no center torso or no armor on both legs they will target and aggressively attack unless severely damaged.
9) NEW 4.0: If a Light mech is legged and can't run any more and are below a critical structural level of damage they will eject.
10) NEW 4.0: If a Light mech is below a critical level of structural damage and is not legged they will run away and try to get out of sight.  Once further than 1200m they will cease to exist--ran away so no salvage.
11) NEW 4.5: Found egregious error where I didn't hook something up. And 2 other errors where there was no off switch causing loops. Lights getting stuck should be much better now.
12) NEW 4.5: Found error in detecting damage to flee where it was supposed to require both legs to be damaged or for ejections both legs destroyed (MerTech)...used OR and not AND by mistake. Now fixed. Should be less ejections.
13) NEW 4.91: Set behavior so when allies are near light mechs try to regroup after jumping. Should keep enemies from getting too distanced to support each other.
14) NEW 5.0: Roles introduced. Strikers will try to flank and hit your back. Skirmishers will try to focus on your light mechs.

*************************************************************************************
RANGED UPDATES: THIS WAS THE REALLY BUGGY PART OF 3.1 and 3.2. NOW PROPERLY DEBUGGED
*************************************************************************************
RANGED was oddly designed. It defaulted a circle around the AI mech and not the AI mechs combat target, which made them rush into a circle fight.  There was no consideration of actual engagment range.  I moved the circle to be centered on the combat target not the AI mech.  The AI now circles around its target trying to reach a perpindicular firing solution while maintaining LOS.  There are 3 engagement branches (ranges) determined by the AI mechs loadout (LRM mechs now go to another tree) that keeps them at their optimal engagement ranges.  Mechs also now jump away to maintain distance and get cover (Even heavies or assaults).  When close only Mediums will jump away, heavies will duke it out knowing they can't flee.

1) Cicada and other fast mediums now default to hit and run and do not use ranged.  For now phoenix hawk and other fairly fast mediums remain in this group.
2) Moved all the catapults and arrows out of the RANGED path and onto the INDIRECT ALGORITHM. Before only the one catapult with LRM only was using that pathway. Archers, Trebuchets, and Catapults use different behaviors as fire support.
3) The AI will attempt to dodge and use cover if fired upon. Using JJ if needed.
4) Heavier mechs will use peek-a-boo tactics to fire on you if taking damage.
5) The AI will try to circle at a range based on its weapons.  If the player starts to come too close they will attempt to reestablish range. 
   a) Short range: 600m and less weapons(AC10, AC20, Med laser, Short laser, SRM); circles at optimal range of 270m
   b) Medium ranged: 601-700m (UAC5, AC5, Large laser, Gauss); circles at optimal range of 450m
   c) Long ranged: 700m + (PPC, AC2); circles at optimal range of 550m
6) At a critical range where maintaining range is not possible, fast mechs will engage in hit and run, while slow mechs will close the remaining range and duke it out.
7) Close engagments are less lame circle and more circle with burst to try to get in rear arch.  More chaotic and unpredectable now.
8) Slow mechs that have JJs but only short range weapons (AC10 and down) will not slowly trod forward while you blast them or try to get cover but are too slow.  They now use a new JJ system to skim the ground at high speed until within their weapon range.
9) The AI now work to maintain LOS (thanks to Sean Lang for calling my attention to this issue).
10) NEW 4.0: Ranged mechs now detect if the enemy is almost cored. If so they close range to use more of their weapons unless their own structure is significantly damaged.  Should make fights more intense against ranged.
11) NEW 4.5: People were complaining the Ranged mechs were rushing in.  Played out multiple AI on AI fights and watched both in group and single.  People were right. Tweaked ranges and some loops to close distance. Now it looks right in AI on AI fights.
12) NEW 4.5: Other people complained the AI was too far away.  People were right. I found a bad error where they could run through 3 levels finding cover/retreating.  I forgot the inverse decorators. Now fixed. In AI on AI I don't see anyone running away.
13) NEW 5.0: Added mech roles to enemies.  Juggernauts will march on your. Firesupport will support them. Brawlers and Skirmishers use the old system.  Strikers will try to flank you and attack your back.

****************************************************************
INDIRECT UPDATES (LRM VARIANT MECHS CATAPULT, ARROW, TREBUCHET):
****************************************************************
Indirect missile mech AI was odd and ran towards the player.  That is now fixed and they should work in a support role

1) Indirect (LRM mainly) mechs will try to maintain maximal LRM distance by walking backwards at an angle if you approach firing
2) Once you get to intermediate range they will cease to backup and turn and run, utilizing jumpjets if they have them, spin in the air, and fire LRM at you as they try to escape.  Its pretty effective.
3) They now try to maintain LOS (at least until I can get the AI to communicate targets like the player)
4) If an allied heavy or assault mech is nearby, these mechs form up and follow them in their rear arch as far from the enemy as possible.  Once too close to the enemy this behavior aborts and they try to reestablish range to supply support fire for the engaged heavy/assualt.
5) New 4.91: Indirect mechs were trying to maintain distance and support allies with multiple hostiles this frequently took them out of support range.  Ranges and behavior adjusted so they should continue support much closer to the enemy when following an ally.

******************************************
FUTURE WORK:Sense missiles incoming and engage dodging behavior.
SENSOR MOD is now up.  I recommend using as it fixes Ranged AI not engaging at the proper distance.
Torso Twist: Currently in Alpha it works but I need a better system to trigger.  Will hopefully be in version 5.
New targeting and aggro system. Framework for Lights prefering Light mechs, Tanks, and VTOL to make them more useful.  Still need to create a new aggro system from scratch. Long term project.
I would like to get lance level functions for light mechs.  First I need to fix the drop lances so it isn't all lights and tanks but more classic BT (at least 2 mediums and 2 lights).  Then I can create a sense Ally node that triggers different behaviors like flanking or champagne moves by lights.  Currently no real options for this unles I redo the UnitDrops. Big project.
********************************
Thanks to AlexGarden at PGI for his blueprint suggestions.  Thanks for Trenchbird Atreyuh CommanderHunter and others for feedback on the mod.  Thanks to NGNG for posting videos with my mod so I could see what was broken and giving feedback.