Index: /trunk/src/lib/coord/p_node.cc
===================================================================
--- /trunk/src/lib/coord/p_node.cc	(revision 6497)
+++ /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 6497)
+++ /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 6497)
+++ /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 6497)
+++ /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 6497)
+++ /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 6497)
+++ /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];
Index: /trunk/src/story_entities/game_world.cc
===================================================================
--- /trunk/src/story_entities/game_world.cc	(revision 6497)
+++ /trunk/src/story_entities/game_world.cc	(revision 6498)
@@ -131,4 +131,5 @@
   this->shell = new Shell();
 
+  State::setCurrentStoryEntity(dynamic_cast<StoryEntity*>(this));
   this->dataTank->init();
 }
Index: /trunk/src/story_entities/game_world.h
===================================================================
--- /trunk/src/story_entities/game_world.h	(revision 6497)
+++ /trunk/src/story_entities/game_world.h	(revision 6498)
@@ -9,5 +9,5 @@
 
 #include "story_entity.h"
-
+#include "game_world_data.h"
 
 class TiXmlElement;
@@ -56,4 +56,7 @@
 
 
+    inline void setSky(WorldEntity* sky) { this->dataTank->sky = sky; }
+
+
   protected:
     /* world - running functions */
Index: /trunk/src/story_entities/multi_player_world.cc
===================================================================
--- /trunk/src/story_entities/multi_player_world.cc	(revision 6497)
+++ /trunk/src/story_entities/multi_player_world.cc	(revision 6498)
@@ -21,4 +21,5 @@
 #include "factory.h"
 #include "load_param.h"
+#include "shell_command.h"
 
 #include "network_manager.h"
@@ -26,4 +27,8 @@
 
 using namespace std;
+
+
+//! Register a command to print some multiplayer world infos
+SHELL_COMMAND(debug, MultiPlayerWorld, debug);
 
 
@@ -79,2 +84,10 @@
 }
 
+
+/**
+ * some debug ouptut - shell command
+ */
+void MultiPlayerWorld::debug()
+{
+  ((MultiPlayerWorldData*)this->dataTank)->debug();
+}
Index: /trunk/src/story_entities/multi_player_world.h
===================================================================
--- /trunk/src/story_entities/multi_player_world.h	(revision 6497)
+++ /trunk/src/story_entities/multi_player_world.h	(revision 6498)
@@ -27,4 +27,6 @@
   void loadParams(const TiXmlElement* root);
 
+  void debug();
+
   protected:
     virtual void synchronize();
Index: /trunk/src/story_entities/multi_player_world_data.cc
===================================================================
--- /trunk/src/story_entities/multi_player_world_data.cc	(revision 6497)
+++ /trunk/src/story_entities/multi_player_world_data.cc	(revision 6498)
@@ -50,4 +50,5 @@
 
 
+
 using namespace std;
 
@@ -58,5 +59,7 @@
 MultiPlayerWorldData::MultiPlayerWorldData()
     : GameWorldData()
-{}
+{
+  this->toggle = false;
+}
 
 
@@ -157,15 +160,6 @@
         }
       }
-      /* clients only spawn the SpaceShip */
-      /// FIXME it is not said to be a SpaceShip
-      else if( !strcmp( element->Value(), "SpaceShip"))
-      {
-        BaseObject* created = Factory::fabricate(element);
-        if( created != NULL )
-          PRINTF(1)("Created a %s: %s (%8.u)\n", created->getClassName(), created->getName(), created->getLeafClassID());
-        else
-          PRINTF(1)("NetworkWorld: could not create this entity\n");
-      }
       element = element->NextSiblingElement();
+
 
       glmis->step();
@@ -173,13 +167,24 @@
     }
 
-
-    /* create a Player */
-    this->localPlayer = new Player();
-    Playable* playable;
-    const list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE);
-    if (playableList != NULL)
-    {
-      playable = dynamic_cast<Playable*>(playableList->front());
-      this->localPlayer->setControllable(playable);
+    if( NetworkManager::getInstance()->isGameServer())
+    {
+      this->localPlayer = new Player();
+      State::setPlayer(this->localPlayer);
+
+      Playable* playable;
+      const std::list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE);
+      assert( playableList != NULL);
+
+      if (playableList != NULL)
+      {
+        playable = dynamic_cast<Playable*>(playableList->front());
+        this->localPlayer->setControllable(playable);
+      }
+    }
+    else
+    {
+      /* create a Player */
+      this->localPlayer = new Player();
+      State::setPlayer(this->localPlayer);
     }
 
@@ -221,2 +226,64 @@
 }
 
+
+/**
+ * some debug output
+ */
+void MultiPlayerWorldData::debug()
+{
+  PRINT(0)("==================================================\n");
+  Playable* playable;
+  const std::list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE);
+  assert(playableList != NULL);
+  std::list<BaseObject*>::const_iterator entity;
+
+
+
+  for (entity = playableList->begin(); entity != playableList->end(); entity++)
+  {
+    Playable* p = dynamic_cast<Playable*>(*entity);
+    PRINTF(0)("Got a playable, class: %s, name: %s, uid: %i\n", (*entity)->getClassName(), (*entity)->getName(), p->getUniqueID());
+  }
+
+
+  if( this->toggle)
+  {
+    playable = dynamic_cast<Playable*>(playableList->front());
+    this->localPlayer->disconnectControllable();
+    this->localPlayer->setControllable(playable);
+    this->toggle = !this->toggle;
+  }
+  else
+  {
+    playable = dynamic_cast<Playable*>(playableList->back());
+    this->localPlayer->disconnectControllable();
+    this->localPlayer->setControllable(playable);
+    this->toggle = !this->toggle;
+  }
+
+
+
+  PNode* cam = State::getCameraTarget();
+  PRINT(0)("Camera has target - class: %s, name: %s, uid: %i\n", cam->getClassName(), cam->getName(), cam->getUniqueID());
+
+  PRINT(0)("==================================================\n");
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /trunk/src/story_entities/multi_player_world_data.h
===================================================================
--- /trunk/src/story_entities/multi_player_world_data.h	(revision 6497)
+++ /trunk/src/story_entities/multi_player_world_data.h	(revision 6498)
@@ -24,4 +24,6 @@
     virtual ErrorMessage init();
 
+    void debug();
+
 
   protected:
@@ -33,4 +35,7 @@
     virtual ErrorMessage unloadWorldEntities();
     virtual ErrorMessage unloadScene();
+
+  private:
+    bool toggle;
 };
 
Index: /trunk/src/util/hud.cc
===================================================================
--- /trunk/src/util/hud.cc	(revision 6497)
+++ /trunk/src/util/hud.cc	(revision 6498)
@@ -143,6 +143,6 @@
 void Hud::updateResolution()
 {
-  this->resX = State::resX();
-  this->resY = State::resY();
+  this->resX = State::getResX();
+  this->resY = State::getResY();
   if (this->energyWidget != NULL)
   {
@@ -174,5 +174,5 @@
 void Hud::tick(float dt)
 {
-  if (this->resY != State::resY() || this->resX != State::resY())
+  if (this->resY != State::getResY() || this->resX != State::getResY())
     this->updateResolution();
 }
Index: /trunk/src/util/state.cc
===================================================================
--- /trunk/src/util/state.cc	(revision 6497)
+++ /trunk/src/util/state.cc	(revision 6498)
@@ -29,11 +29,16 @@
 PNode* State::cameraTarget = NULL;
 
-Player* State::_localPlayer = NULL;
-SkyBox* State::_skyBox = NULL;
+SkyBox* State::skyBox = NULL;
 
 ObjectManager* State::objectManager = NULL;
 
-unsigned int State::_resX = 1;
-unsigned int State::_resY = 1;
+
+unsigned int State::resX = 1;
+unsigned int State::resY = 1;
+
+StoryEntity* State::storyEntity = NULL;
+
+Player* State::player = NULL;
+
 
 /**
Index: /trunk/src/util/state.h
===================================================================
--- /trunk/src/util/state.h	(revision 6497)
+++ /trunk/src/util/state.h	(revision 6498)
@@ -7,10 +7,12 @@
 #define _STATE_H
 
+
 // FORWARD DECLARATION
 class PNode;
 class WorldEntity;
+class Player;
+class SkyBox;
+class StoryEntity;
 class ObjectManager;
-class SkyBox;
-class Player;
 
 
@@ -34,14 +36,11 @@
   static inline PNode* getCameraTarget() { return State::cameraTarget; };
 
-  /** @returns the Local Player */
-  static inline Player* localsPlayer() { return State::_localPlayer; };
-  /** @param localPlayer the local Player */
-  static inline void setLocalPlayer(Player* localPlayer) { State::_localPlayer = localPlayer; };
-
+  ////////////////
+  /// SKYBOX   ///
+  ////////////////
   /** @returns the current SkyBox */
-  static inline SkyBox* skyBox() { return State::_skyBox; };
+  static inline SkyBox* getSkyBox() { return State::skyBox; };
   /** @param skyBox the SkyBox */
-  static inline SkyBox* setSkyBox(SkyBox* skyBox) { State::_skyBox = skyBox; };
-
+  static inline SkyBox* setSkyBox(SkyBox* skyBox) { State::skyBox = skyBox; };
 
   //////////////////////
@@ -53,12 +52,25 @@
   static inline ObjectManager* getObjectManager() { return State::objectManager; };
 
+  static inline void setResolution(unsigned int resX, unsigned int resY) { State::resX = resX; State::resY = resY; };
+  static inline unsigned int getResX() { return State::resX; };
+  static inline unsigned int getResY() { return State::resY; };
 
-  static inline void setResolution(unsigned int resX, unsigned int resY) { State::_resX = resX; State::_resY = resY; };
-  static inline unsigned int resX() { return State::_resX; };
-  static inline unsigned int resY() { return State::_resY; };
+  //////////////////////
+  /// STORY-ENTITY   ///
+  //////////////////////
+  /** @param storyEntity sets the current StoryEntity that is been played */
+  static inline void setCurrentStoryEntity(StoryEntity* storyEntity) { State::storyEntity = storyEntity; };
+  /** @returns the current StoryEntity played */
+  static inline StoryEntity* getCurrentStoryEntity() { return State::storyEntity; };
 
-  /////////////////////////
-  /// WORLD_ENTITY_LIST ///
-  /////////////////////////
+  //////////////
+  /// PLAYER ///
+  //////////////
+  /** @param player sets the current local player */
+  static inline void setPlayer(Player* player) { State::player = player; };
+  /** @returns the local player*/
+  static inline Player* getPlayer() { return State::player; };
+
+
 
  private:
@@ -68,10 +80,11 @@
   static PNode*                 cameraTarget;       //!< A reference to the cameraTarget
   static PNode*                 nullParent;         //!< A reference to the Null-PNode.
-  static ObjectManager*         objectManager;      //!< A referenct to the current ObjectManager
+  static ObjectManager*         objectManager;      //!< A reference to the current ObjectManager
+  static StoryEntity*           storyEntity;        //!< A reference to the current StoryEntity played
+  static Player*                player;             //!< A reference to the Player
 
-  static Player*                _localPlayer;       //!< The Local Player.
-  static SkyBox*                _skyBox;            //!< The SkyBox used in the current world.
-  static unsigned int           _resX;              //!< The X Resolution of the screen.
-  static unsigned int           _resY;              //!< The Y Resolution of the screen.
+  static SkyBox*                skyBox;            //!< The SkyBox used in the current world.
+  static unsigned int           resX;              //!< The X Resolution of the screen.
+  static unsigned int           resY;              //!< The Y Resolution of the screen.
   };
 
Index: /trunk/src/world_entities/power_ups/param_power_up.cc
===================================================================
--- /trunk/src/world_entities/power_ups/param_power_up.cc	(revision 6497)
+++ /trunk/src/world_entities/power_ups/param_power_up.cc	(revision 6498)
@@ -138,4 +138,5 @@
     SYNCHELP_READ_INT( this->min_value );
     SYNCHELP_READ_INT( this->max_value );
+    respawn();
   }
 
@@ -162,5 +163,5 @@
     SYNCHELP_WRITE_FKT( PowerUp::readState );
 
-    int i = this->type;
+    int i = (int)this->type;
     SYNCHELP_WRITE_INT( i );
     SYNCHELP_WRITE_INT( this->value );
Index: /trunk/src/world_entities/power_ups/power_up.cc
===================================================================
--- /trunk/src/world_entities/power_ups/power_up.cc	(revision 6497)
+++ /trunk/src/world_entities/power_ups/power_up.cc	(revision 6498)
@@ -96,4 +96,11 @@
 }
 
+
+
+/********************************************************************************************
+ NETWORK STUFF
+ ********************************************************************************************/
+
+
 /**
  * data copied in data will bee sent to another host
@@ -108,4 +115,5 @@
   return SYNCHELP_WRITE_N;
 }
+
 
 /**
Index: /trunk/src/world_entities/power_ups/turret_power_up.cc
===================================================================
--- /trunk/src/world_entities/power_ups/turret_power_up.cc	(revision 6497)
+++ /trunk/src/world_entities/power_ups/turret_power_up.cc	(revision 6498)
@@ -119,4 +119,12 @@
 }
 
+
+
+
+/********************************************************************************************
+ NETWORK STUFF
+ ********************************************************************************************/
+
+
 int TurretPowerUp::writeBytes( const byte * data, int length, int sender )
 {
@@ -130,5 +138,4 @@
   return SYNCHELP_READ_N;
 }
-
 
 
Index: /trunk/src/world_entities/skybox.cc
===================================================================
--- /trunk/src/world_entities/skybox.cc	(revision 6497)
+++ /trunk/src/world_entities/skybox.cc	(revision 6498)
@@ -270,6 +270,4 @@
   SYNCHELP_READ_STRINGM( textureName );
 
-  PRINT(0)("GOT DATA: size=%f texture='%s'\n", size, textureName);
-
   this->setSize( size );
   this->setTextureAndType( textureName, "jpg" );
@@ -292,5 +290,4 @@
   if ( rec > 0 )
   {
-    PRINT(0)("SEND DATA: size=%f texture='%s'\n", size, textureName);
     *reciever = rec;
 
Index: /trunk/src/world_entities/space_ships/space_ship.cc
===================================================================
--- /trunk/src/world_entities/space_ships/space_ship.cc	(revision 6497)
+++ /trunk/src/world_entities/space_ships/space_ship.cc	(revision 6498)
@@ -510,19 +510,66 @@
 }
 
+#define MASK_bUp         1
+#define MASK_bDown       2
+#define MASK_bLeft       4
+#define MASK_bRight      8
+#define MASK_bAscend    16
+#define MASK_bDescend   32
+#define MASK_bFire      64
+#define MASK_bRollL    128
+#define MASK_bRollR    256
+
+#define DATA_state       1
+#define DATA_flags       2
+#define DATA_mouse       3
 
 int SpaceShip::writeBytes( const byte * data, int length, int sender )
 {
-  setRequestedSync( false );
-  setIsOutOfSync( false );
-
   SYNCHELP_READ_BEGIN();
 
-  SYNCHELP_READ_FKT( WorldEntity::writeState );
+  byte b;
+  SYNCHELP_READ_BYTE( b );
+
+  if ( b == DATA_state && this->getHostID()!=this->getOwner() )
+  {
+    setRequestedSync( false );
+    setIsOutOfSync( false );
+    SYNCHELP_READ_FKT( WorldEntity::writeState );
+    SYNCHELP_READ_FLOAT( cycle );
+  }
+
+  if ( b == DATA_flags && this->getHostID()!=this->getOwner() )
+  {
+    int flags;
+    SYNCHELP_READ_INT( flags );
+
+    bUp = flags & MASK_bUp != 0;
+    bDown = flags & MASK_bDown != 0;
+    bLeft = flags & MASK_bLeft != 0;
+    bRight = flags & MASK_bRight != 0;
+    bAscend = flags & MASK_bAscend != 0;
+    bDescend = flags & MASK_bDescend != 0;
+    bFire = flags & MASK_bFire != 0;
+    bRollL = flags & MASK_bRollL != 0;
+    bRollR = flags & MASK_bRollR != 0;
+  }
+
+  if ( b == DATA_mouse && this->getHostID()!=this->getOwner() )
+  {
+    SYNCHELP_READ_FLOAT( xMouse );
+    SYNCHELP_READ_FLOAT( yMouse );
+    SYNCHELP_READ_FLOAT( mouseSensitivity );
+    SYNCHELP_READ_FLOAT( cycle );
+  }
 
   return SYNCHELP_READ_N;
 }
 
+
+
 int SpaceShip::readBytes( byte * data, int maxLength, int * reciever )
 {
+  SYNCHELP_WRITE_BEGIN();
+
   if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner() )
   {
@@ -536,12 +583,59 @@
     *reciever = rec;
 
-    SYNCHELP_WRITE_BEGIN();
+    SYNCHELP_WRITE_BYTE( (byte)DATA_state );
 
     SYNCHELP_WRITE_FKT( WorldEntity::readState );
+    SYNCHELP_WRITE_FLOAT( cycle );
 
     return SYNCHELP_WRITE_N;
   }
 
+
   *reciever = 0;
-  return 0;
-}
+
+  if ( this->getHostID()==this->getOwner() )
+  {
+    int mask = 0;
+
+    if ( bUp )
+      mask |= MASK_bUp;
+    if ( bDown )
+      mask |= MASK_bDown;
+    if ( bLeft )
+      mask |= MASK_bLeft;
+    if ( bRight )
+      mask |= MASK_bRight;
+    if ( bAscend )
+      mask |= MASK_bAscend;
+    if ( bFire )
+      mask |= MASK_bFire;
+    if ( bRollL )
+      mask |= MASK_bRollL;
+    if ( bRollR )
+      mask |= MASK_bRollR;
+
+    static int oldMask = mask+1; //so it is different the first time!
+    static float oldxMouse = xMouse + 1.0;
+    static float oldyMouse = yMouse + 1.0;
+
+    if ( mask != oldMask )
+    {
+      oldMask = mask;
+      SYNCHELP_WRITE_BYTE( DATA_flags );
+      SYNCHELP_WRITE_INT( mask );
+    }
+
+    if ( oldxMouse != xMouse || oldyMouse != yMouse )
+    {
+      oldxMouse = xMouse;
+      oldyMouse = yMouse;
+      SYNCHELP_WRITE_BYTE( DATA_mouse );
+      SYNCHELP_WRITE_FLOAT( xMouse );
+      SYNCHELP_WRITE_FLOAT( yMouse );
+      SYNCHELP_WRITE_FLOAT( mouseSensitivity );
+      SYNCHELP_WRITE_FLOAT( cycle );
+    }
+  }
+
+  return SYNCHELP_WRITE_N;
+}
Index: /trunk/src/world_entities/world_entity.cc
===================================================================
--- /trunk/src/world_entities/world_entity.cc	(revision 6497)
+++ /trunk/src/world_entities/world_entity.cc	(revision 6498)
@@ -491,4 +491,11 @@
 
 
+
+
+/********************************************************************************************
+ NETWORK STUFF
+ ********************************************************************************************/
+
+
 /**
  * Writes data from network containing information about the state
@@ -523,9 +530,19 @@
 
   SYNCHELP_READ_STRINGM( modelFileName );
+
   if ( strcmp(modelFileName, "") )
-    this->md2TextureFileName = modelFileName;
+    if ( strstr(modelFileName, ResourceManager::getInstance()->getDataDir()) )
+    {
+      this->md2TextureFileName = new char[strlen(modelFileName)-strlen(ResourceManager::getInstance()->getDataDir())+1];
+      strcpy((char*)this->md2TextureFileName, modelFileName+strlen(ResourceManager::getInstance()->getDataDir()));
+    }
+    else
+    {
+      this->md2TextureFileName = modelFileName;
+    }
 
   return SYNCHELP_READ_N;
 }
+
 
 /**
Index: /trunk/src/world_entities/world_entity.h
===================================================================
--- /trunk/src/world_entities/world_entity.h	(revision 6497)
+++ /trunk/src/world_entities/world_entity.h	(revision 6498)
@@ -28,5 +28,5 @@
 
 //! Basis-class all interactive stuff in the world is derived from
-class WorldEntity : public PNode, public Synchronizeable
+class WorldEntity : public PNode
 {
 public:
