WEBVTT

00:02.530 --> 00:05.480
The idea of hope is very simplistic.

00:05.500 --> 00:08.920
However, figuring out the dynamics of it is not.

00:09.070 --> 00:14.780
There's goals and actions and states and all manner of other things to take into consideration.

00:14.800 --> 00:20.230
Debugging an entire system is very challenging, so it's best to start on paper.

00:21.020 --> 00:27.110
The GOP's system we are about to build isn't the be all and end all of how to develop such a system.

00:27.110 --> 00:32.750
But just one way you can use it as you like and modify it for your own needs.

00:32.900 --> 00:35.690
But basically it will work like this.

00:36.170 --> 00:37.630
We have an agent.

00:37.640 --> 00:40.120
The agent has a number of goals.

00:40.130 --> 00:43.640
These goals drives its sequence of actions.

00:44.000 --> 00:48.920
Some actions are only possible after other actions have been completed.

00:49.250 --> 00:54.680
But the environment or game world and other agents also play a part.

00:55.190 --> 01:00.380
For example, some actions might not be possible without the help of another agent.

01:00.590 --> 01:05.210
And other actions might not be possible without the use of a resource.

01:06.100 --> 01:09.550
When using soap, you are actually building a simulation.

01:09.550 --> 01:15.730
So you need to think about how you want the game to look and how the characters are going to move around

01:15.730 --> 01:16.900
the environment.

01:17.170 --> 01:22.000
In this case, we are going to create a very simple hospital simulation.

01:22.750 --> 01:26.920
There will be two types of agents, patients and nurses.

01:27.460 --> 01:30.670
Let's think about how we want the patients to work.

01:31.180 --> 01:38.770
We want them to come into the hospital, register at the front desk, go to the waiting room, be treated

01:38.770 --> 01:42.970
when a nurse and cubicle are available, and then go home.

01:44.350 --> 01:49.480
Each of these things involves moving the character to another location.

01:49.600 --> 01:51.700
They will be our actions.

01:52.430 --> 01:53.350
In scope.

01:53.360 --> 02:00.440
Each of these actions exists as a single and complete task that are accompanied by the agent simulating

02:00.440 --> 02:01.460
some event.

02:01.670 --> 02:07.400
If you were to put together a plan for the agent to take to get through these actions, what would it

02:07.400 --> 02:08.030
be?

02:08.270 --> 02:10.610
Take a moment to consider it.

02:19.600 --> 02:20.530
How did you go?

02:20.560 --> 02:23.320
You probably came up with something similar to this.

02:23.410 --> 02:29.110
Go to hospital, register, wait for nurse, get treated and then go home.

02:29.500 --> 02:36.280
Definitely a legitimate plan, but what we're going to do in our application is structure it a little

02:36.280 --> 02:39.950
more like this so that the patient has three sets of plans.

02:39.970 --> 02:47.260
The reason that we're doing this is because in the simulation itself, the agent has other resources

02:47.260 --> 02:53.620
and other agents that it's going to rely on in order to continue through the actual game.

02:53.800 --> 02:59.350
Now, if you just wanted your agent to come in to the hospital, go to the registration desk, go and

02:59.350 --> 02:59.800
wait.

02:59.830 --> 03:05.060
Go over to a cubicle and then go home without any other dynamics going on.

03:05.080 --> 03:07.450
Then you could just have a single plan.

03:07.720 --> 03:13.810
Once we get into the programming of this, you will see why I have structured it like this with the

03:13.810 --> 03:16.000
three different sections.

03:16.000 --> 03:20.110
But for now, just trust me as we go through this.

03:20.770 --> 03:27.760
Now, if you remember, the whole point of group is that every action is decoupled.

03:27.970 --> 03:30.700
It's not linked to any other action.

03:30.700 --> 03:38.290
So when we want to create a plan to move through actions from one end to the other, we're looking for

03:38.290 --> 03:46.240
a particular goal that we're trying to achieve and then working backwards in order to match the actions

03:46.240 --> 03:49.210
together to come up with a single plan.

03:49.240 --> 03:55.510
The first one in this case is the top one that you can see on the screen, which is go to hospital,

03:55.510 --> 03:57.310
register and wait for nurse.

03:57.340 --> 04:06.890
Now, this will involve the patient having a goal of is waiting and working back from that.

04:06.910 --> 04:12.150
We then think of what are going to be the preconditions for waiting for nurse.

04:12.160 --> 04:15.100
Well, that means that we have to have registered.

04:15.310 --> 04:19.090
This will then be the precondition for wait for nurse.

04:19.180 --> 04:27.670
That means that the register action needs to have has registered as its effect and then moving back

04:27.670 --> 04:31.960
from there before we can register, we actually have to be at the hospital.

04:31.960 --> 04:40.570
And so we have to make sure that we have linked up enough actions that have preconditions and effects

04:40.570 --> 04:46.990
that are going to match so that we do end up with a plan when the system is trying to find one.

04:47.290 --> 04:54.340
As for the other actions in this case, which are forming a plan which only have one action, they must

04:54.340 --> 05:00.900
have an effect because that effect is the final goal that your agent will be looking at.

05:00.910 --> 05:10.720
And therefore we also have to give them a effect and if you want them to fire off, also a precondition.

05:11.700 --> 05:18.480
Our nurse character is going to be a little more simplistic and have two sets of plans to choose from.

05:18.600 --> 05:21.720
The first will be to treat a patient.

05:21.750 --> 05:25.410
Therefore, their ultimate goal is to treat patient.

05:25.410 --> 05:32.400
And that's going to require a plan of picking up a waiting patient, which will require a patient to

05:32.400 --> 05:37.320
be waiting in the first place, as well as there being a free cubical available.

05:37.470 --> 05:44.130
This will then link to our go to cubicle where the treatment is basically taking place, which will

05:44.130 --> 05:45.990
satisfy the treat patient.

05:46.020 --> 05:50.910
Now to make the nurse just a little bit more interesting rather than standing around when there's nothing

05:50.910 --> 05:51.660
to do.

05:51.690 --> 05:54.660
There's also going to be a rest goal.

05:54.870 --> 06:01.410
And that goal will trigger when the nurse becomes exhausted and therefore the nurse will then go to

06:01.410 --> 06:02.490
the break room.

06:03.210 --> 06:09.170
Before we start coding, let's have one will look at how this is going to conceptually fit together.

06:09.180 --> 06:13.980
We have an agent and that agent lives in the game environment.

06:13.980 --> 06:20.730
Now the game environment was going to have a set of world states, and that's going to be things like

06:20.730 --> 06:26.820
how many cubicles are available, how many patients are waiting, and there things that the agent can

06:26.820 --> 06:30.450
draw on when it's trying to determine if it can achieve a goal.

06:30.450 --> 06:35.430
So in some cases it will be some of the preconditions towards the goal.

06:35.460 --> 06:43.140
Now, the agent itself is also going to have a set of states about itself because, for example, if

06:43.140 --> 06:51.420
it is sick, that belief or that state belongs to the agent itself, not the actual game world.

06:51.660 --> 06:59.160
So I'm calling it beliefs in this case, but it really is just like the local world states that belong

06:59.190 --> 07:00.320
to the agent.

07:00.330 --> 07:06.510
Now the agent is also going to have a set of goals and a whole set of actions.

07:06.690 --> 07:13.560
Now, in order to align up all of these actions so that the goals can be achieved, we will have a planner,

07:13.560 --> 07:15.630
so every agent will have a planner.

07:15.900 --> 07:23.250
That means that with the information from the world states, the beliefs or state of the agent.

07:23.940 --> 07:29.100
The goal that needs to be achieved and all of the actions that are available.

07:29.100 --> 07:36.390
The planner is going to come up with a plan, give that back to the agent and the agent will then execute

07:36.390 --> 07:36.840
it.

07:37.880 --> 07:38.080
Okay.

07:38.130 --> 07:43.260
So that is the hope system that we are about to develop.

07:43.470 --> 07:46.130
That's how it's going to conceptually work.

07:46.140 --> 07:53.280
And once we get into the code, although it's essentially quite simple, there's still a fair bit of

07:53.280 --> 07:55.830
it to write and put together.

07:55.980 --> 07:59.400
So why put it off any longer?

07:59.400 --> 08:04.050
In the next video, we're going to come back and actually start the coding.
