Posts

Showing posts from August, 2020

UnityLearn - AI For Beginners - GOAP - Adding Goal Challenge & Taking a Break

August 19, 2020 AI For Beginners Goal Orientated Action Planning (GOAP) Parts 14 and 15 Beginner Programming: Unity Game Dev Courses Unity Learn Course - AI For Beginners Adding Goal Challenge Adding Goal Challenge My Approach This tutorial starts with another challenge to implement a new GAction. This time it is the GoHome GAction for the patient to return to a transform tagged "Home" after they receive treatment. This was rather straight forward as I created this new GAction that just had a Preperform method setting the target to the tagged gameobject "Home" and putting in the Postperform method that the TreatingPatient world state should be reduced by 1 (since they have finished being treated). Once this GAction was applied to the patient, it needed to connect to the previous action by having a precondition of "isTreated" and I added an after effect of "isCured". The "isCured" state was also added as the new sec

UnityLearn - AI For Beginners - GOAP - Implementing the Inventory System & Moving the Nurse

August 13, 2020 AI For Beginners Goal Orientated Action Planning (GOAP) Parts 12 and 13 Beginner Programming: Unity Game Dev Courses Unity Learn Course - AI For Beginners Implementing the Inventory System Implementing the Inventory System They begin this tutorial by adding another simple GAction to the patient agents named GetTreated. They follow this up by adding a WorldStates object to the GAgent class (named beliefs) as well as a WorldStates object in GAction that references the GAgent's beliefs (similar to how the GInventory reference was passed between GAgent and GAction). They then add some logic to the GAction GoToWaitingRoom to add the atHospital state to the beliefs of the GAction itself. Upon running it there is an error because the GPlanner has not been built to handle beliefs (the internal WorldStates of the GActions or GAgents). To solve this, they add a Node overload constructor to the GPlanner class to also take in a WorldStates reference to acce

UnityLearn - AI For Beginners - GOAP - Adding More Resources to the World

August 10, 2020 AI For Beginners Goal Orientated Action Planning (GOAP) Part 11 Beginner Programming: Unity Game Dev Courses Unity Learn Course - AI For Beginners Adding More Resources to the World Adding More Resources to the World The next step is setting up the use of the cubicles in the world. Similarly to patients, these cubicles act as a resource available to the agents. Therefore they must be monitored by the world state in some way to determine how many are available and which ones so they can be distributed properly when needed. Setting this up was very similar to how the patient resources were. They added a queue of gameobjects to hold the cubicles in the GWorld class. This was a bit different as it also initialized full of resources, so the cubicles were immediately added to this queue (through FindGameObjectsWithTag) upon initialization. Then again similar to patients (except through the GWorld class itself instead of an action) a state was added to the