mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 16:25:42 +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
b70f89afa2
commit
5a1405d4bb
6 changed files with 93 additions and 4 deletions
|
|
@ -24,6 +24,7 @@
|
||||||
// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
|
// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
|
||||||
// Copyright (C) 2015 Faust Logic, Inc.
|
// Copyright (C) 2015 Faust Logic, Inc.
|
||||||
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
|
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
|
||||||
|
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
#include "T3D/gameBase/gameBase.h"
|
#include "T3D/gameBase/gameBase.h"
|
||||||
#include "console/consoleTypes.h"
|
#include "console/consoleTypes.h"
|
||||||
|
|
@ -40,6 +41,7 @@
|
||||||
#include "T3D/aiConnection.h"
|
#include "T3D/aiConnection.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "afx/arcaneFX.h"
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Ghost update relative priority values
|
// Ghost update relative priority values
|
||||||
|
|
||||||
|
|
@ -254,6 +256,8 @@ GameBase::GameBase()
|
||||||
|
|
||||||
GameBase::~GameBase()
|
GameBase::~GameBase()
|
||||||
{
|
{
|
||||||
|
if (scope_registered)
|
||||||
|
arcaneFX::unregisterScopedObject(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -266,8 +270,16 @@ bool GameBase::onAdd()
|
||||||
|
|
||||||
// Datablock must be initialized on the server.
|
// Datablock must be initialized on the server.
|
||||||
// Client datablock are initialized by the initial update.
|
// Client datablock are initialized by the initial update.
|
||||||
if ( isServerObject() && mDataBlock && !onNewDataBlock( mDataBlock, false ) )
|
if (isClientObject())
|
||||||
return false;
|
{
|
||||||
|
if (scope_id > 0 && !scope_registered)
|
||||||
|
arcaneFX::registerScopedObject(this);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( mDataBlock && !onNewDataBlock( mDataBlock, false ) )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
setProcessTick( true );
|
setProcessTick( true );
|
||||||
|
|
||||||
|
|
@ -276,6 +288,8 @@ bool GameBase::onAdd()
|
||||||
|
|
||||||
void GameBase::onRemove()
|
void GameBase::onRemove()
|
||||||
{
|
{
|
||||||
|
if (scope_registered)
|
||||||
|
arcaneFX::unregisterScopedObject(this);
|
||||||
// EDITOR FEATURE: Remove us from the reload signal of our datablock.
|
// EDITOR FEATURE: Remove us from the reload signal of our datablock.
|
||||||
if ( mDataBlock )
|
if ( mDataBlock )
|
||||||
mDataBlock->mReloadSignal.remove( this, &GameBase::_onDatablockModified );
|
mDataBlock->mReloadSignal.remove( this, &GameBase::_onDatablockModified );
|
||||||
|
|
@ -556,6 +570,11 @@ U32 GameBase::packUpdate( NetConnection *connection, U32 mask, BitStream *stream
|
||||||
stream->writeFlag(mIsAiControlled);
|
stream->writeFlag(mIsAiControlled);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (stream->writeFlag(mask & ScopeIdMask))
|
||||||
|
{
|
||||||
|
if (stream->writeFlag(scope_refs > 0))
|
||||||
|
stream->writeInt(scope_id, SCOPE_ID_BITS);
|
||||||
|
}
|
||||||
return retMask;
|
return retMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -594,6 +613,11 @@ void GameBase::unpackUpdate(NetConnection *con, BitStream *stream)
|
||||||
mTicksSinceLastMove = 0;
|
mTicksSinceLastMove = 0;
|
||||||
mIsAiControlled = stream->readFlag();
|
mIsAiControlled = stream->readFlag();
|
||||||
#endif
|
#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 )
|
void GameBase::onMount( SceneObject *obj, S32 node )
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
|
// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
|
||||||
// Copyright (C) 2015 Faust Logic, Inc.
|
// Copyright (C) 2015 Faust Logic, Inc.
|
||||||
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
|
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
|
||||||
|
|
||||||
#ifndef _GAMEBASE_H_
|
#ifndef _GAMEBASE_H_
|
||||||
#define _GAMEBASE_H_
|
#define _GAMEBASE_H_
|
||||||
|
|
||||||
|
|
@ -235,7 +236,8 @@ public:
|
||||||
enum GameBaseMasks {
|
enum GameBaseMasks {
|
||||||
DataBlockMask = Parent::NextFreeMask << 0,
|
DataBlockMask = Parent::NextFreeMask << 0,
|
||||||
ExtendedInfoMask = Parent::NextFreeMask << 1,
|
ExtendedInfoMask = Parent::NextFreeMask << 1,
|
||||||
NextFreeMask = Parent::NextFreeMask << 2
|
ScopeIdMask = Parent::NextFreeMask << 2,
|
||||||
|
NextFreeMask = Parent::NextFreeMask << 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
// net flags added by game base
|
// net flags added by game base
|
||||||
|
|
@ -459,6 +461,8 @@ private:
|
||||||
/// within this callback.
|
/// within this callback.
|
||||||
///
|
///
|
||||||
void _onDatablockModified();
|
void _onDatablockModified();
|
||||||
|
protected:
|
||||||
|
void onScopeIdChange() { setMaskBits(ScopeIdMask); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -316,7 +316,10 @@ void NetConnection::checkMaxRate()
|
||||||
{
|
{
|
||||||
packetRateToServer = 128;
|
packetRateToServer = 128;
|
||||||
packetRateToClient = 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;
|
gPacketUpdateDelayToServer = 1024 / packetRateToServer;
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,11 @@
|
||||||
// IN THE SOFTWARE.
|
// 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_
|
#ifndef _NETCONNECTION_H_
|
||||||
#define _NETCONNECTION_H_
|
#define _NETCONNECTION_H_
|
||||||
|
|
||||||
|
|
@ -1050,6 +1055,9 @@ public:
|
||||||
virtual bool readDemoStartBlock(BitStream *stream);
|
virtual bool readDemoStartBlock(BitStream *stream);
|
||||||
virtual void demoPlaybackComplete();
|
virtual void demoPlaybackComplete();
|
||||||
/// @}
|
/// @}
|
||||||
|
public:
|
||||||
|
S32 getCurRatePacketSize() const { return mCurRate.packetSize; }
|
||||||
|
S32 getMaxRatePacketSize() const { return mMaxRate.packetSize; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,11 @@
|
||||||
// IN THE SOFTWARE.
|
// 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 "platform/platform.h"
|
||||||
#include "console/simBase.h"
|
#include "console/simBase.h"
|
||||||
#include "core/dnet.h"
|
#include "core/dnet.h"
|
||||||
|
|
@ -28,6 +33,8 @@
|
||||||
#include "console/consoleTypes.h"
|
#include "console/consoleTypes.h"
|
||||||
#include "console/engineAPI.h"
|
#include "console/engineAPI.h"
|
||||||
|
|
||||||
|
#include "afx/arcaneFX.h"
|
||||||
|
|
||||||
IMPLEMENT_CONOBJECT(NetObject);
|
IMPLEMENT_CONOBJECT(NetObject);
|
||||||
|
|
||||||
// More information can be found in the Torque Manual (CHM)
|
// More information can be found in the Torque Manual (CHM)
|
||||||
|
|
@ -46,6 +53,9 @@ NetObject::NetObject()
|
||||||
mPrevDirtyList = NULL;
|
mPrevDirtyList = NULL;
|
||||||
mNextDirtyList = NULL;
|
mNextDirtyList = NULL;
|
||||||
mDirtyMaskBits = 0;
|
mDirtyMaskBits = 0;
|
||||||
|
scope_id = 0;
|
||||||
|
scope_refs = 0;
|
||||||
|
scope_registered = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetObject::~NetObject()
|
NetObject::~NetObject()
|
||||||
|
|
@ -460,3 +470,26 @@ DefineEngineMethod( NetObject, isServerObject, bool, (),,
|
||||||
//{
|
//{
|
||||||
// return object->isServerObject();
|
// 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.
|
// 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_
|
#ifndef _NETOBJECT_H_
|
||||||
#define _NETOBJECT_H_
|
#define _NETOBJECT_H_
|
||||||
|
|
||||||
|
|
@ -405,6 +410,18 @@ public:
|
||||||
static T* getClientObject( T *netObj ) { return static_cast<T*>( netObj->getClientObject() ); }
|
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…
Add table
Add a link
Reference in a new issue