The idea of hope is very simplistic.
However, figuring out the dynamics of it is not.
There's goals and actions and states and all manner of other things to take into consideration.
Debugging an entire system is very challenging, so it's best to start on paper.
The GOP's system we are about to build isn't the be all and end all of how to develop such a system.
But just one way you can use it as you like and modify it for your own needs.
But basically it will work like this.
We have an agent.
The agent has a number of goals.
These goals drives its sequence of actions.
Some actions are only possible after other actions have been completed.
But the environment or game world and other agents also play a part.
For example, some actions might not be possible without the help of another agent.
And other actions might not be possible without the use of a resource.
When using soap, you are actually building a simulation.
So you need to think about how you want the game to look and how the characters are going to move around
the environment.
In this case, we are going to create a very simple hospital simulation.
There will be two types of agents, patients and nurses.
Let's think about how we want the patients to work.
We want them to come into the hospital, register at the front desk, go to the waiting room, be treated
when a nurse and cubicle are available, and then go home.
Each of these things involves moving the character to another location.
They will be our actions.
In scope.
Each of these actions exists as a single and complete task that are accompanied by the agent simulating
some event.
If you were to put together a plan for the agent to take to get through these actions, what would it
be?
Take a moment to consider it.
How did you go?
You probably came up with something similar to this.
Go to hospital, register, wait for nurse, get treated and then go home.
Definitely a legitimate plan, but what we're going to do in our application is structure it a little
more like this so that the patient has three sets of plans.
The reason that we're doing this is because in the simulation itself, the agent has other resources
and other agents that it's going to rely on in order to continue through the actual game.
Now, if you just wanted your agent to come in to the hospital, go to the registration desk, go and
wait.
Go over to a cubicle and then go home without any other dynamics going on.
Then you could just have a single plan.
Once we get into the programming of this, you will see why I have structured it like this with the
three different sections.
But for now, just trust me as we go through this.
Now, if you remember, the whole point of group is that every action is decoupled.
It's not linked to any other action.
So when we want to create a plan to move through actions from one end to the other, we're looking for
a particular goal that we're trying to achieve and then working backwards in order to match the actions
together to come up with a single plan.
The first one in this case is the top one that you can see on the screen, which is go to hospital,
register and wait for nurse.
Now, this will involve the patient having a goal of is waiting and working back from that.
We then think of what are going to be the preconditions for waiting for nurse.
Well, that means that we have to have registered.
This will then be the precondition for wait for nurse.
That means that the register action needs to have has registered as its effect and then moving back
from there before we can register, we actually have to be at the hospital.
And so we have to make sure that we have linked up enough actions that have preconditions and effects
that are going to match so that we do end up with a plan when the system is trying to find one.
As for the other actions in this case, which are forming a plan which only have one action, they must
have an effect because that effect is the final goal that your agent will be looking at.
And therefore we also have to give them a effect and if you want them to fire off, also a precondition.
Our nurse character is going to be a little more simplistic and have two sets of plans to choose from.
The first will be to treat a patient.
Therefore, their ultimate goal is to treat patient.
And that's going to require a plan of picking up a waiting patient, which will require a patient to
be waiting in the first place, as well as there being a free cubical available.
This will then link to our go to cubicle where the treatment is basically taking place, which will
satisfy the treat patient.
Now to make the nurse just a little bit more interesting rather than standing around when there's nothing
to do.
There's also going to be a rest goal.
And that goal will trigger when the nurse becomes exhausted and therefore the nurse will then go to
the break room.
Before we start coding, let's have one will look at how this is going to conceptually fit together.
We have an agent and that agent lives in the game environment.
Now the game environment was going to have a set of world states, and that's going to be things like
how many cubicles are available, how many patients are waiting, and there things that the agent can
draw on when it's trying to determine if it can achieve a goal.
So in some cases it will be some of the preconditions towards the goal.
Now, the agent itself is also going to have a set of states about itself because, for example, if
it is sick, that belief or that state belongs to the agent itself, not the actual game world.
So I'm calling it beliefs in this case, but it really is just like the local world states that belong
to the agent.
Now the agent is also going to have a set of goals and a whole set of actions.
Now, in order to align up all of these actions so that the goals can be achieved, we will have a planner,
so every agent will have a planner.
That means that with the information from the world states, the beliefs or state of the agent.
The goal that needs to be achieved and all of the actions that are available.
The planner is going to come up with a plan, give that back to the agent and the agent will then execute
it.
Okay.
So that is the hope system that we are about to develop.
That's how it's going to conceptually work.
And once we get into the code, although it's essentially quite simple, there's still a fair bit of
it to write and put together.
So why put it off any longer?
In the next video, we're going to come back and actually start the coding.