Index: trunk/src/world_entities/npcs/npc.cc
===================================================================
--- trunk/src/world_entities/npcs/npc.cc	(revision 6307)
+++ trunk/src/world_entities/npcs/npc.cc	(revision 6341)
@@ -62,6 +62,6 @@
       this->collider = entity;
   }
-  else if (entity->isA(CL_PLAYER))
-    this->applyForce(Vector(0,0,0)-location*100);
+  //  else if (entity->isA(CL_PLAYER))
+  //    this->applyForce(Vector(0,0,0)-location*100);
   else if (entity->isA(CL_NPC))
   {
Index: trunk/src/world_entities/npcs/npc.h
===================================================================
--- trunk/src/world_entities/npcs/npc.h	(revision 6307)
+++ trunk/src/world_entities/npcs/npc.h	(revision 6341)
@@ -8,5 +8,5 @@
 class AI;
 
-class NPC : public WorldEntity, public PhysicsInterface {
+class NPC : public WorldEntity {
 
  public:
Index: trunk/src/world_entities/skybox.cc
===================================================================
--- trunk/src/world_entities/skybox.cc	(revision 6307)
+++ trunk/src/world_entities/skybox.cc	(revision 6341)
@@ -22,4 +22,6 @@
 #include "static_model.h"
 #include "material.h"
+#include "network_game_manager.h"
+#include "converter.h"
 
 using namespace std;
@@ -77,4 +79,6 @@
     }
   this->setParentMode(PNODE_MOVEMENT);
+
+  this->textureName = NULL;
 }
 
@@ -208,2 +212,66 @@
   this->setModel(model);
 }
+
+int SkyBox::writeBytes( const byte * data, int length, int sender )
+{
+  setRequestedSync( false );
+  setIsOutOfSync( false );
+
+  SYNCHELP_READ_BEGIN();
+
+  SYNCHELP_READ_FKT( WorldEntity::writeState );
+
+  SYNCHELP_READ_FLOAT( size );
+  if ( textureName )
+  {
+    delete[] textureName;
+    textureName = NULL;
+  }
+  SYNCHELP_READ_STRINGM( textureName );
+
+  PRINT(0)("GOT DATA: size=%f texture='%s'\n", size, textureName);
+
+  this->setSize( size );
+  this->setTextureAndType( textureName, "jpg" );
+  this->rebuild();
+
+  return SYNCHELP_READ_N;
+}
+
+
+
+int SkyBox::readBytes( byte * data, int maxLength, int * reciever )
+{
+  if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner() )
+  {
+    (NetworkGameManager::getInstance())->sync( this->getUniqueID(), this->getOwner() );
+    setRequestedSync( true );
+  }
+
+  int rec = this->getRequestSync();
+  if ( rec > 0 )
+  {
+    PRINT(0)("SEND DATA: size=%f texture='%s'\n", size, textureName);
+    *reciever = rec;
+
+    SYNCHELP_WRITE_BEGIN();
+
+    SYNCHELP_WRITE_FKT( WorldEntity::readState );
+
+    SYNCHELP_WRITE_FLOAT(this->size);
+    SYNCHELP_WRITE_STRING(this->textureName);
+
+    return SYNCHELP_WRITE_N;
+  }
+
+  *reciever = 0;
+  return 0;
+}
+
+void SkyBox::writeDebug( ) const
+{
+}
+
+void SkyBox::readDebug( ) const
+{
+}
Index: trunk/src/world_entities/skybox.h
===================================================================
--- trunk/src/world_entities/skybox.h	(revision 6307)
+++ trunk/src/world_entities/skybox.h	(revision 6341)
@@ -35,9 +35,14 @@
   void setSize(float size);
   /** assumes jpg as input-format */
-  void setTexture(const char* name) { this->setTextureAndType (name, "jpg"); };
+  void setTexture(const char* name) { if (textureName) delete[] textureName; textureName = new char[strlen(name)+1]; strcpy(textureName, name); this->setTextureAndType (name, "jpg"); };
 
   void setTextureAndType(const char* name, const char* extension);
   void setTextures(const char* top, const char* bottom, const char* left,
                    const char* right, const char* front, const char* back);
+
+  virtual int       writeBytes(const byte* data, int length, int sender);
+  virtual int       readBytes(byte* data, int maxLength, int * reciever);
+  virtual void      writeDebug() const;
+  virtual void      readDebug() const;
 
  private:
@@ -46,4 +51,5 @@
   Material*       material[6];     //!< Materials for the SkyBox. sorted by number (0-5) top, bottom, left, right, front, back
   float           size;            //!< Size of the SkyBox. This should match the frustum maximum range.
+  char*           textureName;     //!< Name of the Texture
 
 };
Index: trunk/src/world_entities/space_ships/space_ship.cc
===================================================================
--- trunk/src/world_entities/space_ships/space_ship.cc	(revision 6307)
+++ trunk/src/world_entities/space_ships/space_ship.cc	(revision 6341)
@@ -121,5 +121,5 @@
   PRINTF(4)("SPACESHIP INIT\n");
 
-  EventHandler::getInstance()->grabEvents(true);
+  //  EventHandler::getInstance()->grabEvents(true);
 
   bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false;
Index: trunk/src/world_entities/terrain.cc
===================================================================
--- trunk/src/world_entities/terrain.cc	(revision 6307)
+++ trunk/src/world_entities/terrain.cc	(revision 6341)
@@ -24,4 +24,6 @@
 #include "resource_manager.h"
 #include "model.h"
+#include "network_game_manager.h"
+
 
 #include "glincl.h"
@@ -111,4 +113,5 @@
 void Terrain::loadVegetation(const char* vegetationFile)
 {
+  PRINTF(0)("loadVegetation: %s\n", vegetationFile);
   if (this->vegetation)
     ResourceManager::getInstance()->unload(this->vegetation, RP_LEVEL);
@@ -116,5 +119,5 @@
   {
     PRINTF(4)("fetching %s\n", vegetationFile);
-      this->vegetation = (Model*)ResourceManager::getInstance()->load(vegetationFile, OBJ, RP_CAMPAIGN);
+    this->vegetation = (Model*)ResourceManager::getInstance()->load(vegetationFile, OBJ, RP_CAMPAIGN);
   }
   else
@@ -315,2 +318,42 @@
     }
 }
+
+int Terrain::writeBytes( const byte * data, int length, int sender )
+{
+  setRequestedSync( false );
+  setIsOutOfSync( false );
+
+  SYNCHELP_READ_BEGIN();
+  SYNCHELP_READ_FKT( WorldEntity::writeState );
+
+  return SYNCHELP_READ_N;
+}
+
+int Terrain::readBytes( byte * data, int maxLength, int * reciever )
+{
+  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;
+
+    return WorldEntity::readState( data, maxLength );
+
+  }
+
+  *reciever = 0;
+  return 0;
+}
+
+void Terrain::writeDebug( ) const
+{
+}
+
+void Terrain::readDebug( ) const
+{
+}
Index: trunk/src/world_entities/terrain.h
===================================================================
--- trunk/src/world_entities/terrain.h	(revision 6307)
+++ trunk/src/world_entities/terrain.h	(revision 6341)
@@ -30,4 +30,9 @@
   virtual ~Terrain();
 
+  virtual int       writeBytes(const byte* data, int length, int sender);
+  virtual int       readBytes(byte* data, int maxLength, int * reciever);
+  virtual void      writeDebug() const;
+  virtual void      readDebug() const;
+
   void init();
   void loadParams(const TiXmlElement* root);
@@ -44,4 +49,5 @@
    Model*              vegetation;
    int                 objectList;
+
 };
 
Index: trunk/src/world_entities/weapons/ground_turret.cc
===================================================================
--- trunk/src/world_entities/weapons/ground_turret.cc	(revision 6307)
+++ trunk/src/world_entities/weapons/ground_turret.cc	(revision 6341)
@@ -19,4 +19,5 @@
 
 #include "factory.h"
+#include "network_game_manager.h"
 #include "load_param.h"
 
@@ -168,2 +169,49 @@
 
 }
+
+/**
+ * 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 GroundTurret::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 GroundTurret::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: trunk/src/world_entities/weapons/ground_turret.h
===================================================================
--- trunk/src/world_entities/weapons/ground_turret.h	(revision 6307)
+++ trunk/src/world_entities/weapons/ground_turret.h	(revision 6341)
@@ -30,4 +30,7 @@
   virtual void collidesWith (WorldEntity* entity, const Vector& location);
 
+  virtual int writeBytes(const byte* data, int length, int sender);
+  virtual int readBytes(byte* data, int maxLength, int * reciever);
+
  private:
    Weapon *left, *right;
Index: trunk/src/world_entities/world_entity.cc
===================================================================
--- trunk/src/world_entities/world_entity.cc	(revision 6307)
+++ trunk/src/world_entities/world_entity.cc	(revision 6341)
@@ -105,5 +105,5 @@
 void WorldEntity::loadModel(const char* fileName, float scaling, unsigned int modelNumber)
 {
-  if (fileName != NULL)
+  if ( fileName != NULL && strcmp(fileName, "") )
   {
    // search for the special character # in the LoadParam
@@ -144,5 +144,7 @@
   }
   else
+  {
     this->setModel(NULL);
+  }
 }
 
@@ -340,2 +342,48 @@
   glPopMatrix();
 }
+
+/**
+ * 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 WorldEntity::writeState( const byte * data, int length, int sender )
+{
+  char* modelFileName;
+  SYNCHELP_READ_BEGIN();
+
+  SYNCHELP_READ_FKT( PNode::writeState );
+
+  SYNCHELP_READ_STRINGM( modelFileName );
+  SYNCHELP_READ_FLOAT( scaling );
+  //check if modelFileName is relative to datadir or absolute
+  if ( strstr(modelFileName, ResourceManager::getInstance()->getDataDir()) )
+  {
+    loadModel( modelFileName+strlen(ResourceManager::getInstance()->getDataDir()), scaling );
+  }
+  else
+  {
+    loadModel( modelFileName, scaling );
+  }
+  delete[] modelFileName;
+
+  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 WorldEntity::readState( byte * data, int maxLength )
+{
+  SYNCHELP_WRITE_BEGIN();
+
+  SYNCHELP_WRITE_FKT( PNode::readState );
+
+  SYNCHELP_WRITE_STRING( getModel( 0 )->getName() );
+  SYNCHELP_WRITE_FLOAT( scaling );
+  return SYNCHELP_WRITE_N;
+}
Index: trunk/src/world_entities/world_entity.h
===================================================================
--- trunk/src/world_entities/world_entity.h	(revision 6307)
+++ trunk/src/world_entities/world_entity.h	(revision 6341)
@@ -74,7 +74,10 @@
   std::list<WorldEntity*>::iterator& getEntityIterator() { return this->objectListIterator; }
 
+  int       writeState(const byte* data, int length, int sender);
+  int       readState(byte* data, int maxLength );
 
  protected:
   //  CharacterAttributes*    charAttr;         //!< the character attributes of a world_entity
+
 
  private:
@@ -89,4 +92,7 @@
   std::list<WorldEntity*>::iterator objectListIterator; //!< The iterator position of this Entity in the given list of the ObjectManager.
 
+  float                   scaling;
+
+
 };
 
