Jump to content
scifer

missionFlow.fsm is it really an advantage?

Recommended Posts

Hello. I am into mission design for more than 5 years now and every thing I do is over script. I NEVER use the editor.

I'd like to know what is the real advantage in using missionFlow.fsm besides a graphical diagram? If a graphical diagram is a advantage indeed and why BI uses it?

Thank you

Share this post


Link to post
Share on other sites
what is the real advantage in using missionFlow.fsm besides a graphical diagram?

This is the reason why. :)

Share this post


Link to post
Share on other sites

For some complex things FSMs are surely more comfortable and faster to make.

I can also imagine that it has it's advantages when you have more than one person working on a task.

Share this post


Link to post
Share on other sites

Another method is: custom events

create an event for each thing you want to script a response to. Add the handlers to the events, then the only thing you need to worry about is when to raise the event.

I'm using it now in a randomly generated mission and it works great. However this is a custom library I'm still working on, but CBA does support custom events as well.

A lot of the needs of mission makers is similarly tied to the needs of GUI programmers

Share this post


Link to post
Share on other sites

So the reason is "comfort".

I thought fsm had some benefit in performance or stability. I'm making randomly/dynamically self generated missions and modules and started to port it to fsm and found myself regretful to death. It's so UNCOMFORTABLE to edit code in that plain and narrow text box with absolutely no syntax resources. You cant call/spawn code with waitUntil, sleep and God knows what in it because context errors.

I'll try to edit the code directly in fsm with Poseidon as my last try.

Thanks for you help

Share this post


Link to post
Share on other sites
So the reason is "comfort".

I thought fsm had some benefit in performance or stability. I'm making randomly/dynamically self generated missions and modules and started to port it to fsm and found myself regretful to death. It's so UNCOMFORTABLE to edit code in that plain and narrow text box with absolutely no syntax resources. You cant call/spawn code with waitUntil, sleep and God knows what in it because context errors.

I'll try to edit the code directly in fsm with Poseidon as my last try.

Thanks for you help

You can link the FSMEditor to a text editor, such as Notepad++.

Go to Edit > External Editor > Full Path and for example, I'm linking Notepad++ > C:\Program Files (x86)\Notepad++\notepad++.exe.

Then, while editing in the FSMEditor you can click Edit (Bellow text window) and it will open current state/condition code in Notepad++.

  • Like 2

Share this post


Link to post
Share on other sites
You can link the FSMEditor to a text editor, such as Notepad++.

Go to Edit > External Editor > Full Path and for example, I'm linking Notepad++ > C:\Program Files (x86)\Notepad++\notepad++.exe.

Then, while editing in the FSMEditor you can click Edit (Bellow text window) and it will open current state/condition code in Notepad++.

Thanks for the heads-up. I was also wondering how it should be possible to properly work on code with such tiny text field. I have packed any events such as cutscenes or conversations in separate "scene"-scripts that carry 100 or more lines sometimes. Maybe I'll try the FSM way some time.

Share this post


Link to post
Share on other sites
You can link the FSMEditor to a text editor, such as Notepad++.

Go to Edit > External Editor > Full Path and for example, I'm linking Notepad++ > C:\Program Files (x86)\Notepad++\notepad++.exe.

Then, while editing in the FSMEditor you can click Edit (Bellow text window) and it will open current state/condition code in Notepad++.

Oh. This is much appreciated!

I hope it pipes the code into FSM editor so we don't need to cut and paste the it.

______________________________________________________________________________________________

Edit: Yes it pipes the code on save. It changes every thing! :yay:

Edited by scifer

Share this post


Link to post
Share on other sites

And you can use FSM and sqf combinations, which can be very powerful.

I have the actual code in precompiled sqfs, and I call them via FSM, which is a lot better if you need to handle complex forks and/or you need an on each frame condition controller.

Share this post


Link to post
Share on other sites
And you can use FSM and sqf combinations, which can be very powerful.

I have the actual code in precompiled sqfs, and I call them via FSM, which is a lot better if you need to handle complex forks and/or you need an on each frame condition controller.

You mean SQF files precompiled like:

ZPT_function =  [] call compile preprocessFileLineNumbers "script.sqf";

I so. Can you use waitUntil / sleep within it with no context errors?

Share this post


Link to post
Share on other sites

Called scripts are as if you typed them there directly, so you cannot use sleeps and waituntils. It is just easier and cleaner to handle IMHO.

For timings:

Either you use spawn (the running of which will be parrallel thus hard to control)

Or you can use the FSM for this task eg. with a state: _d = time; and then a condition: (time - _d) > 5

About original question: are you asking about missionflow especially, or FSMs in general?

And one last thought: you are then in the "editor is for the sissies" movement! :) We should make something like it kinda official, a group or something. :D

Edited by zapat

Share this post


Link to post
Share on other sites
Can you use waitUntil / sleep within it with no context errors?

Yes, by spawning a new thread within the FSM. Did that in A2 when I tried to get kbTell to work with text only.

E.g. something like:

nul = [] spawn {code with sleep and waitUntil};

Share this post


Link to post
Share on other sites

@zapat

I was asking about missionFlow especially but have so many similar questions about fsm usage like when is it more convenient to command a unit to execute a fsm or a sqf, what are the pros and cons?

Share this post


Link to post
Share on other sites
You can link the FSMEditor to a text editor, such as Notepad++.

Go to Edit > External Editor > Full Path and for example, I'm linking Notepad++ > C:\Program Files (x86)\Notepad++\notepad++.exe.

Then, while editing in the FSMEditor you can click Edit (Bellow text window) and it will open current state/condition code in Notepad++.

Awesome thank you, should make things easier.

Share this post


Link to post
Share on other sites

The three major pros for fsms for me is:

1. multiple breakpoints from loops: this is a pain to do in sqfs. Thats why FSMs are used for AI many times. Sometimes you just need this don't you.

2. extensive forks. Sqfs are best for linear designs (unless you are in love with big if blocks). With FSMs it is easy to overview extensive forked code paths.

3. per frame condition evaluation: the brother of sqf waituntil, but you can use it more easily than that.

If one of the above is needed for the task I am about to do, I opt for FSM instead of sqf.

Share this post


Link to post
Share on other sites

FSM doesn't execute diag_log.

How is it possible do debug without diag_log? How debugging works in FSM?

edit: Forget. Never mind.

Edited by scifer

Share this post


Link to post
Share on other sites

I am assuming that missionFlow.fsm is a special file name that will be automatically executed on mission start. Is that correct?

Share this post


Link to post
Share on other sites
I am assuming that missionFlow.fsm is a special file name that will be automatically executed on mission start. Is that correct?

Yes it starts automatically.

Share this post


Link to post
Share on other sites
I am assuming that missionFlow.fsm is a special file name that will be automatically executed on mission start. Is that correct?

Yes, didn't know that, executed it in the init and then wondered why nothing worked or was doubled...

Share this post


Link to post
Share on other sites

After fidlling around with this a little bit I must say it has proven to be a huge advantage for me in non-linear mission making. Doing even simple stuff like in the attached picture below in SQF would require a lot of ifs and elses I guess...

unbenannt53qs1.jpg

Share this post


Link to post
Share on other sites

is there an introduction to fsm that anyone recommends?

Share this post


Link to post
Share on other sites
An FSM is just like a trigger using a condition and a statement.

Here are some FSM resources that might help you:

https://community.bistudio.com/wiki/FSM

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

https://community.bistudio.com/wiki/execFSM

Interesting stuff, thanks for the share.

How easy/complicated is it to handle these FSMs in overly complex missions that would run multiple of these FSMs together? Or would it make more sense to pack it all into one giant FSM?

Cheers

Share this post


Link to post
Share on other sites
Interesting stuff, thanks for the share.

How easy/complicated is it to handle these FSMs in overly complex missions that would run multiple of these FSMs together? Or would it make more sense to pack it all into one giant FSM?

Cheers

that entirely depends on how you design your mission. I would recommend using one FSM to handle the missionFlow (like missionFlow.fsm suggests) - this would involve creating tasks/when tasks are completed/when to assign new ones/when can the mission end

The advantage to this is that if you have a mission that is as complex as lets say 'manhattan' from arma 2, the missionFlow fsm will make it much easier to see the connections made between various tasks and side missions.

If you have some sort of scripted behaviour in your mission that is complicated to write, it would be best to do this in a separate fsm - the missionFlow shouldn't handle some unrelated behaviours to an ai unit when its focusing on handling the mission itself.

Remember that the goal of FSM is to define and implement behaviours for a specific entity. Mission Flow can be considered one entity, where as scripted ai behaviours would be another.

Share this post


Link to post
Share on other sites

I swear FSMs are ridiulously easy to make. Just make sure you have the BI tools installed. Xeno made a little FSM example that is here on the interwebs somewhere. If I can find it I will post it here. It is easier to put your tasks together and actually visiualize what is going on. For example open up the showcase_scuba and you can see how they run the missionflow.fsm and also have another fsm controlling the mines deactivation. Showcase_fixedwings also has a couple of fsms that control livefeed and a number of other functions.

This link might not be working.

http://rte.jonasscholz.de/blog/rte.jonasscholz.de/blog/2009/11/03/new-to-arma-2-fsm-scripted-fsm-by-xenohtml.html

Looks like xeno said he has to fix his tutorial:

http://forums.bistudio.com/showthread.php?144316-FSM-editor-problem&p=2272751&viewfull=1#post2272751

Edited by cobra4v320

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

×