Generic StateMachine Module

Hello Robloxians and Developers, Pretty funny eh?

Anyway… I have made yet another helpful module for devs, To save you about hmmm… 120 lines? and 1-2 hours of your time making an state machine.

Yes you saw it right, State Machine.

I have made an generalized state machine module that allows you to have StateMachine for anything you want, With exit, update and enter functions.

What is a State Machine? Source

A state machine is a behavior model. It consists of a finite number of states and is therefore also called finite-state machine (FSM) (Not all state machines are limited to finite amount of states). Based on the current state and a given input the machine performs state transitions and produces outputs. There are basic types like Mealy and Moore machines and more complex types like Harel and UML statecharts.

Links

Generalized State Machine: create.roblox.com/store/asset/116036508889370
Me (Roblox): ItzMrRatsP - Roblox

I am always looking for tips and trying to improve, So please if you think i can do something better then reply to this and let me know

2 Likes

Forgot to add that in there, But there i do have a wally package for it too.
genericstatemachine = "itzmrratsp/genericstatemachine@0.1.1"

I think it’s important to note that not all state machines have finite states, This line seems to incorrectly state this:

I can provide some examples of ISMs, but they are largely unused in game development. BIggest examples would probably be integer counters, turing machines, and Neal.fun’s InfiniteCraft.

3 Likes

A good example of a StateMachine within Roblox (built in) are the Humanoid States, alongside with the EvaluateStateMachine property.

1 Like

I didn’t write this, I put the source up there. But i will add that in.
Thanks!