Hello,
I’m currently researching Mass Entity/Mass Gameplay systems with Mass State Tree system for my project, so I have some questions regarding their functionality and communication between the systems.
First question is about a proper (Epic’s way) actor’s hydration-dehydration state handling.
I’ve found out that basically everything can be handled using Mass processors and Mass fragments to move around some actor (when streamed-in) or mass entity (when streamed-out) and do some other logic. But what I want to achieve is to have the ability to do some logic on Actors (e.g. AI with some kind of a Brain (AI controller) with a State Tree that will move him around or do other stuff (peaceful, combat behaviours)) when the actors are visible (hydrated state) and when they are streamed-out - use Mass and MassStateTree to do the custom logic for them (dehydrated state) and syncing them during their state change.
From what I’ve tried already - I have a custom RepresentationActorManagement class that I use to sync data from mass to actor in OnPostActorSpawn method (same as in CitySample demo). Also I’ve research the MassTranslator + MassTrait usage to be able to sync mass data with actor when it is visible and vice versa.
But I haven’t found the opposite sync example, when the actor is in destroy process - he syncs all his data with mass and then mass takes control of this entity. I’ve found 2 delegates in MassAgentSubsystem - GetOnMassAgentComponentEntityAssociated and GetOnMassAgentComponentEntityDetaching which can be used to sync actor with mass on actor destroy (second delegate), but I think this will break the architecture and not the ideal way of handling such things. What do you think about such approach? Should this behaviour be custom-made by me, or there is an API that supports such behaviour?
Second question is about the usage of AI Controller’s State Tree Schema along with Mass StateTree Schema.
To provide more context, here is an example - I have one entity that is spawned in some random point on map and is visible (Player stands near the entity). This entity moves using Mass StateTree and now I want this entity to use a custom AI Controller with a State Tree AI that will continue moving my entity and do some other stuff, for example - combat with Player. Then after the combat is finished - this entity must switch back to using Mass State Tree that will move him around some random points once again. How does one implement switch behaviour between State Trees if this is possible? How can I properly stop one tree from executing and restart it when needed (either using a tag or some event with tag)? Should this behaviour also be custom-made? What is the Epic way of doing such things?
Third question is about using Mass as kind of a async backend for AI Controller’s navigation tasks, for example - MoveTo will use Mass to find path and move entity around since the current implementation of AITask_MoveTo is synchronous and not optimal for the large number of simulated entities. This might need some modifications in current Engine code, but the real goal is to make such things less intrusive to the Engine’s code. What can you recommend regarding this?
And the last question is about the way to find all entities in some radius using spatial queries. Looking at the examples at how SmartObjects are found - looks like it has some kind of a wrapper class over hash grid to run queries on and that this solution is specific to smart objects. So it seems that there is no general way to find entities in some grid by radius etc. Should the solution be implemented by me (to have my custom class with hash grid and API to find entities in radius etc) or am I missing something and you already have a solution to this - I just need to look in the right place?
Looking forward to your reply!
- Danylo
[Attachment Removed]