Improbable Icon

Forums

UnrealGDK query-based interest

unreal
v13-0
unreal-gdk
unrealgdk
#1

Is it possible to use query-based interest with the UnrealGDK?
I want to send RPCs to all players in a given radius around another player (all entities with a special component around another entity). How could I do that in Unreal with SpatialOS?
It would of course be possible to just get all actors of a specific type and send RPCs to them depending on their position but that would not work when using multiple server workers, right?
How can I query for entities (actors) outside of a worker’s area of interest in Unreal?
Is it possible to access the low-level workers, if yes, how? Is there any documentation where I can read about that?

1 Like
#3

Hi @CryptX,
At the moment, the GDK does not expose query-based interest to the user code, though we do have plans to support this in the future.
For now, however, I would recommend you to control this behavior inside game code. On the server, find all players within your desired radius and call Client RPCs on them. Regarding your comment about multiple server workers: this approach should still work as long as the radius of this RPC is smaller than the workers’ checkout radius. You would also need to first call a CrossServer RPC before calling a Client RPC to make sure it is the authoritative server calling the Client RPC.

#4

Hey valentyn,

thanks for your answer. I just read that 0.3.0 has been released and added query-based interest to the Unreal GDK. I can’t find any documentation about how to use that in C++ (or generally in Unreal) though, can you tell me where I can find information about it? (even a class or function name would help me to have any point where I can start)

Does it make sense to handle events (e.g. “crouch”, “shoot”, etc.) via query-based interest by declaring something like a state property that I will change when an event occurs and check for changes of that properties via query-based interest? Or should I find all the interested entities (players) myself and call RPCs on them? Would query-based interest have performance advantages in those scenarios or when would I use query-based interest instead of “querying” myself by iterating over all actors in a given area? Are there scenarios where you should not use query-based interest and are there SpatialOS-specific alternatives in the GDK already?

By the way, you guys at Improbable are doing such a great job. It really is incredible what SpatialOS makes possible for even the smallest teams. Keep up creating what many would call improbable :wink: