Maximum AI Difficulty Tweaking for Modders

Started by Phobos, April 11, 2017, 05:24:33 AM

Previous topic - Next topic
April 11, 2017, 05:24:33 AM Last Edit: April 11, 2017, 05:39:32 AM by Phobos
Maximum AI Difficulty Tweaking for Modders
This tutorial covers every currently known mission LUA and side ODF trick to improve the difficulty setting of AI in SWBF1. There are also ways to improve the AI difficulty by adding hintnodes to map LVLs, but this tutorial doesn't cover that.
For zeroeditor hintnodes tutorial, go here http://www.swbfgamers.com/index.php?topic=8424

According to all the info contained in this thread, these would be the best LUA settings to use for the strongest enemy AI possible in SWBF1, in combination with using the Hard difficulty setting ingame:

SetTeamAggressiveness(ALL, 0.0) -- player team
SetTeamAggressiveness(IMP, 1.0) -- enemy team
SetPlayerTeamDifficultyHard(-20) -- functional for SP only
SetEnemyTeamDifficultyHard (20)
SetAttackerSnipeRange(1000) -- Increases shooting range of Scout classlabel units but there is a hardcoded range limit
SetDefenderSnipeRange(1000)
SetDenseEnvironment("false") -- improves the AI awareness of their surroundings and location of players
SetAllowBlindJetJumps(1) -- the AI jets fly everywhere making them harder to kill
SetMaxFlyHeight(1000) -- lets the AI and players fly really high
SetAIVehicleNotifyRadius(1000) -- allows AI to track down vehicles from across the map
SetStayInTurrets(1) -- forces AI to stay in turrets
SetMemoryPoolSize("Aimer", 999) -- allocates the maximum memory possible for AI shooting calculations


Untested Commands (might be functional)
-- SetAIDifficulty(10,10)
-- SetAIFormationRadius()   




Quote from: Phobos on September 29, 2013, 03:54:11 PM
I figured I might as well start a thread to document the various mod tweaks I've been discovering to increase the maximum difficulty of AI. Hard setting just isn't enough and I wish we had the game source to improve the AI further but we will have to get by with LUA and ODF.

I've already implemented these codes into the mission LUA which have slightly improved the AI strength.
SetTeamAggressiveness(IMP, 1.0) -- max value recognized by the game
    SetDenseEnvironment("false") -- improves the AI awareness of their surroundings and player location.
SetAllowBlindJetJumps(1) -- the AI jets like to fly everywhere making them harder to kill.


I've also maximized the limits for the range of AI shooting at players by making this modification to all laser based weapon ODFs (snipers shotguns pistols etc):
LockOnRange  = "0.0"
LockTime  = "0.0"
MinRange  = "0"
OptimalRange  = "32"
MaxRange  = "512"


And of course here is my ODF mod for letting AI shoot rocket launchers at players from the maximum distance allowed by the game:

TargetEnemy  = "1"
TargetNeutral  = "0"
TargetFriendly  = "0"

TargetPerson  = "1"
TargetAnimal  = "0"
TargetDroid  = "0"
TargetVehicle  = "1"
TargetBuilding  = "0"

MinRange  = "0"
OptimalRange  = "16"
MaxRange  = "150"

LockOnRange  = "0.0"
LockTime  = "0.0"


Of course radar can also be added to the AI, but I'm not sure if it actually helps them or is just for players
ScanningRange = "9999.0"
TransmitRange = "9999.0"


I was looking at the meta scripts and noticed one of the bonus references for making the AI have 'advanced training'. However this was not listed in the bonus types Fred posted about here http://www.swbfgamers.com/index.php?topic=6653.msg70823#msg70823
This is what I tested in my mission LUA:
ActivateBonus(IMP, "MEDICAL_SUPPLIES") -- this adds slow auto heal
ActivateBonus(IMP, "ADVANCEDTRAINING") -- how its referenced in metagame_state
ActivateBonus(IMP, "ADVANCED_TRAINING") -- test with underscore added


This is the error I got in SPTest. The game didn't recognize the bonus type so it didn't apply it.

Message Severity: 2
D:\src\FRONTLINE_PC\FrontLine\Source\LuaCallbacks_Mission.cpp(453)
ActivateBonus specifies invalid bonus name: "ADVANCEDTRAINING"

Message Severity: 2
D:\src\FRONTLINE_PC\FrontLine\Source\LuaCallbacks_Mission.cpp(453)
ActivateBonus specifies invalid bonus name: "ADVANCED_TRAINING"


Here is the reference from metagame_state.lua
yavin = {
MapName = "YAV", -- 3-char name for base map name
LocalizeName = "planets.yavin.name",
-- fnGetBonusText = metagame_state_fnGetBonusText_yavin,
chargemax = 1,
ShortBonusText = "planets.yavin.shortbonus",
LongBonusText = "planets.yavin.longbonus",
MapName1 = "planets.yavin.mapname1", -- localization key to first map
MapName2 = "planets.yavin.mapname2", -- localization key to second map
RotateSpeed = 0.62,
ModelScale = 0.16,
BonusType = "AdvancedTraining",
pickorder = 7, -- 1 = picked first, 2 = second, etc
},


Does anyone else have any other ideas for how to implement the AdvancedTraining bonus from Galactic Conquest into a regular mission LUA or any other potential tweaks for making the AI more difficult?

List of things I want to improve for the AI: (note that I play SP exclusively on Hard Difficulty now)
- Intelligence and hunting down players from any distance
- Advanced Training bonuses from GC applied to Instant Action and MP mission LUAs
- More defensive manuevers when fighting players not so many predictable movements and "path hugging"
- Increase the default cutoff range for how far AI can shoot at players (i.e. make it so a sniper AI on the other side of kamino is still going to shoot at you if you're in his line of sight)
- Enable the "special jet tricks" for players which AI are seemingly only capable of using such as: rolling midair while in a jet jump, double jetting really high above the map

Quote from: Phobos on February 19, 2014, 04:14:50 AM
Would it be possible to use some of these features from SWBF2 or hack the game memory to increase AI difficulty?

http://www.secretsociety.com/forum/downloads/BF2Docs/AI/Difficulty.html
Quote from: Psych0fredAI Difficulty

Command Line Options:

/DisableAIAutoBalance
This will disable auto balancing for the entire game. Use this to pure balance your levels.

Console debugging commands:

aidiff
Dumps the difficulty to the console, and also to the debug output (TTY on ps2, DrWatson for xbox):

Profile setting: MEDIUM
AutoBalance: ACTIVE
        base   lua  auto = total
Player :  10 +   0 +   0 = 10
Enemy  :  12 +   0 +   0 = 12   

This shows the current profile difficulty setting (EASY, MEDIUM, HARD).

Then it says if AutoBalance is turned on.  You can control this with the lua EnableAIAutoBalance() command.  The modes shown are:
ACTIVE - AutoBalance is enabled and currently working.
INACTIVE - Its turned on, but not currently active.  Probably because one side has infinite reinforcements.
DISABLED - not turned on.

Then it shows the difficulty setting calculation.  "Base" is the base value that it gets from the profile setting.  "Lua" is the adjustment modifier that you can set in the lua with the SetAIDifficulty() command.  "Auto" is the modifier from the auto balancer.  "Total" is the final value that it uses.

Lua Script commands:

EnableAIAutoBalance()    
Turn on AutoBalancing.  This will work for Conquest/Assault/CTF games.  Not campaign.   Basically if the score gets too far in one teams favor (+/- 40 conquest, 60 assault, 1 ctf) it will make the losing team better and the winning team worse until things get back to close again.

DisableAIAutoBalance()    
Turn off AutoBalancing.  It is on by default so you should use this for your campaign mode scripts.

SetAIDifficulty(player, enemy)    
This will set the current difficulty modifier.  The two values are for the player's team and for the enemy's team.  These are only modifiers on the current profile setting, so you don't need to set these at all if you want.  All maps default to (0,0).

SetAIDifficulty(-2, 3)
This will make the AI on the players team 2 settings easier, and the AI on the enemy team 3 settings harder.
This can be called from any point within a mission.  So if you want the bad guys to be more difficult on just one objective, call this with say (0,2) in the OnStart function, then call it again with (0,0) to reset it in the OnComplete function.

SetAIDifficulty(player, enemy, diff)    
This works just like the above, but only for a specific profile setting.  So if you want to leave medium alone, but make hard mode harder, you could do:

   SetAIDifficulty(0, 3, "hard")
The last value can be "easy", "medium", or "hard".

Quote from: Phobos on October 19, 2014, 05:12:04 AM
To make zombies smarter you can change the UnitType value in the ODF to "Trooper" or "pilot". This will make them strafe shots at close range and they are harder to shoot in the head with high move speeds.

To make zombies more stupid and charge at the player without trying to dodge shots change the UnitType to "assault". When combined with slower move speeds this resembles the classic zombie more but they are much easier to kill. I haven't tested the other unit types such as "support" yet.

This works for any AI not just zombies btw and is most noticeable on Hard difficulty.

Quote from: Phobos on May 15, 2015, 09:55:22 AM
From http://www.swbfgamers.com/index.php?topic=4594

Quote from: tirpider on May 25, 2012, 12:25:28 PM
I grepped through the odf's for BF1 and 2 for "UnitType" and made this list:

//possible unit types:
//"assault" or "Assault"
//"pilot"
//"repair"
//"scout" or "Scout"
//"support"
//"trooper" or "Trooper"
UnitType = "assault"

I don't know if case affects it or not, so I included the variations.
They certainly affect the behavior of the unit, but I imagine the SetTeamAggressiveness setting will have more of an impact on how reckless they are.

-edit
I grepped through the lua files for SetTeamAggressiveness.
The lowest value I saw was 0.7
The Highest was 1.0  (most common one as well.)

UnitType Information
- Assault classlabel will tell AI to place landmines (if they have that weapon) on the Mine hintnodes for maps placed in ZeroEditor. It also makes the AI more 'stupid' and they will not strafe sideways when being aimed at by enemies.
- Pilot is like Trooper, the AI will be most aggressive and use tactics such as strafing. In addition this unit type can also heal vehicles automatically while driving. They also heal players and repair turrets/vehicles
- Repair has not been tested yet.
- Scout is almost as aggressive as Pilot/Trooper, but will play more defensively and retreat sometimes more often. They utilize Sniper hintnodes placed in ZE and will sometimes go prone in certain areas. They also strafe to dodge enemy shots.
- Support has not been tested yet.
- Trooper is the most aggressive unit type which will use strafing tactics to dodge enemy shots.

Also to maximize zombie aggression, use these LUA
SetDenseEnvironment("false")
SetTeamAggressiveness(IMP, 1.0) -- zombie faction

Quote from: Snake on May 25, 2012, 01:39:53 PM
I have already set all of them to assault which is what was in the Luke .odf but they still run away from grenades and still act too nonchalant. Maybe I can increase their speed slightly to make it harder.. Still, I wish there was a way to take away their "grenade sense".
this would be nice, they retreat from melee sometimes too.

Edit
SetHistorical()
SetPlayerTeamDifficultyHard(2)
SetEnemyTeamDifficultyHard (6)

It's possible adding this to a mission LUA will increase the difficulty of enemy faction defined by the missionlist.

Quote from: John Northan - Lead ProgrammerWelcome to my developer diary. My name is John Northan and I'm a programmer on Star Wars Battlefront at Pandemic Studios, specializing in game Artificial Intelligence. My plan is to give you an insight into several challenging technical issues that we've worked on whilst developing Battlefront: creating a massive battlefield sensation, encouraging emergent AI environment interaction, and developing distinct soldier behaviors, such as assault, scout and repair.
One of the great sensations to come from watching the Star Wars movies are the massive battle sequences. We want the player to feel like they are in the midst of those battles, such as down on the surface of Hoth running amongst giant AT-ATs or taking a defensive position in the snow trenches. To achieve this, we need to simulate great numbers of soldiers, ground-based vehicles, and flyers. In Battlefront's single player experience, the majority of these entities need to be controlled by AI. The AI for each entity is calculated at several different layers. At the highest level, the strategic AI, examples of the types of critical decisions that need to be made are: which command post to attack, which enemy to engage, which weapon is most appropriate, and whether to interrupt a current action because a thrown grenade has just been spotted. At the lower levels, the controller AI, examples of the types of immediate decisions that need to be made are: how fast and in what direction to move, where to aim a weapon in order to hit a moving target, and whether to alter course in order to avoid a collision.
The technical difficulty in juggling all this strategic and control AI for a large number of soldiers and vehicles is that it must all be achieved with low CPU usage. For example, in Battlefront, we allow the AI about five to ten percent of CPU time. One of our solutions was to realize that high-level strategic decisions could be made much less frequently than the lower level controls. Decisions, therefore, are made at differing time intervals, dependent upon their urgency. For example, when a soldier is running through a battlefield, he needs only to evaluate which command post to attack every few seconds, whereas he needs to make weapon aiming decisions continuously.
One of the leading-edge AI techniques in use in games at the moment is for characters to react to the environment intelligently. Examples of this are soldiers in combat seeking cover behind barriers or snipers hiding out on rooftops. This emergent behavior is achieved in Battlefront by the placement of hint nodes within the world. We have a variety of hint nodes that our Level Designers can populate the word with, such as "cover" nodes to designate strategic positions to fire on the enemy from, "snipe" hints for concealed, long-range firing positions, and "minefield" hints for areas where mines could be laid. It is the emergent use of these hints that can give an AI-controlled soldier the appearance of intelligent environment use.
We have put much time during the development of Battlefront into distinct soldier behaviors. When running through a battlefield, it is possible to notice each behavior: there will be trooper soldiers directly engaging the enemy, sniper soldiers staying hidden at the periphery of the battle, assault soldiers attempting to outflank and destroy enemy vehicles, and repair soldiers busy healing the wounded. The trooper soldiers have the most variety of behavior. Upon spotting an enemy, they will select a method of attack, based upon factors such as weapon availability and enemy mobility. For example, a trooper soldier armed with just a pistol will try to get up close to a target, dodging and weaving, whereas a trooper armed with a long-range rifle will go prone, reducing the potential for shot error. Troopers will use cover hints to use natural environmental barriers to hide from the enemy. If a cover position is compromised the soldier will run for another barrier from which to take cover.
Sniper soldiers tend to avoid direct combat. They prefer to look for strategic snipe positions, from which they can pick off enemy soldiers with a precise, long-range rifle. If their snipe position is discovered, they will pull out a pistol and make a fighting retreat. Assault soldiers seek out enemy vehicles. At long range, they will go prone and fire a low-error shot at their target. If the vehicle approaches they will attempt to outflank, heading to the backside of the vehicle, where it tends to be most vulnerable. Repair soldiers will follow other soldiers into battle, re-supplying them with ammo, and healing them if injured. Of course, if fired upon, they will interrupt their healing behavior and immediately engage in combat.
That's the quick and comprehensive look into the world of Infantry-based AI! We've also developed many other behaviors and stylized nodes to handle such things as the many, many different types of vehicles or emplacements that can be used! It would be silly to describe all of our secrets, though, wouldn't it!
Keep a look out for these soldier behaviors and more whilst you're mowing them all down in the Battlefront!

Quote from: Phobos on January 18, 2013, 05:55:35 AM
For custom single player maps is there a way to completely disable players from changing the difficulty settings (easy medium hard) and define them within the mission LUA? For example if I put this in the mission LUA
ScriptCB_SetDifficulty(3)
Would this force the difficulty to hard and override whatever the player's default difficulty setting is?
Quote from: Led on January 18, 2013, 08:51:09 AM
Yes, I think that works.  But it goes to something like 12.
Quote from: Led on June 08, 2012, 01:51:58 PM
These are LUA commands for historical maps.  Some commands are duplicated so that you can see the range of values that it may take.  This is currently a work in progress.
   SetPlayerTeamDifficultyEasy (1)
     SetEnemyTeamDifficultyEasy (4)
     SetPlayerTeamDifficultyMedium (2)
     SetEnemyTeamDifficultyMedium (3)
        SetPlayerTeamDifficultyMedium (2)
        SetEnemyTeamDifficultyMedium (-4)     
        SetPlayerTeamDifficultyEasy (14)
        SetEnemyTeamDifficultyEasy (-3)
        SetPlayerTeamDifficultyMedium (-1)
        SetEnemyTeamDifficultyMedium (6)
--     SetPlayerTeamDifficultyHard (-10)
--     SetEnemyTeamDifficultyHard (12)
     SetPlayerTeamDifficultyHard (0)
        SetEnemyTeamDifficultyHard (3)

Quote from: tirpider on October 09, 2013, 03:55:55 AM
Code (lua) Select
--ScriptCB_GetDifficulty()
-- returns: number representing the current difficulty.
--          retrieved from the current profile.
--          [1, 2, or 3](easy, medium, hard)
-- found in: [line numbers in brackets]
--           ifs_difficulty.lua [35]
--           ifs_difficulty_demo.lua [40]
--           ifs_instant_top.lua [19]
--           ifs_opt_general.lua [58][60][187][218][249]
--           ifs_sp_briefing.lua [765]



Code (lua) Select
--ScriptCB_SetAIDifficulty(n1, n2)
-- parameters: n1 and n2 should be numbers.
--             they have something to do with the number of availiable maps in
--             galactic conquest.
-- found in: [line numbers in brackets]
--           ifs_meta_battle.lua [32][34][131][133]
-- notes: I believe it sets some metric for the GC AI and has nothing to do with
--        the in-game AI.



Code (lua) Select
--ScriptCB_SetDifficulty(n)
-- parameters: n should be a number
--          [1, 2, or 3](easy, medium, hard)
-- found in: [line numbers in brackets]
--           ifs_difficulty.lua [60]
--           ifs_difficulty_demo.lua [48]
--           ifs_instant_top.lua [19]
--           ifs_opt_general.lua [187][218][249]
--           ifs_sp_briefing.lua [765]
-- notes: Pretty sure it sets the difficulty in the profile, so if a map is
--        already initialized, this won't have an effect on the current map.



Code (lua) Select
--SetEnemyTeamDifficulty(n)
--SetPlayerTeamDifficulty(n)
-- parameters: n should be a number
-- notes: the only example is commented out in kam1c.lua with 11 as it's number. Most likely a depreciated feature.


Code (lua) Select
--SetEnemyTeamDifficultyEasy(n)
--SetEnemyTeamDifficultyMedium(n)
--SetEnemyTeamDifficultyHard(n)
--SetPlayerTeamDifficultyEasy(n)
--SetPlayerTeamDifficultyMedium(n)
--SetPlayerTeamDifficultyHard(n)
-- parameters: n should be a number
-- found in: all the hustorical mission luas.
-- notes: they seem to accept a wider range of values than SetDifficulty.
          And all appear in the same files. Don't know how to use them.


These are psych0fred's LUA notes, not sure which of it is for BF2 only.
Quote from: psych0fred
I've added a setting to the lua mission scripts that tells the AI the mission is urban.  This allows the AI to change some combat behaviors to be more suitable to an urban environment (for example, ATST will not move as much around during combat, since in a tight urban setting they will collide with walls too much).
I've added the setting to all current lua files, so you will only need to add it to any new lua mission files you create:
SetUrbanEnvironment("true")
or
SetUrbanEnvironment("false")
I've renamed the script function, "SetUrbanEnvironment" to "SetDenseEnvironment" since I realized with Endor that I wanted the AI vehicles to behave in the same way in forested environments as in city environments.  The new function name generalizes the environment type better.  I've updated all the lua scripts with this new function name.

SetAIDifficulty(player, enemy)
          This will set the current difficulty modifier.
          The two values are for the player's team and for the enemy's team.
          These are only modifiers on the current profile setting, so you don't need to set these at all if you want.
          All maps default to (0,0).
      SetAIDifficulty(-2, 3)
          This will make the AI on the players team 2 settings easier, and the AI on the enemy team 3 settings harder.
          This can be called from any point within a mission.
          So if you want the bad guys to be more difficult on just one objective, call this with say (0,2) in the OnStart function, then call it
          again with (0,0) to reset it in the OnComplete function.
       
      SetAIDifficulty(player, enemy, diff)
          This works just like the above, but only for a specific profile setting.
          So if you want to leave medium alone, but make hard mode harder, you could do:

      SetAIDifficulty(0, 3, "hard")
          The last value can be "easy", "medium", or "hard".

I've added a couple of new lua commands:
SetPlayerTeamDifficulty( value )
SetEnemyTeamDifficulty( value )
where value can be between 1 (dumbest) and 20 (smartest)

I've added support for the Historical campaign lua commands:
SetPlayerTeamDifficultyEasy
SetEnemyTeamDifficultyEasy
SetPlayerTeamDifficultyMedium
SetEnemyTeamDifficultyMedium
SetPlayerTeamDifficultyHard
SetEnemyTeamDifficultyHard

Note that Lua DOES NOT accept the "+" sign, so do not do: SetPlayerTeamDifficultyEasy(+5)

Instead, do: SetPlayerTeamDifficultyEasy(5)

Of course, you can use the "-" sign: SetPlayerTeamDifficultyEasy(-5)

Quote from: Ginev on May 06, 2015, 03:54:28 PM
SetDefenderSnipeRange(170)
- Not tested, my theory is that it may increase or maximize (in terms of weapon ODF range) AI sniper bot shooting range.

SetAllowBlindJetJumps(1)
- Set to 0 by default, set to 1 makes AI jets randomly jump around as if jet nodes were everywhere on the map. I test this lines aswell.The first one works with in combination with defence hint node. You can place the hint node in zeroeditor.When a sniper class soldier go to that hint node he will ahve increased range of fire.

SetAIVehicleNotifyRadius(64)
This is taken from platforms LUA and can be seen in various other stock maps with flyer vehicles. This is used for AIs.I think 64 is default.AIs in 64 range away from any vehicle will return and will try to enter the vehicle.If the Ai is too far away for example (65) he will not come back for the vehicle.Its not good to set this value too high because bots will return from far away just to enter a vehicle.
Quote from: Phobos on May 07, 2015, 07:21:02 PM
Nice discovery. So the SetDefenderSnipeRange code allows sniper AI (UnitType=Scout) to shoot players from further distance than default limit for other units? I'm wondering if you made a giant sniper hintnode that covered the entire map, and set the LUA line to 9999, if AI could snipe players from across the map. The default cutoff range for stock sniper is 2000 velocity * 0.15 lifespan so would want to increase that for testing. If this trick worked you could in theory add unlimited shot range to all AI units :o

If you look in the weapon ODF files, you'll see a thing that looks like AIBubbleSizeMultiplier. The lower the value is, the more accurate the AI become with that weapon.
Never let a person named AnthonyBF2 touch your BF2.

I have a question about this. I see the function for TeamAggressiveness, but I wonder: does this work for native teams as well? I checked the Dune Sea LUA's and no commands were given to the Tusken side. I'm trying to get my native team to play more defensively; a "turtle" type strategy if you will.
"Birth, pain, fear, death; the cycle of existence." -Dread Master Calphayus.

SWBF1 Maps: Tatooine: Mos Anek, Kashyyyk: Village, Naboo: Province, Tatooine: Gulch.

SWBF2 Maps: Space Carida.

Quote from: Ascertes on April 30, 2017, 01:02:06 PM
I have a question about this. I see the function for TeamAggressiveness, but I wonder: does this work for native teams as well? I checked the Dune Sea LUA's and no commands were given to the Tusken side. I'm trying to get my native team to play more defensively; a "turtle" type strategy if you will.
If Dune Sea is missing the LUA code for team 3 then it would load the default hardcoded aggression settings for that team, which I think is 0.5

The LUA code works for native teams too, use this setting to make them play the most defensively:
SetTeamAggressiveness(3, 0.0)

here is one of the mission LUA sections from TWD mod which has different settings for each faction
-- GLOBAL
SetTeamName(ALL, "Alliance")
SetTeamName(IMP, "Empire")
SetTeamName(3, "LocalB")
SetTeamAggressiveness(IMP, 0.0) -- player team most defensive
SetTeamAggressiveness(ALL, 1.0) -- enemy team most aggressive
SetTeamAggressiveness(3, 1.0) -- enemy native team most aggressive
SetTeamAggressiveness(4, 1.0) -- allied native team most aggressive
SetTeamAggressiveness(5, 0.0) -- allied native team most defensive
SetAttackerSnipeRange(1000)
SetDefenderSnipeRange(1000)
SetMaxFlyHeight(1000)
SetAIVehicleNotifyRadius(320)
SetStayInTurrets(1)
SetAllowBlindJetJumps(1)

Awesome. Thanks Phobos :)
"Birth, pain, fear, death; the cycle of existence." -Dread Master Calphayus.

SWBF1 Maps: Tatooine: Mos Anek, Kashyyyk: Village, Naboo: Province, Tatooine: Gulch.

SWBF2 Maps: Space Carida.

QuoteList of things I want to improve for the AI: (note that I play SP exclusively on Hard Difficulty now)
- Intelligence and hunting down players from any distance
- Advanced Training bonuses from GC applied to Instant Action and MP mission LUAs
- More defensive manuevers when fighting players not so many predictable movements and "path hugging"
- Increase the default cutoff range for how far AI can shoot at players (i.e. make it so a sniper AI on the other side of kamino is still going to shoot at you if you're in his line of sight)
- Enable the "special jet tricks" for players which AI are seemingly only capable of using such as: rolling midair while in a jet jump, double jetting really high above the map

I'm also dying to know how to enable the "special jet tricks" like the double jet jump/roll the dark troopers do in mid-air. Any luck with this one in particular yet?

May 02, 2017, 04:44:40 AM #6 Last Edit: May 02, 2017, 09:40:54 AM by oldsnake
hi Idren
QuoteI'm also dying to know how to enable the "special jet tricks" like the double jet jump/roll the dark troopers do in mid-air. Any luck with this one in particular yet?

this can be done by giving the DJ unlimited jet fuel and adding SetAllowBlindJetJumps(1) eg: mission.lvl bes2a.lua
also might want to make the SetMaxFlyHeight higher.

https://youtu.be/_WyBmnRntC8

May 03, 2017, 05:09:31 AM #7 Last Edit: May 03, 2017, 05:19:41 AM by xMichael
But they wont actually double jump from that right? I dont see that in the video I think. I think AI just cant do some things but you could edit the odf files to emulate some things, for example you could increase the height of the jetjump to match the double jump.

Im a swbf2 modder but many things should be the same on swbf1.
The AI have "serpentine" state which triggers when enemy aims directly at them. Serpentine means they will strafe to right and left to try to dodge your shots. By testing, I found out that AI do not use serpentine state when they are close to barriers (those things set up in ZE that tell AI where they cannot go). I removed all the barriers and they started using it very often. However not using any barriers also presents problems like bots walking into objects. I need to test this more because I think just keeping important barriers could be a compromise.

SetAIDifficulty tells AI how aggressively they will shoot (the rate pressing the shoot button), the accuracy of the aimbot and the time they take to lock on to enemies is improved too. By lot of testing, I use value 80 for this lua command. But value 20 is already hard enough for average players. Dont forget to disable auto balancing for this to work properly.

the other command about aggressivenes is actually there to make the AI worse than default (1.0), I could see it in endor hunt the sniper bots had the value 0.7 by pandemic to make them worse against the inferior ewoks. And in bf2, the CW luas have values 0.9 (I have some theories why but its not important)

If you want snipers or other units to shoot you from across the map thats easy. First make sure the weapon ordnance itself has the required range (lifespan and velocity affect this) then in the weapon odf look for minrange,optimalrange and maxrange. Make the minrange 0, make optimal whatever range you think is good and maxrange something crazy like 2000 or more. Also make Lockonrange very high or 0 (infinite). If the weapon dont have those odf lines, you can add them (find the examples in other odfs). In mission lua, there are sometimes commands that limit the ranges like aisnipesuitability or setdefenderrange etc, just remove those or put really high values.

You cant make the AI more intelligent. You can make them hide behind objects with hintnodes or jump in planning (assuming its the same in bf1). You can make them roll from a grenade by adding "sticky" classlabel to the ord (cause them to "flee event" state when near) someone asked to remove that feature, so removing it is possible with this. I also tried adding it as "tracer" ordnance to normal weapons, it was kinda funny when bots rolled from shooting my shotgun at them but ultimately it made them react slower and made them worse.

There are also other AI states like "flank" or "retreat" but I havent been able to use those more.

If we had the source files, we could make some hard bots which would compete with humans I think. But like this, its just minor improvements.

Also ScriptCB_SetDifficulty(3) is just the game difficulty (easy,medium,hard) I think. So no, it doesnt have 12 levels.


May 03, 2017, 01:27:26 PM #8 Last Edit: May 03, 2017, 02:15:41 PM by oldsnake
QuoteBut they wont actually double jump from that right? I dont see that in the video I think
they will jump two times before hitting the ground if that is what you mean when getting closer to enemy ai/players
https://youtu.be/w_e2Ld0I8DI

for better picture here is a link for the vid

https://mega.nz/#!OQw0XajB!2_0mmgJVgz1nJurh9uwn51B2cGYxSxWFZTxrMIAXPo4


June 30, 2017, 01:49:42 AM #10 Last Edit: June 30, 2017, 01:54:58 AM by Phobos
Quote from: Idren on May 01, 2017, 09:58:18 PM
I'm also dying to know how to enable the "special jet tricks" like the double jet jump/roll the dark troopers do in mid-air. Any luck with this one in particular yet?
I don't know any way for players to use this trick, I've only seen AI use it. If you land on a (slanted) surface after the first jet though it's possible to jet twice. I suspect there is a memory address somewhere that could be altered using cheat engine to enable this if it was discovered. If it's not featured in SWBF2 then the code was probably removed for that game, which likely would require the game source to re-add.

Quote from: xMichael on May 03, 2017, 05:09:31 AM
Im a swbf2 modder but many things should be the same on swbf1.
The AI have "serpentine" state which triggers when enemy aims directly at them. Serpentine means they will strafe to right and left to try to dodge your shots. By testing, I found out that AI do not use serpentine state when they are close to barriers (those things set up in ZE that tell AI where they cannot go). I removed all the barriers and they started using it very often. However not using any barriers also presents problems like bots walking into objects. I need to test this more because I think just keeping important barriers could be a compromise.
The "serpentine" state that AI use has their best strafing patterns. I noticed this too using SPtest. If there was a way to permanently force AI to always use this setting, they would be way stronger.

Quote from: xMichael on May 03, 2017, 05:09:31 AMIf you want snipers or other units to shoot you from across the map thats easy. First make sure the weapon ordnance itself has the required range (lifespan and velocity affect this) then in the weapon odf look for minrange,optimalrange and maxrange. Make the minrange 0, make optimal whatever range you think is good and maxrange something crazy like 2000 or more. Also make Lockonrange very high or 0 (infinite). If the weapon dont have those odf lines, you can add them (find the examples in other odfs). In mission lua, there are sometimes commands that limit the ranges like aisnipesuitability or setdefenderrange etc, just remove those or put really high values.

You cant make the AI more intelligent. You can make them hide behind objects with hintnodes or jump in planning (assuming its the same in bf1). You can make them roll from a grenade by adding "sticky" classlabel to the ord (cause them to "flee event" state when near) someone asked to remove that feature, so removing it is possible with this. I also tried adding it as "tracer" ordnance to normal weapons, it was kinda funny when bots rolled from shooting my shotgun at them but ultimately it made them react slower and made them worse.

If we had the source files, we could make some hard bots which would compete with humans I think. But like this, its just minor improvements.
I've unlocked max range shooting for most weapons but there's still a hardcoded limit for AI aiming distance in BF1.

There is a memory address for this too that hasn't been discovered yet. AI are hard-coded to dodge anything that has delayed explosion and is "sticky" classlabel. Some of the weapons in my mod have to use this classlabel, so for now the zombie AI still dodge them.

You're right about the source files. Unfortunately neither game source can be released though, which limits our improvements to mods and memory hacking.