[Orxonox-commit 2446] r7153 - in code/branches/presentation3: . src/libraries/network src/libraries/network/packet src/libraries/network/synchronisable src/modules/objects src/modules/objects/collisionshapes src/modules/pong src/modules/weapons/weaponmodes src/orxonox src/orxonox/collisionshapes src/orxonox/graphics src/orxonox/infos src/orxonox/items src/orxonox/sound src/orxonox/worldentities src/orxonox/worldentities/pawns
scheusso at orxonox.net
scheusso at orxonox.net
Mon Jul 12 13:08:59 CEST 2010
Author: scheusso
Date: 2010-07-12 13:08:58 +0200 (Mon, 12 Jul 2010)
New Revision: 7153
Modified:
code/branches/presentation3/
code/branches/presentation3/src/libraries/network/GamestateClient.cc
code/branches/presentation3/src/libraries/network/GamestateManager.cc
code/branches/presentation3/src/libraries/network/GamestateManager.h
code/branches/presentation3/src/libraries/network/Host.h
code/branches/presentation3/src/libraries/network/packet/Gamestate.cc
code/branches/presentation3/src/libraries/network/packet/Gamestate.h
code/branches/presentation3/src/libraries/network/packet/Packet.cc
code/branches/presentation3/src/libraries/network/synchronisable/Serialise.h
code/branches/presentation3/src/libraries/network/synchronisable/Synchronisable.cc
code/branches/presentation3/src/libraries/network/synchronisable/Synchronisable.h
code/branches/presentation3/src/modules/objects/Planet.h
code/branches/presentation3/src/modules/objects/collisionshapes/BoxCollisionShape.h
code/branches/presentation3/src/modules/objects/collisionshapes/ConeCollisionShape.h
code/branches/presentation3/src/modules/objects/collisionshapes/PlaneCollisionShape.h
code/branches/presentation3/src/modules/objects/collisionshapes/SphereCollisionShape.h
code/branches/presentation3/src/modules/pong/PongBall.h
code/branches/presentation3/src/modules/pong/PongBat.h
code/branches/presentation3/src/modules/weapons/weaponmodes/RocketFire.cc
code/branches/presentation3/src/orxonox/CMakeLists.txt
code/branches/presentation3/src/orxonox/Level.h
code/branches/presentation3/src/orxonox/Test.h
code/branches/presentation3/src/orxonox/collisionshapes/CollisionShape.h
code/branches/presentation3/src/orxonox/graphics/Backlight.h
code/branches/presentation3/src/orxonox/graphics/Billboard.h
code/branches/presentation3/src/orxonox/graphics/BlinkingBillboard.cc
code/branches/presentation3/src/orxonox/graphics/BlinkingBillboard.h
code/branches/presentation3/src/orxonox/graphics/FadingBillboard.h
code/branches/presentation3/src/orxonox/graphics/GlobalShader.h
code/branches/presentation3/src/orxonox/graphics/Light.h
code/branches/presentation3/src/orxonox/graphics/Model.h
code/branches/presentation3/src/orxonox/graphics/ParticleEmitter.h
code/branches/presentation3/src/orxonox/infos/GametypeInfo.h
code/branches/presentation3/src/orxonox/infos/HumanPlayer.h
code/branches/presentation3/src/orxonox/infos/PlayerInfo.h
code/branches/presentation3/src/orxonox/items/Engine.h
code/branches/presentation3/src/orxonox/items/MultiStateEngine.h
code/branches/presentation3/src/orxonox/sound/BaseSound.cc
code/branches/presentation3/src/orxonox/sound/BaseSound.h
code/branches/presentation3/src/orxonox/sound/WorldSound.cc
code/branches/presentation3/src/orxonox/worldentities/BigExplosion.cc
code/branches/presentation3/src/orxonox/worldentities/BigExplosion.h
code/branches/presentation3/src/orxonox/worldentities/ControllableEntity.h
code/branches/presentation3/src/orxonox/worldentities/ExplosionChunk.h
code/branches/presentation3/src/orxonox/worldentities/MobileEntity.cc
code/branches/presentation3/src/orxonox/worldentities/MovableEntity.h
code/branches/presentation3/src/orxonox/worldentities/StaticEntity.h
code/branches/presentation3/src/orxonox/worldentities/WorldEntity.h
code/branches/presentation3/src/orxonox/worldentities/pawns/Pawn.cc
code/branches/presentation3/src/orxonox/worldentities/pawns/Pawn.h
code/branches/presentation3/src/orxonox/worldentities/pawns/SpaceShip.h
code/branches/presentation3/src/orxonox/worldentities/pawns/Spectator.h
Log:
- merged network2 branch into presentation3 branch (lots of network traffic and cpu load improvements)
- fixed network related bugs in BigExplosion
Property changes on: code/branches/presentation3
___________________________________________________________________
Modified: svn:mergeinfo
- /code/branches/ai:6592-7033
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/dynamicmatch:6584-7030
/code/branches/fps:6591-7072
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hudelements:6584-6941
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/map:2801-3086,3089
/code/branches/menu:5941-6146,6148
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network64:2210-2355
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660
/code/branches/presentation2:6106-6416
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/steering:5949-6091
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051
/code/branches/weaponsystem:2742-2890
+ /code/branches/ai:6592-7033
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/dynamicmatch:6584-7030
/code/branches/fps:6591-7072
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hudelements:6584-6941
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/map:2801-3086,3089
/code/branches/menu:5941-6146,6148
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network64:2210-2355
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660
/code/branches/presentation2:6106-6416
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/steering:5949-6091
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051
/code/branches/weaponsystem:2742-2890
Modified: code/branches/presentation3/src/libraries/network/GamestateClient.cc
===================================================================
--- code/branches/presentation3/src/libraries/network/GamestateClient.cc 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/libraries/network/GamestateClient.cc 2010-07-12 11:08:58 UTC (rev 7153)
@@ -160,24 +160,28 @@
bool b = gs->decompressData();
assert(b);
}
- if(gs->isDiffed()){
- packet::Gamestate *base = gamestateMap_[gs->getBaseID()];
- if(!base){
- COUT(3) << "could not find base gamestate id: " << gs->getBaseID() << endl;
- delete gs;
- return 0;
- }
-// assert(base); //TODO: fix this
- packet::Gamestate *undiffed = gs->undiff(base);
- delete gs;
- gs=undiffed;
- COUT(5) << "successfully undiffed gamestate id: " << undiffed->getID() << std::endl;
+ if(gs->isDiffed())
+ {
+ assert(0);
+// packet::Gamestate *base = gamestateMap_[gs->getBaseID()];
+// if(!base)
+// {
+// COUT(0) << "could not find base gamestate id: " << gs->getBaseID() << endl;
+// assert(0);
+// delete gs;
+// return 0;
+// }
+// packet::Gamestate *undiffed = gs->undiff(base);
+// delete gs;
+// gs=undiffed;
+// COUT(5) << "successfully undiffed gamestate id: " << undiffed->getID() << std::endl;
}
if(gs->spreadData(0x2))
return gs;
else
{
- COUT(3) << "could not spread gamestate" << endl;
+ COUT(0) << "could not spread gamestate" << endl;
+ assert(0);
return NULL;
}
}
Modified: code/branches/presentation3/src/libraries/network/GamestateManager.cc
===================================================================
--- code/branches/presentation3/src/libraries/network/GamestateManager.cc 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/libraries/network/GamestateManager.cc 2010-07-12 11:08:58 UTC (rev 7153)
@@ -42,6 +42,7 @@
#include <cassert>
#include <queue>
+#include "util/Clock.h"
// #include <boost/thread/mutex.hpp>
#include "util/Debug.h"
@@ -157,7 +158,7 @@
}
clientGamestates.push(0);
- finishGamestate( cid, &clientGamestates.back(), client, reference );
+ finishGamestate( cid, clientGamestates.back(), client, reference );
//FunctorMember<GamestateManager>* functor =
// ExecutorMember<GamestateManager>* executor = createExecutor( createFunctor(&GamestateManager::finishGamestate, this) );
// executor->setDefaultValues( cid, &clientGamestates.back(), client, reference );
@@ -179,47 +180,52 @@
}
- void GamestateManager::finishGamestate( unsigned int clientID, packet::Gamestate** destgamestate, packet::Gamestate* base, packet::Gamestate* gamestate ) {
+ void GamestateManager::finishGamestate( unsigned int clientID, packet::Gamestate*& destgamestate, packet::Gamestate* base, packet::Gamestate* gamestate ) {
//why are we searching the same client's gamestate id as we searched in
//Server::sendGameState?
// save the (undiffed) gamestate in the clients gamestate map
//chose wheather the next gamestate is the first or not
- packet::Gamestate *gs = gamestate->doSelection(clientID, 20000);
-// packet::Gamestate *gs = new packet::Gamestate(*gamestate);
+// packet::Gamestate *gs = gamestate->doSelection(clientID, 20000);
+// packet::Gamestate* gs = new packet::Gamestate(*gamestate);
+// packet::Gamestate* gs = gamestate;
+ packet::Gamestate *gs = new packet::Gamestate(*gamestate); //TODO: is this neccessary ?
// packet::Gamestate *gs = new packet::Gamestate();
// gs->collectData( id_, 0x1 );
// this->threadMutex_->lock();
gamestateMap_[clientID][gamestate->getID()]=gs;
// this->threadMutex_->unlock();
+ Clock clock;
+ clock.capture();
if(base)
{
-
-// COUT(3) << "diffing" << std::endl;
-// packet::Gamestate* gs1 = gs;
- packet::Gamestate *diffed = gs->diff(base);
- //packet::Gamestate *gs2 = diffed->undiff(gs);
-// assert(*gs == *gs2);
- gs = diffed;
-// packet::Gamestate* gs2 = gs->undiff(client);
-// gs = new packet::Gamestate(*gs);
-// assert(*gs1==*gs2);
+ packet::Gamestate *diffed1 = gs->diffVariables(base);
+ if( diffed1->getDataSize() == 0 )
+ {
+ delete diffed1;
+ destgamestate = 0;
+ return;
+ }
+ gs = diffed1;
}
- else{
+ else
+ {
gs = new packet::Gamestate(*gs);
}
bool b = gs->compressData();
assert(b);
-// COUT(4) << "sending gamestate with id " << gs->getID();
+ clock.capture();
+ COUT(0) << "diff time: " << clock.getDeltaTime() << endl;
+// COUT(5) << "sending gamestate with id " << gs->getID();
// if(gamestate->isDiffed())
-// COUT(4) << " and baseid " << gs->getBaseID() << endl;
+// COUT(5) << " and baseid " << gs->getBaseID() << endl;
// else
-// COUT(4) << endl;
+// COUT(5) << endl;
gs->setClientID(clientID);
- *destgamestate = gs;
+ destgamestate = gs;
}
Modified: code/branches/presentation3/src/libraries/network/GamestateManager.h
===================================================================
--- code/branches/presentation3/src/libraries/network/GamestateManager.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/libraries/network/GamestateManager.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -75,7 +75,7 @@
bool update();
void sendGamestates();
// packet::Gamestate *popGameState(unsigned int clientID);
- void finishGamestate( unsigned int clientID, packet::Gamestate** destgamestate, packet::Gamestate* base, packet::Gamestate* gamestate );
+ void finishGamestate( unsigned int clientID, packet::Gamestate*& destgamestate, packet::Gamestate* base, packet::Gamestate* gamestate );
bool getSnapshot();
Modified: code/branches/presentation3/src/libraries/network/Host.h
===================================================================
--- code/branches/presentation3/src/libraries/network/Host.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/libraries/network/Host.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -35,7 +35,7 @@
namespace orxonox {
const unsigned int CLIENTID_SERVER = 0;
- const unsigned int NETWORK_FREQUENCY = 30;
+ const unsigned int NETWORK_FREQUENCY = 25;
const float NETWORK_PERIOD = 1.0f/NETWORK_FREQUENCY;
/**
Modified: code/branches/presentation3/src/libraries/network/packet/Gamestate.cc
===================================================================
--- code/branches/presentation3/src/libraries/network/packet/Gamestate.cc 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/libraries/network/packet/Gamestate.cc 2010-07-12 11:08:58 UTC (rev 7153)
@@ -44,32 +44,54 @@
#define PACKET_FLAG_GAMESTATE PacketFlag::Reliable
+inline bool memzero( uint8_t* data, uint32_t datalength)
+{
+ uint64_t* d = (uint64_t*)data;
-Gamestate::Gamestate()
+ for( unsigned int i=0; i<datalength/8; i++ )
+ {
+ if( *(d+i) != 0 )
+ return false;
+ }
+ // now process the rest (when datalength isn't a multiple of 4)
+ for( unsigned int j = 8*(datalength/8); j<datalength; j++ )
+ {
+ if( *(data+j) != 0 )
+ return false;
+ }
+ return true;
+}
+
+
+Gamestate::Gamestate():
+ header_(0)
{
flags_ = flags_ | PACKET_FLAG_GAMESTATE;
- header_ = 0;
}
+
Gamestate::Gamestate(uint8_t *data, unsigned int clientID):
- Packet(data, clientID)
+ Packet(data, clientID)
{
flags_ = flags_ | PACKET_FLAG_GAMESTATE;
header_ = new GamestateHeader(data_);
}
+
Gamestate::Gamestate(uint8_t *data)
{
flags_ = flags_ | PACKET_FLAG_GAMESTATE;
- data_=data;
+ data_ = data;
header_ = new GamestateHeader(data_);
}
+
Gamestate::Gamestate(const Gamestate& g) :
- Packet( *(Packet*)&g )
+ Packet( *(Packet*)&g ), nrOfVariables_(0)
{
flags_ = flags_ | PACKET_FLAG_GAMESTATE;
header_ = new GamestateHeader(data_);
+ sizes_ = g.sizes_;
}
@@ -79,6 +101,7 @@
delete header_;
}
+
bool Gamestate::collectData(int id, uint8_t mode)
{
assert(this->header_==0); // make sure the header didn't exist before
@@ -90,7 +113,8 @@
if(size==0)
return false;
data_ = new uint8_t[size + GamestateHeader::getSize()];
- if(!data_){
+ if(!data_)
+ {
COUT(2) << "GameStateManager: could not allocate memory" << std::endl;
return false;
}
@@ -100,19 +124,21 @@
header_ = new GamestateHeader(data_);
//start collect data synchronisable by synchronisable
- uint8_t *mem=data_;
+ uint8_t *mem = data_; // in this stream store all data of the variables and the headers of the synchronisable
mem += GamestateHeader::getSize();
ObjectList<Synchronisable>::iterator it;
- for(it = ObjectList<Synchronisable>::begin(); it; ++it){
+ for(it = ObjectList<Synchronisable>::begin(); it; ++it)
+ {
// tempsize=it->getSize(id, mode);
- tempsize = it->getData(mem, id, mode);
+ tempsize = it->getData(mem, this->sizes_, id, mode);
if ( tempsize != 0 )
dataVector_.push_back( obj(it->getObjectID(), it->getCreatorID(), tempsize, mem-data_) );
#ifndef NDEBUG
- if(currentsize+tempsize > size){
+ if(currentsize+tempsize > size)
+ {
assert(0); // if we don't use multithreading this part shouldn't be neccessary
// start allocate additional memory
COUT(3) << "G.St.Man: need additional memory" << std::endl;
@@ -147,17 +173,18 @@
return true;
}
+
bool Gamestate::spreadData(uint8_t mode)
{
COUT(4) << "processing gamestate with id " << header_->getID() << endl;
assert(data_);
assert(!header_->isCompressed());
- assert(!header_->isDiffed());
uint8_t *mem=data_+GamestateHeader::getSize();
Synchronisable *s;
// update the data of the objects we received
- while(mem < data_+GamestateHeader::getSize()+header_->getDataSize()){
+ while(mem < data_+GamestateHeader::getSize()+header_->getDataSize())
+ {
SynchronisableHeader objectheader(mem);
s = Synchronisable::getSynchronisable( objectheader.getObjectID() );
@@ -169,7 +196,7 @@
}
else
{
- mem += objectheader.getDataSize();
+ mem += objectheader.getDataSize() + ( objectheader.isDiffed() ? SynchronisableHeaderLight::getSize() : SynchronisableHeader::getSize() );
}
}
else
@@ -180,22 +207,29 @@
}
// In debug mode, check first, whether there are no duplicate objectIDs
#ifndef NDEBUG
- if(this->getID()%1000==0){
+ if(this->getID()%1000==1)
+ {
std::list<uint32_t> v1;
ObjectList<Synchronisable>::iterator it;
- for (it = ObjectList<Synchronisable>::begin(); it != ObjectList<Synchronisable>::end(); ++it) {
- if (it->getObjectID() == OBJECTID_UNKNOWN) {
- if (it->objectMode_ != 0x0) {
+ for (it = ObjectList<Synchronisable>::begin(); it != ObjectList<Synchronisable>::end(); ++it)
+ {
+ if (it->getObjectID() == OBJECTID_UNKNOWN)
+ {
+ if (it->objectMode_ != 0x0)
+ {
COUT(0) << "Found object with OBJECTID_UNKNOWN on the client with objectMode != 0x0!" << std::endl;
COUT(0) << "Possible reason for this error: Client created a synchronized object without the Server's approval." << std::endl;
COUT(0) << "Objects class: " << it->getIdentifier()->getName() << std::endl;
assert(false);
}
}
- else {
+ else
+ {
std::list<uint32_t>::iterator it2;
- for (it2 = v1.begin(); it2 != v1.end(); ++it2) {
- if (it->getObjectID() == *it2) {
+ for (it2 = v1.begin(); it2 != v1.end(); ++it2)
+ {
+ if (it->getObjectID() == *it2)
+ {
COUT(0) << "Found duplicate objectIDs on the client!" << std::endl
<< "Are you sure you don't create a Sychnronisable objcect with 'new' \
that doesn't have objectMode = 0x0?" << std::endl;
@@ -210,6 +244,7 @@
return true;
}
+
uint32_t Gamestate::getSize() const
{
assert(data_);
@@ -221,7 +256,9 @@
}
}
-bool Gamestate::operator==(packet::Gamestate gs){
+
+bool Gamestate::operator==(packet::Gamestate gs)
+{
uint8_t *d1 = data_+GamestateHeader::getSize();
uint8_t *d2 = gs.data_+GamestateHeader::getSize();
GamestateHeader* h1 = new GamestateHeader(data_);
@@ -232,13 +269,13 @@
return memcmp(d1, d2, h1->getDataSize())==0;
}
+
bool Gamestate::process()
{
return GamestateHandler::addGamestate(this, getClientID());
}
-
bool Gamestate::compressData()
{
assert(data_);
@@ -252,7 +289,8 @@
uint8_t *source = data_ + GamestateHeader::getSize();
int retval;
retval = compress( dest, &buffer, source, (uLong)(header_->getDataSize()) );
- switch ( retval ) {
+ switch ( retval )
+ {
case Z_OK: COUT(5) << "G.St.Man: compress: successfully compressed" << std::endl; break;
case Z_MEM_ERROR: COUT(1) << "G.St.Man: compress: not enough memory available in gamestate.compress" << std::endl; return false;
case Z_BUF_ERROR: COUT(2) << "G.St.Man: compress: not enough memory available in the buffer in gamestate.compress" << std::endl; return false;
@@ -269,9 +307,11 @@
data_ = ndata;
header_->setCompSize( buffer );
header_->setCompressed( true );
- COUT(5) << "gamestate compress datasize: " << header_->getDataSize() << " compsize: " << header_->getCompSize() << std::endl;
+ COUT(0) << "gamestate compress datasize: " << header_->getDataSize() << " compsize: " << header_->getCompSize() << std::endl;
return true;
}
+
+
bool Gamestate::decompressData()
{
assert(data_);
@@ -288,7 +328,8 @@
int retval;
uLongf length=bufsize;
retval = uncompress( dest, &length, source, (uLong)compsize );
- switch ( retval ) {
+ switch ( retval )
+ {
case Z_OK: COUT(5) << "successfully decompressed" << std::endl; break;
case Z_MEM_ERROR: COUT(1) << "not enough memory available" << std::endl; return false;
case Z_BUF_ERROR: COUT(2) << "not enough memory available in the buffer" << std::endl; return false;
@@ -300,12 +341,14 @@
header_ = new GamestateHeader( data_, header_ );
delete temp;
- if (this->bDataENetAllocated_){
+ if (this->bDataENetAllocated_)
+ {
// Memory was allocated by ENet. --> We let it be since enet_packet_destroy will
// deallocated it anyway. So data and packet stay together.
this->bDataENetAllocated_ = false;
}
- else{
+ else
+ {
// We allocated the memory in the first place (unlikely). So we destroy the old data
// and overwrite it with the new decompressed data.
delete[] this->data_;
@@ -319,44 +362,171 @@
return true;
}
-/*Gamestate *Gamestate::diff(Gamestate *base)
+
+Gamestate* Gamestate::diffVariables(Gamestate *base)
{
- assert(data_);
- assert(!header_->isCompressed());
+ assert(this && base); assert(data_ && base->data_);
+ assert(!header_->isCompressed() && !base->header_->isCompressed());
assert(!header_->isDiffed());
- GamestateHeader diffHeader(base->data_);
- uint8_t *basep = GAMESTATE_START(base->data_), *gs = GAMESTATE_START(this->data_);
- uint32_t of=0; // pointers offset
- uint32_t dest_length=0;
- dest_length=header_->getDataSize();
- if(dest_length==0)
- return NULL;
- uint8_t *ndata = new uint8_t[dest_length*sizeof(uint8_t)+GamestateHeader::getSize()];
- uint8_t *dest = ndata + GamestateHeader::getSize();
- while(of < diffHeader.getDataSize() && of < header_->getDataSize()){
- *(dest+of)=*(basep+of)^*(gs+of); // do the xor
- ++of;
- }
- if(diffHeader.getDataSize()!=header_->getDataSize()){
- uint8_t n=0;
- if(diffHeader.getDataSize() < header_->getDataSize()){
- while(of<dest_length){
- *(dest+of)=n^*(gs+of);
- of++;
+
+
+ // *** first do a raw diff of the two gamestates
+
+ uint8_t *baseData = GAMESTATE_START(base->data_);
+ uint8_t *origData = GAMESTATE_START(this->data_);
+ uint32_t origLength = header_->getDataSize();
+ uint32_t baseLength = base->header_->getDataSize();
+
+ assert( origLength && baseLength );
+
+ uint8_t *nData = new uint8_t[origLength + GamestateHeader::getSize() + sizeof(uint32_t)*this->nrOfVariables_]; // this is the maximum size needed in the worst case
+ uint8_t *dest = GAMESTATE_START(nData);
+
+ uint32_t baseOffset = 0; //offset in the diffed stream
+ uint32_t origOffset = 0; //offset in the new stream with removed 0's
+ std::vector<uint32_t>::iterator sizes = this->sizes_.begin();
+
+ while( origOffset < origLength )
+ {
+ //iterate through all objects
+
+ SynchronisableHeader h(origData+origOffset);
+
+ // Find (if possible) the current object in the datastream of the old gamestate
+ // Start at the current offset position
+ if(baseOffset >= baseLength)
+ baseOffset = 0;
+ uint8_t* temp = baseData + baseOffset;
+ uint32_t objectID = h.getObjectID();
+ assert(temp < baseData+baseLength);
+ assert(dest < nData + origLength + GamestateHeader::getSize() + sizeof(uint32_t)*this->nrOfVariables_);
+ assert(sizes != this->sizes_.end());
+ while ( temp < baseData+baseLength )
+ {
+ SynchronisableHeader htemp(temp);
+ if ( htemp.getObjectID() == objectID )
+ {
+ assert( h.getClassID() == htemp.getClassID() );
+ goto DODIFF;
}
+ temp += htemp.getDataSize()+SynchronisableHeader::getSize();
}
+ // If not found start looking at the beginning
+ temp = baseData;
+ while ( temp < baseData+baseOffset )
+ {
+ SynchronisableHeader htemp(temp);
+ if ( htemp.getObjectID() == objectID )
+ {
+ assert( h.getClassID() == htemp.getClassID() );
+ goto DODIFF;
+ }
+ temp += htemp.getDataSize()+SynchronisableHeader::getSize();
+ }
+ // Object is new, thus never transmitted -> just copy over
+ goto DOCOPY;
+
+
+DODIFF:
+ {
+// if(baseOffset==0)
+// {
+// assert(origOffset==0);
+// }
+ uint32_t objectOffset = SynchronisableHeader::getSize(); // offset inside the object in the origData and baseData
+ // Check whether the whole object stayed the same
+ if( memcmp( origData+origOffset+objectOffset, temp+objectOffset, h.getDataSize()) == 0 )
+ {
+ origOffset += objectOffset+ h.getDataSize(); // skip the whole object
+ baseOffset = temp + h.getDataSize()+SynchronisableHeader::getSize() - baseData;
+ sizes += Synchronisable::getSynchronisable(h.getObjectID())->getNrOfVariables();
+ }
+ else
+ {
+// COUT(4) << "diff " << h.getObjectID() << ":";
+ // Now start to diff the Object
+ SynchronisableHeaderLight h2(dest);
+ h2 = h; // copy over the objectheader
+ VariableID variableID = 0;
+ uint32_t newObjectOffset = SynchronisableHeaderLight::getSize();
+ // iterate through all variables
+ while( objectOffset < h.getDataSize()+SynchronisableHeader::getSize() )
+ {
+ // check whether variable changed and write id and copy over variable to the new stream
+ // otherwise skip variable
+ assert(sizes != this->sizes_.end());
+ uint32_t varSize = *sizes;
+ assert( varSize == Synchronisable::getSynchronisable(h.getObjectID())->getVarSize(variableID) );
+ if ( varSize != 0 )
+ {
+ if ( memcmp(origData+origOffset+objectOffset, temp+objectOffset, varSize) != 0 )
+ {
+// COUT(4) << " c" << varSize;
+ *(VariableID*)(dest+newObjectOffset) = variableID; // copy over the variableID
+ newObjectOffset += sizeof(VariableID);
+ memcpy( dest+newObjectOffset, origData+origOffset+objectOffset, varSize );
+ newObjectOffset += varSize;
+ objectOffset += varSize;
+ }
+ else
+ {
+// COUT(4) << " s" << varSize;
+ objectOffset += varSize;
+ }
+ }
+
+ ++variableID;
+ ++sizes;
+ }
+ if( Synchronisable::getSynchronisable(h.getObjectID())->getNrOfVariables() != variableID )
+ sizes += Synchronisable::getSynchronisable(h.getObjectID())->getNrOfVariables() - variableID;
+// COUT(4) << endl;
+ h2.setDiffed(true);
+ h2.setDataSize(newObjectOffset-SynchronisableHeaderLight::getSize());
+ assert(objectOffset == h.getDataSize()+SynchronisableHeader::getSize());
+ origOffset += objectOffset;
+ baseOffset += temp + h.getDataSize()+SynchronisableHeader::getSize() - baseData;
+ dest += newObjectOffset;
+ }
+
+ continue;
+ }
+
+DOCOPY:
+ {
+ // Just copy over the whole Object
+ memcpy( dest, origData+origOffset, h.getDataSize()+SynchronisableHeader::getSize() );
+ dest += h.getDataSize()+SynchronisableHeader::getSize();
+ origOffset += h.getDataSize()+SynchronisableHeader::getSize();
+ assert( Synchronisable::getSynchronisable(h.getObjectID()) );
+// COUT(4) << "copy " << h.getObjectID() << endl;
+// COUT(4) << "copy " << h.getObjectID() << ":";
+ //sizes += Synchronisable::getSynchronisable(h.getObjectID())->getNrOfVariables();
+ for( unsigned int i = 0; i < Synchronisable::getSynchronisable(h.getObjectID())->getNrOfVariables(); ++i )
+ {
+// COUT(4) << " " << *sizes;
+ ++sizes;
+ }
+// COUT(4) << endl;
+ assert(sizes != this->sizes_.end() || origOffset>=origLength);
+ continue;
+ }
}
- Gamestate *g = new Gamestate(ndata, getClientID());
+
+ Gamestate *g = new Gamestate(nData, getClientID());
+ assert(g->header_);
*(g->header_) = *header_;
- g->header_->setDiffed( true );
g->header_->setBaseID( base->getID() );
+ g->header_->setDataSize(dest - nData - GamestateHeader::getSize());
g->flags_=flags_;
g->packetDirection_ = packetDirection_;
+ assert(!g->isCompressed());
return g;
-}*/
+}
-Gamestate *Gamestate::diff(Gamestate *base)
+
+Gamestate* Gamestate::diffData(Gamestate *base)
{
assert(this && base); assert(data_ && base->data_);
assert(!header_->isCompressed() && !base->header_->isCompressed());
@@ -392,7 +562,8 @@
return g;
}
-Gamestate *Gamestate::undiff(Gamestate *base)
+
+Gamestate* Gamestate::undiff(Gamestate *base)
{
assert(this && base); assert(data_ && base->data_);
assert(!header_->isCompressed() && !base->header_->isCompressed());
@@ -422,59 +593,6 @@
}
-// Gamestate *Gamestate::diff(Gamestate *base)
-// {
-// assert(data_);
-// assert(!header_->isCompressed());
-// assert(!header_->isDiffed());
-// GamestateHeader diffHeader(base->data_);
-// uint8_t *basep = GAMESTATE_START(base->data_), *gs = GAMESTATE_START(this->data_);
-// uint32_t of=0; // pointers offset
-// uint32_t dest_length=0;
-// dest_length=header_->getDataSize();
-// if(dest_length==0)
-// return NULL;
-// uint8_t *ndata = new uint8_t[dest_length*sizeof(uint8_t)+GamestateHeader::getSize()];
-// uint8_t *dest = ndata + GamestateHeader::getSize();
-//
-//
-// // LOOP-UNROLLED DIFFING
-// uint32_t *dest32 = (uint32_t*)dest, *base32 = (uint32_t*)basep, *gs32 = (uint32_t*)gs;
-// // diff in 4-byte steps
-// while( of < (uint32_t)(header_->getDataSize())/4 ){
-// if( of < (uint32_t)(diffHeader.getDataSize())/4 )
-// {
-// *(dest32+of)=*(base32+of) ^ *(gs32+of); // do the xor
-// ++of;
-// }
-// else
-// {
-// *(dest32+of)=*(gs32+of); // same as 0 ^ *(gs32+of)
-// ++of;
-// }
-// }
-// for( unsigned int of2 = 0; of2 < header_->getDataSize()%4; ++of2 )
-// {
-// if( of*4+of2 < diffHeader.getDataSize() )
-// {
-// *(dest+4*of+of2)=*(basep+4*of+of2) ^ *(gs+4*of+of2); // do the xor
-// }
-// else
-// {
-// *(dest+4*of+of2)=*(gs+4*of+of2); // same as 0 ^ *(gs32+of)
-// }
-// }
-//
-// Gamestate *g = new Gamestate(ndata, getClientID());
-// *(g->header_) = *header_;
-// g->header_->setDiffed( true );
-// g->header_->setBaseID( base->getID() );
-// g->flags_=flags_;
-// g->packetDirection_ = packetDirection_;
-// return g;
-// }
-
-
void Gamestate::rawDiff( uint8_t* newdata, uint8_t* data, uint8_t* basedata, uint32_t datalength, uint32_t baselength)
{
uint64_t* gd = (uint64_t*)data;
@@ -501,6 +619,7 @@
assert(j==datalength);
}
+
Gamestate* Gamestate::doSelection(unsigned int clientID, unsigned int targetSize){
assert(data_);
std::list<obj>::iterator it;
@@ -528,25 +647,23 @@
// std::list<obj>::iterator itt;
// COUT(0) << "myvector contains:";
// for ( itt=dataVector_.begin() ; itt!=dataVector_.end(); itt++ )
-// COUT(0) << ' ' << (*itt).objID;
+// COUT(0) << " " << (*itt).objID;
// COUT(0) << endl;
for(it=dataVector_.begin(); it!=dataVector_.end();){
SynchronisableHeader oldobjectheader(origdata);
SynchronisableHeader newobjectheader(newdata);
- if ( it->objSize == 0 )
+ if ( (*it).objSize == 0 )
{
++it;
continue;
}
- objectsize = oldobjectheader.getDataSize();
+ objectsize = oldobjectheader.getDataSize()+SynchronisableHeader::getSize();
objectOffset=SynchronisableHeader::getSize(); //skip the size and the availableData variables in the objectheader
- if ( it->objID == oldobjectheader.getObjectID() ){
+ if ( (*it).objID == oldobjectheader.getObjectID() ){
memcpy(newdata, origdata, objectsize);
- assert(newobjectheader.isDataAvailable()==true);
++it;
}else{
newobjectheader = oldobjectheader;
- newobjectheader.setDataAvailable(false);
memset(newdata+objectOffset, 0, objectsize-objectOffset);
}
newdata += objectsize;
@@ -558,7 +675,7 @@
while ( origsize < header_->getDataSize() )
{
SynchronisableHeader oldobjectheader(origdata);
- objectsize = oldobjectheader.getDataSize();
+ objectsize = oldobjectheader.getDataSize()+SynchronisableHeader::getSize();
origdata += objectsize;
origsize += objectsize;
}
@@ -570,54 +687,22 @@
}
-/*Gamestate *Gamestate::undiff(Gamestate *base)
-{
- assert(this && base);assert(data_);
- assert(header_->isDiffed());
- assert(!header_->isCompressed() && !base->header_->isCompressed());
- uint8_t *basep = GAMESTATE_START(base->data_);
- uint8_t *gs = GAMESTATE_START(this->data_);
- uint32_t of=0; // pointers offset
- uint32_t dest_length=0;
- dest_length=header_->getDataSize();
- if(dest_length==0)
- return NULL;
- uint8_t *ndata = new uint8_t[dest_length*sizeof(uint8_t)+GamestateHeader::getSize()];
- uint8_t *dest = ndata + GamestateHeader::getSize();
- while(of < base->header_->getDataSize() && of < header_->getDataSize()){
- *(dest+of)=*(basep+of)^*(gs+of); // do the xor
- ++of;
- }
- if(base->header_->getDataSize()!=header_->getDataSize()){
- uint8_t n=0;
- if(base->header_->getDataSize() < header_->getDataSize()){
- while(of < dest_length){
- *(dest+of)=n^*(gs+of);
- of++;
- }
- }
- }
- Gamestate *g = new Gamestate(ndata, getClientID());
- assert(g->header_);
- *(g->header_) = *header_;
- g->header_->setDiffed( false );
- g->flags_=flags_;
- g->packetDirection_ = packetDirection_;
- assert(!g->isDiffed());
- assert(!g->isCompressed());
- return g;
-}*/
-
uint32_t Gamestate::calcGamestateSize(int32_t id, uint8_t mode)
{
- uint32_t size=0;
+ uint32_t size = 0;
+ uint32_t nrOfVariables = 0;
// get the start of the Synchronisable list
ObjectList<Synchronisable>::iterator it;
// get total size of gamestate
- for(it = ObjectList<Synchronisable>::begin(); it; ++it)
+ for(it = ObjectList<Synchronisable>::begin(); it; ++it){
size+=it->getSize(id, mode); // size of the actual data of the synchronisable
+ nrOfVariables += it->getNrOfVariables();
+ }
+// COUT(0) << "allocating " << nrOfVariables << " ints" << endl;
+ this->sizes_.reserve(nrOfVariables);
return size;
}
+
} //namespace packet
} //namespace orxonox
Modified: code/branches/presentation3/src/libraries/network/packet/Gamestate.h
===================================================================
--- code/branches/presentation3/src/libraries/network/packet/Gamestate.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/libraries/network/packet/Gamestate.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -35,6 +35,7 @@
#include <cassert>
#include <cstring>
#include <list>
+#include <vector>
#include "util/CRC32.h"
#include "network/TrafficControl.h"
@@ -112,7 +113,9 @@
inline bool isDiffed() const { return header_->isDiffed(); }
inline bool isCompressed() const { return header_->isCompressed(); }
inline int32_t getBaseID() const { return header_->getBaseID(); }
- Gamestate *diff(Gamestate *base);
+ inline uint32_t getDataSize() const { return header_->getDataSize(); }
+ Gamestate* diffVariables(Gamestate *base);
+ Gamestate* diffData(Gamestate *base);
Gamestate *undiff(Gamestate *base);
Gamestate* doSelection(unsigned int clientID, unsigned int targetSize);
bool compressData();
@@ -122,13 +125,15 @@
// Packet functions
private:
void rawDiff( uint8_t* newdata, uint8_t* data, uint8_t* basedata, uint32_t datalength, uint32_t baselength);
+ inline uint32_t findObject( const SynchronisableHeader& header, uint8_t* mem, uint32_t dataLength, uint32_t startPosition = 0 );
virtual uint32_t getSize() const;
virtual inline bool process();
-
- private:
uint32_t calcGamestateSize(int32_t id, uint8_t mode=0x0);
- std::list<obj> dataVector_;
- GamestateHeader* header_;
+
+ std::list<obj> dataVector_;
+ GamestateHeader* header_;
+ std::vector<uint32_t> sizes_;
+ uint32_t nrOfVariables_;
};
}
Modified: code/branches/presentation3/src/libraries/network/packet/Packet.cc
===================================================================
--- code/branches/presentation3/src/libraries/network/packet/Packet.cc 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/libraries/network/packet/Packet.cc 2010-07-12 11:08:58 UTC (rev 7153)
@@ -70,10 +70,6 @@
bDataENetAllocated_ = false;
}
-void blub(ENetPacket *packet){
- COUT(4) << "blubb" << std::endl;
-}
-
Packet::Packet(uint8_t *data, unsigned int clientID){
flags_ = PACKET_FLAG_DEFAULT;
packetDirection_ = Direction::Incoming;
Modified: code/branches/presentation3/src/libraries/network/synchronisable/Serialise.h
===================================================================
--- code/branches/presentation3/src/libraries/network/synchronisable/Serialise.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/libraries/network/synchronisable/Serialise.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -73,7 +73,7 @@
if ( variable )
return *(uint32_t*)(mem) == variable->getObjectID();
else
- return *(uint32_t*)(mem) == OBJECTID_UNKNOWN;
+ return variable == variable->getSynchronisable(*(uint32_t*)(mem));
}
// These functions implement loading / saving / etc. for SmartPtr<T>
Modified: code/branches/presentation3/src/libraries/network/synchronisable/Synchronisable.cc
===================================================================
--- code/branches/presentation3/src/libraries/network/synchronisable/Synchronisable.cc 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/libraries/network/synchronisable/Synchronisable.cc 2010-07-12 11:08:58 UTC (rev 7153)
@@ -48,7 +48,8 @@
* Constructor:
* Initializes all Variables and sets the right objectID_
*/
- Synchronisable::Synchronisable(BaseObject* creator ){
+ Synchronisable::Synchronisable(BaseObject* creator )
+ {
RegisterRootObject(Synchronisable);
static uint32_t idCounter=0;
objectMode_=0x1; // by default do not send data to server
@@ -72,39 +73,25 @@
this->creatorID_ = creator->getSceneID();
else
this->creatorID_ = OBJECTID_UNKNOWN;
-
- /*searchcreatorID:
- if (creator)
- {
- Synchronisable* synchronisable_creator = orxonox_cast<Synchronisable*>(creator);
- if (synchronisable_creator && synchronisable_creator->objectMode_)
- {
- this->creatorID = synchronisable_creator->getScene()->getObjectID();
- }
- else if (creator != creator->getCreator())
- {
- creator = creator->getCreator();
- goto searchcreatorID;
- }
- }*/
}
/**
* Destructor:
* Delete all callback objects and remove objectID_ from the objectMap_
*/
- Synchronisable::~Synchronisable(){
+ Synchronisable::~Synchronisable()
+ {
// delete callback function objects
if(!Identifier::isCreatingHierarchy()){
// remove object from the static objectMap
if (this->objectMode_ != 0x0 && (Host::running() && Host::isServer()))
deletedObjects_.push(objectID_);
}
- // delete all Synchronisable Variables from syncList ( which are also in stringList )
- for(std::vector<SynchronisableVariableBase*>::iterator it = syncList.begin(); it!=syncList.end(); it++)
+ // delete all Synchronisable Variables from syncList_ ( which are also in stringList_ )
+ for(std::vector<SynchronisableVariableBase*>::iterator it = syncList_.begin(); it!=syncList_.end(); it++)
delete (*it);
- syncList.clear();
- stringList.clear();
+ syncList_.clear();
+ stringList_.clear();
std::map<uint32_t, Synchronisable*>::iterator it;
it = objectMap_.find(objectID_);
if (it != objectMap_.end())
@@ -117,7 +104,8 @@
* This function sets the internal mode for synchronisation
* @param b true if this object is located on a client or on a server
*/
- void Synchronisable::setClient(bool b){
+ void Synchronisable::setClient(bool b)
+ {
if(b) // client
state_=0x2;
else // server
@@ -134,13 +122,8 @@
Synchronisable *Synchronisable::fabricate(uint8_t*& mem, uint8_t mode)
{
SynchronisableHeader header(mem);
+ assert( !header.isDiffed() );
- if(!header.isDataAvailable())
- {
- mem += header.getDataSize();
- return 0;
- }
-
COUT(4) << "fabricating object with id: " << header.getObjectID() << std::endl;
Identifier* id = ClassByID(header.getClassID());
@@ -159,7 +142,7 @@
Synchronisable* synchronisable_creator = Synchronisable::getSynchronisable(header.getCreatorID());
if (!synchronisable_creator)
{
- mem += header.getDataSize(); //.TODO: this suckz.... remove size from header
+ mem += header.getDataSize()+SynchronisableHeader::getSize(); //.TODO: this suckz.... remove size from header
assert(0); // TODO: uncomment this if we have a clean objecthierarchy (with destruction of children of objects) ^^
return 0;
}
@@ -197,7 +180,8 @@
* @param objectID_ objectID_ of the Synchronisable
* @return true/false
*/
- bool Synchronisable::deleteObject(uint32_t objectID_){
+ bool Synchronisable::deleteObject(uint32_t objectID_)
+ {
if(!getSynchronisable(objectID_))
return false;
assert(getSynchronisable(objectID_)->objectID_==objectID_);
@@ -214,19 +198,12 @@
* @param objectID_ objectID_ of the Synchronisable
* @return pointer to the Synchronisable with the objectID_
*/
- Synchronisable* Synchronisable::getSynchronisable(uint32_t objectID_){
+ Synchronisable* Synchronisable::getSynchronisable(uint32_t objectID_)
+ {
std::map<uint32_t, Synchronisable*>::iterator it1;
it1 = objectMap_.find(objectID_);
if (it1 != objectMap_.end())
return it1->second;
-
-// ObjectList<Synchronisable>::iterator it;
-// for(it = ObjectList<Synchronisable>::begin(); it; ++it){
-// if( it->getObjectID()==objectID_ ){
-// objectMap_[objectID_] = *it;
-// return *it;
-// }
-// }
// if the objects not in the map it should'nt exist at all anymore
return NULL;
}
@@ -246,7 +223,9 @@
* 0x3: bidirectional
* @return true: if !doSync or if everything was successfully saved
*/
- uint32_t Synchronisable::getData(uint8_t*& mem, int32_t id, uint8_t mode){
+ uint32_t Synchronisable::getData(uint8_t*& mem, std::vector<uint32_t>& sizes, int32_t id, uint8_t mode)
+ {
+ unsigned int test = 0;
if(mode==0x0)
mode=state_;
//if this tick is we dont synchronise, then abort now
@@ -254,6 +233,7 @@
return 0;
uint32_t tempsize = 0;
#ifndef NDEBUG
+ uint8_t* oldmem = mem;
if (this->classID_==0)
COUT(3) << "classid 0 " << this->getIdentifier()->getName() << std::endl;
#endif
@@ -271,20 +251,28 @@
mem += SynchronisableHeader::getSize();
// end copy header
-
- COUT(5) << "Synchronisable getting data from objectID_: " << objectID_ << " classID_: " << classID_ << std::endl;
+ CCOUT(5) << "getting data from objectID_: " << objectID_ << ", classID_: " << classID_ << std::endl;
+// COUT(4) << "objectid: " << this->objectID_ << ":";
// copy to location
- for(i=syncList.begin(); i!=syncList.end(); ++i){
- tempsize += (*i)->getData( mem, mode );
+ for(i=syncList_.begin(); i!=syncList_.end(); ++i)
+ {
+ uint32_t varsize = (*i)->getData( mem, mode );
+// COUT(4) << " " << varsize;
+ tempsize += varsize;
+ sizes.push_back(varsize);
+ ++test;
//tempsize += (*i)->getSize( mode );
}
+// COUT(4) << endl;
- tempsize += SynchronisableHeader::getSize();
header.setObjectID( this->objectID_ );
header.setCreatorID( this->creatorID_ );
header.setClassID( this->classID_ );
- header.setDataAvailable( true );
header.setDataSize( tempsize );
+ assert( tempsize == mem-oldmem-SynchronisableHeader::getSize() );
+ assert( test == this->getNrOfVariables() );
+ header.setDiffed(false);
+ tempsize += SynchronisableHeader::getSize();
#ifndef NDEBUG
uint32_t size;
@@ -301,37 +289,51 @@
* @param mode same as in getData
* @return true/false
*/
- bool Synchronisable::updateData(uint8_t*& mem, uint8_t mode, bool forceCallback){
+ bool Synchronisable::updateData(uint8_t*& mem, uint8_t mode, bool forceCallback)
+ {
if(mode==0x0)
mode=state_;
- std::vector<SynchronisableVariableBase *>::iterator i;
- if(syncList.empty()){
+ if(syncList_.empty())
+ {
assert(0);
- COUT(4) << "Synchronisable::updateData syncList is empty" << std::endl;
+ COUT(2) << "Synchronisable::updateData syncList_ is empty" << std::endl;
return false;
}
uint8_t* data=mem;
// start extract header
- SynchronisableHeader syncHeader(mem);
- assert(syncHeader.getObjectID()==this->objectID_);
- assert(syncHeader.getCreatorID()==this->creatorID_);
- assert(syncHeader.getClassID()==this->classID_);
- if(syncHeader.isDataAvailable()==false){
- mem += syncHeader.getDataSize();
- return true;
- }
+ SynchronisableHeaderLight syncHeaderLight(mem);
+ assert(syncHeaderLight.getObjectID()==this->getObjectID());
- mem += SynchronisableHeader::getSize();
- // stop extract header
-
//COUT(5) << "Synchronisable: objectID_ " << syncHeader.getObjectID() << ", classID_ " << syncHeader.getClassID() << " size: " << syncHeader.getDataSize() << " synchronising data" << std::endl;
- for(i=syncList.begin(); i!=syncList.end(); i++)
+ if( !syncHeaderLight.isDiffed() )
{
- assert( mem <= data+syncHeader.getDataSize() ); // always make sure we don't exceed the datasize in our stream
- (*i)->putData( mem, mode, forceCallback );
+ SynchronisableHeader syncHeader2(mem);
+ assert( this->getClassID() == syncHeader2.getClassID() );
+ assert( this->getCreatorID() == syncHeader2.getCreatorID() );
+ mem += SynchronisableHeader::getSize();
+ std::vector<SynchronisableVariableBase *>::iterator i;
+ for(i=syncList_.begin(); i!=syncList_.end(); i++)
+ {
+ assert( mem <= data+syncHeader2.getDataSize()+SynchronisableHeader::getSize() ); // always make sure we don't exceed the datasize in our stream
+ (*i)->putData( mem, mode, forceCallback );
+ }
+ assert(mem == data+syncHeaderLight.getDataSize()+SynchronisableHeader::getSize() );
}
- assert(mem == data+syncHeader.getDataSize());
+ else
+ {
+ mem += SynchronisableHeaderLight::getSize();
+// COUT(0) << "objectID: " << this->objectID_ << endl;
+ while( mem < data+syncHeaderLight.getDataSize()+SynchronisableHeaderLight::getSize() )
+ {
+ VariableID varID = *(VariableID*)mem;
+// COUT(0) << "varID: " << varID << endl;
+ assert( varID < syncList_.size() );
+ mem += sizeof(VariableID);
+ syncList_[varID]->putData( mem, mode, forceCallback );
+ }
+ assert(mem == data+syncHeaderLight.getDataSize()+SynchronisableHeaderLight::getSize() );
+ }
return true;
}
@@ -341,8 +343,9 @@
* @param mode same as getData
* @return amount of bytes
*/
- uint32_t Synchronisable::getSize(int32_t id, uint8_t mode){
- int tsize=SynchronisableHeader::getSize();
+ uint32_t Synchronisable::getSize(int32_t id, uint8_t mode)
+ {
+ uint32_t tsize=SynchronisableHeader::getSize();
if (mode==0x0)
mode=state_;
if (!doSync(id, mode))
@@ -350,7 +353,8 @@
assert( mode==state_ );
tsize += this->dataSize_;
std::vector<SynchronisableVariableBase*>::iterator i;
- for(i=stringList.begin(); i!=stringList.end(); ++i){
+ for(i=stringList_.begin(); i!=stringList_.end(); ++i)
+ {
tsize += (*i)->getSize( mode );
}
return tsize;
@@ -361,24 +365,14 @@
* @param id gamestate id
* @return true/false
*/
- bool Synchronisable::doSync(int32_t id, uint8_t mode){
+ bool Synchronisable::doSync(int32_t id, uint8_t mode)
+ {
if(mode==0x0)
mode=state_;
- return ( (this->objectMode_ & mode)!=0 && (!syncList.empty() ) );
+ return ( (this->objectMode_ & mode)!=0 && (!syncList_.empty() ) );
}
/**
- * This function looks at the header located in the bytestream and checks wheter objectID_ and classID_ match with the Synchronisables ones
- * @param mem pointer to the bytestream
- */
- bool Synchronisable::isMyData(uint8_t* mem)
- {
- SynchronisableHeader header(mem);
- assert(header.getObjectID()==this->objectID_);
- return header.isDataAvailable();
- }
-
- /**
* This function sets the synchronisation mode of the object
* If set to 0x0 variables will not be synchronised at all
* If set to 0x1 variables will only be synchronised to the client
@@ -386,7 +380,8 @@
* If set to 0x3 variables will be synchronised bidirectionally (only if set so in registerVar)
* @param mode same as in registerVar
*/
- void Synchronisable::setSyncMode(uint8_t mode){
+ void Synchronisable::setSyncMode(uint8_t mode)
+ {
assert(mode==0x0 || mode==0x1 || mode==0x2 || mode==0x3);
this->objectMode_=mode;
}
@@ -398,9 +393,44 @@
sv = new SynchronisableVariableBidirectional<std::string>(variable, mode, cb);
else
sv = new SynchronisableVariable<std::string>(variable, mode, cb);
- syncList.push_back(sv);
- stringList.push_back(sv);
+ syncList_.push_back(sv);
+ stringList_.push_back(sv);
}
+template <> void Synchronisable::unregisterVariable( std::string& variable )
+ {
+ bool unregistered_nonexistent_variable = true;
+ std::vector<SynchronisableVariableBase*>::iterator it = syncList_.begin();
+ while(it!=syncList_.end())
+ {
+ if( ((*it)->getReference()) == &variable )
+ {
+ delete (*it);
+ syncList_.erase(it);
+ unregistered_nonexistent_variable = false;
+ break;
+ }
+ else
+ ++it;
+ }
+ assert(unregistered_nonexistent_variable == false);
+
+ it = stringList_.begin();
+ while(it!=stringList_.end())
+ {
+ if( ((*it)->getReference()) == &variable )
+ {
+ delete (*it);
+ stringList_.erase(it);
+ return;
+ }
+ else
+ ++it;
+ }
+ unregistered_nonexistent_variable = true;
+ assert(unregistered_nonexistent_variable == false); //if we reach this point something went wrong:
+ // the variable has not been registered before
+ }
+
}
Modified: code/branches/presentation3/src/libraries/network/synchronisable/Synchronisable.h
===================================================================
--- code/branches/presentation3/src/libraries/network/synchronisable/Synchronisable.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/libraries/network/synchronisable/Synchronisable.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -64,6 +64,8 @@
VeryLow = 100
};
}
+
+ typedef uint8_t VariableID;
/**
* @brief: stores information about a Synchronisable
@@ -71,43 +73,76 @@
* This class stores the information about a Synchronisable (objectID_, classID_, creatorID_, dataSize)
* in an emulated bitset.
* Bit 1 to 31 store the size of the Data the synchronisable consumes in the stream
- * Bit 32 is a bool and defines whether the data is actually stored or is just filled up with 0
+ * Bit 32 is a bool and defines whether the variables are stored in diff mode
* Byte 5 to 8: objectID_
* Byte 9 to 12: classID_
* Byte 13 to 16: creatorID_
*/
class _NetworkExport SynchronisableHeader{
+ friend class SynchronisableHeaderLight;
private:
- uint8_t *data_;
+ uint8_t* data_;
public:
SynchronisableHeader(uint8_t* data)
{ data_ = data; }
inline static uint32_t getSize()
- { return 16; }
- inline uint32_t getDataSize() const
- { return (*(uint32_t*)data_) & 0x7FFFFFFF; } //only use the first 31 bits
- inline void setDataSize(uint32_t size)
- { *(uint32_t*)(data_) = (size & 0x7FFFFFFF) | (*(uint32_t*)(data_) & 0x80000000 ); }
- inline bool isDataAvailable() const
- { return ( (*(uint32_t*)data_) & 0x80000000 ) == 0x80000000; }
- inline void setDataAvailable( bool b)
- { *(uint32_t*)(data_) = (b << 31) | (*(uint32_t*)(data_) & 0x7FFFFFFF ); }
+ { return 14; }
+ inline uint16_t getDataSize() const
+ { return (*(uint16_t*)data_) & 0x7FFF; } //only use the first 31 bits
+ inline void setDataSize(uint16_t size)
+ { *(uint16_t*)(data_) = (size & 0x7FFFFFFF) | (*(uint16_t*)(data_) & 0x8000 ); }
+ inline bool isDiffed() const
+ { return ( (*(uint16_t*)data_) & 0x8000 ) == 0x8000; }
+ inline void setDiffed( bool b)
+ { *(uint16_t*)(data_) = (b << 15) | (*(uint16_t*)(data_) & 0x7FFF ); }
inline uint32_t getObjectID() const
- { return *(uint32_t*)(data_+4); }
+ { return *(uint32_t*)(data_+2); }
inline void setObjectID(uint32_t objectID_)
- { *(uint32_t*)(data_+4) = objectID_; }
+ { *(uint32_t*)(data_+2) = objectID_; }
inline uint32_t getClassID() const
- { return *(uint32_t*)(data_+8); }
+ { return *(uint32_t*)(data_+6); }
inline void setClassID(uint32_t classID_)
- { *(uint32_t*)(data_+8) = classID_; }
+ { *(uint32_t*)(data_+6) = classID_; }
inline uint32_t getCreatorID() const
- { return *(uint32_t*)(data_+12); }
+ { return *(uint32_t*)(data_+10); }
inline void setCreatorID(uint32_t creatorID_)
- { *(uint32_t*)(data_+12) = creatorID_; }
+ { *(uint32_t*)(data_+10) = creatorID_; }
inline void operator=(SynchronisableHeader& h)
{ memcpy(data_, h.data_, getSize()); }
};
+ /**
+ * @brief: stores information about a Synchronisable (light version)
+ *
+ * This class stores the information about a Synchronisable (objectID_, dataSize)
+ * in an emulated bitset.
+ * Bit 1 to 31 store the size of the Data the synchronisable consumes in the stream
+ * Bit 32 is a bool and defines whether the variables are stored in diff mode
+ * Byte 5 to 8: objectID_
+ */
+ class _NetworkExport SynchronisableHeaderLight{
+ private:
+ uint8_t* data_;
+ public:
+ SynchronisableHeaderLight(uint8_t* data)
+ { data_ = data; }
+ inline static uint32_t getSize()
+ { return 6; }
+ inline uint16_t getDataSize() const
+ { return (*(uint16_t*)data_) & 0x7FFF; } //only use the first 31 bits
+ inline void setDataSize(uint16_t size)
+ { *(uint16_t*)(data_) = (size & 0x7FFFFFFF) | (*(uint16_t*)(data_) & 0x8000 ); }
+ inline bool isDiffed() const
+ { return ( (*(uint16_t*)data_) & 0x8000 ) == 0x8000; }
+ inline void setDiffed( bool b)
+ { *(uint16_t*)(data_) = (b << 15) | (*(uint16_t*)(data_) & 0x7FFF ); }
+ inline uint32_t getObjectID() const
+ { return *(uint32_t*)(data_+2); }
+ inline void setObjectID(uint32_t objectID_)
+ { *(uint32_t*)(data_+2) = objectID_; }
+ inline void operator=(SynchronisableHeader& h)
+ { memcpy(data_, h.data_, getSize()); }
+ };
/**
* This class is the base class of all the Objects in the universe that need to be synchronised over the network
@@ -134,20 +169,24 @@
inline uint8_t getSyncMode() const { return this->objectMode_; }
void setSyncMode(uint8_t mode);
+
+ inline uint32_t getNrOfVariables(){ return this->syncList_.size(); }
+ inline uint32_t getVarSize( VariableID ID )
+ { return this->syncList_[ID]->getSize(state_); }
protected:
Synchronisable(BaseObject* creator);
template <class T> void registerVariable(T& variable, uint8_t mode=0x1, NetworkCallbackBase *cb=0, bool bidirectional=false);
template <class T> void registerVariable(std::set<T>& variable, uint8_t mode=0x1, NetworkCallbackBase *cb=0, bool bidirectional=false);
+ template <class T> void unregisterVariable(T& var);
void setPriority(unsigned int freq){ objectFrequency_ = freq; }
private:
- uint32_t getData(uint8_t*& men, int32_t id, uint8_t mode=0x0);
+ uint32_t getData(uint8_t*& mem, std::vector<uint32_t>& sizes, int32_t id, uint8_t mode);
uint32_t getSize(int32_t id, uint8_t mode=0x0);
bool updateData(uint8_t*& mem, uint8_t mode=0x0, bool forceCallback=false);
- bool isMyData(uint8_t* mem);
bool doSync(int32_t id, uint8_t mode=0x0);
inline void setObjectID(uint32_t id){ this->objectID_ = id; objectMap_[this->objectID_] = this; }
@@ -157,8 +196,8 @@
uint32_t creatorID_;
uint32_t classID_;
- std::vector<SynchronisableVariableBase*> syncList;
- std::vector<SynchronisableVariableBase*> stringList;
+ std::vector<SynchronisableVariableBase*> syncList_;
+ std::vector<SynchronisableVariableBase*> stringList_;
uint32_t dataSize_; //size of all variables except strings
static uint8_t state_; // detemines wheter we are server (default) or client
bool backsync_; // if true the variables with mode > 1 will be synchronised to server (client -> server)
@@ -172,16 +211,33 @@
{
if (bidirectional)
{
- syncList.push_back(new SynchronisableVariableBidirectional<T>(variable, mode, cb));
- this->dataSize_ += syncList.back()->getSize(state_);
+ syncList_.push_back(new SynchronisableVariableBidirectional<T>(variable, mode, cb));
+ this->dataSize_ += syncList_.back()->getSize(state_);
}
else
{
- syncList.push_back(new SynchronisableVariable<T>(variable, mode, cb));
+ syncList_.push_back(new SynchronisableVariable<T>(variable, mode, cb));
if ( this->state_ == mode )
- this->dataSize_ += syncList.back()->getSize(state_);
+ this->dataSize_ += syncList_.back()->getSize(state_);
}
}
+
+ template <class T> void Synchronisable::unregisterVariable(T& variable){
+ std::vector<SynchronisableVariableBase*>::iterator it = syncList_.begin();
+ while(it!=syncList_.end()){
+ if( ((*it)->getReference()) == &variable ){
+ this->dataSize_ -= (*it)->getSize(Synchronisable::state_);
+ delete (*it);
+ syncList_.erase(it);
+ return;
+ }
+ else
+ it++;
+ }
+ bool unregistered_nonexistent_variable = false;
+ assert(unregistered_nonexistent_variable); //if we reach this point something went wrong:
+ // the variable has not been registered before
+ }
template <class T> void Synchronisable::registerVariable( std::set<T>& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional)
{
@@ -190,12 +246,13 @@
sv = new SynchronisableVariableBidirectional<std::set<T> >(variable, mode, cb);
else
sv = new SynchronisableVariable<std::set<T> >(variable, mode, cb);
- syncList.push_back(sv);
- stringList.push_back(sv);
+ syncList_.push_back(sv);
+ stringList_.push_back(sv);
}
template <> _NetworkExport void Synchronisable::registerVariable( std::string& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional);
// template <class T> _NetworkExport void Synchronisable::registerVariable<std::set<T> >( std::set<T>& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional);
+ template <> _NetworkExport void Synchronisable::unregisterVariable( std::string& variable );
}
Modified: code/branches/presentation3/src/modules/objects/Planet.h
===================================================================
--- code/branches/presentation3/src/modules/objects/Planet.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/modules/objects/Planet.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -93,9 +93,9 @@
}
protected:
- void registerVariables();
private:
+ void registerVariables();
void changedMesh();
void changedShadows();
Modified: code/branches/presentation3/src/modules/objects/collisionshapes/BoxCollisionShape.h
===================================================================
--- code/branches/presentation3/src/modules/objects/collisionshapes/BoxCollisionShape.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/modules/objects/collisionshapes/BoxCollisionShape.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -42,7 +42,6 @@
BoxCollisionShape(BaseObject* creator);
virtual ~BoxCollisionShape();
- void registerVariables();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
inline void setHalfExtents(const Vector3& extents)
@@ -66,6 +65,8 @@
{ return this->halfExtents_.x * 2; }
private:
+ void registerVariables();
+
btCollisionShape* createNewShape() const;
Vector3 halfExtents_;
Modified: code/branches/presentation3/src/modules/objects/collisionshapes/ConeCollisionShape.h
===================================================================
--- code/branches/presentation3/src/modules/objects/collisionshapes/ConeCollisionShape.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/modules/objects/collisionshapes/ConeCollisionShape.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -40,7 +40,6 @@
ConeCollisionShape(BaseObject* creator);
virtual ~ConeCollisionShape();
- void registerVariables();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
inline void setRadius(float value)
@@ -54,6 +53,8 @@
{ return this->height_; }
private:
+ void registerVariables();
+
btCollisionShape* createNewShape() const;
float radius_;
Modified: code/branches/presentation3/src/modules/objects/collisionshapes/PlaneCollisionShape.h
===================================================================
--- code/branches/presentation3/src/modules/objects/collisionshapes/PlaneCollisionShape.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/modules/objects/collisionshapes/PlaneCollisionShape.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -42,7 +42,6 @@
PlaneCollisionShape(BaseObject* creator);
virtual ~PlaneCollisionShape();
- void registerVariables();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
inline void setNormal(const Vector3& normal)
@@ -56,6 +55,8 @@
{ return this->offset_;}
private:
+ void registerVariables();
+
btCollisionShape* createNewShape()const;
Vector3 normal_;
Modified: code/branches/presentation3/src/modules/objects/collisionshapes/SphereCollisionShape.h
===================================================================
--- code/branches/presentation3/src/modules/objects/collisionshapes/SphereCollisionShape.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/modules/objects/collisionshapes/SphereCollisionShape.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -40,7 +40,6 @@
SphereCollisionShape(BaseObject* creator);
virtual ~SphereCollisionShape();
- void registerVariables();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
inline void setRadius(float radius)
@@ -49,6 +48,8 @@
{ return this->radius_; }
private:
+ void registerVariables();
+
btCollisionShape* createNewShape() const;
float radius_;
Modified: code/branches/presentation3/src/modules/pong/PongBall.h
===================================================================
--- code/branches/presentation3/src/modules/pong/PongBall.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/modules/pong/PongBall.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -44,8 +44,6 @@
virtual void tick(float dt);
- void registerVariables();
-
void setFieldDimension(float width, float height)
{ this->fieldWidth_ = width; this->fieldHeight_ = height; }
void setFieldDimension(const Vector2& dimension)
@@ -73,6 +71,8 @@
static const float MAX_REL_Z_VELOCITY;
private:
+ void registerVariables();
+
float fieldWidth_;
float fieldHeight_;
float speed_;
Modified: code/branches/presentation3/src/modules/pong/PongBat.h
===================================================================
--- code/branches/presentation3/src/modules/pong/PongBat.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/modules/pong/PongBat.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -40,7 +40,6 @@
PongBat(BaseObject* creator);
virtual ~PongBat() {}
- void registerVariables();
virtual void tick(float dt);
virtual void moveFrontBack(const Vector2& value);
@@ -64,6 +63,8 @@
{ return this->length_; }
private:
+ void registerVariables();
+
float movement_;
bool bMoveLocal_;
float speed_;
Modified: code/branches/presentation3/src/modules/weapons/weaponmodes/RocketFire.cc
===================================================================
--- code/branches/presentation3/src/modules/weapons/weaponmodes/RocketFire.cc 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/modules/weapons/weaponmodes/RocketFire.cc 2010-07-12 11:08:58 UTC (rev 7153)
@@ -65,7 +65,8 @@
this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
rocket->setOrientation(this->getMuzzleOrientation());
rocket->setPosition(this->getMuzzlePosition());
- rocket->setVelocity(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity() + this->getMuzzleDirection() * this->speed_);
+// rocket->setVelocity(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity() + this->getMuzzleDirection() * this->speed_);
+ rocket->setVelocity(Vector3(1,0,0));
rocket->scale(2);
rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
Modified: code/branches/presentation3/src/orxonox/CMakeLists.txt
===================================================================
--- code/branches/presentation3/src/orxonox/CMakeLists.txt 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/CMakeLists.txt 2010-07-12 11:08:58 UTC (rev 7153)
@@ -33,6 +33,7 @@
Radar.cc
ChatHistory.cc
ChatInputHandler.cc
+# Test.cc
COMPILATION_BEGIN SceneCompilation.cc
CameraManager.cc
Scene.cc
Modified: code/branches/presentation3/src/orxonox/Level.h
===================================================================
--- code/branches/presentation3/src/orxonox/Level.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/Level.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -47,7 +47,6 @@
virtual ~Level();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- void registerVariables();
inline void setDescription(const std::string& description)
{ this->description_ = description; }
@@ -61,6 +60,7 @@
private:
+ void registerVariables();
void addObject(BaseObject* object);
BaseObject* getObject(unsigned int index) const;
Modified: code/branches/presentation3/src/orxonox/Test.h
===================================================================
--- code/branches/presentation3/src/orxonox/Test.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/Test.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -49,7 +49,6 @@
virtual ~Test();
void setConfigValues();
- void registerVariables();
static void call(unsigned int clientID);
void call2(unsigned int clientID, std::string s1, std::string s2, std::string s3, std::string s4);
@@ -86,6 +85,8 @@
void printBlaBla(std::string s1, std::string s2, std::string s3, std::string s4, std::string s5);
private:
+ void registerVariables();
+
UTYPE u1;
UTYPE u2;
UTYPE u3;
Modified: code/branches/presentation3/src/orxonox/collisionshapes/CollisionShape.h
===================================================================
--- code/branches/presentation3/src/orxonox/collisionshapes/CollisionShape.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/collisionshapes/CollisionShape.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -44,7 +44,6 @@
virtual ~CollisionShape();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- void registerVariables();
inline void setPosition(const Vector3& position)
{ this->position_ = position; this->updateParent(); }
@@ -87,6 +86,8 @@
unsigned int parentID_;
private:
+ void registerVariables();
+
Vector3 position_;
Quaternion orientation_;
Vector3 scale_;
Modified: code/branches/presentation3/src/orxonox/graphics/Backlight.h
===================================================================
--- code/branches/presentation3/src/orxonox/graphics/Backlight.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/graphics/Backlight.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -44,7 +44,6 @@
virtual ~Backlight();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- void registerVariables();
virtual void tick(float dt);
virtual void changedVisibility();
@@ -80,6 +79,7 @@
virtual void changedTimeFactor(float factor_new, float factor_old);
private:
+ void registerVariables();
virtual void startturnonoff();
virtual void stopturnonoff();
virtual void poststopturnonoff();
Modified: code/branches/presentation3/src/orxonox/graphics/Billboard.h
===================================================================
--- code/branches/presentation3/src/orxonox/graphics/Billboard.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/graphics/Billboard.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -45,7 +45,6 @@
virtual ~Billboard();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- void registerVariables();
virtual void changedVisibility();
@@ -77,6 +76,7 @@
virtual void changedColour();
private:
+ void registerVariables();
void changedMaterial();
// void changedRotation();
Modified: code/branches/presentation3/src/orxonox/graphics/BlinkingBillboard.cc
===================================================================
--- code/branches/presentation3/src/orxonox/graphics/BlinkingBillboard.cc 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/graphics/BlinkingBillboard.cc 2010-07-12 11:08:58 UTC (rev 7153)
@@ -65,16 +65,18 @@
void BlinkingBillboard::registerVariables()
{
-// registerVariable(this->amplitude_, VariableDirection::ToClient);
-// registerVariable(this->frequency_, VariableDirection::ToClient);
-// registerVariable(this->phase_, VariableDirection::ToClient);
+ unregisterVariable(this->getScale3D());
+ registerVariable(this->amplitude_, VariableDirection::ToClient);
+ registerVariable(this->frequency_, VariableDirection::ToClient);
+ registerVariable(this->phase_, VariableDirection::ToClient);
+ registerVariable(this->bQuadratic_, VariableDirection::ToClient);
}
void BlinkingBillboard::tick(float dt)
{
SUPER(BlinkingBillboard, tick, dt);
- if (GameMode::isMaster() && this->isActive())
+ if (this->isActive())
{
this->time_ += dt;
if (this->bQuadratic_)
Modified: code/branches/presentation3/src/orxonox/graphics/BlinkingBillboard.h
===================================================================
--- code/branches/presentation3/src/orxonox/graphics/BlinkingBillboard.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/graphics/BlinkingBillboard.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -44,7 +44,6 @@
virtual ~BlinkingBillboard();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- void registerVariables();
virtual void tick(float dt);
@@ -69,6 +68,8 @@
{ return this->bQuadratic_; }
private:
+ void registerVariables();
+
float amplitude_;
float frequency_;
Degree phase_;
Modified: code/branches/presentation3/src/orxonox/graphics/FadingBillboard.h
===================================================================
--- code/branches/presentation3/src/orxonox/graphics/FadingBillboard.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/graphics/FadingBillboard.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -45,7 +45,6 @@
virtual ~FadingBillboard();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- void registerVariables();
virtual void tick(float dt);
virtual void changedActivity();
@@ -65,6 +64,7 @@
{ return this->fadedColour_; }
protected:
+ void registerVariables();
virtual void startturnonoff();
virtual void stopturnonoff();
virtual void poststopturnonoff();
Modified: code/branches/presentation3/src/orxonox/graphics/GlobalShader.h
===================================================================
--- code/branches/presentation3/src/orxonox/graphics/GlobalShader.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/graphics/GlobalShader.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -44,7 +44,6 @@
virtual ~GlobalShader();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- void registerVariables();
virtual void changedVisibility();
@@ -52,6 +51,7 @@
{ return this->shader_; }
private:
+ void registerVariables();
void changedCompositor();
Shader shader_;
Modified: code/branches/presentation3/src/orxonox/graphics/Light.h
===================================================================
--- code/branches/presentation3/src/orxonox/graphics/Light.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/graphics/Light.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -56,7 +56,6 @@
virtual ~Light();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- void registerVariables();
virtual void changedVisibility();
@@ -131,6 +130,7 @@
{ return this->spotlightRange_; }
private:
+ void registerVariables();
void setTypeString(const std::string& type);
std::string getTypeString() const;
Modified: code/branches/presentation3/src/orxonox/graphics/Model.h
===================================================================
--- code/branches/presentation3/src/orxonox/graphics/Model.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/graphics/Model.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -44,7 +44,6 @@
virtual ~Model();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- void registerVariables();
virtual void changedVisibility();
@@ -62,6 +61,7 @@
{ return this->bCastShadows_; }
protected:
+ void registerVariables();
void changedMesh();
void changedShadows();
Modified: code/branches/presentation3/src/orxonox/graphics/ParticleEmitter.h
===================================================================
--- code/branches/presentation3/src/orxonox/graphics/ParticleEmitter.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/graphics/ParticleEmitter.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -43,7 +43,6 @@
~ParticleEmitter();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- void registerVariables();
virtual void changedVisibility();
virtual void changedActivity();
@@ -73,6 +72,9 @@
ParticleInterface* particles_;
std::string source_;
LODParticle::Value LOD_;
+
+ private:
+ void registerVariables();
};
}
Modified: code/branches/presentation3/src/orxonox/infos/GametypeInfo.h
===================================================================
--- code/branches/presentation3/src/orxonox/infos/GametypeInfo.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/infos/GametypeInfo.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -44,8 +44,6 @@
GametypeInfo(BaseObject* creator);
virtual ~GametypeInfo();
- void registerVariables();
-
inline bool hasStarted() const
{ return this->bStarted_; }
inline bool hasEnded() const
@@ -73,6 +71,8 @@
void dispatchFadingMessage(const std::string& message);
private:
+ void registerVariables();
+
bool bStarted_;
bool bEnded_;
bool bStartCountdownRunning_;
Modified: code/branches/presentation3/src/orxonox/infos/HumanPlayer.h
===================================================================
--- code/branches/presentation3/src/orxonox/infos/HumanPlayer.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/infos/HumanPlayer.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -42,7 +42,6 @@
HumanPlayer(BaseObject* creator);
virtual ~HumanPlayer();
- void registerVariables();
void setConfigValues();
bool isInitialized() const;
@@ -100,6 +99,8 @@
OverlayGroup* humanHud_;
std::string gametypeHudTemplate_;
OverlayGroup* gametypeHud_;
+ private:
+ void registerVariables();
};
}
Modified: code/branches/presentation3/src/orxonox/infos/PlayerInfo.h
===================================================================
--- code/branches/presentation3/src/orxonox/infos/PlayerInfo.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/infos/PlayerInfo.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -43,8 +43,6 @@
PlayerInfo(BaseObject* creator);
virtual ~PlayerInfo();
- void registerVariables();
-
virtual void changedName();
virtual void changedGametype();
@@ -91,6 +89,7 @@
unsigned int clientID_;
private:
+ void registerVariables();
void networkcallback_changedcontrollableentityID();
void networkcallback_changedgtinfoID();
void updateGametypeInfo();
Modified: code/branches/presentation3/src/orxonox/items/Engine.h
===================================================================
--- code/branches/presentation3/src/orxonox/items/Engine.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/items/Engine.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -45,7 +45,6 @@
virtual ~Engine();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- void registerVariables();
void setConfigValues();
virtual void tick(float dt);
@@ -126,6 +125,7 @@
virtual PickupCarrier* getCarrierParent(void);
private:
+ void registerVariables();
void networkcallback_shipID();
SpaceShip* ship_;
Modified: code/branches/presentation3/src/orxonox/items/MultiStateEngine.h
===================================================================
--- code/branches/presentation3/src/orxonox/items/MultiStateEngine.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/items/MultiStateEngine.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -52,7 +52,6 @@
virtual ~MultiStateEngine();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- void registerVariables();
virtual void tick(float dt);
@@ -67,6 +66,8 @@
const std::string& getDefEngSndBoost();
private:
+ void registerVariables();
+
int state_;
int oldState_;
LuaState* lua_;
Modified: code/branches/presentation3/src/orxonox/sound/BaseSound.cc
===================================================================
--- code/branches/presentation3/src/orxonox/sound/BaseSound.cc 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/sound/BaseSound.cc 2010-07-12 11:08:58 UTC (rev 7153)
@@ -247,7 +247,7 @@
}
else // No source acquired so far, but might be set to playing or paused
{
- State state = this->state_; // save
+ State state = static_cast<State>(this->state_); // save
if (this->isPlaying() || this->isPaused())
doPlay();
if (state == Paused)
Modified: code/branches/presentation3/src/orxonox/sound/BaseSound.h
===================================================================
--- code/branches/presentation3/src/orxonox/sound/BaseSound.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/sound/BaseSound.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -111,7 +111,7 @@
std::string source_;
float volume_;
bool bLooping_;
- State state_;
+ uint8_t state_; // This Variable is actually of type State
float pitch_;
private:
Modified: code/branches/presentation3/src/orxonox/sound/WorldSound.cc
===================================================================
--- code/branches/presentation3/src/orxonox/sound/WorldSound.cc 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/sound/WorldSound.cc 2010-07-12 11:08:58 UTC (rev 7153)
@@ -57,7 +57,7 @@
registerVariable(source_, ObjectDirection::ToClient, new NetworkCallback<WorldSound>(this, &WorldSound::sourceChanged));
registerVariable(bLooping_, ObjectDirection::ToClient, new NetworkCallback<WorldSound>(this, &WorldSound::loopingChanged));
registerVariable(pitch_, ObjectDirection::ToClient, new NetworkCallback<WorldSound>(this, &WorldSound::pitchChanged));
- registerVariable((int&)(BaseSound::state_), ObjectDirection::ToClient, new NetworkCallback<WorldSound>(this, &WorldSound::stateChanged));
+ registerVariable((uint8_t&)(BaseSound::state_), ObjectDirection::ToClient, new NetworkCallback<WorldSound>(this, &WorldSound::stateChanged));
}
void WorldSound::XMLPort(Element& xmlelement, XMLPort::Mode mode)
Modified: code/branches/presentation3/src/orxonox/worldentities/BigExplosion.cc
===================================================================
--- code/branches/presentation3/src/orxonox/worldentities/BigExplosion.cc 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/worldentities/BigExplosion.cc 2010-07-12 11:08:58 UTC (rev 7153)
@@ -100,13 +100,24 @@
this->debrisEntity2_ = new MovableEntity(this);
this->debrisEntity3_ = new MovableEntity(this);
this->debrisEntity4_ = new MovableEntity(this);
+
+ this->debrisEntity1_->setSyncMode(0);
+ this->debrisEntity2_->setSyncMode(0);
+ this->debrisEntity3_->setSyncMode(0);
+ this->debrisEntity4_->setSyncMode(0);
this->debris1_ = new Model(this);
this->debris2_ = new Model(this);
this->debris3_ = new Model(this);
this->debris4_ = new Model(this);
+
+ this->debris1_->setSyncMode(0);
+ this->debris2_->setSyncMode(0);
+ this->debris3_->setSyncMode(0);
+ this->debris4_->setSyncMode(0);
this->explosion_ = new StaticEntity(this);
+ this->explosion_->setSyncMode(0);
this->debrisSmoke1_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/smoke7", this->LOD_);
this->debrisSmoke2_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/smoke7", this->LOD_);
@@ -157,11 +168,13 @@
effect->setDestroyAfterLife(true);
effect->setSource("Orxonox/explosion2b");
effect->setLifetime(4.0f);
+ effect->setSyncMode(0);
ParticleSpawner* effect2 = new ParticleSpawner(this->getCreator());
effect2->setDestroyAfterLife(true);
effect2->setSource("Orxonox/smoke6");
effect2->setLifetime(4.0f);
+ effect2->setSyncMode(0);
this->explosion_->attach(effect);
this->explosion_->attach(effect2);
@@ -180,6 +193,11 @@
MovableEntity* partEntity1 = new MovableEntity(this);
MovableEntity* partEntity2 = new MovableEntity(this);
+
+ part1->setSyncMode(0);
+ part2->setSyncMode(0);
+ partEntity1->setSyncMode(0);
+ partEntity2->setSyncMode(0);
partEntity1->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(10,100));
partEntity1->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians());
Modified: code/branches/presentation3/src/orxonox/worldentities/BigExplosion.h
===================================================================
--- code/branches/presentation3/src/orxonox/worldentities/BigExplosion.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/worldentities/BigExplosion.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -44,7 +44,6 @@
virtual ~BigExplosion();
virtual void tick(float dt);
- void registerVariables();
inline void setLOD(LODParticle::Value level)
{ this->LOD_ = level; this->LODchanged(); }
@@ -52,6 +51,7 @@
{ return this->LOD_; }
private:
+ void registerVariables();
void LODchanged();
void checkStop();
Modified: code/branches/presentation3/src/orxonox/worldentities/ControllableEntity.h
===================================================================
--- code/branches/presentation3/src/orxonox/worldentities/ControllableEntity.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/worldentities/ControllableEntity.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -48,7 +48,6 @@
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
virtual void tick(float dt);
- void registerVariables();
void setConfigValues();
virtual void changedPlayer() {}
@@ -166,6 +165,7 @@
Ogre::SceneNode* cameraPositionRootNode_;
private:
+ void registerVariables();
void setXMLController(Controller* controller);
void overwrite();
Modified: code/branches/presentation3/src/orxonox/worldentities/ExplosionChunk.h
===================================================================
--- code/branches/presentation3/src/orxonox/worldentities/ExplosionChunk.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/worldentities/ExplosionChunk.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -43,7 +43,6 @@
virtual ~ExplosionChunk();
virtual void tick(float dt);
- void registerVariables();
inline void setLOD(LODParticle::Value level)
{ this->LOD_ = level; this->LODchanged(); }
@@ -51,6 +50,7 @@
{ return this->LOD_; }
private:
+ void registerVariables();
void LODchanged();
void checkStop();
void stop();
Modified: code/branches/presentation3/src/orxonox/worldentities/MobileEntity.cc
===================================================================
--- code/branches/presentation3/src/orxonox/worldentities/MobileEntity.cc 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/worldentities/MobileEntity.cc 2010-07-12 11:08:58 UTC (rev 7153)
@@ -45,8 +45,6 @@
this->linearVelocity_ = Vector3::ZERO;
this->angularAcceleration_ = Vector3::ZERO;
this->angularVelocity_ = Vector3::ZERO;
-
- this->registerVariables();
}
MobileEntity::~MobileEntity()
Modified: code/branches/presentation3/src/orxonox/worldentities/MovableEntity.h
===================================================================
--- code/branches/presentation3/src/orxonox/worldentities/MovableEntity.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/worldentities/MovableEntity.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -47,7 +47,6 @@
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
- void registerVariables();
using WorldEntity::setPosition;
using WorldEntity::setOrientation;
@@ -78,6 +77,7 @@
{ return this->enableCollisionDamage_; }
private:
+ void registerVariables();
void clientConnected(unsigned int clientID);
void clientDisconnected(unsigned int clientID);
void resynchronize();
Modified: code/branches/presentation3/src/orxonox/worldentities/StaticEntity.h
===================================================================
--- code/branches/presentation3/src/orxonox/worldentities/StaticEntity.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/worldentities/StaticEntity.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -41,8 +41,6 @@
StaticEntity(BaseObject* creator);
virtual ~StaticEntity();
- void registerVariables();
-
using WorldEntity::setPosition;
using WorldEntity::setOrientation;
@@ -50,6 +48,7 @@
void setOrientation(const Quaternion& orientation);
private:
+ void registerVariables();
bool isCollisionTypeLegal(CollisionType type) const;
// network callbacks
Modified: code/branches/presentation3/src/orxonox/worldentities/WorldEntity.h
===================================================================
--- code/branches/presentation3/src/orxonox/worldentities/WorldEntity.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/worldentities/WorldEntity.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -93,7 +93,6 @@
virtual ~WorldEntity();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- void registerVariables();
inline const Ogre::SceneNode* getNode() const
{ return this->node_; }
@@ -213,6 +212,8 @@
Ogre::SceneNode* node_;
private:
+ void registerVariables();
+
inline void lookAt_xmlport(const Vector3& target)
{ this->lookAt(target); }
inline void setDirection_xmlport(const Vector3& direction)
Modified: code/branches/presentation3/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/presentation3/src/orxonox/worldentities/pawns/Pawn.cc 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/worldentities/pawns/Pawn.cc 2010-07-12 11:08:58 UTC (rev 7153)
@@ -129,7 +129,7 @@
registerVariable(this->shieldHealth_, VariableDirection::ToClient);
registerVariable(this->shieldAbsorption_, VariableDirection::ToClient);
registerVariable(this->bReload_, VariableDirection::ToServer);
- registerVariable(this->aimPosition_, Bidirectionality::ServerMaster, 0, true);
+ registerVariable(this->aimPosition_, VariableDirection::ToServer); // For the moment this variable gets only transfered to the server
}
void Pawn::tick(float dt)
Modified: code/branches/presentation3/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/presentation3/src/orxonox/worldentities/pawns/Pawn.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/worldentities/pawns/Pawn.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -49,7 +49,6 @@
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
virtual void tick(float dt);
- void registerVariables();
inline bool isAlive() const
{ return this->bAlive_; }
@@ -165,6 +164,7 @@
unsigned int numexplosionchunks_;
private:
+ void registerVariables();
inline void setWeaponSystem(WeaponSystem* weaponsystem)
{ this->weaponSystem_ = weaponsystem; }
Modified: code/branches/presentation3/src/orxonox/worldentities/pawns/SpaceShip.h
===================================================================
--- code/branches/presentation3/src/orxonox/worldentities/pawns/SpaceShip.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/worldentities/pawns/SpaceShip.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -46,7 +46,6 @@
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
virtual void tick(float dt);
- void registerVariables();
void setConfigValues();
virtual void moveFrontBack(const Vector2& value);
@@ -98,9 +97,9 @@
btVector3 localAngularAcceleration_;
private:
+ void registerVariables();
virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const;
- private:
void loadEngineTemplate();
std::string enginetemplate_;
Modified: code/branches/presentation3/src/orxonox/worldentities/pawns/Spectator.h
===================================================================
--- code/branches/presentation3/src/orxonox/worldentities/pawns/Spectator.h 2010-06-23 17:00:18 UTC (rev 7152)
+++ code/branches/presentation3/src/orxonox/worldentities/pawns/Spectator.h 2010-07-12 11:08:58 UTC (rev 7153)
@@ -43,7 +43,6 @@
virtual ~Spectator();
void setConfigValues();
- void registerVariables();
virtual void tick(float dt);
virtual void moveFrontBack(const Vector2& value);
@@ -62,6 +61,7 @@
virtual void startLocalHumanControl();
private:
+ void registerVariables();
void changedGreeting();
void changedFlareVisibility();
More information about the Orxonox-commit
mailing list