This project was canceled. The experiment wasn't successful for me. Even it can be good for visual programming, it not worth without it.
The state machine here is powerful and easy describing, but better use simple library with any other fsm.
The FSM plugin for Defold to describe states like Playmaker in Unity with predefined actions
Defold Adam has next features:
- Powerful Finite State Machine to describe any behaviour you want
- Easy to start: A lot of predefined actions with good API reference and annotations
- Enough for game: Ability to build any game logic just via state machine (like Playmaker and Bolt in Unity)
- Rich features: reusable action templates and nested FSM
- Comfort: Any action describes in one line of code. It provides fast developing, easy reading and less bugs
- Performance: Good performance even with a lot of instances of FSM
- Visual Editor: not provided now, but who knows?
- Code as Data: Ability to load your FSM as JSON (from resources, from web, etc). Need visual editor to make it :)
You can use the Defold-Adam extension in your own project by adding this project as a Defold library dependency. Open your game.project file and in the dependencies field under project add:
https://github.com/Insality/defold-adam/archive/main.zip
Or point to the ZIP file of a specific release.
To use Adam, you should do next:
-
Describe your states with actions via create State instances:
adam.state
-
Describe transitions between states via create Adam instances:
adam.new
The basic code looks like this:
local adam = require("adam.adam")
local actions = require("adam.actions")
function init(self)
-- Empty state
local initial = adam.state()
-- The state with one instant action
local hello = adam.state(
actions.debug.print("Hello guys")
)
-- The Adam instance itself
self.adam = adam.new(initial,
{
{initial, hello, adam.FINISHED} -- Third parameter is optional, it's adam.FINISHED by default
}
)
self.adam:start()
end
function final(self)
self.adam:final() --- The final call is important!
end
function update(self, dt)
self.adam:update(dt) --- The update call is important!
end
Short description how to create your custom actions and how to use it in code. Full instruction in other document
- Core Concepts && Glossary
- States
- Events
- Actions
- Variables
- Custom Actions
- Template Actions
- Nested State Machines
- JSON representation
- EmmyLua annotations
- Performance
- Usage examples
- FAQ
- Tips
List of created examples and their code from /examples
Developed and supported by Insality
Used libraries:
If you have any issues, questions or suggestions please create an issue or contact me: insality@gmail.com