To start off we have to see what the state of the world is and make goals according to the worldstate. One goal will be made for every action the AI can do on every object in the world. To keep it simple I will use goals A, B, C, D, and E. These goals can be anything and will be used as an example on the right.
In blueprints
A-
B-
C-
D-
E-
In c++
We have all these goals in data form now but we need a way to use them in C++ which is why we turn each goal with its data into an FGoalStruct. The FGoalStruct is there to make it easier to know what data you are using in C++.
In blueprints
A- (R1, S0)
B- (R1, S1)
C- (R10, S2)
D- (R10, S3)
E- (R10, S4)
In c++
We are now on the C++ side of things and in the STUP algorithm, this starts with the first step of Utility. What this step does is remove all the goals that we don't want to or cannot use. Goals like these will have a score of 0 or lower so goal A gets eliminated.
In blueprints
In c++
B- (R1, S1)
C- (R10, S2)
D- (R10, S3)
E- (R10, S4)
The goals we currently have are relevant so we will make a plan(P) for each of them which will be done using GOAP. During GOAP we will see what the cost(C) of a plan is which is based on the cost of the actions the AI needs to do to complete the goal. If a plan could not be made for any of the goals for whatever reason they will be eliminated. If after GOAP there are no goals left it will return a goal it can always do like "Idle".
In blueprints
In c++
C- (R10, S2, C2, P)
D- (R10, S3, C0.25, P)
E- (R10, S4, C0.3, P)
Now we have a pretty complicated step that being Utility step 3. What it does is eliminate goals based on a cutoff ratio but if the goals that would be removed are still relevant they will be kept. This is very complicated and is explained in the in-depth explanation but it will have no change on the current goals.
In blueprints
In c++
C- (R10, S2, C2, P)
D- (R10, S3, C0.25, P)
E- (R10, S4, C0.3, P)