bot_army v1.0.0 BotArmy.BTParser View Source

Parses JSON files created from the Behavior Tree visual editor into a BehaviorTree.Node, ready to be supplied to a bot.

Note, you can automatically import your defined Actions into the visual editor with the included mix bots.extract_actions mix task:

mix bots.extract_actions --actions-dir lib/actions/ --module-base MyProject.Actions --bt-json-file lib/trees/tree.json

Link to this section Summary

Functions

Parses the requested tree in the supplied JSON file created with the visual editor.

Link to this section Functions

Link to this function

parse!(path, tree_title, opts \\ []) View Source
parse!(path :: String.t(), tree :: String.t(), opts :: Keyword.t()) ::
  BehaviorTree.Node.t()

Parses the requested tree in the supplied JSON file created with the visual editor.

The tree parameter should match the title of the tree in the editor.

The following opts are allowed:

  • context - a map of keys and values to be merged onto the root node's properties (overwriting any existing keys).
  • module_base - a common module base to prefix each parsed generic function style action and custom action. Useful in combination with the module-base flag on the bots.extract_actions mix task.