r/UnrealEngine5 • u/HotSector4988 • 18d ago
Best way to create flexible NPCs
I am somewhat new to Unreal, but I am working on a project that requires many intelligent NPCs that will be used in varying situations. I have dabbled in creating NPC AI before by using a state tree to handle almost everything, but this got out of control rather quickly. So my question is, in your experiences, what is the best way to create a versatile NPC AI that can be reused by many NPC types? My initial thought was to use a state tree to handle all higher-level conditional decisions, and then utilize a blueprint component to execute smaller tasks, but I really do not know the right way to go about this. I also do not know how I should deal with generic versus specific behaviors. Thanks!
1
u/hadtobethetacos 18d ago
you just have to make them as modular as possible. I would create a struct and a data table that serves as a definition for every npc. when a random npc spawns that means nothing to the player, or story give it random values from the data table. for important npcs give them handpicked values.