Index: src/game/Level0.cpp =================================================================== --- src/game/Level0.cpp (revision 3252) +++ src/game/Level0.cpp (working copy) @@ -150,6 +150,17 @@ PSendSysMessage(LANG_CONNECTED_USERS, clientsNum, maxClientsNum); + if(!m_session->GetSecurity()) + return true; + + // additional info + PSendSysMessage("Field memory allocated: bit-based %u mirror based %u percent %f", + sWorld.m_updateSize_BitBased, sWorld.m_updateSize_MirrorBased, + sWorld.m_updateSize_MirrorBased*100.0f/sWorld.m_updateSize_BitBased); + PSendSysMessage("Field updates sent: bit-based %u mirror based %u percent %f", + sWorld.m_updateCount_BitBased, sWorld.m_updateCount_MirrorBased, + sWorld.m_updateCount_MirrorBased*100.0f/sWorld.m_updateCount_BitBased); + return true; } Index: src/game/Object.cpp =================================================================== --- src/game/Object.cpp (revision 3252) +++ src/game/Object.cpp (working copy) @@ -40,6 +40,7 @@ m_objectType = TYPE_OBJECT; m_uint32Values = 0; + m_uint32Values_mirror = 0; m_valuesCount = 0; m_inWorld = false; @@ -56,10 +57,27 @@ { //DEBUG_LOG("Object desctr 1 check (%p)",(void*)this); delete [] m_uint32Values; + delete [] m_uint32Values_mirror; //DEBUG_LOG("Object desctr 2 check (%p)",(void*)this); } } +void Object::_InitValues() +{ + m_uint32Values = new uint32[ m_valuesCount ]; + memset(m_uint32Values, 0, m_valuesCount*sizeof(uint32)); + + m_uint32Values_mirror = new uint32[ m_valuesCount ]; + memset(m_uint32Values_mirror, 0, m_valuesCount*sizeof(uint32)); + + m_updateMask.SetCount(m_valuesCount); + ClearUpdateMask(); + + sWorld.m_updateSize_BitBased += m_valuesCount*4 + m_updateMask.GetBlockCount()*4; + sWorld.m_updateSize_MirrorBased += m_valuesCount*4*2; +} + + void Object::_Create( uint32 guidlow, uint32 guidhigh ) { if(!m_uint32Values) _InitValues(); @@ -315,6 +333,8 @@ { if( updateMask->GetBit( index ) ) { + ++sWorld.m_updateCount_BitBased; + // Some values at server stored in float format but must be sended to client in uint32 format if( isType(TYPE_UNIT) && ( index >= UNIT_FIELD_POWER1 && index <= UNIT_FIELD_MAXPOWER5 || @@ -332,6 +352,12 @@ *data << m_uint32Values[ index ]; } } + + if(m_uint32Values_mirror[index] != m_uint32Values[index]) + { + ++sWorld.m_updateCount_MirrorBased; + m_uint32Values_mirror[index] = m_uint32Values[index]; + } } } Index: src/game/Object.h =================================================================== --- src/game/Object.h (revision 3252) +++ src/game/Object.h (working copy) @@ -184,15 +184,7 @@ Object ( ); - void _InitValues() - { - m_uint32Values = new uint32[ m_valuesCount ]; - memset(m_uint32Values, 0, m_valuesCount*sizeof(uint32)); - - m_updateMask.SetCount(m_valuesCount); - ClearUpdateMask(); - } - + void _InitValues(); void _Create (uint32 guidlow, uint32 guidhigh); virtual void _SetUpdateBits(UpdateMask *updateMask, Player *target) const; @@ -212,6 +204,8 @@ float *m_floatValues; }; + uint32 *m_uint32Values_mirror; + uint16 m_valuesCount; UpdateMask m_updateMask; Index: src/game/World.cpp =================================================================== --- src/game/World.cpp (revision 3252) +++ src/game/World.cpp (working copy) @@ -85,6 +85,11 @@ m_ShutdownTimer = 0; m_gameTime=time(NULL); m_maxSessionsCount = 0; + + m_updateSize_BitBased = 0; + m_updateSize_MirrorBased = 0; + m_updateCount_BitBased = 0; + m_updateCount_MirrorBased = 0; } /// World desctructor World::~World() Index: src/game/World.h =================================================================== --- src/game/World.h (revision 3252) +++ src/game/World.h (working copy) @@ -228,6 +228,12 @@ void ScriptsStart(map > const& scripts, uint32 id, Object* source, Object* target); + //TEMPORARY: field update sending stats stor + uint32 m_updateSize_BitBased; + uint32 m_updateSize_MirrorBased; + uint32 m_updateCount_BitBased; + uint32 m_updateCount_MirrorBased; + protected: void _UpdateGameTime();