Question about network scope detection (ghosting)
by Shannon Cook · in Torque 3D Beginner · 07/30/2012 (1:45 pm) · 5 replies
I need a quick way to detect, in script, the full set of objects that are in network scope for a specific client. According to the documentation, the engine calls onCameraScopeQuery() to determine the list of visible objects.
Is it possible to get an array of server side Player ID's purely in script without iterating through all the player objects and testing them individually, or do I need to dig into NetGhost.cpp and generate a new console method?
I've been looking at http://www.garagegames.com/community/forums/viewthread/101223/1 and a few other threads, but everything so far seems to be doing client-side checks. Essentially, I need a server-side script or engine method to detect all human players within a certain radius (speaking distance) of the selected player.
Is it possible to get an array of server side Player ID's purely in script without iterating through all the player objects and testing them individually, or do I need to dig into NetGhost.cpp and generate a new console method?
I've been looking at http://www.garagegames.com/community/forums/viewthread/101223/1 and a few other threads, but everything so far seems to be doing client-side checks. Essentially, I need a server-side script or engine method to detect all human players within a certain radius (speaking distance) of the selected player.
#2
From reading your resource and examining the code, I'll likely be using the onCameraScopeQuery() with a query set to the needed distance (within speaking range) in code to find what I need.
P.S. The resource it's based on is quite handy, too. Thanks again.
07/31/2012 (7:06 am)
While that's an interesting resource, it doesn't quite answer my question. The resource shows how to modify the engine so that it detects players at a greater range and ghosts them to the client correctly for "zoom" purposes, but it doesn't get into the details of the actual list of objects. It does, however, give me more places to start looking for a solution. Thanks for the reply.From reading your resource and examining the code, I'll likely be using the onCameraScopeQuery() with a query set to the needed distance (within speaking range) in code to find what I need.
P.S. The resource it's based on is quite handy, too. Thanks again.
#3
07/31/2012 (2:23 pm)
Perhaps the updated T3D Radar resource would be the best place to start looking for what you're wanting and adapt it for server side if the client side data isn't sufficient.
#4
07/31/2012 (2:29 pm)
There's also a script Fn that may be useful for running a query on the server, InitContainerRadiusSearch. You can pass it the distance and type(s) of object you're interested in. %start = %player.getEyePoint();
%vector = %player.getEyeVector();
%vectorN = VectorNormalize(%vector);
%vectorS = VectorScale(%vectorN,%distance);
%center = VectorAdd(%vectorS,%start); //Center of our radius search
InitContainerRadiusSearch(%center,24,$TypeMasks::PlayerObjectType | $TypeMasks::CorpseObjectType);
//need to check that they're visible as well, and not behind something
%selected = %client.getSelectedObj();
while ((%target = containerSearchNext()) != 0)
{
...
#5
07/31/2012 (7:21 pm)
I believe the InitContainerRadiusSearch script may be exactly what I've been needing. Thank you all for your help.
Torque 3D Owner Paul Yoskowitz
WinterLeaf Entertainment