Finite Stack Machine

An asset by Reefpirate
The page banner background of a mountain and forest
Finite Stack Machine hero image

Quick Information

0 ratings
Finite Stack Machine icon image
Reefpirate
Finite Stack Machine

A simple implementation of a variation on a finite state machine that uses a 'pushdown' stack arrangement to handle states.Attach an instance of the finite_stack_machine.gd class to any entity in your Godot scene. Push new states to the top or bottom of your 'state stack' to control the flow of behavior.The demo shows of some of the features. I've only done limited testing on the on_start and on_end transitions of states, but so far everything seems to be working. Please make an issue if something isn't working!Still in an early version with some planned features missing: better input event handling, perhaps hierarchical states, etc.

Supported Engine Version
3.0
Version String
0.1
License Version
MIT
Support Level
community
Modified Date
6 years ago
Git URL
Issue URL

Finite Stack Machine -

A finite state machine variant that uses a stack of custom states to drive the behavior of virtually any entity in Godot.

There's a fair amount of comments in the code, and overall there is not a lot of code so hopefully you can make some sense of it. I will return to do a more thorough write-up once I've tested and implemented a few more features.

If you were to use this StackMachine in your project you only really need FiniteStackMachine.gd, Globals.gd and at least one State script. You can take StBlank.gd from the States folder and use that as a template for more states.

Basically you can create and add a StackMachine to any Godot entity, which can process state scripts that you can write yourself. Many possible applications, some of which I hope I demonstrated in the little demo game.

I don't really know what I'm doing with repo permissions, so I've limited them to project members for editing the repo. I don't know what is standard in these things. But please feel free to download, copy, paste do whatever you want with the code. Hopefully to improve it! I would appreciate knowing of any cool developments, hacks or tweaks that I could use to improve my system.

And sorry, I messed up the repo's ignore settings. I'll fix this soon.

I found this today: https://en.wikipedia.org/wiki/Pushdown_automaton Seems relevant :P

onready var string = "Hello, world."

A simple implementation of a variation on a finite state machine that uses a 'pushdown' stack arrangement to handle states.

Attach an instance of the finite_stack_machine.gd class to any entity in your Godot scene. Push new states to the top or bottom of your 'state stack' to control the flow of behavior.

The demo shows of some of the features. I've only done limited testing on the on_start and on_end transitions of states, but so far everything seems to be working. Please make an issue if something isn't working!

Still in an early version with some planned features missing: better input event handling, perhaps hierarchical states, etc.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Finite Stack Machine icon image
Reefpirate
Finite Stack Machine

A simple implementation of a variation on a finite state machine that uses a 'pushdown' stack arrangement to handle states.Attach an instance of the finite_stack_machine.gd class to any entity in your Godot scene. Push new states to the top or bottom of your 'state stack' to control the flow of behavior.The demo shows of some of the features. I've only done limited testing on the on_start and on_end transitions of states, but so far everything seems to be working. Please make an issue if something isn't working!Still in an early version with some planned features missing: better input event handling, perhaps hierarchical states, etc.

Supported Engine Version
3.0
Version String
0.1
License Version
MIT
Support Level
community
Modified Date
6 years ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers