Skip to content

Decisions

In Utility Intelligence, each decision has:

  • A list of Target Filters: They are used to filter targets for the decision.
  • A list of Considerations: They are used to calculate the score of the decision.
  • A list of Action Tasks: They will be executed by the egent if the decision is chosen.

Understanding how decisions work?

Since a decision is scored per target, and any Utility Entity (all GameObjects with UtilityEntityController or UtilityAgentController attached) in the Utility World could be a target of the decision, we need a way to filter targets to ensure that only appropriate targets are considered. This is the job of Target Filters.

After finding appropriate targets, all Considerations of the decision will be evaluated for each target to calculate the score of each decision-target pair. Then the score of each pair is multiplied with the Decision weight to get the final score.

Finally, the best decision-target pair with the highest score will be chosen and the agent will execute all Action Tasks attached to the decision, either in Sequence or in Parallel.

Decisions are scored per target

A decision may or may not have targets. However:

  1. If it has targets, it will be scored per target. Afterward, Utility Intelligence will compare the scores of all the decision-target pairs with each other and select the pair with the highest score.
  2. If it does not have targets, it will be scored only once, and that score is the final score of the decision.

Attachments/UtilityIntelligence/Documentation/UtilityAgent/Decisions/decisions-per-target.png

Oscillation between decision-target pairs

When using Utility AI, there may be a scenario where decision-target pairs with similar scores oscillate back and forth as their scores rise and fall. This leads to the agent constantly changing its decision and target. Currently, there are four ways to address this issue:

  1. Enable the Momentum Bonus option to add a bonus to the last chosen decision-target pair in the next decision-making round.
    • This will prioritize the last decision-target pair over the others, thereby eliminating the oscillation.
  2. Increase the weight of the decision that you want to prioritize. For example, let’s say 2 or 3 instead of just 1.
    • This will prioritize one decision over the others, reducing the oscillation.
  3. Enable Keep Running Until Finished option to prevent the agent from making a new decision while an important task is running.
    • When the agent is performing an important task, such as AttackPlayer, ChargeHealth, ReloadAmmunition, and you don’t want it to be interrupted, you can enable this option to prevent the agent from switching to another decision while that task is running.
  4. Add more considerations to each decision.
    • This will introduce more variation to the score-calculation process, increasing the chances that the competing decision will consistently win (or lose) and thereby reducing the oscillation.

Decision Weight

In Utility Intelligence, you can control the prioritization of each decision by adjusting the Decision Weight.

For example, you can organize your decisions into multiple layers like the following:

  • Normal Layer’s Weight: 1.0
  • Combat Layer’s Weight: 2.0
  • Urgent Layer’s Weight: 3.0

center|550

You can change the weight of a decision in the Decision Editor:

Attachments/UtilityIntelligence/Documentation/UtilityAgent/Decisions/adjust-decision-weight.png

Tip

You can adjust the weight of decisions to reduce the oscillation between nearly equal decision-target pairs.

Momentum Bonus

When you enable the Momentum Bonus option, Utility Intelligence will add a bonus to the score of the last decision-target pair in the next decision-making round. This prioritizes the last chosen decision-target pair, increasing its chances of winning and thereby reducing the oscillation between nearly equal decision-target pairs.

Info

Currently, the Momentum Bonus in Utility Intelligence is 25%.

To enable/disable Momentum Bonus, you need to check/uncheck the Momentum Bonus option in the Intelligence Editor.
center|300

Creating Decisions

To create a new decision, you need to go to the Intelligence Tab, fill in the Name field, and then click the Create button:

center

After creating a decision, you can add considerations to the decision and observe how they affect the decision score. Additionally, you can add target filters and action tasks to the decision to determine which actions will be executed with the target if this decision is selected at runtime.

Decision Statuses

At runtime, decisions have 5 statuses:

 : Running


 : Success


 : Failed


 : Aborted


 : Inactive

At editor time, decision only have 2 statuses:

 : Selected


 : Unselected


If you find this plugin more valuable than its price, especially when it's on sale, or if you simply want to support me on my development journey, there are currently 3 ways to do so:

1. Leave a 5-star review on the Unity Asset Store.
2. Buy assets through my Affiliate Links. It won't cost you any extra money, and I'll get a commission from Unity.
    • Utility Intelligence: A user-friendly Utility AI Framework
    • Top New Assets
    • Top Paid Assets
    • Top Downloaded Assets
3. Buy me a coffee at Ko-fi. Donation Benefits:
    • Your requests will be prioritized in my todo-list.
    • You'll receive a special role on my Discord server exclusively for donors:
       • Supporter: One-time donation.
       • Patron: Monthly donation.

Thank you so much for your support! 🥰
It allows me to dedicate more time to developing this plugin.


Last update : April 23, 2024
Created : March 31, 2024