Unity (2021)
AI
UI
I found the AI of the companions in Dragon Age: Inquisition kinda neat, so I decided to look into how this was implemented and try doing something similar in Unity.
I discovered that it uses an original system created for the game dubbed The Behavior Decision System, which functions like a traditional decision tree, however it uses a priority queue to decide the current leaf of the tree, rather than a large tree which can become unwieldy and expensive in complex systems.
The code for the project is available under the MIT license at this Github link!
On the left is an example of a "Behavior Snippet" that serves as a "leaf" which the Behavior Decision System may end up using as the behavior for an agent.
Sets the name of the current goal, which is displayed in the UI as the smaller italicized text, it also sets up any other relevant stats for this derived class.
Mainly used to update the "actionValue" of the snippet, determining the priority of it (in this case, increasing it as the agent gets more exhausted).
This is the update that occurs if this behavior snippet has the highest actionValue of all the snippets available. This is where the current logic for the agent is decided/altered. (in this case, sleeping in the hammock or heading to it)
The AI display what factors each agent is considering when they made their decisions, especially showing what task they were currently thinking of, and any sub-tasks which came from it.
Since I realized the UI would VERY quickly get over-complicated without a broader plan behind each step, I made a plan of the UI that I can follow to keep the UI ordered whenever I add new features.