Devlog 3 - Smart Actor System


Smart Actor System

When AI characters can be driven according to their programmed selves to meet their dynamically changing needs, the rest becomes straightforward: making the AI behave believably. We know that many games don’t care about the lack of animation performance details of NPCs. They may often use teleportation, occlusion, screen switching, or edited animation shots to imply or express the actions of characters interacting with objects.

I didn’t want to use these methods to complete the final piece of the puzzle, because they were not realistic, and I didn’t have enough resources to complete these tasks. On the other hand, ready-made animations are much more accessible and editable to me.

Data structure

In order for NPCs to use the target items smoothly, play the correct animation and return to the normal logic after use. I created a Smart Actor parent class and let all interactive objects in the game inherit his attribute variables, and access and control them by the interface.

There’s some naming confusion because I didn’t think about the concept of smart objects at first

The information data structure that the NPC needs to know is stored in the smart object.

The parent class of the smart object contains a data structure of interaction information, which will guide the NPC to interact with the target, and guide the interaction code when and how to set some related variables. These data structures have been optimized aside, I will continue to try to optimize them to enhance the readability and ease of use of these data.

Blueprint functions that handle interaction events

Tag string array as a flexible parameter to each Action data

All interactive events are controlled by the same interactive function, which will read the pre-set Tag at the beginning of the function, and use it as a parameter to read the correct data on the interactive object.

Tag output function

These tags are not only used on the interaction function, they are applied to the entire AI behavior cycle, and are read when needed. I made a function to parse these label strings, and plan to do some optimizations in the future to replace this ugly result output.

Get GOAP Project (UE5)

Comments

Log in with itch.io to leave a comment.

Hi Cheng,

I really like your dev blog here, I am trying to learn and implement GOAP in Unreal engine, how did you learned can you provide me any resources or documentation, and is your code available in github if so it will be useful for many people, thank.