Jump to content
Sign in to follow this  
.kju

Research on AI FSM

Recommended Posts

You are welcome to contribute!

Please share your insights in this thread or merge it into the BIKI article directly: BIKI: AI_FSM

Related info:

Unexpected Danger FSM triggering

GAM Clockfacing Report

AI leader orders crouch stance when in 'Danger' mode

New Event Handler: Enemy Detected

Why THE HECK does the AI lay down without a reason?

Detecting AI squad behavior

Random shouting of troops

http://community.bistudio.com/wiki/FSM, especially the tutorial of Rune at the end helps.

http://community.bistudio.com/wiki/FSM_Editor_Manual

Each CharacterType can have up to 2 FSMs.

fsmFormation

fsmDanger

The fsmFormation is the default FSM, wich is automatically run at mission start. You can leave it blank, but then the game engine falls back to the native "Formation" FSM, wich is declared in "CfgFSM/Formation". The value should be the name of a nativeFSM or the name of a FSM file(see example below).

The fsmDanger is the second FSM you can define. This FSM is optional. It's automatically run by the game engine, if your character 'thinks' he is in danger (for example i could start it by firing some bullets into the ground close to the character). The fsmFormation is then immediatly aborted (it will not run an "End State"). If the fsmDanger comes to a "End State", the engine will restart the fsmDanger again (if the fsmFormation was running while firing the fsmDanger). If you don't use it, set the value to "" and the game e.ngine will continue to execute fsmFormation if character is in danger.

BIKI: HeliJunkie's_Sandbox

The Danger.fsm will trigger after a specific danger event was happened.

Danger Events:

* Enemy Detected

* Enemy Near

* Dead Body Detected

* Hit Detected

All thouse events are covered by the "Danger.fsm" and will be triggered for each unit after a specific danger event was detected by the given unit.

Nope the "Danger.fsm" can only be used AddOn based because it's assigned to each unit in it's config.

So it's not the same like a normal Event Handler which can be added.

You will be suprised what can be made with the different danger events.

qbKxsefL41Y

In reference to "AI leader orders crouch stance when in 'Danger' mode":

This can only be done well through editing danger.fsm which isn't something a mission maker can do.

I added "_this setUnitPos "Middle"; _this setUnitPosWeak "AUTO"; " to the start state of a danger.fsm.

It looks seriously cool. Basically when AI sees enemy he crouches and moves around crouch-running, keeping his head down - both your and enemy AIs do that.

However as soon as they can't see any enemy they try to look for him by going into standing stance too (and moving around standing - even in "danger" mode yes, as originally) - as soon as they see an enemy the start crouching again, engaging so none of that stupid "I'm standing in the open field under an enemy fire yay!".

Note that those commands should be overridden when the player gives commands so it should be non intrusive if you command AI squads.

Now I need to test this some more to confirm it.

So, I've been playing with the FSMs and found the formation and danger FSMs can be over written.

As a test, the formation FSM was overridden just loop every second and write out to global. The same was done with the danger FSM.

When you start you see the FSM for formation start, and a second goes by, and it is fine. I fire a gun, the danger FSM is triggered. And it keeps re-triggering, as in it continues to say "DANGER FSM STARTED" then an occasional second will tick by and the "Danger FSM time 2" will fire off, then the DANGER FSM STARTED again...

Is this how this is supposed to work? :confused:

From my knowledge of the danger FSM, it triggers everytime there is an update to the _dangerCause there are 8 possible causes varying from different levels of "awareness", the FSM loops itself until there is no cause of danger (ie area clear or enemy presence knowsAbout times out).

I believe yes... what you described is normal. Since the input to that fsm is commanded by the engine. The multiple states are going to update. Your control is more about the "micro" behaviour of the AI on the different hardcoded states.

For the record all config data for FSM:

http://pastebin.jonasscholz.de/1422

(except modules data for its custom FSM)

Found out that the formationEntity.fsm (inside ca\characters\scripts) is equal to 'class

Formation' of 'class CfgFSMs' in the config space.

The FSM file also has two code comments.

It means one can look at the structure/FSM easily with the FSMEditor.

And modify it this way. To the conversion to the config representation is very simple.

It seems it uses a special configuration for the FSMEditor called entityFSM.cfg.

The FSM uses special / low level commands contrary to SQF used in others.

So the ability to modify it might be limited.

Will start a (series) of BIKI pages about the AI FSM in a bit to make it easier to gather insights.

Edited by .kju [PvPscene]

Share this post


Link to post
Share on other sites

Suma is sharing a lot of insights into AI FSM these days.

If it interests you make sure to visit the CIT tickets:

You can filter in addition for AI issues

http://dev-heaven.net/projects/cis/issues

or look at the activity view:

http://dev-heaven.net/projects/cis/activity

In addition he made this BIKI page: FSM_Danger_Causes

Make sure to check also its talk page.

Share this post


Link to post
Share on other sites

I'm gald more information on this topic shows up.

But is it still true, that one needs to create a stupid addon to mess with these core fsm? Because that sucks (as in: "pfff, well, then not. :mad:").

I don't wan't to introduce new units and I don't wan't to mess around with addons. But as a mission designer, I really wanna change these core fsm on a per group basis (looks like it wouldnt make much sense to do this on a per unit basis...). I want to be able to give all units from faction X another core fsm and I want to be able to give yet other ones to specific vehicle crews and my sniper team and so on...

... yeah, there is a command to mess with the config by means of scripting, but if I do remember this correctly, that command is only intended for testing purposes for actual/later addons... so I guess we're out of luck for now. :/

so... Suma? What are the chances, that we might get something like this:

  _group setFSM["danger", "/ai-library/commies/nomercy-harharhar.fsm"];
  _group setFSM["formation", "/ai-library/commies/formations-b.fsm"];

^^ neat, no? :)

Share this post


Link to post
Share on other sites

You mean mergeConfig, but it is disabled. :(

Create a new feature ticket for setFSM in the CIT please.

Share this post


Link to post
Share on other sites
You mean mergeConfig, ...

Yeah.

..., but it is disabled. :(

Oh. Well, never mind then.

Create a new feature ticket for setFSM in the CIT please.

I'm actually querying the CIT right now, for I'm quite a bit sure, I've already created such a ticket somewhen last year or so... though maybe not, hehe.

Also I've found yet another use for such a new command (or simply a related ticket): http://dev-heaven.net/issues/20426

So this command would not only allow to really play "robocode" in Arma, but also to better manage lots of AI/CPU: you could easily create a "LOD system" for AI this way, by auto-swaping lighter to heavier version of your fsm by distance or so... :D

Share this post


Link to post
Share on other sites

Its only a related ticket. To be able to load mission specific FSM is something different and

in my view would be a huge addition.

Share this post


Link to post
Share on other sites
Its only a related ticket. To be able to load mission specific FSM is something different...

sure. :)

...and in my view would be a huge addition.

Totally. :yay:

Here you go: http://dev-heaven.net/issues/23159

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×