Where's the proper place to store the state of an NPC?

chiefGui
Fri, 16 Feb 2018 04:05:37 +0000
Blueprint

Hey guys!

Creatin’ a multiplayer game with both Player Controlled Characters (doh) and Characters controlled by the AI (aka monsters, creatures, enemies, whatever.).

I’m using the PlayerState to store Current HP, Current Mana, etc. of the Player’s character. Also, under the server supervision, this PlayerState has some functions to calculate damage given, received, and et cetera. These functions, naturally, can also be reused by AI enemies because the same rules will always apply (like damage calculation, etc.).

But according to this official article:

A PlayerState is the state of a participant in the game, […] Non-player AI that exists as part of the game would not have a PlayerState. […]

As you may guess, I’m struggling to decide the proper place to store the state of my NPCs. Should I create a separated Actor, spawn it, attach it to my NPC and use it as the state, repeating exactly every variable and function my PlayerState has?

The question may sound dumb, but even after reading several contents and sources, I couldn’t come up with a solid, scalable solution.

Any guidance is welcome! Thanks!

6 posts - 4 participants