Index: branches/network/src/lib/coord/p_node.cc
===================================================================
--- branches/network/src/lib/coord/p_node.cc	(revision 6511)
+++ branches/network/src/lib/coord/p_node.cc	(revision 6526)
@@ -501,6 +501,10 @@
 {
   PNode* childNode = dynamic_cast<PNode*>(ClassList::getObject(childName, CL_PARENT_NODE));
+//  PRINTF(0)("Adding the Child: %s to: %s\n", childName, this->getName());
+//  assert( childNode != NULL );
   if (childNode != NULL)
+  {
     this->addChild(childNode);
+  }
 }
 
@@ -1063,10 +1067,5 @@
   SYNCHELP_READ_FLOAT( f3 );
   this->setRelCoor( f1, f2, f3 );
-  //this->setRelCoor( 5, 0, 0 );
-
-  /*SYNCHELP_READ_FLOAT( f1 );
-  SYNCHELP_READ_FLOAT( f2 );
-  SYNCHELP_READ_FLOAT( f3 );*/
-  //this->setAbsCoor( f1, f2, f3 );
+
 
   SYNCHELP_READ_FLOAT( f1 );
@@ -1076,10 +1075,4 @@
   this->setRelDir( Quaternion( Vector(f2, f3, f4), f1 ) );
 
-  /*SYNCHELP_READ_FLOAT( f1 );
-  SYNCHELP_READ_FLOAT( f2 );
-  SYNCHELP_READ_FLOAT( f3 );
-  SYNCHELP_READ_FLOAT( f4 );*/
-  //this->setAbsDir( Quaternion( Vector(f2, f3, f4), f1 ) );
-
   int n;
   char * childName;
@@ -1126,12 +1119,4 @@
   SYNCHELP_WRITE_FLOAT( this->relCoordinate.z );
 
-  //PRINTF(0)("%s, %f, %f, %f\n", getClassName(), relCoordinate.x, relCoordinate.y, relCoordinate.z);
-
-  /*SYNCHELP_WRITE_FLOAT( this->absCoordinate.x );
-  SYNCHELP_WRITE_FLOAT( this->absCoordinate.y );
-  SYNCHELP_WRITE_FLOAT( this->absCoordinate.z );*/
-
-  //PRINTF(0)("%s, %f, %f, %f\n", getClassName(), absCoordinate.x, absCoordinate.y, absCoordinate.z);
-
   SYNCHELP_WRITE_FLOAT( this->relDirection.w );
   SYNCHELP_WRITE_FLOAT( this->relDirection.v.x );
@@ -1139,17 +1124,141 @@
   SYNCHELP_WRITE_FLOAT( this->relDirection.v.z );
 
-  /*SYNCHELP_WRITE_FLOAT( this->absDirection.w );
-  SYNCHELP_WRITE_FLOAT( this->absDirection.v.x );
-  SYNCHELP_WRITE_FLOAT( this->absDirection.v.y );
-  SYNCHELP_WRITE_FLOAT( this->absDirection.v.z );*/
-
   int n = children.size();
+
+  //check if camera is in children
+  for (std::list<PNode*>::const_iterator it = children.begin(); it!=children.end(); it++)
+  {
+    if ( (*it)->isA(CL_CAMERA) )
+      n--;
+  }
   SYNCHELP_WRITE_INT( n );
 
   for (std::list<PNode*>::const_iterator it = children.begin(); it!=children.end(); it++)
   {
-    SYNCHELP_WRITE_STRING( (*it)->getName() );
+    //dont add camera because there is only one camera attached to local player
+    if ( !(*it)->isA(CL_CAMERA) )
+      SYNCHELP_WRITE_STRING( (*it)->getName() );
   }
 
   return SYNCHELP_WRITE_N;
 }
+
+#define __FLAG_COOR 1
+#define __FLAG_ROT  2
+
+#define __OFFSET 1.0
+
+/**
+ * Writes data from network containing information about the state which has changed
+ * @param data pointer to data
+ * @param length length of data
+ * @param sender hostID of sender
+ */
+int PNode::writeSync( const byte * data, int length, int sender )
+{
+  SYNCHELP_READ_BEGIN();
+
+  if ( this->getHostID()==this->getOwner() )
+  {
+    return SYNCHELP_READ_N;
+  }
+
+  byte flags = 0;
+  SYNCHELP_READ_BYTE( flags );
+  //PRINTF(0)("%s::FLAGS = %d\n", this->getName(), flags);
+
+  float f1, f2, f3, f4;
+
+  if ( flags & __FLAG_COOR )
+  {
+    SYNCHELP_READ_FLOAT( f1 );
+    SYNCHELP_READ_FLOAT( f2 );
+    SYNCHELP_READ_FLOAT( f3 );
+    this->setRelCoor( f1, f2, f3 );
+  }
+
+  if ( flags & __FLAG_ROT )
+  {
+    SYNCHELP_READ_FLOAT( f1 );
+    SYNCHELP_READ_FLOAT( f2 );
+    SYNCHELP_READ_FLOAT( f3 );
+    SYNCHELP_READ_FLOAT( f4 );
+    this->setRelDir( Quaternion( Vector(f2, f3, f4), f1 ) );
+  }
+
+  return SYNCHELP_READ_N;
+}
+
+/**
+ * data copied in data will bee sent to another host
+ * @param data pointer to data
+ * @param maxLength max length of data
+ * @return the number of bytes writen
+ */
+int PNode::readSync( byte * data, int maxLength )
+{
+  SYNCHELP_WRITE_BEGIN();
+
+  if ( this->getHostID()!=this->getOwner() )
+  {
+    return SYNCHELP_WRITE_N;
+  }
+
+  static float coorx = relCoordinate.x + 1;
+  static float coory = relCoordinate.y + 1;
+  static float coorz = relCoordinate.z + 1;
+
+  static float rotw = relDirection.w + 1;
+  static float rotx = relDirection.v.x + 1;
+  static float roty = relDirection.v.y + 1;
+  static float rotz = relDirection.v.z + 1;
+
+  byte flags = 0;
+  if ( fabs( coorx - relCoordinate.x ) > __OFFSET ||
+       fabs( coory - relCoordinate.y ) > __OFFSET ||
+       fabs( coorz - relCoordinate.z ) > __OFFSET )
+    flags |= __FLAG_COOR;
+
+  if ( fabs( rotw - relDirection.w ) > __OFFSET ||
+       fabs( rotx - relDirection.v.x ) > __OFFSET ||
+       fabs( roty - relDirection.v.y ) > __OFFSET ||
+       fabs( rotz - relDirection.v.z ) > __OFFSET )
+    flags |= __FLAG_ROT;
+
+  SYNCHELP_WRITE_BYTE( flags );
+  //PRINTF(0)("FLAGS = %d\n", flags);
+
+  coorx = relCoordinate.x;
+  coory = relCoordinate.y;
+  coorz = relCoordinate.z;
+
+
+  rotw = relDirection.w;
+  rotx = relDirection.v.x;
+  roty = relDirection.v.y;
+  rotz = relDirection.v.z;
+
+
+  if ( flags & __FLAG_COOR )
+  {
+
+    PRINTF(0)("%f %f %f\n", coorx, coory, coorz);
+
+    SYNCHELP_WRITE_FLOAT( this->relCoordinate.x );
+    SYNCHELP_WRITE_FLOAT( this->relCoordinate.y );
+    SYNCHELP_WRITE_FLOAT( this->relCoordinate.z );
+  }
+
+  if ( flags & __FLAG_ROT )
+  {
+
+    PRINTF(0)("%f %f %f %f\n", rotw, rotx, roty, rotz);
+
+    SYNCHELP_WRITE_FLOAT( this->relDirection.w );
+    SYNCHELP_WRITE_FLOAT( this->relDirection.v.x );
+    SYNCHELP_WRITE_FLOAT( this->relDirection.v.y );
+    SYNCHELP_WRITE_FLOAT( this->relDirection.v.z );
+  }
+
+  return SYNCHELP_WRITE_N;
+}
Index: branches/network/src/lib/coord/p_node.h
===================================================================
--- branches/network/src/lib/coord/p_node.h	(revision 6511)
+++ branches/network/src/lib/coord/p_node.h	(revision 6526)
@@ -185,4 +185,6 @@
   int       writeState(const byte* data, int length, int sender);
   int       readState(byte* data, int maxLength );
+  int       writeSync(const byte* data, int length, int sender);
+  int       readSync(byte* data, int maxLength );
 
  private:
Index: branches/network/src/lib/network/network_game_manager.cc
===================================================================
--- branches/network/src/lib/network/network_game_manager.cc	(revision 6511)
+++ branches/network/src/lib/network/network_game_manager.cc	(revision 6526)
@@ -130,14 +130,14 @@
     }
 
+    if ( b == REQUEST_ENTITY_LIST )
+    {
+      sendEntityList( sender );
+      continue;
+    }
+
     if ( b == REQUEST_SYNC )
     {
       if ( !handleRequestSync( i, data, length, sender ) )
         return i;
-      continue;
-    }
-
-    if ( b == REQUEST_ENTITY_LIST )
-    {
-      sendEntityList( sender );
       continue;
     }
@@ -486,5 +486,5 @@
 
     //HACK: hack to prevent collision
-    if ( b->isA(CL_WORLD_ENTITY) )
+    if ( b->isA(CL_WORLD_ENTITY) /*&& !b->isA(CL_PLAYABLE)*/ )
     {
       if ( NetworkManager::getInstance()->getHostID()!=0 )
@@ -492,6 +492,6 @@
         static Vector pos = Vector(1000.0, 1000.0, 1000.0);
         PNode *p = dynamic_cast<PNode*>(b);
-        p->setRelCoor(pos);
-        p->updateNode(0);
+        p->setAbsCoor(pos);
+        //p->updateNode(0);
         pos += Vector(1000.0, 1000.0, 1000.0);
       }
@@ -599,4 +599,5 @@
 
   Playable *p = NULL;
+  Synchronizeable *s = NULL;
 
   for ( ; it !=networkStream->getSyncEnd(); it++ )
@@ -604,4 +605,8 @@
     if ( (*it)->getUniqueID()==uniqueID )
     {
+      if ( (*it)->isA( CL_SYNCHRONIZEABLE ) )
+      {
+        s = dynamic_cast<Synchronizeable*>(*it);
+      }
       if ( (*it)->isA( CL_PLAYABLE ) )
       {
@@ -617,5 +622,10 @@
   Player* player = State::getPlayer();
   assert(p != NULL);
+  assert(s != NULL);
   assert(player != NULL);
+
+  s->setIsOutOfSync( true );
+
+  PRINTF(0)("uniqueID = %d\n", s->getUniqueID());
 
   player->setControllable(p);
@@ -874,6 +884,6 @@
 void NetworkGameManager::sync( int uniqueID, int owner )
 {
-  if ( owner==this->getHostID() )
-    return;
+  /*if ( owner==this->getHostID() )
+  return;*/
 
   if ( !isServer() )
Index: branches/network/src/lib/network/network_stream.cc
===================================================================
--- branches/network/src/lib/network/network_stream.cc	(revision 6511)
+++ branches/network/src/lib/network/network_stream.cc	(revision 6526)
@@ -311,5 +311,5 @@
             if ( (*it)->writeBytes(upBuffer+sizeof(header), dataLength, i) != header.length )
             {
-              PRINTF(1)("%s did not read all the data!\n", (*it)->getClassName());
+              PRINTF(1)("%s did not read all the data id = %d!\n", (*it)->getClassName(), (*it)->getUniqueID());
               break;
             }
