Jump to content
alleycat

What is the purpose of FSM in arma3?

Recommended Posts

I was looking at FSM and after quickly glancing over what it does, I wonder:

1. Can the same things be achieved with normal scripting and is FSM just a visually easier way to handle it? Or is there something in FSM that normal scripting cant do?

Share this post


Link to post
Share on other sites

The FSM is a different concept of executing programming code. It's applied when you wish to define the bahaviour of an entity under certain conditions. AI-behaviour or mission flow (or conversation flow in A2) are good examples from the Armaverse. Imagine you have a non-linear mission with a lot of different ways to accomplish it. You could do that in simple .sqf and with a lot of triggers, global variables etc. Or you use an FSM which looks better and is easier and faster to create. Look at the (partial) example from one of my missions below:

1mtb12.jpg

As you can see this mission has many possible events in one situation. I could have achieved the same functionality with tons of .sqfs, triggers and eventhandlers. But it was way easier to do it with an FSM, and since it's all in one place I can change stuff quickly and see if it could affect another state.

Another example would be this (extended) FSM from Arma 2 PMC which controls the behaviour of a protesting civie:

2x1lht.jpg

Again, you could probably write .sqfs but it will be way more complicated with lots of huge if-then-else or case blocks and loops. On the other hand a strictly linear script or function is easier to write in plain .sqf. You can also combine both e.g. by executing linear stuff like cutscenes from the missionFlow.fsm. Finally, some additional literature about the concept of FSMs in general.

Share this post


Link to post
Share on other sites

Ah zapat was faster. I was just about to post that same link :P

FSM is good for logical flows, especially for scripted AI.

Share this post


Link to post
Share on other sites

I am feeling more comfortable with sqf scripting, so if apart from a diagram, I would rather not use it. Thanks for the answer.

Reading some old interviews of rocket there was screenshots of fsm and zombie behaviour and I assumed from that you can do things with it sqf cant.

Ok just to be clear, fsm can use exactly the same scripting commands as regular sqf?

Share this post


Link to post
Share on other sites

Yes. FSM condition evaluation is on each frame and unscheduled. Spawned, execVMed sqf is scheduled.

Other than that a command in an SQF will take the same time as a command in FSM. Only distributed differently.

And there is one thing you cannot do in sqfs: complex forking (As IndeedPete wrote). Eg something like this. :)

Edited by zapat

Share this post


Link to post
Share on other sites

So for bringing this old thread back up. There is not a lot of information about why vanilla waypoints disappear once a group gets into combat mode and the FSM AI behavior kicks in. I'm trying to understand why does it deletes  the waypoints once  it puts the group into combat. The we'll just sit idle once the threat is eliminated and never follow its waypoints again that was placed in the editor. I know groups will follow Marker waypoints that are scripted even if combat status is reached and the FSM kicks in the group will follow its Marker way points once the threat is eliminated. I'm trying to find a way to allow editor place waypoints to continue!!!

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

×