Jump to content
Sign in to follow this  
Kydoimos

FSM Compiling

Recommended Posts

Hi all - so, ok - first time messing about with BIS' FSM editor. I've read everything I can find on creating FSMs, but, I must admit, I don't feel I've really grasped everything. In particular, I don't really get how I compile an FSM. I understand it needs to be compiled as an .FSM file, as opposed to a .BIFSM file in order to be used.

Essentially, I'm trying to create a custom ORBAT FSM. I'm using BIS' existing FSMs as a guide. I want to edit the attributes on the ORBAT.FSM files from the East Wind campaign - I can make the changes, just fine - but when I attempt to save the file, I get problems. My question is: how, in laymen's terms, do I compile the file? Thanks in advance, for anyone who can shed some light on the subject! :D

Share this post


Link to post
Share on other sites

Nvm havent noticed you were already using the editor, duh!

Edited by Killzone_Kid

Share this post


Link to post
Share on other sites

You don't need to compile it afaik.

You need to save it with extension .fsm.

I've never saved anything as .bifsm and it works fine for me.

Share this post


Link to post
Share on other sites
You don't need to compile it afaik.

You need to save it with extension .fsm.

I've never saved anything as .bifsm and it works fine for me.

thats probably becuase you've defined the path to compile the .fsm. the program always spits out errors at you about not being able to compile if it doesn't have the compile config path set up already. Also to my knowledge it said in the wiki that it MUST be compiled in order to function ingame.

Had a whirl with it a long while ago and got frustrated then simply quit trying to get it to work because the documentation on it was incomplete.

Share this post


Link to post
Share on other sites

Yes, you need to set the compile config. When opened a file in the FSM Editor hit FSMAttributes >> Compile config. Then navigate to the BI Tools dir, for me it's "D:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition". Depending on what you have in mind you need to pick the right config. I found for most applications (mission flow, scripting) the "scriptedFSM.cfg" works fine. However, I don't know if BI's orbat.fsm uses a different config - for example, their .fsm to handle the campaign flow requires a different config we don't have access to at the moment. If I were you I'd open up the original orbat.fsm and take a look under FSMAttributes >> Compile config. The path to the config of the BI Dev's machine who made the fsm in the first place should still be set, you might get a file name to look for in your own BI Tools dir. Good luck!

  • Like 1

Share this post


Link to post
Share on other sites

@All - cheers guys! Thanks for the responses :D

@IndeedPete - awesome! Very helpful! That's a good place for me to start! Thanks, matey!

Share this post


Link to post
Share on other sites

Is there actually any advantage of using FSMs over regular sqf files besides having a better overview with more complex stuff?

Tried FSMs some time ago and couldn't really make out any significant difference.

Share this post


Link to post
Share on other sites

@GOM: Well, you said it yourself: better overview. FSMs are good when dealing with lots of branching. In plain SQF you'd need huge if-then-else structures, FSMs are a neat way to organise complex code. Well suited for applications like mission flow, conversation flow, AI behaviour etc. In A2 I used to define a mission's flow by setting up triggers and execute single "scenes" from it; mission flow related code was scattered around the folder. Since I discovered the generic and automatically executed missionFlow.fsm I put everything in there, works fine, looks good and certainly saves some time. Plus, if anything goes wrong, you know where to look, even if you haven't touched that particular mission in months. Check this example picture taken from two of my FSMs (both scriptedFSM.cfg), left part of the image shows the mission flow of one of the final M.E.R.C.S. missions, in the right part is a small FSM that controls a leader / scout car:

unbenanntigdo0.jpg

I could have done both in SQF as well. However, as you can see, the mission flow has five different endings with six different conditions (plus the complexity beforehand) - a pain in the ass to script in SQF, lots of branching / multiple files. Doing the AI behaviour in FSM works well as it is quite repetitive (accelerating, check if follower isn't too far away, break, wait, accelerate again...).

In short: For small, capsuled scripts or functions (libraries), init files, single events I prefer SQF. For unique, complex stuff / flows I choose FSMs.

---------- Post added at 12:18 PM ---------- Previous post was at 12:11 PM ----------

Another good AI example is this part from a three-staged zombie system for Contention Zone. Top level is a global controller administrating pre-defined zombie zones on the map (SQF), second level is a function that creates and prepares a zombie unit (also SQF) and the third one is the zombie controller which controls an individual zombie unit shown in the pic (FSM):

unbenannte9ubu.png

Edited by IndeedPete

Share this post


Link to post
Share on other sites
Is there actually any advantage of using FSMs over regular sqf files besides having a better overview with more complex stuff?

If you need to wait but want to do it in unscheduled environment.

Share this post


Link to post
Share on other sites

I'm looking to use the FSM for the ORBAT markers because there seems to be a bug with defining them from the description.ext. Basically, when you load a saved game, custom ORBAT markers cannot be viewed! However, it works fine from the FSM (or at least, it does in BIS' campaign!)

---------- Post added at 20:11 ---------- Previous post was at 20:01 ----------

Ah, it appears I need a special ORBAT.Cfg that is not in the FSM editor! :(

Share this post


Link to post
Share on other sites

lol, cool! I've added my request on the thread! :D Fingers crossed!

Share this post


Link to post
Share on other sites

Oh well, since I'm already in the middle of sorting out/redoing most of my functions I might as well find a use for some FSMs,

guess it's just a question of getting the hang of the workflow (I hate that terrible GUI).

As for ORBAT, I always thought that stuff only works if predefined in the description.ext? Is it possible to make it work dynamically mid-mission?

Cheers

Share this post


Link to post
Share on other sites

I guess the Orbat FSMs are not meant to change anything mid-mission but rather during the course of the (East Wind) campaign. I haven't looked at them in detail, just noticed them a couple of times messing with the East Wind's sources. The FSM was probably just easier to view and maintain during the development of the campaign; to keep track of intended troop movement and strength and to avoid inconsistencies. Just a wild guess though.

But you do know about the possibility to pipe code from the FSM Editor's GUI to an external text editor of your choice? If not, hit Edit > External Editor and link the executable of notepad++ or so. When opening a state or condition hit the edit button down right and it will open the contents of the small window in the external editor. Just don't forget to save the external documents, otherwise synching seems messed up. And it frequently deletes the temporary code files when switching back to the FSM editor. Had to rework several scripts because I forgot to save in time and accidently disbanded the temp files.

Share this post


Link to post
Share on other sites

Thanks for the tip, I'm using poseidon and already aware of that. ;)

Are there any common quirks to be avoided / watch out for when using FSMs?

Been goofing around a bit with it and it's growing on me, looks like a very comfortable way to handle complex stuff indeed.

Share this post


Link to post
Share on other sites

First, don't forget to (re-)compile! ;)

And be aware of the fact that FSMs don't allow sleep commands. Well, there are ways to bypass it.

In a state:

_timeout = time + 5;

And in a follow-up condition:

time > _timeout

Or what I use in mission flows and (cut-)scenes.

State:

_handle = [] spawn {
// Do Stuff
sleep 5;
};

Condition:

scriptDone _handle

Share this post


Link to post
Share on other sites

You can link to multiple states and conditions even though the editor issues warnings, it works just fine

Share this post


Link to post
Share on other sites

I've been making a minor civilian waypoint fsm, works incredibly good.

Multiple states and conditions being cross-linked, no errors from either editor or compiling.

Really appreciate the workflow now that I'm somewhat used to it.

Helps you to add stuff rather than trying to figure out how to create all these if then else constructions.

This is actually more fun than I'm willing to admit.

Cheers

Share this post


Link to post
Share on other sites

Told you! It's the right tool for the right task, just like plain SQF or config files.

I guess KK referred to the possibility of directly connecting a condition with a condition or a state with a state which throws an error. Never tried to compile that though, I feel it's bad practice even if it does work. I simply use dummy states or true conditions in such cases.

Share this post


Link to post
Share on other sites
Told you! It's the right tool for the right task, just like plain SQF or config files.

I guess KK referred to the possibility of directly connecting a condition with a condition or a state with a state which throws an error. Never tried to compile that though, I feel it's bad practice even if it does work. I simply use dummy states or true conditions in such cases.

Yeah, it's a bit confusing at first but working out quite well.

Just made a task management fsm that gets fed with text, conditions needed to complete/fail/cancel a task and specific task descriptions for each possible case.

Basically nothing special, just a nightmare to do in sqf alone.

Really handy.

Share this post


Link to post
Share on other sites
Told you! It's the right tool for the right task, just like plain SQF or config files.

I guess KK referred to the possibility of directly connecting a condition with a condition or a state with a state which throws an error. Never tried to compile that though, I feel it's bad practice even if it does work. I simply use dummy states or true conditions in such cases.

Actually not quite, if I link to the same condition from 2 states and press F7 it issues warning ((1) Warning: Condition has in degree greater than 1). I looked up BIS FSMs and they were doing it left right and centre and were also issuing warnings for those. Maybe I have outdated Editor, though I did download latest tools. Anyway, it works even if editor complains. If you dont do multiple linking then fsm can get really messy.

EDIT: mine is 1.2.1 not sure if this is the latest one.

Share this post


Link to post
Share on other sites

Really, that throws errors / warnings? I do that all the time. Though I usually add knees to my FSMs for better visibility. Maybe they do more than just look pretty?^^

I've got 1.2.1 as well, installed from BI Tools 2.5 a few months ago.

Share this post


Link to post
Share on other sites
Really, that throws errors / warnings? I do that all the time. Though I usually add knees to my FSMs for better visibility. Maybe they do more than just look pretty?^^

I've got 1.2.1 as well, installed from BI Tools 2.5 a few months ago.

Meh, knee doesn't matter. Press F7 and you will get warning. Warning is fine, Error is not.

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  

×