This adds limiting the ghost data to a specific area around the client.

By default it is not included in the build, you must #define GHOSTSCOPING in the torqueConfig.h to enable it.
The distance can be set via the mission file by adding

visibleGhostDistance = "1000";

Or if it is not set in the mission file it will default to what is defined in torqueConfig.h #defined as GHOSTSCOPING_DEFAULT_DISTANCE_IF_NOT_IN_MISSION

The mission default distance can be overridden on a per connection basis by using gameconnection:setVisibleGhostDistance and gameconnection:getVisibleGhostDistance

The logic for setting the scoping distance was moved from shapebase in the original design to SceneObject so that it will affect cameras, players, etc.
This commit is contained in:
Vincent Gee 2014-11-05 23:14:39 -05:00
parent 378a933894
commit 55bdfe5dc3
15 changed files with 138 additions and 1 deletions

View file

@ -35,6 +35,8 @@
#include "console/engineAPI.h"
#include "math/mathIO.h"
#include "torqueConfig.h"
IMPLEMENT_CO_NETOBJECT_V1(LevelInfo);
@ -77,6 +79,9 @@ static SFXAmbience sDefaultAmbience;
LevelInfo::LevelInfo()
: mNearClip( 0.1f ),
mVisibleDistance( 1000.0f ),
#ifdef GHOSTSCOPING
mVisibleGhostDistance (200.0f),
#endif
mDecalBias( 0.0015f ),
mCanvasClearColor( 255, 0, 255, 255 ),
mSoundAmbience( NULL ),
@ -114,6 +119,9 @@ void LevelInfo::initPersistFields()
addField( "nearClip", TypeF32, Offset( mNearClip, LevelInfo ), "Closest distance from the camera's position to render the world." );
addField( "visibleDistance", TypeF32, Offset( mVisibleDistance, LevelInfo ), "Furthest distance fromt he camera's position to render the world." );
#ifdef GHOSTSCOPING
addField( "visibleGhostDistance", TypeF32, Offset( mVisibleGhostDistance, LevelInfo ), "Furthest distance from the camera's position to render players." );
#endif
addField( "decalBias", TypeF32, Offset( mDecalBias, LevelInfo ),
"NearPlane bias used when rendering Decal and DecalRoad. This should be tuned to the visibleDistance in your level." );
@ -300,6 +308,9 @@ void LevelInfo::_updateSceneGraph()
scene->setNearClip( mNearClip );
scene->setVisibleDistance( mVisibleDistance );
#ifdef GHOSTSCOPING
scene->setVisibleGhostDistance( mVisibleGhostDistance );
#endif
gDecalBias = mDecalBias;