![]() To sum up the theory written above, here is a screenshot of how the EQS works: The point that has the higher score is considered the best match for our result. Tests are attached to generators.īased on the attached Tests, each point has a score. Think of Tests as functions that filter and/or (depending on your needs) score every generated point. We’re going to specify what this result is going to be, for example, it can be another Actor, or a world space location, etc. Each time our AI runs an Environment Query, the system iterates through all the generated points in order to find a result. Moreover, the developer is able to configure the size of the area as well. ![]() This area consists of points and their density is configurable through the corresponding editor. Most Generators are used to generate an area around a specified actor in our game. The EQS is a system that allows our AI to “ask” the game’s environment specific questions and based on the received answers it will be able to act accordingly. What is the Environment Query System (EQS)? I will explain what these are in the following section. You will notice that of the node’s properties in the details panel are marked as red. The Run EQS Query node is located inside the available tasks of the behavior tree. Please bare with me for a few moments and everything will become clear! Creating the Behavior Tree for our AIĬreate the following Behavior Tree for our AI: Click on image to enlarge in a new tab We won’t add any logic to it just yet because we haven’t explained what a Query actually is. If you activated EQS by following the steps above, right click somewhere on the content browser and create an Environment Query (it’s located inside the Artificial Intelligence tab only after when you enable the system) named FindHidingSpot. The following picture sums up the above steps: Click on image to enlarge in a new tab Creating an Environment Query To activate the EQS in 4.13 version of the engine, perform the following steps: The EQS is still an experimental system and we explicitly need to enable it by changing some options inside the editor in order to use it on our Behavior Tree. Make sure that your Enemy key has the Actor class as its Base Class as seen in the screenshot above. Creating the Blackboard of our AIĬreate the following Blackboard: Click on image to enlarge in a new tab UObject* object = BlackboardComp->GetValueAsObject(BlackboardEnemyKey) Register the OnPerceptionUpdated function to fire whenever the AIPerception get's updatedĪIPerceptionComponent->OnPerceptionUpdated.AddDynamic(this, &AMyAIController::OnPerceptionUpdated) Initialize the Blackboard and start the attached behavior treeīlackboardComp->InitializeBlackboard(*BehaviorTree->BlackboardAsset) īehaviorTreeComp->StartTree(*BehaviorTree) ![]() Void AMyAIController::Possess(APawn* InPawn) Register the sight sense to our Perception ComponentĪIPerceptionComponent->ConfigureSense(*Sight) Sight->DetectionByAffiliation.bDetectNeutrals = true Sight->DetectionByAffiliation.bDetectEnemies = true Tell the sight sense to detect everything Sight->PeripheralVisionAngleDegrees = 130.f Sight = CreateDefaultSubobject(FName("Sight Config")) to delete any previous reference of him from the blackboardīlackboardComp->SetValueAsObject(BlackboardEnemyKey, nullptr) īehaviorTreeComp = CreateDefaultSubobject(FName("BehaviorComp")) īlackboardComp = CreateDefaultSubobject(FName("BlackboardComp")) ĪIPerceptionComponent = CreateDefaultSubobject(FName("PerceptionComp")) The character doesn't exist in our updated actors - so make sure If our character exists inside the UpdatedActors array, register himīlackboardComp->SetValueAsObject(BlackboardEnemyKey, Actor) ![]() Void AMyAIController::OnPerceptionUpdated(TArray UpdatedActors)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |