Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CfgFSMs #39

Open
nk3nny opened this issue Oct 12, 2019 · 6 comments
Open

CfgFSMs #39

nk3nny opened this issue Oct 12, 2019 · 6 comments
Assignees
Milestone

Comments

@nk3nny
Copy link
Owner

nk3nny commented Oct 12, 2019

Exciting news. The latest version introduces changes to the core configuration of the AI-- the formation brain of the AI so to speak.

The relevant file is:
https://github.com/nk3nny/LambsDanger/blob/master/addons/danger/CfgFSMs.hpp

There are two interesting changes:

  1. Changing one stance change state to nothing, which gives us much more control of the AI.
  2. Altering the paramaters of the 'searchPath' function. This is where gold can be found!

Introducing searchPath
'SearchPath' is an important part of the path finding algorithm. Specifically the two parameters deal with:
0, Radius or threshold -- maximum cost-- of pathfinding
1, Delay or maximum waiting time for bounds.

Changing the first variable (0) increases the distance the AI search for valid cover. If no cover is found, the AI will instead navigate by terrain. Setting it higher makes for longer bounds, which in turn increases the speed.

The second variable (1) seems to have a (very) soft impact on the AIs willingness to wait for allies while pressing forward. In practice, setting it higher increases cohesiveness of the squad. With little loss of overall speed.

Units which are outside combat or driving have both values set to 0. This creates a dumbly effective AI which disregards micro terrain and cover in order to move directly to the intended destination.

Counter intuitively, setting parameters (0) higher actually increases the speed which AI moves and increases the propensity for moving and shooting.

Tweaking it

The current settings are the result of considerable testing
0, Threshold, 30
1, Delay, 6

In contrast the default settings have been, as far as I can tell, carried over from Arma2 and are:
0, Threshold, 10
1, Delay, 5

There are unfortunately no free meals. The absolute ideal would have been if it was possible to dynamically change the setting based on needs.

Setting 6-6 produces a squad which in terrains with high density moves with authority and great cohesion. Setting it to 0-0 has considerable impact on speed (making it possible to speed up AI where no cover or threat is found).

As it appears impossible to interject new functions into the CfgFSM/Formation, this must remain a pipe dream. Instead a balanced compromise must be sought.

To be clear: aside from the incidental effect noted above, this setting has no appreciable effect on the "stop-and-go" or "redlight, greenlight" style of movement described by Beaglerush at #21

Testing it

The current settings are a product of testing. Given the variability of terrains in Arma. There is no scientifically perfect setting. The best approach is for now to do testing in a large variety of situations and scenarios.

a. One fear I have is that setting it higher introduces additional drain on the host system. My limited personal tests have not seen such stress-- but it is a worry.

b. Another is that the the larger threshold will create fractured and disorganised AI squads. Which would run counter to the intended scope.

That's about it. Well aside from the cautious optimism that this is one AI tweaks with tremendous potential. I have seen nothing of its sort in any AI mod before-- and it appears to have been virtually untouched since Arma2.

@nk3nny nk3nny added this to the 2.0.0 milestone Oct 12, 2019
@nk3nny nk3nny pinned this issue Oct 12, 2019
@jokoho48 jokoho48 unpinned this issue Oct 22, 2019
@jokoho48 jokoho48 pinned this issue Oct 22, 2019
@nk3nny
Copy link
Owner Author

nk3nny commented Oct 23, 2019

Yesterday we played a larger scale test of danger.fsm v2.0

I spent the entire mission in spectator looking in particular at the performance of the FSM tweaks. Some was good, some not so.

The overall goal of the tweaks should be:

  1. Move large enough distances to not become targets in open ground
  2. Move large enough distances to trigger moving-and-shooting in CQB
  3. Move with enough delay to to retain unit cohesion (ie, no suicidal squad leaders)

At the current time, the AI is very aggressive. Aggressive to the point of abandoning perfectly good positions. While fully funcitonal, and not by any stretch of imagination broken (or inferior to vanilla). I believe some tweaks are in order.

@nk3nny
Copy link
Owner Author

nk3nny commented Nov 4, 2019

Current working settings are:
24 / 8

A real shame that these cannot be tweaked dynamically. sigh

@jokoho48 jokoho48 unpinned this issue Feb 25, 2020
@jokoho48 jokoho48 pinned this issue Feb 25, 2020
@jokoho48 jokoho48 unpinned this issue Mar 14, 2020
@jokoho48 jokoho48 pinned this issue Mar 22, 2020
@freghar
Copy link

freghar commented Jan 14, 2021

Why are these changes needed? Shouldn't they be irrelevant once fsmDanger is executed? Thanks!

@nk3nny
Copy link
Owner Author

nk3nny commented Jan 14, 2021

@freghar
There are essentially two FSMs running. One which is only triggered during danger, the other always being active. Check this video for an explanation:
https://youtu.be/F0okjfLtNJ0

@freghar
Copy link

freghar commented Apr 22, 2021

I just saw this issue again and thought I'd share my thoughts from my somewhat independent LAMBS-less testing.

I'm pretty sure the second parameter is a cover search radius - setting it to 0 just makes AI drop on the ground with no attempts at taking cover, thus also speeding up the overall movement.

By increasing either of the parameters, the AI soldiers take longer bounds and are often out of cover by their teammates - this, combined with how non-responsive the moveTo-like movement is, makes it trivial for players to set up "killzones" (ie. in towns) where they camp and kill AI soldiers one-by-one as they do long bounds (during which they often don't react to fire) without anyone to cover them.

So the original post is kind of right in that there's no one good setting, though I found the vanilla defaults to be safer overall. There are some other ways of speeding up pathfinding (ie. coefInsideHeur), but they risk AI getting stuck in places where only the more expensive pathfinding can find a way out. No free meals indeed.

@jokoho48
Copy link
Collaborator

@nk3nny todo for you: Move this into the Wiki!

@jokoho48 jokoho48 modified the milestones: 2.5.2, 2.6.0 Oct 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants