v4k-git-backup/engine/split/v4k_bt.h

24 lines
605 B
C
Raw Normal View History

// Behavior trees: decision planning and decision making.
// Supersedes finite state-machines (FSM) and hierarchical finite state-machines (HFSM).
// - rlyeh, public domain.
typedef int (*bt_func)();
typedef struct bt_t {
uint64_t type;
int (*action)();
union {
int argi;
float argf;
};
array(struct bt_t) children;
} bt_t;
API bt_t bt(const char *ini_file, unsigned flags);
API int bt_run(bt_t *b);
API void bt_addfun(const char *name, int(*func)());
API bt_func bt_findfun(const char *name);
API char *bt_funcname(bt_func fn);
2023-10-05 05:16:41 +00:00
API int ui_bt(bt_t *b);