diff --git a/GOAP/Assets/Scenes/SampleScene.unity b/GOAP/Assets/Scenes/SampleScene.unity index 7dc575a..7fbe811 100644 --- a/GOAP/Assets/Scenes/SampleScene.unity +++ b/GOAP/Assets/Scenes/SampleScene.unity @@ -138,7 +138,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 402548309473215301, guid: aafd274850c585047933903e37307aef, type: 3} propertyPath: m_IsActive - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 8622252793202009712, guid: aafd274850c585047933903e37307aef, type: 3} propertyPath: m_LocalPosition.x @@ -1697,7 +1697,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 402548309473215301, guid: aafd274850c585047933903e37307aef, type: 3} propertyPath: m_IsActive - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 8622252793202009712, guid: aafd274850c585047933903e37307aef, type: 3} propertyPath: m_LocalPosition.x @@ -1827,7 +1827,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 402548309473215301, guid: aafd274850c585047933903e37307aef, type: 3} propertyPath: m_IsActive - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 8622252793202009712, guid: aafd274850c585047933903e37307aef, type: 3} propertyPath: m_LocalPosition.x @@ -2318,7 +2318,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 402548309473215301, guid: aafd274850c585047933903e37307aef, type: 3} propertyPath: m_IsActive - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 8622252793202009712, guid: aafd274850c585047933903e37307aef, type: 3} propertyPath: m_LocalPosition.x @@ -6241,7 +6241,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 402548309473215301, guid: aafd274850c585047933903e37307aef, type: 3} propertyPath: m_IsActive - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 8622252793202009712, guid: aafd274850c585047933903e37307aef, type: 3} propertyPath: m_LocalPosition.x diff --git a/README.md b/README.md index 7f36769..6e92d6b 100644 --- a/README.md +++ b/README.md @@ -4,21 +4,19 @@ Made by Bram Verhulst, 2GD11 ## What is Goal Oriented Action Planning? -Goal Oriented Action Planning (Goap for short) is a form of AI decisionmaking that was developed by Jeff Orkin at MIT. +Goal Oriented Action Planning (Goap for short) is a form of AI decision-making that was developed by Jeff Orkin at MIT. -It's an alternative to more conventional AI behaviour machines like the State machine. GOAP is another way of approaching this problem of making AI work in games. +Its an alternative to more conventional AI behaviour machines like the State machine. GOAP is another way of approaching this problem of making AI work in games. -Unlike A Finite State Machine and Behaviour Trees, GOAP decouples actions and goals to achive it's "Goal". +Unlike A Finite State Machine and Behaviour Trees, GOAP decouples actions and goals to achieve its "Goal". -//IMAGE HERE - -The biggest downside of GOAP is that it is slower to compute than FSM or BT's, But the upsisde is that it allows to be more flexible when it comes to adding or chaning existing behaviours. +The biggest downside of GOAP is that it is slower to compute then FSM or BT's, But the upside is that it allows to be more flexible when it comes to adding or changing existing behaviours. ## How does it work? ### Goals -A Agent gets a goal (or several) and knows what actions it can preform to get to a certain goal. +An Agent gets a goal (or several) and knows what actions it can perform to get to a certain goal. A goal is a state that the agent is trying to achieve. For example: @@ -29,15 +27,15 @@ A goal is a state that the agent is trying to achieve. For example: ### Actions Every action in a GOAP has PreConditions and Effects. -In order to preform a action all the "conditions" need to met. +In order to perform a action all the "conditions" need to met. ![ActionExample](assets/ActionExample.png) Think of these as "What does the agent need to be able to do this action?" -And "What happens to the world when i do this action" +And "What happens to the world when I do this action" -All of these conditons and effects should lead to a Planner that can string all of these toghder so the agent can get to it's goal. +All of these conditions and effects should lead to a Planner that can string all of these together so the agent can get to its goal. ![ActionTree](assets/ActionTreeExample.png) @@ -49,7 +47,7 @@ This is the real "Brain" of the AI. The planner takes 3 pieces of information - Actions - Current Worldstate -The planner with this information can than try to make a graph of possible plans. +The planner with this information can then try to make a graph of possible plans. - Plans may only be possible if certain conditions are met. @@ -65,7 +63,7 @@ A valid plan gets constructed back to front. Are we doomed? -No, ofcourse not. We just add a cost to each action and take that into account for these plans. +No, of course not. We just add a cost to each action and take that into account for these plans. We use can then use A* to find the plan with the lowest "cost" @@ -79,15 +77,15 @@ Let me explain what they both do. ### Doctor -The doctor is quite simple in behaviour. Their main goal is to "TreatPatient". But they also have a limted battery and need to charge often. +The doctor is quite simple in behaviour. Their main goal is to "TreatPatient". But they also have a limited battery and need to charge often. -Their goals are repeaing so they keep treating patients. +Their goals are repeating so they keep treating patients. After some random amount of time their battery will deplete, This state is the precondition for the "Charge" action. -I set it up in a way where if there are still more patients than the other doctors can handle it will wait to charge until it can. Thus prioritising helping patients over charging. +I set it up in a way where if there are still more patients then the other doctors can handle it will wait to charge until it can. Thus prioritising helping patients over charging. -In my implemtation i show the first nurses action on the top left. +In my implementation I show the first nurses action on the top left. ### Patient @@ -99,9 +97,9 @@ He has 3 main goals - IsTreated (Get to a bed and get treated) - IsHome (Get to the home location) -So easy right? The paitient enters, goes to the reception, checks in and goes to the waiting room. +So easy right? The patient enters, goes to the reception, checks in and goes to the waiting room. -In this gif i have no doctors that come get the patients, you can see how they all checkin and goto the waiting area. +In this gif I have no doctors that come get the patients, you can see how they all checkin and goto the waiting area. ![NoDoctors](./Assets/NoDoctors.gif) @@ -109,26 +107,26 @@ Wait, how does the doctor get the patient from the room? Does the patient know w The way we fix this is by making the world hold a global state of Patients, Beds, Chargers, etc. -This is stored internally as a Queue of Patients, when a patient enters the waiting room i add him to the queue. When a doctor looks for a patient i just pop him from the queue. +This is stored internally as a Queue of Patients, when a patient enters the waiting room I add him to the queue. When a doctor looks for a patient I just pop him from the queue. -This allows the patient aswell to know when a doctor gets him. -This is how i also show this on the UI on the top left. +This allows the patient as well to know when a doctor gets him. +This is how I also show this on the UI on the top left. - Waiting is decremented when the patient is retrieved from the waiting room -- FreeBeds is decremented becuase the doctor and patient will be using it. +- FreeBeds is decremented because the doctor and patient will be using it. -When the patient gets treated he can now start on his final goal which has a preconditon of "IsCured" (Eg. when he is treated by a doctor). +When the patient gets treated he can now start on his final goal which has a precondition of "IsCured" (Eg. when he is treated by a doctor). -Home in my case is just somewhere outside the map where i remove him from the world. +Home in my case is just somewhere outside the map where I remove him from the world. -Here you can see the final result of the doctors and patients working togheder. +Here you can see the final result of the doctors and patients working together. ![Final](./Assets/Final.gif) ## Conclusion -Looking back on this research i wish i had more time to get deeper into this. -It's an interesting topic in AI i don't see often used in games. +Looking back on this research I wish I had more time to get deeper into this. +Its an interesting topic in AI I don't see often used in games. I would guess the reason is because the planner is quite intensive to calculate. ## References @@ -141,4 +139,4 @@ I would guess the reason is because the planner is quite intensive to calculate. - Most of the understanding of GOAP - [Building the AI of F.E.A.R](https://youtu.be/PaOLBOuyswI?si=cwH2paeVlTySvhkD) -Thank you for reading this, have a amazing day! +Thank you for reading this, have an amazing day!