You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: BrainAI/AI/README.md
+54-3Lines changed: 54 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -133,23 +133,74 @@ Selects the best Action from a list of Actions and its Appraisals attached to th
133
133
-**LowestScoreReasoner<T>:** Selects action with minimum score
134
134
-**Reasoner<T>:** Base class for custom implementations
135
135
136
-
137
136
## Appraisal
138
137
Appraisals calculate and return a score which is used by the Reasoner to determine the action.
139
138
139
+
-**IAppraisal<T>:** Base interface for custom implementations
140
140
-**ActionAppraisal<T>:** Func wrapper for use as an Appraisal without having to create a subclass.
141
141
-**FirstAppraisal<T>:** Returns first score that is above then threshold.
142
142
-**FixedAppraisal<T>:** Always returns a fixed score.
143
143
-**MaxAppraisal<T>:** Return max score of child appraisals. For binary child appraisals (that returns 1 or 0) can be used as boolean 'OR' operator.
144
144
-**MultiAppraisal<T>:** Scores by multiplying the score of all child Appraisals. For binary child appraisals (that returns 1 or 0) can be used as boolean 'AND' operator if threshold is set to 0.
145
145
-**SumAppraisal<T>:** Scores if all child Appraisals score above the threshold. If threshold not specified - float.MinValue is used.
146
-
-**IAppraisal<T>:** Base interface for custom implementations
147
146
147
+
Additionaly there are a few helper Appraisals for binary operations. As an input those Appraisals take child's appraisals score and comparing them to 0 - treat it as false, other values treated as true:
148
+
149
+
-**AndAppraisal** - return true(1) if all child appraisal scores treated as true, othervise false(0)
150
+
-**OrAppraisal** - return true(1) if any child appraisal scores treated as true, othervise false(0)
151
+
-**NotAppraisal** - return true(1) if child appraisal score treated as false, othervise false(0)
148
152
149
153
## Action
150
154
The action that the AI executes when a specific consideration is selected.
151
155
152
-
-**FirstScoreReasoner<T>:** Selects first action with score above the threshold
156
+
-**FirstScoreReasoner<T>:** Selects first action with score above the threshold.
153
157
-**HighestScoreReasoner<T>:** Selects the action with the highest score.
154
158
-**LowestScoreReasoner<T>:** Selects the action with the lowest score.
155
159
160
+
## Intents
161
+
To execute lower level actions (like move to the point, or wait for attack animation) that is not eally related to decision making intents can be used.
162
+
163
+
Example usecase:
164
+
UtilityAI decide to move to specific point. But the move itself may take time, and during this time no other decisions should be made (unless something more urgent happens).
165
+
166
+
To use intents the Context should implement **IIntentContainer<T>** and any low level action should implement **IIntent**
167
+
168
+
To simplify integration with UtilityAI a few classes can be used:
169
+
-**SetIntentAction** an action that sets specified IIntent to IIntentContainer.
170
+
-**HasIntentAppraisal** checks that containser has Intent set, if yes - score is returned, othervise 0.
171
+
-**UseIntentAction** an action that executes specified IIntent. Intent is cleared on Exit or when IIntent.Execute return true (finished).
172
+
173
+
Example usage:
174
+
175
+
```csharp
176
+
varreasoner=newFirstScoreReasoner<Unit>(1);
177
+
// Intent phase. If there is an intent to act - intent will be executed.
0 commit comments