Index: /branches/network/src/lib/coord/p_node.cc
===================================================================
--- /branches/network/src/lib/coord/p_node.cc	(revision 6684)
+++ /branches/network/src/lib/coord/p_node.cc	(revision 6685)
@@ -488,4 +488,14 @@
       this->children.push_back(child);
     child->parentCoorChanged();
+
+//     if(this->getUniqueID() == NET_UID_UNASSIGNED)
+//     {
+//       PRINTF(1)("Adding to an UNASSIGNED PNode - looking for next assigned Node\n");
+//       PNode* node = this->seekNextAssignedPNode(this);
+//       if( node == NULL)
+//         PRINTF(1)("    Got NULL - Is this the NULLParent - uid %i\n", this->getUniqueID());
+//       else
+//         PRINTF(1)("    Found next assigned node: %i\n", node->getUniqueID());
+//     }
   }
   else
@@ -496,4 +506,21 @@
     child->parentCoorChanged();
   }
+}
+
+
+PNode* PNode::seekNextAssignedPNode(PNode* node) const
+{
+  PNode* tmpNode = node->parent;
+  printf("entering seek PNode loop for name: %s, uid: %i\n", node->getName(), node->getUniqueID());
+  if(tmpNode)
+    printf("  @node name: %s, uid: %d\n", tmpNode->getName(), tmpNode->getUniqueID());
+  while( tmpNode != NULL && tmpNode->getUniqueID() == NET_UID_UNASSIGNED)
+  {
+    printf("  @node name: %s, uid: %d\n", tmpNode->getName(), tmpNode->getUniqueID());
+    tmpNode = tmpNode->parent;
+  }
+  printf("leaving PNode loop\n\n");
+
+  return tmpNode;
 }
 
Index: /branches/network/src/lib/coord/p_node.h
===================================================================
--- /branches/network/src/lib/coord/p_node.h	(revision 6684)
+++ /branches/network/src/lib/coord/p_node.h	(revision 6685)
@@ -147,4 +147,6 @@
   void removeNode();
 
+  PNode* seekNextAssignedPNode(PNode* node) const;
+
   /** @param parent the new parent of this node */
   inline void setParent (PNode* parent) { parent->addChild(this); };
Index: /branches/network/src/lib/network/netdefs.h
===================================================================
--- /branches/network/src/lib/network/netdefs.h	(revision 6684)
+++ /branches/network/src/lib/network/netdefs.h	(revision 6685)
@@ -28,3 +28,10 @@
 } NodeType;
 
+
+typedef enum {
+  NET_UID_UNASSIGNED = -1,
+
+  NET_UID_NUMBER
+} UidType;
+
 #endif /* _NETWORK_MANAGER */
Index: /branches/network/src/lib/network/network_game_manager.cc
===================================================================
--- /branches/network/src/lib/network/network_game_manager.cc	(revision 6684)
+++ /branches/network/src/lib/network/network_game_manager.cc	(revision 6685)
@@ -407,8 +407,9 @@
   e = this->networkStream->getSyncEnd();
 
+  // send the packet header
   if ( !writeToClientBuffer( outBuffer[userID], (byte)NET_CREATE_ENTITY_LIST ) )
     return;
 
-  // -2 because you must not send network_game_manager and handshake
+  // send the number of entities: -2 because you must not send network_game_manager and handshake
   if ( !writeToClientBuffer( outBuffer[userID], networkStream->getSyncCount() ) )
     return;
@@ -416,9 +417,16 @@
   //PRINTF(0)("SendEntityList: n = %d\n", networkStream->getSyncCount()-2 );
 
-  int n = 0;
-
+  // first send the NullParent
+  if ( !writeToClientBuffer( outBuffer[userID], (int)PNode::getNullParent()->getLeafClassID()) )
+    return;
+  if ( !writeToClientBuffer( outBuffer[userID], (int)PNode::getNullParent()->getUniqueID()) )
+    return;
+  if ( !writeToClientBuffer( outBuffer[userID], (int)PNode::getNullParent()->getOwner()) )
+    return;
+
+  // now send the rest of the entities
   while ( it != e )
   {
-    if( (*it)->beSynchronized())
+    if( (*it)->beSynchronized() && (*it) != PNode::getNullParent())
     {
       PRINTF(0)("SENDING ENTITY %s classid: %x, uniqueid %d\n", (*it)->getClassName(), (*it)->getLeafClassID(), (*it)->getUniqueID() );
@@ -489,5 +497,5 @@
   if( classID == CL_NULL_PARENT)
   {
-    b = PNode::getNullParent();
+    b = (BaseObject*)PNode::getNullParent();
   }
   else
@@ -806,14 +814,4 @@
     {
       BaseObject* b = doCreateEntity( (ClassID)classID, uniqueID, owner );
-
-      /*if ( b != NULL )
-      {
-        if ( b->isA(CL_WORLD_ENTITY) )
-        {
-          int n = dynamic_cast<WorldEntity*>(b)->writeState( data, length, sender );
-
-          i += n;
-        }
-    }*/
     }
 
Index: /branches/network/src/lib/network/synchronizeable.cc
===================================================================
--- /branches/network/src/lib/network/synchronizeable.cc	(revision 6684)
+++ /branches/network/src/lib/network/synchronizeable.cc	(revision 6685)
@@ -39,5 +39,5 @@
   this->hostID = SharedNetworkData::getInstance()->getHostID();
   this->setIsServer(this->hostID == 0);
-  this->uniqueID = -1;
+  this->uniqueID = NET_UID_UNASSIGNED;
   this->networkStream = NULL;
   this->setRequestedSync( false );
Index: /branches/network/src/orxonox.cc
===================================================================
--- /branches/network/src/orxonox.cc	(revision 6684)
+++ /branches/network/src/orxonox.cc	(revision 6685)
@@ -279,10 +279,10 @@
   if( this->serverName != NULL) // we are a client
   {
+    State::setOnline(true);
     NetworkManager::getInstance()->establishConnection(this->serverName, port);
+  }
+  else if( this->port > 0) {    // we are a server
     State::setOnline(true);
-  }
-  else if( this->port > 0) {    // we are a server
     NetworkManager::getInstance()->createServer(port);
-    State::setOnline(true);
   }
   return 0;
Index: /branches/network/src/world_entities/environments/water.cc
===================================================================
--- /branches/network/src/world_entities/environments/water.cc	(revision 6684)
+++ /branches/network/src/world_entities/environments/water.cc	(revision 6685)
@@ -219,2 +219,51 @@
   this->grid->rebuildNormals(this->height);
 }
+
+
+/**
+ * Writes data from network containing information about the state
+ * @param data pointer to data
+ * @param length length of data
+ * @param sender hostID of sender
+ */
+int Water::writeBytes( const byte * data, int length, int sender )
+{
+//   setRequestedSync( false );
+//   setIsOutOfSync( false );
+//
+//   SYNCHELP_READ_BEGIN();
+//
+//   SYNCHELP_READ_FKT( WorldEntity::writeState );
+//
+//   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 Water::readBytes( byte * data, int maxLength, int * reciever )
+{
+//   SYNCHELP_WRITE_BEGIN();
+//
+//   if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner() )
+//   {
+//     (NetworkGameManager::getInstance())->sync( this->getUniqueID(), this->getOwner() );
+//     setRequestedSync( true );
+//   }
+//
+//   int rec = this->getRequestSync();
+//   if ( rec > 0 )
+//   {
+//     *reciever = rec;
+//
+//     SYNCHELP_WRITE_FKT( WorldEntity::readState );
+//
+//   }
+//
+//   *reciever = 0;
+//   return SYNCHELP_WRITE_N;
+}
Index: /branches/network/src/world_entities/environments/water.h
===================================================================
--- /branches/network/src/world_entities/environments/water.h	(revision 6684)
+++ /branches/network/src/world_entities/environments/water.h	(revision 6685)
@@ -35,4 +35,8 @@
    void tick(float dt);
 
+   virtual int writeBytes(const byte* data, int length, int sender);
+   virtual int readBytes(byte* data, int maxLength, int * reciever);
+
+
   private:
     Grid*           grid;            //!< The water-surface-model to render with
