- Take values and normalize them into the same range -> score
- Each option gets a score, and an option is chosen based on the scores
- Pick absolute best
- Pick at random from N highest scoring, or f.ex. best and those that match within 10% of it
- Pick by relative utility: select a random option using the utility score as a weight. Divide the score of each option by the total score of all options.
- Randomness in the choice reduces the predictability, but due to randomness, it can sometimes cause the AI to pick an option that makes it look stupid.
- This can be reduced via “dual utility” selection: Each valid option is also given a rank, and only options within the highest scoring rank are valid for the final selection. The rank value is selected via absolute score
- Can use curves to help scoring
- Curves can be standard math curves or custom defined curves
- Value for the utility is put into the curve to get the final score for the value
- Bucketing: Put actions into buckets, buckets get a weight, bucket with highest priority always is used if it contains any valid actions
- This is suitable f.ex. when certain actions should always be invalid under some circumstances, such as combat should ignore other non-combat actions
- Bucket weight can be static/programmer defined
- Weight can also be dynamic, scored at runtime based on something else
- Oscillations: If AI chooses actions often and actions score similar, it could oscillate between two actions which looks bad
- Can be solved by adding a weight to the action its currently executing. This way it remains in action until something significantly better is available
- Cooldown: can also have a cooldown period for the time the active action is scored higher
- Or simply don’t make another decision until the action is finished
(Image from Game AI Pro)
Utility value in the middle column, normalized to the same range. The action choices consider them to determine the utility score.
Source material
- Game AI Pro
- Game AI Pro 2, Dual-Utility Reasoning