Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/insality/defold-adam
The FSM plugin for Defold to describe states like Playmaker in Unity with predefined actions
https://github.com/insality/defold-adam
architecture defold defold-library defold-module fsm
Last synced: about 1 month ago
JSON representation
The FSM plugin for Defold to describe states like Playmaker in Unity with predefined actions
- Host: GitHub
- URL: https://github.com/insality/defold-adam
- Owner: Insality
- License: mit
- Created: 2020-11-22T15:47:01.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-10-30T08:41:19.000Z (about 3 years ago)
- Last Synced: 2024-11-09T15:00:51.270Z (about 1 month ago)
- Topics: architecture, defold, defold-library, defold-module, fsm
- Language: Lua
- Homepage: https://insality.github.io/defold-adam/
- Size: 371 KB
- Stars: 19
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DEVELOPMENT CANCELED
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.
---
![](media/adam-logo.png)
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/insality/defold-adam/Run%20tests)](https://github.com/Insality/defold-adam/actions)
[![codecov](https://codecov.io/gh/Insality/defold-adam/branch/main/graph/badge.svg?token=VIN9pcSlpF)](https://codecov.io/gh/Insality/defold-adam)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/insality/defold-adam)
---
The FSM plugin for Defold to describe states like Playmaker in Unity with predefined actions## Features
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_ :)## Setup
### Dependency
You can use the **Defold-Adam** extension in your own project by adding this project as a [Defold library dependency](https://www.defold.com/manuals/libraries/). Open your game.project file and in the dependencies field under project add:
> [https://github.com/Insality/defold-adam/archive/main.zip](https://github.com/Insality/defold-adam/archive/main.zip)
Or point to the ZIP file of a [specific release](https://github.com/Insality/defold-adam/releases).
## Basic usage
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:
```lua
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()
endfunction final(self)
self.adam:final() --- The final call is important!
endfunction update(self, dt)
self.adam:update(dt) --- The update call is important!
end```
## Custom actions
Short description how to create your custom actions and how to use it in code. Full instruction in other document
## Learn more
- [Core Concepts && Glossary](docs_md/01-core-concepts.md)
- [States](docs_md/02-states.md)
- [Events](docs_md/03-events.md)
- [Actions](docs_md/04-actions.md)
- [Variables](docs_md/05-variables.md)
- [Custom Actions](docs_md/06-custom-actions.md)
- [Template Actions](docs_md/07-template-actions.md)
- [Nested State Machines](docs_md/08-nested-fsm.md)
- [JSON representation](docs_md/09-json-format.md)
- [EmmyLua annotations](docs_md/10-emmylua.md)
- [Performance](docs_md/11-performance.md)
- [Usage examples](docs_md/12-examples.md)
- [FAQ](docs_md/13-faq.md)
- [Tips](docs_md/14-tips.md)## Examples
List of created examples and their code from `/examples`
## License
Developed and supported by [Insality](https://github.com/Insality)
---
Used libraries:
- [lua-fsm](https://github.com/unindented/lua-fsm)
- [middleclass](https://github.com/kikito/middleclass)## Issues and suggestions
If you have any issues, questions or suggestions please [create an issue](https://github.com/Insality/defold-adam/issues) or contact me: [[email protected]](mailto:[email protected])