mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-30 09:31:00 +00:00
packet-size-checking -- Methods for querying packet-size settings. Used for detecting when spells or effects overrun the packet buffer from networked dynamic field usage.
scope-tracking -- changes related to the tracking of AFX constraint objects as they move in and out of scope.
This commit is contained in:
parent
eb5d3cc749
commit
b17b45edbb
|
|
@ -24,6 +24,7 @@
|
|||
// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
|
||||
// Copyright (C) 2015 Faust Logic, Inc.
|
||||
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
|
||||
|
||||
#include "platform/platform.h"
|
||||
#include "T3D/gameBase/gameBase.h"
|
||||
#include "console/consoleTypes.h"
|
||||
|
|
@ -40,6 +41,7 @@
|
|||
#include "T3D/aiConnection.h"
|
||||
#endif
|
||||
|
||||
#include "afx/arcaneFX.h"
|
||||
//----------------------------------------------------------------------------
|
||||
// Ghost update relative priority values
|
||||
|
||||
|
|
@ -254,6 +256,8 @@ GameBase::GameBase()
|
|||
|
||||
GameBase::~GameBase()
|
||||
{
|
||||
if (scope_registered)
|
||||
arcaneFX::unregisterScopedObject(this);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -266,8 +270,16 @@ bool GameBase::onAdd()
|
|||
|
||||
// Datablock must be initialized on the server.
|
||||
// Client datablock are initialized by the initial update.
|
||||
if ( isServerObject() && mDataBlock && !onNewDataBlock( mDataBlock, false ) )
|
||||
return false;
|
||||
if (isClientObject())
|
||||
{
|
||||
if (scope_id > 0 && !scope_registered)
|
||||
arcaneFX::registerScopedObject(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( mDataBlock && !onNewDataBlock( mDataBlock, false ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
setProcessTick( true );
|
||||
|
||||
|
|
@ -276,6 +288,8 @@ bool GameBase::onAdd()
|
|||
|
||||
void GameBase::onRemove()
|
||||
{
|
||||
if (scope_registered)
|
||||
arcaneFX::unregisterScopedObject(this);
|
||||
// EDITOR FEATURE: Remove us from the reload signal of our datablock.
|
||||
if ( mDataBlock )
|
||||
mDataBlock->mReloadSignal.remove( this, &GameBase::_onDatablockModified );
|
||||
|
|
@ -556,6 +570,11 @@ U32 GameBase::packUpdate( NetConnection *connection, U32 mask, BitStream *stream
|
|||
stream->writeFlag(mIsAiControlled);
|
||||
#endif
|
||||
|
||||
if (stream->writeFlag(mask & ScopeIdMask))
|
||||
{
|
||||
if (stream->writeFlag(scope_refs > 0))
|
||||
stream->writeInt(scope_id, SCOPE_ID_BITS);
|
||||
}
|
||||
return retMask;
|
||||
}
|
||||
|
||||
|
|
@ -594,6 +613,11 @@ void GameBase::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
mTicksSinceLastMove = 0;
|
||||
mIsAiControlled = stream->readFlag();
|
||||
#endif
|
||||
if (stream->readFlag())
|
||||
{
|
||||
scope_id = (stream->readFlag()) ? (U16) stream->readInt(SCOPE_ID_BITS) : 0;
|
||||
scope_refs = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void GameBase::onMount( SceneObject *obj, S32 node )
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
|
||||
// Copyright (C) 2015 Faust Logic, Inc.
|
||||
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
|
||||
|
||||
#ifndef _GAMEBASE_H_
|
||||
#define _GAMEBASE_H_
|
||||
|
||||
|
|
@ -235,7 +236,8 @@ public:
|
|||
enum GameBaseMasks {
|
||||
DataBlockMask = Parent::NextFreeMask << 0,
|
||||
ExtendedInfoMask = Parent::NextFreeMask << 1,
|
||||
NextFreeMask = Parent::NextFreeMask << 2
|
||||
ScopeIdMask = Parent::NextFreeMask << 2,
|
||||
NextFreeMask = Parent::NextFreeMask << 3,
|
||||
};
|
||||
|
||||
// net flags added by game base
|
||||
|
|
@ -459,6 +461,8 @@ private:
|
|||
/// within this callback.
|
||||
///
|
||||
void _onDatablockModified();
|
||||
protected:
|
||||
void onScopeIdChange() { setMaskBits(ScopeIdMask); }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -316,7 +316,10 @@ void NetConnection::checkMaxRate()
|
|||
{
|
||||
packetRateToServer = 128;
|
||||
packetRateToClient = 128;
|
||||
packetSize = 1024;
|
||||
// These changes introduced in T3D 1.1 Preview reduce the packet headroom which leads
|
||||
// to some spells and effects running out of room when dynamic variables are used
|
||||
// to send launch-time parameters to clients.
|
||||
packetSize = 512;
|
||||
}
|
||||
|
||||
gPacketUpdateDelayToServer = 1024 / packetRateToServer;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,11 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
|
||||
// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
|
||||
// Copyright (C) 2015 Faust Logic, Inc.
|
||||
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
|
||||
|
||||
#ifndef _NETCONNECTION_H_
|
||||
#define _NETCONNECTION_H_
|
||||
|
||||
|
|
@ -1050,6 +1055,9 @@ public:
|
|||
virtual bool readDemoStartBlock(BitStream *stream);
|
||||
virtual void demoPlaybackComplete();
|
||||
/// @}
|
||||
public:
|
||||
S32 getCurRatePacketSize() const { return mCurRate.packetSize; }
|
||||
S32 getMaxRatePacketSize() const { return mMaxRate.packetSize; }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,11 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
|
||||
// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
|
||||
// Copyright (C) 2015 Faust Logic, Inc.
|
||||
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
|
||||
|
||||
#include "platform/platform.h"
|
||||
#include "console/simBase.h"
|
||||
#include "core/dnet.h"
|
||||
|
|
@ -28,6 +33,8 @@
|
|||
#include "console/consoleTypes.h"
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
#include "afx/arcaneFX.h"
|
||||
|
||||
IMPLEMENT_CONOBJECT(NetObject);
|
||||
|
||||
// More information can be found in the Torque Manual (CHM)
|
||||
|
|
@ -46,6 +53,9 @@ NetObject::NetObject()
|
|||
mPrevDirtyList = NULL;
|
||||
mNextDirtyList = NULL;
|
||||
mDirtyMaskBits = 0;
|
||||
scope_id = 0;
|
||||
scope_refs = 0;
|
||||
scope_registered = false;
|
||||
}
|
||||
|
||||
NetObject::~NetObject()
|
||||
|
|
@ -460,3 +470,26 @@ DefineEngineMethod( NetObject, isServerObject, bool, (),,
|
|||
//{
|
||||
// return object->isServerObject();
|
||||
//}
|
||||
U16 NetObject::addScopeRef()
|
||||
{
|
||||
if (scope_refs == 0)
|
||||
{
|
||||
scope_id = arcaneFX::generateScopeId();
|
||||
onScopeIdChange();
|
||||
}
|
||||
scope_refs++;
|
||||
return scope_id;
|
||||
}
|
||||
|
||||
void NetObject::removeScopeRef()
|
||||
{
|
||||
if (scope_refs == 0)
|
||||
return;
|
||||
scope_refs--;
|
||||
if (scope_refs == 0)
|
||||
{
|
||||
scope_id = 0;
|
||||
onScopeIdChange();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,11 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
|
||||
// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
|
||||
// Copyright (C) 2015 Faust Logic, Inc.
|
||||
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
|
||||
|
||||
#ifndef _NETOBJECT_H_
|
||||
#define _NETOBJECT_H_
|
||||
|
||||
|
|
@ -405,6 +410,18 @@ public:
|
|||
static T* getClientObject( T *netObj ) { return static_cast<T*>( netObj->getClientObject() ); }
|
||||
|
||||
/// @}
|
||||
protected:
|
||||
U16 scope_id;
|
||||
U16 scope_refs;
|
||||
bool scope_registered;
|
||||
virtual void onScopeIdChange() { }
|
||||
public:
|
||||
enum { SCOPE_ID_BITS = 14 };
|
||||
U16 getScopeId() const { return scope_id; }
|
||||
U16 addScopeRef();
|
||||
void removeScopeRef();
|
||||
void setScopeRegistered(bool flag) { scope_registered = flag; }
|
||||
bool getScopeRegistered() const { return scope_registered; }
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in a new issue