[RELEASED] Finite State Machine Version 2.0b by Lost Zombie Studios $15

Link : See it on the asset store !

Read Me : ReadMe in PDF Format

Company Website : Lost Zombie Studios

Finite State Machines have been one of the best ways to control and power a project
whether it is a light-switch being on or off to AI which could have tens of states to even
Game Controllers that could technically have hundreds of states. The LZS Finite State
Machine can do all of that … and ! has a few nice features you wont get elsewhere.

Why so cheap a Cost ?
Lost Zombie Studio’s is a small and independent game developer from Scotland. We
are between 3-10 members depending on project and we of course understand the time
and cost constraints that go with being a small studio. This is why we have decided to start
releasing a number of asset’s that we feel can help other small studios like ourselves to get
their projects going in a good direction, and get them out there at an affordable
price(knocked down from the advised price from unity store. The first of these assets is the
Finite State Machine.

Why ? Why our finite state machine over others ?
We have looked through the asset store at what it has to offer in terms of other FSM.
They are priced around the $30-$50 mark for what we feel are assets that lack in some
core mechanics that might be useful. We also talked about how BIG scripts and classes
can get that use many states. Imagine a game controller that has 30 states and all these
states are written into the original class as “States”. Our FSM splits these states up for
you into separate script files and thus can be kept to very small files that just do their own
job or task. This is also great for working with others where tasks on the one mechanic may
be split between multiple people and they can concentrate on separate States, saving any confusion
between versions of one large class. We have added in the “Pushing” and “Popping” of states
that some may know from the functionality of the Unreal Engine’s own state machine and worked
it into ours in a nice, fluid way. We also have Object Handling between states which is something generally
overlooked by FSM’s and is a great way to save time and calculations.

Feel free to ask any questions
Thankyou
Daniel Gallagher
Programming Lead
Lost Zombie Studios

Lost Zombie Studio LIMITED is registered in Scotland. Company Number. 409159

Sold a few in the last 24 hours and just wondered if you cought it could you give a little post and let me know what you think, thankyou

I bought the package and gave it a look over, looks good! Nice, simple and pretty robust from the look of it. When I have some time to play with it and produce something I’ll report back :smile:

Good to hear it David ! Feel free to email me anytime and I promise to get back to you sharp. My email is in the readme

Please remember to review and rate this if you buy it thankyou :slight_smile:

New Update coming soon, watch this space :slight_smile:

I read through your pdf and have a few questions. I’ve been learning about fsm’s for a few weeks so I’m rather inexperienced with them but I have an idea of what I’m going to need.

I have an enemy that seems to really need 2 fsm’s. One for movement, and one for attacks, possibly a third in the future but lets say two for now.

-Movement and attack states may change at any time independently. IE: start lerp to player > start weapon swing anim > stop lerp mid swing

-The attack state may ask that the movement state change. (your pdf example seems it could this with one fsm but would it be similar if there are two fsm’s)?

-An outside event may signal one or both to change state abruptly or once they have finished changing states. Does yours support this and if not, any idea how I might add it in with something like delegate events? I’m just not sure if those would tie into the state code directly or into the fsm class…

Overall it seems I would need a base class to handle/manage the logic of changing in and out states between the two fsm’s. Does that sound like the correct approach or should the two fsm’s somehow communicate with each other? Sorry if my questions seem silly :stuck_out_tongue: By the way I found your pdf to be very clear and informative and will likely buy your fsm soon.

Thanks for any help!

Hi Frip, some good questions there and this is basically all along the lines of programming Gameplay Theory I suppose. Would be great to chat more about it in the hope I could possibly help with any thoughts and advice. Just to clear up a couple of things before I begin to answer. The 2 FSM’s for attacking and for moving … What is considered states of attack and what is considered states of movement ? The less code and less calculations you have going on the better obviously and this seems like something that could maybe be brought down into one FSM. Especially in cases of enemies where you could have a LOT of them in the one scene. Could you give me a better idea of why you have 2 FSM’s and what they both control ?

To answer your question straight up though, using my code your Objects could have unlimited state machines. I currently, for example, have an enemy class in one of my projects which has 2 FSM’s. 1 is the controller which powers what the enemy is doing. The other is the Animation FSM which controls which animation to be in and when to run animations. (Its nice to split these up as they can be moved between objects) I then have a bridgeing class which constantly feeds data from the controller to the Animation FSM. This works perfectly fine and isn’t too hard to setup and I would be happy to give you further explanation and help with anything you need :slight_smile:

Try to give me a bit more detail on your problem and if possible I will let you know how it can be solved with my code. By the sounds of it though it wouldn’t be difficult at all for you to setup and maybe I’ll look into doing an in-depth example of multiple FSM on a single object.

Cheers !

P.s. sorry for the wait on the reply

P.p.s … I read your post again and you have made it clearer than I thought you had :slight_smile: I think this could be handled pretty simply by the example I breifly spoke about there. You would have the Moving State …

Active (if see player, gotostate pursue player) … Seen Player ! →
Pursue Player (run towards player … if (close enough) set closeenough to attack →

your animation FSM is constantly looking for close enough to attack, when it sees that that is turned on it “Pushes state SwingArmsAttack” (this Push is the abrupt change you mentioned, without having to wait for any time to change the state)
this constantly runs through this state in the animation class until it sees its not close enough, at which point you just Pop out of that state.

So whilst your movement FSM is still pursueing player, your animation class is animation the enemy to look like hes attacking. Then all you do is some kind of attack calculation whether that be collision detection on the enemies hands or weapon or whether it is simply everytime it runs the animation it damages you. That bit is upto you.

Theres other ways to look at this though. You could simply have the animations popping off in the movement FSM and only ever need 1 FSM … animation’s will constantly run until told to stop so they can quite easily continue to run when states in your movement class are changing.

Is it actually just Animation you are needing to split from movement ? Sorry if this is a LOT to take in haha. Feel free to add me on skype or google chat or whatever and I’d happily talk theory all day :slight_smile:

Hey again!

Thanks for the great response! :slight_smile: I believe I have an idea now how I should attempt to get this working. I might try to do as you suggested and bring this down to one fsm as the more I think about it, it should be able to operate just fine without being split up. I think I was trying to avoid duplicating the more elaborate code chunks but as long as I keep it clean/organized that shouldn’t be a problem. I just bought the package so now I can get into the gritty bits and see if I run into any problems I can’t work through. I really appreciate the help!

Honestly mate no problem, even if the product works fine for you, if I can offer any kind of advice or help in any way with your project feel free to gimmie a holler if you get stuck and I’ll try my best :slight_smile:

Good luck !

Working on a wee update today, stay tuned today/tomorrow for it !

That’s a small update been made and you can see what the changes are by having a look at the ReadMe file posted in this threads main post at the PDF linked.

You’ll see the changes at the bottom of the file and a new little chapter called “The Reason Method”

cheers !

Just thought I’d stop in and say I’ve been using this quite successfully for a few weeks. It makes organizing my enemy AI SOOO much easier. Keep up the great work :smile:

thanks very much mate :slight_smile: sorry been at home for a wedding last couple days so been troubling to keep up with the forum !

Let me know if you need any help or anything !

Thankyou

Danny

Working on a little update as we speak :slight_smile: glad that I havnt had any complaints yet the product seems to be going down a treat ! If you are using it could I ask you to please do a review in the app store as it would help me a lot ! thankyou

Link : See it on the asset store !

Read Me : ReadMe in PDF Format

Company Website : Lost Zombie Studios

Some new functionality added ! Check out the new Readme files and a big thankyou to Gergely Tabiczky for his input on this request.

Danny

(bookmarked)

Waiting to see how it develops ? or just bookmarking out of interest ?

Hi. How do I destroy a gameobject within a state? I got this error “‘Destroy’ does not exist in the current context”.

Hiya buddy, could you please email me the problem and the bit of code you are using telling me whether it is in a state or in the FSM itself. I think you may need to do it from the FSM but I can explain this to you better if you email me :slight_smile:

danielgallagher.59@gmail.com

thankyou !