Index: trunk/src/lib/coord/p_node.cc
===================================================================
--- trunk/src/lib/coord/p_node.cc	(revision 6480)
+++ trunk/src/lib/coord/p_node.cc	(revision 6498)
@@ -1039,6 +1039,4 @@
   SYNCHELP_READ_FKT( BaseObject::writeState );
 
-  PRINTF(0)("name = %s\n", this->getName());
-
   char * parentName = NULL;
   SYNCHELP_READ_STRINGM( parentName );
@@ -1065,9 +1063,9 @@
   SYNCHELP_READ_FLOAT( f3 );
   this->setRelCoor( f1, f2, f3 );
-  //this->setRelCoor( 10, 0, 0 );
-
-  SYNCHELP_READ_FLOAT( f1 );
+  //this->setRelCoor( 5, 0, 0 );
+
+  /*SYNCHELP_READ_FLOAT( f1 );
   SYNCHELP_READ_FLOAT( f2 );
-  SYNCHELP_READ_FLOAT( f3 );
+  SYNCHELP_READ_FLOAT( f3 );*/
   //this->setAbsCoor( f1, f2, f3 );
 
@@ -1078,8 +1076,8 @@
   this->setRelDir( Quaternion( Vector(f2, f3, f4), f1 ) );
 
-  SYNCHELP_READ_FLOAT( f1 );
+  /*SYNCHELP_READ_FLOAT( f1 );
   SYNCHELP_READ_FLOAT( f2 );
   SYNCHELP_READ_FLOAT( f3 );
-  SYNCHELP_READ_FLOAT( f4 );
+  SYNCHELP_READ_FLOAT( f4 );*/
   //this->setAbsDir( Quaternion( Vector(f2, f3, f4), f1 ) );
 
@@ -1092,5 +1090,5 @@
   {
     SYNCHELP_READ_STRINGM( childName );
-    PRINTF(0)("childname = %s\n", childName);
+    //PRINTF(0)("childname = %s\n", childName);
     addChild( childName );
     delete childName;
@@ -1113,6 +1111,4 @@
   SYNCHELP_WRITE_FKT( BaseObject::readState );
 
-  PRINTF(0)("name = %s\n", this->getName());
-
   if ( this->parent )
   {
@@ -1130,11 +1126,11 @@
   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 );
+  //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->absCoordinate.z );*/
+
+  //PRINTF(0)("%s, %f, %f, %f\n", getClassName(), absCoordinate.x, absCoordinate.y, absCoordinate.z);
 
   SYNCHELP_WRITE_FLOAT( this->relDirection.w );
@@ -1143,8 +1139,8 @@
   SYNCHELP_WRITE_FLOAT( this->relDirection.v.z );
 
-  SYNCHELP_WRITE_FLOAT( this->absDirection.w );
+  /*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 );
+  SYNCHELP_WRITE_FLOAT( this->absDirection.v.z );*/
 
   int n = children.size();
@@ -1153,7 +1149,7 @@
   for (std::list<PNode*>::const_iterator it = children.begin(); it!=children.end(); it++)
   {
-    PRINTF(0)("childname = %s\n", (*it)->getName() );
     SYNCHELP_WRITE_STRING( (*it)->getName() );
   }
+
   return SYNCHELP_WRITE_N;
 }
Index: trunk/src/lib/coord/p_node.h
===================================================================
--- trunk/src/lib/coord/p_node.h	(revision 6480)
+++ trunk/src/lib/coord/p_node.h	(revision 6498)
@@ -21,4 +21,5 @@
 #include "base_object.h"
 #include "stdincl.h"
+#include "synchronizeable.h"
 
 #include "vector.h"
@@ -72,5 +73,5 @@
 
 //! Patent Node is a Engine to calculate the position of an Object in respect to the position of its parent.
-class PNode : virtual public BaseObject {
+class PNode : virtual public BaseObject, virtual public Synchronizeable {
  public:
   PNode (PNode* parent = PNode::getNullParent(), long nodeFlags = PNODE_PARENT_MODE_DEFAULT);
Index: trunk/src/lib/lang/base_object.cc
===================================================================
--- trunk/src/lib/lang/base_object.cc	(revision 6480)
+++ trunk/src/lib/lang/base_object.cc	(revision 6498)
@@ -199,4 +199,9 @@
   }
   SYNCHELP_READ_STRINGM( this->objectName );
+  if ( this->objectName && !strcmp(this->objectName, "") )
+  {
+    delete[] this->objectName;
+    this->objectName = NULL;
+  }
 
   return SYNCHELP_READ_N;
Index: trunk/src/lib/network/network_game_manager.cc
===================================================================
--- trunk/src/lib/network/network_game_manager.cc	(revision 6480)
+++ trunk/src/lib/network/network_game_manager.cc	(revision 6498)
@@ -25,4 +25,10 @@
 
 #include "p_node.h"
+#include "state.h"
+#include "game_world.h"
+#include "world_entity.h"
+#include "playable.h"
+#include "player.h"
+#include "network_manager.h"
 
 
@@ -81,6 +87,4 @@
   {
     b = data[i++];
-
-    PRINTF(0)("WriteBytes: b = %d\n", b);
 
     if ( isServer() )
@@ -142,5 +146,4 @@
     if ( b == REQUEST_ENTITY_LIST )
     {
-      PRINTF(0)("sending THE list\n");
       sendEntityList( sender );
       continue;
@@ -163,7 +166,7 @@
     SYNCHELP_WRITE_BYTE( b );
     hasRequestedWorld = true;
-    PRINTF(0)("the world is enough! id=%d\n", this->getUniqueID());
     return SYNCHELP_WRITE_N;
   }
+
   for ( int i = 0; i<outBuffer.size(); i++ )
   {
@@ -216,6 +219,7 @@
  * @param classID: The ID of the class of which an entity should be created
  */
-void NetworkGameManager::createEntity( ClassID classID, int owner )
-{
+int NetworkGameManager::createEntity( ClassID classID, int owner )
+{
+
   if ( this->isServer() )
   {
@@ -223,12 +227,13 @@
     {
       PRINTF(1)("Cannot create entity! There are no more uniqueIDs left!\n");
-      return;
-    }
-
-    this->executeCreateEntity( classID, newUniqueID++, owner );
+      return -1;
+    }
+
+    return this->executeCreateEntity( classID, newUniqueID++, owner );
   }
   else
   {
     this->requestCreateEntity( classID );
+    return -1;
   }
 }
@@ -273,4 +278,5 @@
       delete b;
     }
+
   }
   else
@@ -330,16 +336,18 @@
  * @param classID: The ID of the class of which an entity should be created
  */
-void NetworkGameManager::executeCreateEntity(ClassID classID, int uniqueID, int owner)
+int NetworkGameManager::executeCreateEntity(ClassID classID, int uniqueID, int owner)
 {
   if ( !writeToClientBuffer( allOutBuffer, (byte)CREATE_ENTITY ) )
-    return;
+    return -1;
   if ( !writeToClientBuffer( allOutBuffer, (int)classID ) )
-    return;
+    return -1;
   if ( !writeToClientBuffer( allOutBuffer, uniqueID ) )
-    return;
+    return -1;
   if ( !writeToClientBuffer( allOutBuffer, owner ) )
-    return;
+    return -1;
 
   doCreateEntity( classID, uniqueID, owner );
+
+  return uniqueID;
 }
 
@@ -401,5 +409,4 @@
     if ( !writeToClientBuffer( outBuffer[userID], (int)((*it)->getLeafClassID()) ) )
       return;
-      //PRINTF(0)("SendEntityList: ClassID = %x\n", (*it)->getRealClassID());
 
     if ( !writeToClientBuffer( outBuffer[userID], (int)((*it)->getUniqueID()) ) )
@@ -409,23 +416,23 @@
       return;
 
-
-    PRINTF(0)("id = %x %s %s\n", (int)((*it)->getLeafClassID()), (*it)->getClassName(), (*it)->getName());
-
-
-    /*if ( (*it)->isA(CL_WORLD_ENTITY) )
-    {
-      n = dynamic_cast<WorldEntity*>((*it))->readState( outBuffer[userID].buffer, outBuffer[userID].maxLength-outBuffer[userID].length );
-      if ( n = 0 )
-      {
-        PRINTF(2)("n = 0\n");
-      }
-      outBuffer[userID].length += n;
-  }*/
-
     it++;
   }
 
-
-}
+  signalNewPlayer( userID );
+}
+
+
+
+bool NetworkGameManager::signalNewPlayer(int userId)
+{
+
+  /* create new playable for Player*/
+  PRINTF(0)("Request for creation: %i\n", userId);
+  int uniqueId = this->createEntity(CL_SPACE_SHIP, userId);
+  PRINTF(0)("Request for creation: userid: %i, uniqueid: %i\n", userId, uniqueId);
+  this->sendYouAre(uniqueId, userId);
+
+}
+
 
 /**
@@ -474,4 +481,18 @@
       s->setIsOutOfSync( true );
     PRINTF(0)("Fabricated %s with id %d\n", s->getClassName(), s->getUniqueID());
+
+    //HACK: hack to prevent collision
+    if ( b->isA(CL_WORLD_ENTITY) )
+    {
+      if ( NetworkManager::getInstance()->getHostID()!=0 )
+      {
+        static Vector pos = Vector(1000.0, 1000.0, 1000.0);
+        PNode *p = dynamic_cast<PNode*>(b);
+        p->setRelCoor(pos);
+        p->updateNode(0);
+        pos += Vector(1000.0, 1000.0, 1000.0);
+      }
+    }
+
     return b;
   }
@@ -571,5 +592,31 @@
 void NetworkGameManager::doYouAre( int uniqueID )
 {
-  //TODO: what has to be done
+
+  SynchronizeableList::const_iterator it = this->networkStream->getSyncBegin();
+
+  Playable *p = NULL;
+
+  for ( ; it !=networkStream->getSyncEnd(); it++ )
+  {
+    if ( (*it)->getUniqueID()==uniqueID )
+    {
+      if ( (*it)->isA( CL_PLAYABLE ) )
+      {
+        p = dynamic_cast<Playable*>(*it);
+        break;
+      } else
+      {
+        PRINTF(1)("UniqueID is not a Playable\n");
+      }
+    }
+  }
+
+  Player* player = State::getPlayer();
+  assert(p != NULL);
+  assert(player != NULL);
+
+  player->setControllable(p);
+
+
 }
 
@@ -716,5 +763,4 @@
     i += Converter::byteArrayToInt( &data[i], &owner );
 
-    PRINTF(0)("before fabricate\n");
     if ( classID != CL_NETWORK_GAME_MANAGER && classID != CL_HANDSHAKE )
     {
Index: trunk/src/lib/network/network_game_manager.h
===================================================================
--- trunk/src/lib/network/network_game_manager.h	(revision 6480)
+++ trunk/src/lib/network/network_game_manager.h	(revision 6498)
@@ -74,5 +74,5 @@
     virtual void readDebug() const;
 
-    void createEntity( ClassID classID, int owner = 0 );
+    int createEntity( ClassID classID, int owner = 0 );
     BaseObject* createEntity(const TiXmlElement* element);
     void removeEntity( int uniqueID );
@@ -87,5 +87,5 @@
 
     void requestCreateEntity(ClassID classID);
-    void executeCreateEntity(ClassID classID, int uniqueID = 0, int owner = 0);
+    int executeCreateEntity(ClassID classID, int uniqueID = 0, int owner = 0);
 
     void requestRemoveEntity(int uniqueID);
@@ -100,4 +100,6 @@
 
     bool canCreateEntity(ClassID classID);
+
+    bool signalNewPlayer(int userId);
 
     void resizeBufferVector(int n);
Index: trunk/src/lib/network/network_stream.cc
===================================================================
--- trunk/src/lib/network/network_stream.cc	(revision 6480)
+++ trunk/src/lib/network/network_stream.cc	(revision 6498)
@@ -166,5 +166,5 @@
       networkSockets[0]->destroy();
       networkSockets[0] = NULL;
-      //TODO: delete handshake from synchronizeable list so i can delete it
+
       if ( handshakes[0] )
         delete handshakes[0];
@@ -192,5 +192,5 @@
           else
           {
-            //this->networkGameManager->sendEntityList( i );
+
           }
           PRINT(0)("handshake finished id=%d\n", handshakes[i]->getNetworkGameManagerId());
@@ -252,5 +252,5 @@
           if ( networkSockets[reciever] != NULL )
           {
-            PRINTF(0)("write %d bytes to socket %d\n", dataLength, reciever);
+            PRINTF(5)("write %d bytes to socket %d\n", dataLength, reciever);
             networkSockets[reciever]->writePacket(downBuffer, dataLength);
           }
@@ -266,5 +266,5 @@
             if ( networkSockets[i] != NULL )
             {
-              PRINTF(0)("write %d bytes to socket %d\n", dataLength, reciever);
+              PRINTF(5)("write %d bytes to socket %d\n", dataLength, reciever);
               networkSockets[i]->writePacket(downBuffer, dataLength);
             }
@@ -291,5 +291,5 @@
         dataLength -= sizeof(header);
 
-        PRINTF(0)("read %d bytes from socket uniqueID = %d\n", dataLength, header.synchronizeableID);
+        PRINTF(5)("read %d bytes from socket uniqueID = %d\n", dataLength, header.synchronizeableID);
 
         if ( dataLength != header.length )
@@ -372,5 +372,5 @@
       networkSockets[i]->destroy();
       networkSockets[i] = NULL;
-      //TODO: delete handshake from synchronizeable list so i can delete it
+
       if ( handshakes[i] )
         delete handshakes[i];
