This project is used for the implemention of RoseHFSMhierarchical state-machine AI in Unity.
Features:
- An easy to use node editor for designers to develop the behaviours for agents.
- A frame work for designers/programmers to inherent from to create their own states specific to the game.
- Abstract enough to be used alongside game systems not related to agent behaviour.
Place the files within an appropriate place in your Unity Projects' file structure. Installation:
Add a 'Behaviour' object to a game object. Once added you'll be able to click the 'Node Editor' button to begin designing agent behaviours. How to Use:
Within the node editor, drag and drop any monoscript files that inherit from the State class to add states. Once a State is clicked, variables that you have marked as a SerializeField will appear for you change to match the design of your AI. States:
You may right-click a state to add transitions between them, to edit a state click on either of the states that the transition is between and find the button to edit the appropriate transition at the bottom of the state editing menu. Transitions:
You have the ability to transition to parent-states and choose where the parent state begins, or to an exact state within the parent state if you select another tab while selecting the end of your transition.
Read the parent state section below for more details.
Once editing a transition you may drag and drop monoscripts that inherit from a condition class. Similar to the State class, it will show fields you've marked as a SerializeField to edit. Conditions:
There are built-in distinct boolean conditions that may help you build more advanced behaviour:
- NOT Condition
- AND Condition
- OR Condition
A parent state is where more enhanced behaviour may be used. It's basically a state which acts like another finite state machine. Right-click anywhere in the editor and select 'Parent State' to add a new Parent State. A tab will appear at the top of the node editor so you may switch to editing this parent state. Once editing this parent state you may either click the 'Base' tab or 'Back' tab to return to the last state-machine you were in. Parent State
Read the Transitions sections to read about the more distinct properties of transitioning to a parent state.
Bugs
- Currently UnityEvents do not function properly as a SerializeField as their variables will not be saved.
- Various errors while switching between GameObjects in the middle of using the NodeEditor.