Index: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am	(revision 6423)
+++ trunk/src/Makefile.am	(revision 6424)
@@ -48,6 +48,11 @@
                   story_entities/story_entity.cc \
                   story_entities/campaign.cc \
-                  story_entities/world.cc \
-                  story_entities/network_world.cc \
+                  story_entities/campaign_data.cc \
+                  story_entities/game_world.cc \
+                  story_entities/game_world_data.cc \
+                  story_entities/single_player_world.cc \
+                  story_entities/single_player_world_data.cc \
+                  story_entities/multi_player_world.cc \
+                  story_entities/multi_player_world_data.cc \
                   world_entities/world_entity.cc \
                   world_entities/camera.cc \
@@ -96,6 +101,11 @@
                  story_entities/story_def.h \
                  story_entities/campaign.h \
-                 story_entities/world.h \
-                 story_entities/network_world.h \
+                 story_entities/campaign_data.h \
+                 story_entities/game_world.h \
+                 story_entities/game_world_data.h \
+                 story_entities/single_player_world.h \
+                 story_entities/single_player_world_data.h \
+                 story_entities/multi_player_world.h \
+                 story_entities/multi_player_world_data.h \
                  world_entities/world_entity.h \
                  world_entities/camera.h \
Index: trunk/src/defs/class_id.h
===================================================================
--- trunk/src/defs/class_id.h	(revision 6423)
+++ trunk/src/defs/class_id.h	(revision 6424)
@@ -147,6 +147,11 @@
   // StoryEntities (range from 0x00000100 to 0x000001ff)
   CL_CAMPAIGN                   =    0x00000101,
-  CL_WORLD                      =    0x00000102,
-
+  CL_CAMPAIGN_DATA              =    0x00000102,
+  CL_GAME_WORLD                 =    0x00000103,
+  CL_GAME_WORLD_DATA            =    0x00000104,
+  CL_SINGLE_PLAYER_WORLD        =    0x00000105,
+  CL_SINGLE_PLAYER_WORLD_DATA   =    0x00000106,
+  CL_MULTI_PLAYER_WORLD         =    0x00000107,
+  CL_MULTI_PLAYER_WORLD_DATA    =    0x00000108,
 
   // WorldEntities (range from 0x00000200 to 0x000004ff)
Index: trunk/src/lib/Makefile.am
===================================================================
--- trunk/src/lib/Makefile.am	(revision 6423)
+++ trunk/src/lib/Makefile.am	(revision 6424)
@@ -36,4 +36,5 @@
                         lang/base_object.cc \
                         lang/class_list.cc \
+                        data/data_tank.cc \
                         util/substring.cc \
                         util/color.cc \
@@ -47,4 +48,5 @@
 noinst_HEADERS =        coord/p_node.h \
                         lang/base_object.h \
+                        data/data_tank.h \
                         graphics/render2D/element_2d.h \
                         graphics/render2D/render_2d.h \
@@ -70,5 +72,5 @@
           particles \
           collision_detection \
-	  network \
+	        network \
           parser \
           shell \
Index: trunk/src/lib/coord/p_node.cc
===================================================================
--- trunk/src/lib/coord/p_node.cc	(revision 6423)
+++ trunk/src/lib/coord/p_node.cc	(revision 6424)
@@ -29,4 +29,7 @@
 
 #include "synchronizeable.h"
+
+#include "shell_command.h"
+SHELL_COMMAND(debugNode, PNode, debugNodeSC);
 
 using namespace std;
@@ -152,4 +155,18 @@
   }
 }
+
+
+/**
+ *  init the pnode to a well definied state
+ *
+ * this function actualy only updates the PNode tree
+ */
+void PNode::init()
+{
+  /* just update all aboslute positions via timestep 0.001ms */
+  this->updateNode(0.001f);
+  this->updateNode(0.001f);
+}
+
 
 /**
Index: trunk/src/lib/coord/p_node.h
===================================================================
--- trunk/src/lib/coord/p_node.h	(revision 6423)
+++ trunk/src/lib/coord/p_node.h	(revision 6424)
@@ -78,4 +78,6 @@
 
   void loadParams(const TiXmlElement* root);
+
+  void init();
 
   // ACTIVATION //
@@ -172,4 +174,5 @@
   // DEBUG //
   void countChildNodes(int& nodes) const;
+  void debugNodeSC (unsigned int depth = 1, unsigned int level = 0) { this->debugNode(depth, level); };
   void debugNode (unsigned int depth = 1, unsigned int level = 0) const;
   void debugDraw(unsigned int depth = 1, float size = 1.0, const Vector& color = Vector(1, 0, 0), unsigned int level = 0) const;
Index: trunk/src/lib/data/data_tank.h
===================================================================
--- trunk/src/lib/data/data_tank.h	(revision 6424)
+++ trunk/src/lib/data/data_tank.h	(revision 6424)
@@ -0,0 +1,33 @@
+/*!
+ * @file data_tank.h
+ *  container for all data and data loadings. Its absolutily abstract and therefore generic.
+ *  if there is something to load, this class will serve as a good base class since it
+ *  gives you a basic structure for data loading
+ */
+
+#ifndef _DATA_TANK_H
+#define _DATA_TANK_H
+
+
+#include "base_object.h"
+#include "error.h"
+
+
+//! The DataTank
+class DataTank : public BaseObject
+{
+
+  public:
+    DataTank() {}
+    virtual ~DataTank() {}
+
+    /** initializes the DataTank to be able to load the data */
+    virtual ErrorMessage init() {}
+    /** loads the data into the DataTank @param root is the xml root parameter for for loadParams() connection */
+    virtual ErrorMessage loadData(TiXmlElement* root = NULL) {}
+    /** unloads the data again from the DataTank */
+    virtual ErrorMessage unloadData() {}
+};
+
+
+#endif /* _DATA_TANK_H */
Index: trunk/src/lib/network/network_game_manager.cc
===================================================================
--- trunk/src/lib/network/network_game_manager.cc	(revision 6423)
+++ trunk/src/lib/network/network_game_manager.cc	(revision 6424)
@@ -23,4 +23,7 @@
 #include "network_stream.h"
 #include "converter.h"
+
+#include "p_node.h"
+
 
 /* include your own header */
@@ -237,5 +240,5 @@
  * @param classID: The ID of the class of which an entity should be created
  */
-BaseObject* NetworkGameManager::createEntity( TiXmlElement* element)
+BaseObject* NetworkGameManager::createEntity(const TiXmlElement* element)
 {
   if ( this->isServer() )
@@ -252,5 +255,5 @@
     if ( !b )
     {
-      PRINTF(1)("Could not fabricate Object with classID %x\n", element->Value() );
+      PRINTF(1)("Could not fabricate Object with className %s\n", element->Value() );
       return NULL;
     }
@@ -391,4 +394,6 @@
   //PRINTF(0)("SendEntityList: n = %d\n", networkStream->getSyncCount()-2 );
 
+  int n = 0;
+
   while ( it != e )
   {
@@ -403,4 +408,18 @@
     if ( !writeToClientBuffer( outBuffer[userID], (int)((*it)->getOwner()) ) )
       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++;
@@ -436,5 +455,5 @@
  * @param owner: owner of this synchronizealbe
  */
-void NetworkGameManager::doCreateEntity( ClassID classID, int uniqueID, int owner )
+BaseObject* NetworkGameManager::doCreateEntity( ClassID classID, int uniqueID, int owner )
 {
   BaseObject * b = Factory::fabricate( classID );
@@ -443,5 +462,5 @@
   {
     PRINTF(1)("Could not fabricate Object with classID %x\n", classID);
-    return;
+    return NULL;
   }
 
@@ -455,4 +474,5 @@
       s->setIsOutOfSync( true );
     PRINTF(0)("Fabricated %s with id %d\n", s->getClassName(), s->getUniqueID());
+    return b;
   }
   else
@@ -461,4 +481,5 @@
     delete b;
   }
+  return NULL;
 }
 
@@ -695,8 +716,22 @@
     i += Converter::byteArrayToInt( &data[i], &owner );
 
+    PRINTF(0)("before fabricate\n");
     if ( classID != CL_NETWORK_GAME_MANAGER && classID != CL_HANDSHAKE )
-      doCreateEntity( (ClassID)classID, uniqueID, owner );
-
-  }
+    {
+      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;
+        }
+    }*/
+    }
+
+  }
+
   return true;
 }
Index: trunk/src/lib/network/network_game_manager.h
===================================================================
--- trunk/src/lib/network/network_game_manager.h	(revision 6423)
+++ trunk/src/lib/network/network_game_manager.h	(revision 6424)
@@ -75,5 +75,5 @@
 
     void createEntity( ClassID classID, int owner = 0 );
-    BaseObject* createEntity( TiXmlElement* element);
+    BaseObject* createEntity(const TiXmlElement* element);
     void removeEntity( int uniqueID );
     void sendYouAre( int uniqueID, int userID );
@@ -94,5 +94,5 @@
     void executeRequestSync( int uniqueID, int user );
 
-    void doCreateEntity(ClassID classID, int uniqueID, int owner);
+    BaseObject* doCreateEntity(ClassID classID, int uniqueID, int owner);
     void doRemoveEntity(int uniqueID);
     void doRequestSync(int uniqueID, int userID);
Index: trunk/src/lib/network/synchronizeable.cc
===================================================================
--- trunk/src/lib/network/synchronizeable.cc	(revision 6423)
+++ trunk/src/lib/network/synchronizeable.cc	(revision 6424)
@@ -36,4 +36,5 @@
   this->networkStream = NULL;
   this->setRequestedSync( false );
+  this->setIsOutOfSync( !(this->isServer()) );
 }
 
Index: trunk/src/orxonox.cc
===================================================================
--- trunk/src/orxonox.cc	(revision 6423)
+++ trunk/src/orxonox.cc	(revision 6424)
@@ -409,5 +409,5 @@
     else if(!strcmp( "--server", argv[i])   || !strcmp("-s", argv[i]))
       return startNetworkOrxonox(argc, argv);
-    else if(!strcmp( "--license", argv[i])  || !strcmp("-s", argv[i]))
+    else if(!strcmp( "--license", argv[i])  || !strcmp("-l", argv[i]))
       return PRINT(0)(ORXONOX_LICENSE_SHORT);
   }
Index: trunk/src/story_entities/campaign.cc
===================================================================
--- trunk/src/story_entities/campaign.cc	(revision 6423)
+++ trunk/src/story_entities/campaign.cc	(revision 6424)
@@ -13,5 +13,4 @@
    ### File Specific:
    main-programmer: Patrick Boenzli
-   co-programmer:
 */
 
@@ -20,22 +19,17 @@
 
 #include "factory.h"
-#include "game_loader.h"
-#include "story_entity.h"
-
-#include "world.h"
-#include "camera.h"
-
 #include "load_param.h"
 
+#include "campaign_data.h"
 
 using namespace std;
 
 
-Campaign::Campaign ()
-{
-  this->setClassID(CL_CAMPAIGN, "Campaign");
-  this->isInit = false;
-}
-
+/**
+ *  the constructor
+ * @param root the XML root element
+ *
+ * this constructor is always called in a XML context (loading procedure)
+ */
 Campaign::Campaign ( TiXmlElement* root)
 {
@@ -43,249 +37,112 @@
 
   PRINTF(4)("Loading Campaign...\n");
-
   assert( root != NULL);
 
-  this->isInit = false;
-
+  this->campaignData = new CampaignData(root);
   this->loadParams(root);
 
-
-  //if( lastCreated != NULL)
-  //lastCreated->setStoryID( WORLD_ID_GAMEEND);
-}
-
-Campaign::~Campaign ()
-{}
-
-
-ErrorMessage Campaign::init()
-{
-  this->isInit = true;
-}
-
-/**
-  \brief loads the Parameters of a Campaign
-* @param root: The XML-element to load from
- */
-void Campaign::loadParams(const TiXmlElement* root)
-{
-  static_cast<BaseObject*>(this)->loadParams(root);
-
-  LoadParam(root, "identifier", this, Campaign, setStoryID)
-     .describe("A Unique Identifier for this Campaign");
-
-   LoadParamXML(root, "WorldList", this, Campaign, loadWorldListParams)
-      .describe("A List of Worlds to be loaded in this Campaign");
-}
-
-/**
-  \brief loads a WorldList
-* @param root: the XML-element to load from
- */
-void Campaign::loadWorldListParams(const TiXmlElement* root)
-{
-  if (root == NULL)
-    return;
-
-  LOAD_PARAM_START_CYCLE(root, element);
-  {
-    PRINTF(5)("Campaign: Constructor: adding a world\n");
-    StoryEntity* created = (StoryEntity*) Factory::fabricate(element);
-    if( created != NULL)
-    {
-      this->addEntity( created);
-    }
-  }
-  LOAD_PARAM_END_CYCLE(element);
-}
-
-ErrorMessage Campaign::start()
-{
-  this->start(0);
-}
-
-//! @todo boky -> fix it
-ErrorMessage Campaign::start(int storyID = 0)
-{
-  ErrorMessage errorCode;
-  if( !this->isInit) return errorCode;
-  if( storyID == WORLD_ID_GAMEEND) return errorCode;
-  this->running = true;
-  StoryEntity* se = this->getStoryEntity(storyID);
-  this->currentEntity = se;
-  while( se != NULL && this->running)
-    {
-      PRINTF(0)("Starting new StoryEntity Nr:%i\n", se->getStoryID());
-      se->preLoad();
-      se->load();
-      se->postLoad();
-
-      se->init();
-      se->preStart();
-      se->start();
-      se->destroy();
-
-      int nextWorldID = se->getNextStoryID();
-
-      this->entities.remove(se);
-      delete se;
-
-      //printf("Campaing::start() - got nextWorldID = %i\n", nextWorldID);
-      se = this->getStoryEntity(nextWorldID);
-      this->currentEntity = se;
-      if( ( nextWorldID == WORLD_ID_GAMEEND) ||( se == NULL) )
-        {
-          PRINTF(4)("Quitting campaing story loop\n");
-          if(se != NULL)
-            delete se;
-          return errorCode;
-        }
-    }
-
-    /* clean up all world that have not been loaded and therefore are still in the world list  -
-       this probably does not belong into the start function. remove this later
-    */
-    list<StoryEntity*>::iterator it;
-    for(it = this->entities.begin(); it != entities.end(); it++)
-    {
-      delete (*it);
-    }
-    PRINTF(1)("There is no StoryEnity left to play, quitting\n");
-}
-
-
-ErrorMessage Campaign::pause()
-{
-  if(this->currentEntity != NULL)
-    this->isPaused = true;
-}
-
-
-ErrorMessage Campaign::resume()
-{
-  if(this->currentEntity != NULL)
-    this->isPaused = false;
-}
-
-
-ErrorMessage Campaign::stop()
-{
-  this->running = false;
-  if(this->currentEntity != NULL)
-    {
-      this->currentEntity->stop();
-    }
-}
-
-
-ErrorMessage Campaign::destroy()
-{
-  if(this->currentEntity != NULL)
-    {
-      this->currentEntity->destroy();
-      delete this->currentEntity;
-      this->currentEntity = NULL;
-    }
 }
 
 
 /**
-  *  adds an game stroy entity to the campaign
-
-  * @param se: The entity
-  * @param storyID: The number that identifies the entity in the campaign. Each ID only used once in a Campaign
-
-    An entity can be a world (playable), a cinematic, a shop, sounds, whatever you
-    want to queue up in the campaign.
-*/
-void Campaign::addEntity(StoryEntity* se, int storyID)
+ * the campaign destructor
+ */
+Campaign::~Campaign ()
 {
-  se->setStoryID(storyID);
-  this->addEntity(se);
-}
-
-void Campaign::addEntity(StoryEntity* se)
-{
-  this->entities.push_back(se);
+  if( this->campaignData)
+    delete this->campaignData;
 }
 
 
-void Campaign::removeEntity(int storyID)
+/**
+ *  loads the Parameters of a Campaign
+ * @param root: The XML-element to load from
+ */
+void Campaign::loadParams(const TiXmlElement* root)
 {
-  this->removeEntity(this->getStoryEntity(storyID));
+  static_cast<StoryEntity*>(this)->loadParams(root);
 
+  PRINTF(4)("Loaded Campaign specific stuff\n");
 }
 
 
-void Campaign::removeEntity(StoryEntity* se)
+/**
+ *  starts the campaing with a specific ID
+ * @param storyID the id of the StoryEntity
+ */
+bool Campaign::start()
 {
-  this->entities.remove(se);
+  PRINTF(2)("Starting Campaign nr. %i\n", this->getStoryID());
+
+  this->isRunning = true;
+  this->run();
 }
 
 
-/*
-  \brief this changes to the next level
-*/
-void Campaign::nextLevel()
+/**
+ *  pauses the campaign
+ */
+bool Campaign::pause()
 {
-  PRINTF(4)("Campaign:nextLevel()\n");
+  this->isPaused = true;
+}
+
+
+/**
+ *  resumes the campaign after a pause
+ */
+bool Campaign::resume()
+{
+  PRINTF(4)("Resuming the current Campaign\n");
+  this->isPaused = false;
+}
+
+
+/**
+ *  stops the campaign
+ */
+bool Campaign::stop()
+{
+  PRINTF(4)("Stopping the current Campaign\n");
+  this->isRunning = false;
+  if( this->currentEntity != NULL)
+  {
+    this->currentEntity->stop();
+  }
+}
+
+
+/**
+ *  runs the campaign
+ */
+void Campaign::run()
+{
+  ErrorMessage       errorCode;
+  int                storyID = WORLD_ID_0;
+
+  for( this->currentEntity = this->campaignData->getFirstLevel(), this->isRunning = true;
+       this->currentEntity != NULL && this->isRunning;
+       this->currentEntity = this->campaignData->getNextLevel())
+  {
+    PRINTF(0)("Campaign is starting StoryEntity nr:%i\n", this->currentEntity->getStoryID());
+
+    this->currentEntity->init();
+
+    this->currentEntity->loadData();
+    this->currentEntity->start();
+    this->currentEntity->unloadData();
+  }
+  PRINTF(2)("There is no StoryEnity left to play, quitting\n");
+}
+
+
+/**
+ *  this changes to the next level
+ */
+void Campaign::switchToNextLevel()
+{
+  PRINTF(4)("Switching to the next StoryEntity\n");
   this->currentEntity->stop();
 }
 
-/*
-  \brief change to the previous level - not implemented
 
-  this propably useless
-*/
-void Campaign::previousLevel()
-{}
-
-
-/*
-  \brief lookup a entity with a given id
-* @param story id to be lookuped
-  @returns the entity found or NULL if search ended without match
-*/
-StoryEntity* Campaign::getStoryEntity(int storyID)
-{
-  //printf("Campaing::getStoryEntity(%i) - getting next Entity\n", storyID);
-  if( storyID == WORLD_ID_GAMEEND)
-    return NULL;
-
-  /*
-  tList<StoryEntity>* l;
-  StoryEntity* entity = NULL;
-  l = this->entities->getNext();
-  while( l != NULL)
-    {
-      entity = l->getObject();
-      l = l->getNext();
-
-      int id = entity->getStoryID();
-      //printf("Campaing::getStoryEntity() - now looping, found entity nr=%i\n", id);
-      if(id == storyID)
-        {
-          //printf("Campaing::getStoryEntity() - yea, this is what we where looking for: %id\n");
-          return entity;
-        }
-
-    }
-  */
-
-
-  list<StoryEntity*>::iterator it;
-  for (it = this->entities.begin(); it != this->entities.end(); it++)
-  {
-      int id = (*it)->getStoryID();
-      //printf("Campaing::getStoryEntity() - now looping, found entity nr=%i\n", id);
-      if(id == storyID)
-        {
-          //printf("Campaing::getStoryEntity() - yea, this is what we where looking for: %id\n");
-          return (*it);
-        }
-    }
-
-
-
-  return NULL;
-}
Index: trunk/src/story_entities/campaign.h
===================================================================
--- trunk/src/story_entities/campaign.h	(revision 6423)
+++ trunk/src/story_entities/campaign.h	(revision 6424)
@@ -1,47 +1,40 @@
+/*!
+ * @file campaign.h
+ * definition of the campaign
+ */
 
 #ifndef _CAMPAIGN_H
 #define _CAMPAIGN_H
 
+
 #include "story_entity.h"
 
-#include <list>
 
-class World;
 class TiXmlElement;
+class CampaignData;
 
-class Campaign : public StoryEntity {
 
- public:
-  Campaign ();
-  Campaign ( TiXmlElement* root);
-  virtual ~Campaign ();
+//! A class that represents a game Campaign that contains other StoryEntities like GameWorlds, movies, etc.
+class Campaign : public StoryEntity
+{
 
-  void loadParams(const TiXmlElement* root);
-  void loadWorldListParams(const TiXmlElement* root);
+  public:
+    Campaign( TiXmlElement* root);
+    virtual ~Campaign ();
 
-  StoryEntity* currentEntity;
+    void loadParams(const TiXmlElement* root);
 
-  virtual ErrorMessage init();
-  virtual ErrorMessage start();
-  virtual ErrorMessage start(int storyID);
-  virtual ErrorMessage pause();
-  virtual ErrorMessage resume();
-  virtual ErrorMessage stop();
-  virtual ErrorMessage destroy();
+    virtual bool start();
+    virtual bool stop();
+    virtual bool pause();
+    virtual bool resume();
+    virtual void run();
 
-  void addEntity(StoryEntity* se, int storyID);
-  void addEntity(StoryEntity* se);
-  void removeEntity(int storyID);
-  void removeEntity(StoryEntity* se);
+    void switchToNextLevel();
 
-  void nextLevel();
-  void previousLevel();
 
- private:
-  //ListTemplate<StoryEntity>* entities;
-   std::list<StoryEntity*> entities;
-   bool running;
-
-   StoryEntity* getStoryEntity(int storyID);
+  private:
+    StoryEntity*                        currentEntity;          //!< reference to the current StoryEntity
+    CampaignData*                       campaignData;           //!< reference to the CampaignData
 };
 
Index: trunk/src/story_entities/campaign_data.cc
===================================================================
--- trunk/src/story_entities/campaign_data.cc	(revision 6424)
+++ trunk/src/story_entities/campaign_data.cc	(revision 6424)
@@ -0,0 +1,141 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+### File Specific:
+   main-programmer: Patrick Boenzli
+*/
+
+
+#include "campaign_data.h"
+
+#include "factory.h"
+#include "load_param.h"
+
+#include "story_entity.h"
+
+
+using namespace std;
+
+
+/**
+ * constructor for CampaignData
+ */
+CampaignData::CampaignData(const TiXmlElement* root)
+{
+  this->setClassID(CL_CAMPAIGN_DATA, "CampaignData");
+
+  this->currentEntity = NULL;
+
+  this->loadParams(root);
+}
+
+
+/**
+ * destructor for CampaignData
+ */
+CampaignData::~CampaignData()
+{
+  PRINTF(4)("Deleting CampaignData\n");
+  while( !this->storyEntities.empty())
+  {
+    StoryEntity* bo = this->storyEntities.back();
+    this->storyEntities.pop_back();
+    PRINTF(4)("CampaignData is been deleted: nr %i\n", bo->getStoryID());
+    delete bo;
+  }
+}
+
+
+/**
+ *  loads the Parameters of a Campaign
+ * @param root: The XML-element to load from
+ */
+void CampaignData::loadParams(const TiXmlElement* root)
+{
+  LoadParamXML(root, "WorldList", this, CampaignData, loadData)
+      .describe("A List of Worlds to be loaded in this Campaign");
+}
+
+
+/**
+ *  loads a WorldList
+ * @param root: the XML-element to load from
+ */
+void CampaignData::loadData(const TiXmlElement* root)
+{
+  if( root == NULL)
+    return;
+
+  LOAD_PARAM_START_CYCLE(root, element);
+  {
+    StoryEntity* created = (StoryEntity*) Factory::fabricate(element);
+    if( created != NULL)
+      this->addStoryEntity(created);
+    PRINTF(4)("Created a new StoryEntity and added it to the Campaign: id=%i\n", created->getStoryID());
+  }
+  LOAD_PARAM_END_CYCLE(element);
+}
+
+
+/**
+ *  add the StoryEntity to the campaign data tank
+ * @param se the StoryEntity to add
+ */
+void CampaignData::addStoryEntity(StoryEntity* se)
+{
+  this->storyEntities.push_back(se);
+}
+
+
+/**
+ *  switch to the next level in the list and return it
+ */
+StoryEntity* CampaignData::getFirstLevel()
+{
+  int                            nextStoryID;
+  int                            storyID;
+  list<StoryEntity*>::iterator   it;
+
+  nextStoryID = 0;
+  this->currentEntity = NULL;
+  for( it = this->storyEntities.begin(); it != this->storyEntities.end(); it++)
+  {
+    storyID = (*it)->getStoryID();
+    if( storyID == nextStoryID)
+      this->currentEntity = (*it);
+  }
+  return this->currentEntity;
+}
+
+
+/**
+ *  switch to the next level in the list and return it
+ */
+StoryEntity* CampaignData::getNextLevel()
+{
+  int                            nextStoryID;
+  int                            storyID;
+  list<StoryEntity*>::iterator   it;
+
+  nextStoryID = this->currentEntity->getNextStoryID();
+  this->currentEntity = NULL;
+  for( it = this->storyEntities.begin(); it != this->storyEntities.end(); it++)
+  {
+    storyID = (*it)->getStoryID();
+    if( storyID == nextStoryID)
+      this->currentEntity = (*it);
+  }
+  return this->currentEntity;
+}
+
+
+
+
+
Index: trunk/src/story_entities/campaign_data.h
===================================================================
--- trunk/src/story_entities/campaign_data.h	(revision 6424)
+++ trunk/src/story_entities/campaign_data.h	(revision 6424)
@@ -0,0 +1,40 @@
+/*!
+ * @file campaign_data.h
+ * definition of the campaign data tank
+ */
+
+#ifndef _CAMPAIGN_DATA_H
+#define _CAMPAIGN_DATA_H
+
+
+#include "data_tank.h"
+#include <list>
+
+class StoryEntity;
+
+//! A class that contains the data of the Campaign object
+class CampaignData : public DataTank
+{
+
+  public:
+    CampaignData(const TiXmlElement* root);
+    virtual ~CampaignData();
+
+    void loadParams(const TiXmlElement* root);
+
+    void loadData(const TiXmlElement* root);
+
+    void addStoryEntity(StoryEntity* se);
+
+    StoryEntity* getFirstLevel();
+    StoryEntity* getNextLevel();
+
+
+  private:
+    StoryEntity*                  currentEntity;                //!< reference to the currently used StoryEntity
+    std::list<StoryEntity*>       storyEntities;                //!< list of story entities
+};
+
+
+#endif /* _CAMPAIGN_DATA_H */
+
Index: trunk/src/story_entities/debug_world.cc
===================================================================
--- trunk/src/story_entities/debug_world.cc	(revision 6423)
+++ trunk/src/story_entities/debug_world.cc	(revision 6424)
@@ -1,868 +1,0 @@
-/*
-   orxonox - the future of 3D-vertical-scrollers
-
-   Copyright (C) 2004 orx
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   ### File Specific:
-   main-programmer: Patrick Boenzli
-   co-programmer: Christian Meyer
-   co-programmer: Benjamin Grauer
-*/
-
-#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD
-
-#include "world.h"
-
-#include "shell_command.h"
-
-#include "state.h"
-
-#include "p_node.h"
-#include "pilot_node.h"
-#include "world_entity.h"
-#include "player.h"
-#include "camera.h"
-#include "environment.h"
-#include "skysphere.h"
-#include "skybox.h"
-#include "satellite.h"
-#include "test_entity.h"
-#include "terrain.h"
-#include "light.h"
-#include "load_param.h"
-#include "shell.h"
-
-#include "fast_factory.h"
-#include "animation_player.h"
-#include "particle_engine.h"
-#include "graphics_engine.h"
-#include "physics_engine.h"
-#include "fields.h"
-
-#include "md2Model.h"
-
-#include "glmenu_imagescreen.h"
-#include "game_loader.h"
-
-#include "animation3d.h"
-
-#include "substring.h"
-
-#include "factory.h"
-
-#include "weapons/projectile.h"
-#include "event_handler.h"
-#include "sound_engine.h"
-#include "ogg_player.h"
-
-#include "class_list.h"
-
-#include "cd_engine.h"
-#include "npcs/npc_test1.h"
-#include "shader.h"
-
-#include "playable.h"
-#include "network_manager.h"
-#include "playable.h"
-
-
-SHELL_COMMAND(speed, World, setSpeed);
-SHELL_COMMAND(togglePNodeVisibility, World, togglePNodeVisibility);
-SHELL_COMMAND(toggleBVVisibility, World, toggleBVVisibility);
-
-using namespace std;
-
-//! This creates a Factory to fabricate a World
-CREATE_FACTORY(World, CL_WORLD);
-
-World::World(const TiXmlElement* root)
-{
-  this->constuctorInit("", -1);
-  this->path = NULL;
-
-  this->loadParams(root);
-}
-
-/**
-  *  create a new World
-
-    This creates a new empty world!
-*/
-World::World (const char* name)
-{
-  this->path = NULL;
-  this->constuctorInit(name, -1);
-}
-
-/**
- *  creates a new World...
- * @param worldID with this ID
-*/
-World::World (int worldID)
-{
-  this->path = NULL;
-  this->constuctorInit(NULL, worldID);
-}
-
-/**
- *  remove the World from memory
-
-    delete everything explicitly, that isn't contained in the parenting tree!
-    things contained in the tree are deleted automaticaly
- */
-World::~World ()
-{
-  delete this->shell;
-  PRINTF(3)("World::~World() - deleting current world\n");
-
-  delete this->localPlayer;
-
-  // delete all the initialized Engines.
-  FastFactory::flushAll(true);
-  delete LightManager::getInstance();
-  delete ParticleEngine::getInstance();
-  delete AnimationPlayer::getInstance();
-  delete PhysicsEngine::getInstance();
-
-  // external engines initialized by the orxonox-class get deleted
-  SoundEngine::getInstance()->flushAllBuffers();
-  SoundEngine::getInstance()->flushAllSources();
-
-  if (State::getObjectManager() == &this->objectManager)
-    State::setObjectManager(NULL);
-  // erease everything that is left.
-  delete PNode::getNullParent();
-
-  //secondary cleanup of PNodes;
-  const std::list<BaseObject*>* nodeList = ClassList::getList(CL_PARENT_NODE);
-  if (nodeList != NULL)
-    while (!nodeList->empty())
-      delete nodeList->front();
-
-  Shader::suspendShader();
-
-  // unload the resources !!
-  ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL);
-
-  delete[] this->path;
-}
-
-/**
- * initializes the world.
- * @param name the name of the world
- * @param worldID the ID of this world
- *
- * set all stuff here that is world generic and does not use to much memory
- * because the real init() function StoryEntity::init() will be called
- * shortly before start of the game.
- * since all worlds are initiated/referenced before they will be started.
- * NO LEVEL LOADING HERE - NEVER!
-*/
-void World::constuctorInit(const char* name, int worldID)
-{
-  this->setClassID(CL_WORLD, "World");
-
-  this->setName(name);
-  this->debugWorldNr = worldID;
-  this->gameTime = 0.0f;
-  this->setSpeed(1.0);
-  this->music = NULL;
-  this->shell = NULL;
-  this->localPlayer = NULL;
-  this->localCamera = NULL;
-
-  this->showPNodes = false;
-  this->showBV = false;
-}
-
-/**
- * loads the parameters of a World from an XML-element
- * @param root the XML-element to load from
- */
-void World::loadParams(const TiXmlElement* root)
-{
-  PRINTF(4)("Creating a World\n");
-
-  LoadParam(root, "identifier", this, World, setStoryID)
-    .describe("Sets the StoryID of this world");
-
-  LoadParam(root, "nextid", this, World, setNextStoryID)
-    .describe("Sets the ID of the next world");
-
-  LoadParam(root, "path", this, World, setPath)
-    .describe("The Filename of this World (relative from the data-dir)");
-}
-
-/**
- * this is executed just before load
- *
- * since the load function sometimes needs data, that has been initialized
- * before the load and after the proceeding storyentity has finished
-*/
-ErrorMessage World::preLoad()
-{
-  State::setObjectManager(&this->objectManager);
-  this->cycle = 0;
-
-  /* init the world interface */
-  this->shell = new Shell();
-
-  LightManager::getInstance();
-  PNode::getNullParent();
-
-  AnimationPlayer::getInstance(); // initializes the animationPlayer
-  ParticleEngine::getInstance();
-  PhysicsEngine::getInstance();
-
-  this->localCamera = new Camera();
-  this->localCamera->setName ("World-Camera");
-
-  State::setCamera(this->localCamera, this->localCamera->getTarget());
-
-  GraphicsEngine::getInstance()->displayFPS(true);
-}
-
-
-/**
- *  loads the World by initializing all resources, and set their default values.
-*/
-ErrorMessage World::load()
-{
-  PRINTF(3)("> Loading world: '%s'\n", getPath());
-  TiXmlElement* element;
-  GameLoader* loader = GameLoader::getInstance();
-
-  if( getPath() == NULL)
-    {
-      PRINTF(1)("World has no path specified for loading");
-      this->loadDebugWorld(this->getStoryID());
-      return (ErrorMessage){213,"Path not specified","World::load()"};
-    }
-
-  TiXmlDocument* XMLDoc = new TiXmlDocument( getPath());
-  // load the campaign document
-  if( !XMLDoc->LoadFile())
-  {
-    // report an error
-    PRINTF(1)("loading XML File: %s @ %s:l%d:c%d\n", XMLDoc->ErrorDesc(), this->getPath(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
-    delete XMLDoc;
-    return (ErrorMessage){213,"XML File parsing error","World::load()"};
-  }
-
-  // check basic validity
-  TiXmlElement* root = XMLDoc->RootElement();
-  assert( root != NULL);
-
-  if( root == NULL || root->Value() == NULL || strcmp( root->Value(), "WorldDataFile"))
-    {
-      // report an error
-      PRINTF(1)("Specified XML File is not an orxonox world data file (WorldDataFile element missing)\n");
-      delete XMLDoc;
-      return (ErrorMessage){213,"Path not a WorldDataFile","World::load()"};
-    }
-
-  // load the parameters
-  // name
-  const char* string = grabParameter( root, "name");
-  if( string == NULL)
-    {
-      PRINTF(2)("World is missing a proper 'name'\n");
-      this->setName("Unknown");
-    }
-  else
-    {
-      this->setName(string);
-    }
-
-  ////////////////
-  // LOADSCREEN //
-  ////////////////
-  element = root->FirstChildElement("LoadScreen");
-  if (element == NULL)
-    {
-      PRINTF(2)("no LoadScreen specified, loading default\n");
-
-      glmis->setBackgroundImage("pictures/load_screen.jpg");
-      this->glmis->setMaximum(8);
-      this->glmis->draw();
-    }
-  else
-    {
-      this->glmis->loadParams(element);
-      this->glmis->draw();
-    }
-  this->glmis->draw();
-
-  ////////////////////////
-  // find WorldEntities //
-  ////////////////////////
-
-  element = root->FirstChildElement("WorldEntities");
-
-  if( element == NULL)
-    {
-      PRINTF(1)("World is missing 'WorldEntities'\n");
-    }
-  else
-    {
-      element = element->FirstChildElement();
-      // load Players/Objects/Whatever
-      PRINTF(4)("Loading WorldEntities\n");
-      while( element != NULL)
-        {
-          BaseObject* created = Factory::fabricate(element);
-          if( created != NULL )
-          {
-            if(created->isA(CL_WORLD_ENTITY))
-              this->spawn(dynamic_cast<WorldEntity*>(created));
-            printf("Created a %s: %s\n", created->getClassName(), created->getName());
-          }
-
-          // if we load a 'Player' we use it as localPlayer
-
-
-          //todo do this more elegant
-          if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))
-            sky = dynamic_cast<SkyBox*>(created);
-          if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
-          {
-            terrain = dynamic_cast<Terrain*>(created);
-            CDEngine::getInstance()->setTerrain(terrain);
-          }
-          element = element->NextSiblingElement();
-          glmis->step(); //! @todo temporary
-        }
-      PRINTF(4)("Done loading WorldEntities\n");
-    }
-
-    //////////////////////////////
-    // LOADING ADDITIONAL STUFF //
-    //////////////////////////////
-
-    LoadParamXML(root, "LightManager", LightManager::getInstance(), LightManager, loadParams);
-
-   LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams);
-//   LoadParamXML(root, "PhysicsEngine", PhysicsEngine::getInstance(), PhysicsEngine, loadParams);
-
-  // free the XML data
-
-  delete XMLDoc;
-  /* GENERIC LOADING PROCESS FINISHED */
-
-
-  // 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);
-  }
-
-  // bind camera
-  playable->addChild (this->localCamera);
-
-//   //localCamera->setParent(TrackNode::getInstance());
-//  tn->addChild(this->localCamera);
-  localCamera->setClipRegion(1, 10000.0);
-  localCamera->lookAt(playable);
-//  this->localPlayer->setParentMode(PNODE_ALL);
-  if (sky != NULL)
-  {
-    this->sky->setParent(this->localCamera);
-    this->sky->setParentMode(PNODE_MOVEMENT);
-  }
-
-  // initialize debug coord system
-  objectList = glGenLists(1);
-  glNewList (objectList, GL_COMPILE);
-
-  glEndList();
-
-  SoundEngine::getInstance()->setListener(this->localCamera);
-
-
-
-  ////////////
-  // STATIC //
-  ////////////
-
-
-//   TestEntity* testEntity = new TestEntity();
-//   testEntity->setRelCoor(Vector(570, 10, -15));
-//   testEntity->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));
-//   this->spawn(testEntity);
-
-  for(int i = 0; i < 100; i++)
-  {
-    WorldEntity* tmp = new NPCTest1();
-    char npcChar[10];
-    sprintf (npcChar, "NPC_%d", i);
-        tmp->setName(npcChar);
-    tmp->setAbsCoor(((float)rand()/RAND_MAX) * 5000, 50/*+ (float)rand()/RAND_MAX*20*/, ((float)rand()/RAND_MAX -.5) *30);
-    this->spawn(tmp);
-  }
-
-  this->music = NULL;
-  //(OggPlayer*)ResourceManager::getInstance()->load("sound/00-luke_grey_-_hypermode.ogg", OGG, RP_LEVEL);
-  //music->playback();
-}
-
-
-
-/**
- * creates a debug world: only for experimental stuff
-*/
-void World::loadDebugWorld(int worldID)
-{
-  /*monitor progress*/
-  this->glmis->step();
-  // stuff beyond this point remains to be loaded properly
-
-  // LIGHT initialisation
-  LightManager::getInstance()->setAmbientColor(.1,.1,.1);
-//  LightManager::getInstance()->addLight();
-  LightManager::getInstance()->debug();
-
-  switch(this->debugWorldNr)
-    {
-      /*
-        this loads the hard-coded debug world. this only for simplicity and will be
-        removed by a reald world-loader, which interprets a world-file.
-        if you want to add an own debug world, just add a case DEBUG_WORLD_[nr] and
-        make whatever you want...
-      */
-    case DEBUG_WORLD_0:
-      {
-        LightManager::getInstance()->getLight()->setAbsCoor(-5.0, 10.0, -40.0);
-        /*monitor progress*/
-        this->glmis->step();
-
-        // bind camera
-        this->localCamera = new Camera();
-        this->localCamera->setName ("camera");
-        /*monitor progress*/
-        this->glmis->step();
-
-
-        // Create SkySphere
-        this->sky = new Skysphere("pictures/sky-replace.jpg");
-        this->sky->setName("SkySphere");
-        this->spawn(this->sky);
-        this->localCamera->addChild(this->sky);
-        this->sky->setParentMode(PNODE_MOVEMENT);
-        /*monitor progress*/
-        this->glmis->step();
-
-
-        terrain = new Terrain("worlds/newGround.obj");
-        terrain->setRelCoor(Vector(0,-10,0));
-        this->spawn(terrain);
-        /*monitor progress*/
-        this->glmis->step();
-
-        this->glmis->step();
-        break;
-      }
-    case DEBUG_WORLD_1:
-      {
-
-        break;
-      }
-    case DEBUG_WORLD_2:
-      {
-
-        break;
-      }
-    default:
-      break;
-    }
-}
-
-/**
- *  initializes a new World shortly before start
- *
- * this is the function, that will be loaded shortly before the world is
- * started
-*/
-ErrorMessage World::init()
-{
-  this->bPause = false;
-
-  /* update the object position before game start - so there are no wrong coordinates used in the first processing */
-  PNode::getNullParent()->updateNode (0.001f);
-  PNode::getNullParent()->updateNode (0.001f);
-
-}
-
-
-/**
- *  starts the World
-*/
-ErrorMessage World::start()
-{
-  PRINTF(3)("World::start() - starting current World: nr %i\n", this->debugWorldNr);
-  this->bQuitOrxonox = false;
-  this->bQuitCurrentGame = false;
-  this->mainLoop();
-}
-
-/**
- *  stops the world.
-
-   This happens, when the player decides to end the Level.
-*/
-ErrorMessage World::stop()
-{
-  PRINTF(3)("World::stop() - got stop signal\n");
-  this->bQuitCurrentGame = true;
-}
-
-/**
- *  pauses the Game
-*/
-ErrorMessage World::pause()
-{
-  this->isPaused = true;
-}
-
-/**
- *  ends the pause Phase
-*/
-ErrorMessage World::resume()
-{
-  this->isPaused = false;
-}
-
-/**
- *  destroys the World
-*/
-ErrorMessage World::destroy()
-{
-
-}
-
-/**
- *  shows the loading screen
-*/
-void World::displayLoadScreen ()
-{
-  PRINTF(3)("World::displayLoadScreen - start\n");
-
-  //GLMenuImageScreen*
-  this->glmis = new GLMenuImageScreen();
-  this->glmis->setMaximum(8);
-
-  PRINTF(3)("World::displayLoadScreen - end\n");
-}
-
-/**
- *  removes the loadscreen, and changes over to the game
-
-   @todo take out the delay
-*/
-void World::releaseLoadScreen ()
-{
-  PRINTF(3)("World::releaseLoadScreen - start\n");
-  this->glmis->setValue(this->glmis->getMaximum());
-  PRINTF(3)("World::releaseLoadScreen - end\n");
-  delete this->glmis;
-}
-
-
-/**
- *  this returns the current game time
- * @returns elapsed game time
-*/
-double World::getGameTime()
-{
-  return this->gameTime;
-}
-
-/**
-  \brief main loop of the world: executing all world relevant function
-
-  in this loop we synchronize (if networked), handle input events, give the heart-beat to
-  all other member-entities of the world (tick to player, enemies etc.), checking for
-  collisions drawing everything to the screen.
-*/
-void World::mainLoop()
-{
-  this->lastFrame = SDL_GetTicks ();
-  PRINTF(3)("World::mainLoop() - Entering main loop\n");
-
-  while( !this->bQuitOrxonox && !this->bQuitCurrentGame) /* @todo implement pause */
-    {
-      ++this->cycle;
-      // Network
-      this->synchronize ();
-      // Process input
-      this->handleInput ();
-      if( this->bQuitCurrentGame || this->bQuitOrxonox)
-          break;
-      // Process time
-      this->tick ();
-      // Process collision
-      this->collide ();
-      // Update the state
-      this->update ();
-      // Draw
-      this->display ();
-    }
-
-  PRINTF(3)("World::mainLoop() - Exiting the main loop\n");
-}
-
-
-/**
- *  synchronize local data with remote data
-*/
-void World::synchronize ()
-{
-  // Get remote input
-  // Update synchronizables
-/*  NetworkManager::getInstance()->synchronize();*/
-}
-
-
-/**
- *  run all input processing
-
-   the command node is the central input event dispatcher. the node uses the even-queue from
-   sdl and has its own event-passing-queue.
-*/
-void World::handleInput ()
-{
-  EventHandler::getInstance()->process();
-
-  // remoteinput
-}
-
-void World::tick(std::list<WorldEntity*> entityList, float dt)
-{
-  std::list<WorldEntity*>::iterator entity;
-  for (entity = entityList.begin(); entity != entityList.end(); entity++)
-    (*entity)->tick(dt);
-
-}
-
-/**
- *  advance the timeline
-
-   this calculates the time used to process one frame (with all input handling, drawing, etc)
-   the time is mesured in ms and passed to all world-entities and other classes that need
-   a heart-beat.
-*/
-void World::tick ()
-{
-  Uint32 currentFrame = SDL_GetTicks();
-  if(!this->bPause)
-    {
-      this->dt = currentFrame - this->lastFrame;
-
-      if( this->dt > 10)
-        {
-          float fps = 1000/dt;
-
-          // temporary, only for showing how fast the text-engine is
-          char tmpChar[20];
-          sprintf(tmpChar, "fps: %4.0f", fps);
-        }
-      else
-        {
-          /* the frame-rate is limited to 100 frames per second, all other things are for
-             nothing.
-          */
-          PRINTF(3)("fps = 1000 - frame rate is adjusted\n");
-          SDL_Delay(10-dt);
-          this->dt = 10;
-        }
-
-      this->dtS = (float)this->dt / 1000.0 * this->speed;
-      this->gameTime += this->dtS;
-
-/*      this->tick(this->objectManager.getObjectList(OM_DEAD_TICK), this->dtS);
-      this->tick(this->objectManager.getObjectList(OM_COMMON), this->dtS);
-      this->tick(this->objectManager.getObjectList(OM_GROUP_00), this->dtS);*/
-      this->tick(this->objectManager.getObjectList(OM_GROUP_01), this->dtS);
-      this->tick(this->objectManager.getObjectList(OM_GROUP_01_PROJ), this->dtS);
-
-      /* update tick the rest */
-      this->localCamera->tick(this->dtS);
-      // tick the engines
-      AnimationPlayer::getInstance()->tick(this->dtS);
-//      if (this->cycle > 5)
-        PhysicsEngine::getInstance()->tick(this->dtS);
-
-      ParticleEngine::getInstance()->tick(this->dtS);
-
-
-      /** actualy the Graphics Engine should tick the world not the other way around...
-         but since we like the things not too complicated we got it this way around
-         until there is need or time to do it the other way around.
-         @todo: GraphicsEngine ticks world: separation of processes and data...
-
-        bensch: in my opinion the GraphicsEngine could draw the world, but not tick it,
-         beceause graphics have nothing(or at least not much) to do with Motion.
-      */
-      GraphicsEngine::getInstance()->tick(this->dtS);
-    }
-  this->lastFrame = currentFrame;
-}
-
-
-/**
- *  this function gives the world a consistant state
-
-   after ticking (updating the world state) this will give a constistant
-   state to the whole system.
-*/
-void World::update()
-{
-  GraphicsEngine::getInstance()->update(this->dtS);
-  PNode::getNullParent()->updateNode (this->dtS);
-
-  SoundEngine::getInstance()->update();
-  //music->update();
-}
-
-
-void World::collide()
-{
-  CDEngine::getInstance()->checkCollisions(this->objectManager.getObjectList(OM_GROUP_00),
-                                            this->objectManager.getObjectList(OM_GROUP_01_PROJ));
-  CDEngine::getInstance()->checkCollisions(this->objectManager.getObjectList(OM_GROUP_01),
-                                            this->objectManager.getObjectList(OM_COMMON));
-}
-
-/**
- *  render the current frame
-
-   clear all buffers and draw the world
-*/
-void World::display ()
-{
-  // clear buffer
-  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
-  // set camera
-  this->localCamera->apply ();
-  // draw world
-  this->draw();
-  // draw HUD
-  /** @todo draw HUD */
-  // flip buffers
-  GraphicsEngine::swapBuffers();
-  //SDL_Surface* screen = Orxonox::getInstance()->getScreen ();
-  //SDL_Flip (screen);
-}
-
-
-/**
- *  runs through all entities calling their draw() methods
- */
-void World::draw ()
-{
-  GraphicsEngine* engine = GraphicsEngine::getInstance();
-  engine->draw(State::getObjectManager()->getObjectList(OM_ENVIRON_NOTICK));
-  engine->draw(State::getObjectManager()->getObjectList(OM_ENVIRON));
-  engine->draw(State::getObjectManager()->getObjectList(OM_COMMON));
-  engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_00));
-  engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_01));
-  engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_01_PROJ));
-
-//   {
-//     if( entity->isVisible() ) entity->draw();
-  //FIXME
-//     if( unlikely( this->showBV)) entity->drawBVTree(3, 226);  // to draw the bounding boxes of the objects at level 2 for debug purp
-//     entity = iterator->nextElement();
-//   }
-
-  glCallList (objectList);
-
-  ParticleEngine::getInstance()->draw();
-
-  if (unlikely(this->showPNodes))
-    PNode::getNullParent()->debugDraw(0);
-
-  engine->draw();
-  //TextEngine::getInstance()->draw();
-}
-
-/**
- *  add and spawn a new entity to this world
- * @param entity to be added
-*/
-void World::spawn(WorldEntity* entity)
-{
-//   this->entities->add (entity);
-  entity->postSpawn ();
-}
-
-
-/**
- *  add and spawn a new entity to this world
- * @param entity to be added
- * @param absCoor At what coordinates to add this entity.
- * @param absDir In which direction should it look.
-*/
-void World::spawn(WorldEntity* entity, Vector* absCoor, Quaternion* absDir)
-{
-//   this->entities->add (entity);
-
-  entity->setAbsCoor (*absCoor);
-  entity->setAbsDir (*absDir);
-
-  entity->postSpawn ();
-}
-
-
-/**
- *  add and spawn a new entity to this world
- * @param entity to be added
- * @param entity to be added to (PNode)
- * @param At what relative  coordinates to add this entity.
- * @param In which relative direction should it look.
-*/
-void World::spawn(WorldEntity* entity, PNode* parentNode,
-                  Vector* relCoor, Quaternion* relDir)
-{
-  if( parentNode != NULL)
-    {
-      parentNode->addChild (entity);
-
-      entity->setRelCoor (*relCoor);
-      entity->setRelDir (*relDir);
-
-//       this->entities->add (entity);
-
-      entity->postSpawn ();
-    }
-}
-
-void World::setPath( const char* name)
-{
-  if (this->path)
-    delete this->path;
-  if (ResourceManager::isFile(name))
-  {
-    this->path = new char[strlen(name)+1];
-    strcpy(this->path, name);
-  }
-  else
-    {
-      this->path = new char[strlen(ResourceManager::getInstance()->getDataDir()) + strlen(name) +1];
-      sprintf(this->path, "%s%s", ResourceManager::getInstance()->getDataDir(), name);
-    }
-}
-
-const char* World::getPath( void)
-{
-  return path;
-}
Index: trunk/src/story_entities/debug_world.h
===================================================================
--- trunk/src/story_entities/debug_world.h	(revision 6423)
+++ trunk/src/story_entities/debug_world.h	(revision 6424)
@@ -1,123 +1,0 @@
-/*!
- * @file world.h
-  *  Holds and manages all game data
-*/
-
-#ifndef _WORLD_H
-#define _WORLD_H
-
-#include "stdincl.h"
-#include "comincl.h"
-#include "story_entity.h"
-#include "p_node.h"
-#include "object_manager.h"
-
-
-class WorldEntity;
-class Camera;
-class Player;
-class GLMenuImageScreen;
-class Terrain;
-class TiXmlElement;
-
-class Shell;
-class OggPlayer;
-
-//! The game world
-/**
-   this class initializes everything that should be displayed inside of the current level.
-   it is the main driving factor during gameplay.
-*/
-class World : public StoryEntity {
-
- public:
-  World (const char* name);
-  World (int worldID);
-  World (const TiXmlElement* root = NULL);
-  virtual ~World ();
-
-  void loadParams(const TiXmlElement* root);
-
-  double getGameTime();
-
-  /* classes from story-entity */
-  virtual ErrorMessage preLoad();
-  virtual ErrorMessage load ();
-  virtual ErrorMessage init ();
-  virtual ErrorMessage start ();
-  virtual ErrorMessage stop ();
-  virtual ErrorMessage pause ();
-  virtual ErrorMessage resume ();
-  virtual ErrorMessage destroy ();
-
-  void loadDebugWorld(int worldID);
-
-  virtual void displayLoadScreen();
-  virtual void releaseLoadScreen();
-
-  /* command node functions */
-  bool command (Command* cmd);
-
-  /* interface to world */
-  void spawn (WorldEntity* entity);
-  void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir);
-  void spawn(WorldEntity* entity, PNode* parentNode, Vector* relCoor, Quaternion* relDir);
-
-  /** @param speed sets the speed of the Game */
-  inline void setSpeed(float speed) { this->speed = speed; };
-  const char* getPath();
-  void setPath( const char* name);
-
-  inline Camera* getLocalCamera() { return this->localCamera; };
-
-  void togglePNodeVisibility() { this->showPNodes = !this->showPNodes; };
-  void toggleBVVisibility() { this->showBV = !this->showBV; };
-
- private:
-  void constuctorInit(const char* name, int worldID);
-  /* function for main-loop */
-  void mainLoop ();
-  void synchronize ();
-  void handleInput ();
-  void tick (std::list<WorldEntity*> worldEntity, float dt);
-  void tick ();
-  void update ();
-  void collide ();
-  void draw ();
-  void display ();
-  void debug ();
-
-  private:
-    bool   showPNodes;                  //!< if the PNodes should be visible.
-    bool   showBV;                      //!< if the Bounding Volumes should be visible.
-    Uint32 lastFrame;                   //!< last time of frame
-    Uint32 cycle;                       //!< The cycle we are in (starts with 0 and rises with every frame)
-    Uint32 dt;                          //!< time needed to calculate this frame (in milliSeconds)
-    float dtS;                          //!< The time needed for caluculations in seconds
-    float speed;                        //!< how fast the game flows
-    double gameTime;                    //!< this is where the game time is saved
-    bool bQuitOrxonox;                  //!< quit this application
-    bool bQuitCurrentGame;              //!< quit only the current game and return to menu
-    bool bPause;                        //!< pause mode
-
-    ObjectManager      objectManager;   //!< The ObjectManager of this World.
-
-    GLMenuImageScreen* glmis;           //!< The Level-Loader Display
-
-    int debugWorldNr;                   //!< The Debug Nr. needed, if something goes wrong
-    char* path;                         //!< The file from which this world is loaded
-
-    Shell*     shell;
-    OggPlayer* music;
-
-  // IMPORTANT WORLD-ENTITIES
-    Camera* localCamera;                //!< The current Camera
-    WorldEntity* sky;                   //!< The Environmental Heaven of orxonox @todo insert this to environment insted
-    Terrain* terrain;                   //!< The Terrain of the World.
-
-    GLuint objectList;                  //!< temporary: @todo this will be ereased soon
-
-    Player* localPlayer;                //!< The Player, you fly through the level.
-};
-
-#endif /* _WORLD_H */
Index: trunk/src/story_entities/dedicated_server_world.cc
===================================================================
--- trunk/src/story_entities/dedicated_server_world.cc	(revision 6424)
+++ trunk/src/story_entities/dedicated_server_world.cc	(revision 6424)
@@ -0,0 +1,69 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+### File Specific:
+   main-programmer: Patrick Boenzli
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD
+
+#include "dedicated_server_world.h"
+
+#include "state.h"
+#include "class_list.h"
+
+#include "load_param.h"
+#include "fast_factory.h"
+#include "factory.h"
+
+#include "world_entity.h"
+#include "npcs/npc_test1.h"
+
+
+using namespace std;
+
+//! This creates a Factory to fabricate a DedicatedServerWorld
+CREATE_FACTORY(DedicatedServerWorld, CL_DEDICATED_SERVER_WORLD);
+
+
+
+DedicatedServerWorld::DedicatedServerWorld(const TiXmlElement* root)
+  : GameWorld(root)
+{
+  this->setClassID(CL_DEDICATED_SERVER_WORLD, "DedicatedServerWorld");
+  this->setName("DedicatedServerWorld uninitialized");
+
+  this->loadParams(root);
+}
+
+
+/**
+ *  remove the DedicatedServerWorld from memory
+ *
+ *  delete everything explicitly, that isn't contained in the parenting tree!
+ *  things contained in the tree are deleted automaticaly
+ */
+DedicatedServerWorld::~DedicatedServerWorld ()
+{
+  PRINTF(3)("DedicatedServerWorld::~DedicatedServerWorld() - deleting current world\n");
+}
+
+
+/**
+ * loads the parameters of a DedicatedServerWorld from an XML-element
+ * @param root the XML-element to load from
+ */
+void DedicatedServerWorld::loadParams(const TiXmlElement* root)
+{
+  static_cast<GameWorld*>(this)->loadParams(root);
+
+  PRINTF(4)("Loaded DedicatedServerWorld specific stuff\n");
+}
+
Index: trunk/src/story_entities/dedicated_server_world.h
===================================================================
--- trunk/src/story_entities/dedicated_server_world.h	(revision 6424)
+++ trunk/src/story_entities/dedicated_server_world.h	(revision 6424)
@@ -0,0 +1,33 @@
+/*!
+ * @file dedicated_server_world.h
+ *  Holds and manages all dedicated server data
+ */
+
+#ifndef _DEDICATED_SERVER_WORLD_H
+#define _DEDICATED_SERVER_WORLD_H
+
+#include "game_world.h"
+
+
+class TiXmlElement;
+
+
+//! The game world
+/**
+ *  this class initializes everything that should be displayed inside of the current level.
+ *  it is the main driving factor during gameplay.
+ */
+class DedicatedServerWorld : public GameWorld
+{
+
+  public:
+    DedicatedServerWorld (const TiXmlElement* root = NULL);
+    virtual ~DedicatedServerWorld ();
+
+    void loadParams(const TiXmlElement* root);
+
+  private:
+
+};
+
+#endif /* _DEDICATED_SERVER_WORLD_H */
Index: trunk/src/story_entities/game_world.cc
===================================================================
--- trunk/src/story_entities/game_world.cc	(revision 6424)
+++ trunk/src/story_entities/game_world.cc	(revision 6424)
@@ -0,0 +1,473 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Patrick Boenzli
+   co-programmer: Christian Meyer
+   co-programmer: Benjamin Grauer
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD
+
+#include "game_world.h"
+#include "game_world_data.h"
+
+#include "resource_manager.h"
+#include "state.h"
+#include "class_list.h"
+#include "substring.h"
+
+#include "game_loader.h"
+
+#include "p_node.h"
+#include "world_entity.h"
+#include "player.h"
+#include "camera.h"
+#include "environment.h"
+#include "terrain.h"
+#include "test_entity.h"
+#include "terrain.h"
+#include "md2Model.h"
+#include "weapons/projectile.h"
+#include "npcs/npc_test1.h"
+#include "playable.h"
+
+#include "light.h"
+
+#include "factory.h"
+#include "fast_factory.h"
+#include "load_param.h"
+#include "shell_command.h"
+
+#include "particle_engine.h"
+#include "graphics_engine.h"
+#include "event_handler.h"
+#include "sound_engine.h"
+#include "cd_engine.h"
+#include "network_manager.h"
+#include "physics_engine.h"
+#include "fields.h"
+
+#include "glmenu_imagescreen.h"
+#include "shell.h"
+
+#include "animation_player.h"
+#include "animation3d.h"
+
+#include "ogg_player.h"
+#include "shader.h"
+
+
+using namespace std;
+
+
+SHELL_COMMAND(speed, GameWorld, setSpeed);
+SHELL_COMMAND(togglePNodeVisibility, GameWorld, togglePNodeVisibility);
+SHELL_COMMAND(toggleBVVisibility, GameWorld, toggleBVVisibility);
+
+
+
+GameWorld::GameWorld(const TiXmlElement* root)
+    : StoryEntity()
+{
+  this->setClassID(CL_GAME_WORLD, "GameWorld");
+  this->setName("Preloaded World - no name yet");
+
+  this->gameTime = 0.0f;
+  this->setSpeed(1.0f);
+  this->shell = NULL;
+
+  this->showPNodes = false;
+  this->showBV = false;
+
+  this->path = NULL;
+}
+
+/**
+ *  remove the GameWorld from memory
+ *
+ *  delete everything explicitly, that isn't contained in the parenting tree!
+ *  things contained in the tree are deleted automaticaly
+ */
+GameWorld::~GameWorld ()
+{
+  PRINTF(4)("Deleted GameWorld\n");
+}
+
+
+
+/**
+ * loads the parameters of a GameWorld from an XML-element
+ * @param root the XML-element to load from
+ */
+void GameWorld::loadParams(const TiXmlElement* root)
+{
+  static_cast<StoryEntity*>(this)->loadParams(root);
+
+  LoadParam(root, "path", this, GameWorld, setPath)
+  .describe("The Filename of this GameWorld (relative from the data-dir)");
+
+  PRINTF(4)("Loaded GameWorld specific stuff\n");
+}
+
+
+/**
+ * this is executed just before load
+ *
+ * since the load function sometimes needs data, that has been initialized
+ * before the load and after the proceeding storyentity has finished
+*/
+ErrorMessage GameWorld::init()
+{
+  this->cycle = 0;
+  /* init the world interface */
+  this->shell = new Shell();
+
+  this->dataTank->init();
+}
+
+
+/**
+ *  loads the GameWorld by initializing all resources, and set their default values.
+ */
+ErrorMessage GameWorld::loadData()
+{
+  this->displayLoadScreen();
+
+  PRINTF(0)("Loading the GameWorld\n");
+
+  PRINTF(3)("> Loading world: '%s'\n", getPath());
+  TiXmlElement* element;
+  GameLoader* loader = GameLoader::getInstance();
+
+  if( getPath() == NULL)
+  {
+    PRINTF(1)("GameWorld has no path specified for loading");
+    return (ErrorMessage){213,"Path not specified","GameWorld::load()"};
+  }
+
+  TiXmlDocument* XMLDoc = new TiXmlDocument( getPath());
+  // load the xml world file for further loading
+  if( !XMLDoc->LoadFile())
+  {
+    PRINTF(1)("loading XML File: %s @ %s:l%d:c%d\n", XMLDoc->ErrorDesc(), this->getPath(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
+    delete XMLDoc;
+    return (ErrorMessage){213,"XML File parsing error","GameWorld::load()"};
+  }
+  // check basic validity
+  TiXmlElement* root = XMLDoc->RootElement();
+  assert( root != NULL);
+  if( root == NULL || root->Value() == NULL || strcmp( root->Value(), "WorldDataFile"))
+  {
+    // report an error
+    PRINTF(1)("Specified XML File is not an orxonox world data file (WorldDataFile element missing)\n");
+    delete XMLDoc;
+    return (ErrorMessage){213,"Path not a WorldDataFile","GameWorld::load()"};
+  }
+  /* the whole loading process for the GameWorld */
+  this->dataTank->loadData(root);
+
+  delete XMLDoc;
+  this->releaseLoadScreen();
+}
+
+
+/**
+ *  unload the data of this GameWorld
+ */
+ErrorMessage GameWorld::unloadData()
+{
+  delete this->shell;
+  PRINTF(3)("GameWorld::~GameWorld() - unloading the current GameWorld\n");
+
+  this->dataTank->unloadData();
+}
+
+
+/**
+ *  starts the GameWorld
+ */
+bool GameWorld::start()
+{
+  this->isPaused = false;
+  this->isRunning = true;
+
+  this->run();
+}
+
+
+/**
+ *  stops the world.
+ */
+bool GameWorld::stop()
+{
+  PRINTF(3)("GameWorld::stop() - got stop signal\n");
+  this->isRunning = false;
+}
+
+
+/**
+ *  pauses the game
+ */
+bool GameWorld::pause()
+{
+  this->isPaused = true;
+}
+
+
+/**
+ *  ends the pause Phase
+ */
+bool GameWorld::resume()
+{
+  this->isPaused = false;
+}
+
+
+/**
+ *  main loop of the world: executing all world relevant function
+ *
+ * in this loop we synchronize (if networked), handle input events, give the heart-beat to
+ * all other member-entities of the world (tick to player, enemies etc.), checking for
+ * collisions drawing everything to the screen.
+ */
+void GameWorld::run()
+{
+  this->lastFrame = SDL_GetTicks ();
+  PRINTF(3)("GameWorld::mainLoop() - Entering main loop\n");
+
+  while( this->isRunning) /* @todo implement pause */
+  {
+    ++this->cycle;
+    /* process intput */
+    this->handleInput ();
+    if( !this->isRunning)
+      break;
+
+    /* network synchronisation */
+    this->synchronize ();
+    /* process time */
+    this->tick ();
+    /* process collision */
+    this->collide ();
+    /* update the state */
+    this->update ();
+    /* draw everything */
+    this->display ();
+  }
+
+  PRINTF(3)("GameWorld::mainLoop() - Exiting the main loop\n");
+}
+
+
+/**
+ *  synchronize local data with remote data
+*/
+void GameWorld::synchronize ()
+{}
+
+
+/**
+ *  run all input processing
+
+   the command node is the central input event dispatcher. the node uses the even-queue from
+   sdl and has its own event-passing-queue.
+*/
+void GameWorld::handleInput ()
+{
+  EventHandler::getInstance()->process();
+}
+
+
+/**
+ *  ticks a WorldEntity list
+ * @param entityList list of the WorldEntities
+ * @param dt time passed since last frame
+ */
+void GameWorld::tick(std::list<WorldEntity*> entityList, float dt)
+{
+  std::list<WorldEntity*>::iterator entity;
+  for (entity = entityList.begin(); entity != entityList.end(); entity++)
+    (*entity)->tick(dt);
+
+}
+
+/**
+ *  advance the timeline
+ *
+ * this calculates the time used to process one frame (with all input handling, drawing, etc)
+ * the time is mesured in ms and passed to all world-entities and other classes that need
+ * a heart-beat.
+ */
+void GameWorld::tick ()
+{
+  Uint32 currentFrame = SDL_GetTicks();
+
+  if( !this->isPaused)
+  {
+    this->dt = currentFrame - this->lastFrame;
+
+    /* limit the the frame rate to 100 frames per second (fps) */
+    if( this->dt < 10)
+    {
+      /* the frame-rate is limited to 100 frames per second, all other things are for nothing. */
+      //PRINTF(0)("fps = 1000 - frame rate is adjusted\n");
+      SDL_Delay(10 - dt);
+      this->dt = 10;
+    }
+
+    this->dtS = (float)this->dt / 1000.0f * this->speed;
+    this->gameTime += this->dtS;
+
+    this->tick(this->dataTank->objectManager->getObjectList(OM_DEAD_TICK), this->dtS);
+    this->tick(this->dataTank->objectManager->getObjectList(OM_COMMON), this->dtS);
+    this->tick(this->dataTank->objectManager->getObjectList(OM_GROUP_00), this->dtS);
+    this->tick(this->dataTank->objectManager->getObjectList(OM_GROUP_01), this->dtS);
+    this->tick(this->dataTank->objectManager->getObjectList(OM_GROUP_01_PROJ), this->dtS);
+
+    /* update tick the rest */
+    this->dataTank->localCamera->tick(this->dtS);
+    AnimationPlayer::getInstance()->tick(this->dtS);
+    ParticleEngine::getInstance()->tick(this->dtS);
+    PhysicsEngine::getInstance()->tick(this->dtS);
+
+    GraphicsEngine::getInstance()->tick(this->dtS);
+  }
+  this->lastFrame = currentFrame;
+}
+
+
+/**
+ *  this function gives the world a consistant state
+ *
+ * after ticking (updating the world state) this will give a constistant
+ * state to the whole system.
+ */
+void GameWorld::update()
+{
+  GraphicsEngine::getInstance()->update(this->dtS);
+  PNode::getNullParent()->updateNode (this->dtS);
+  SoundEngine::getInstance()->update();
+  //music->update();
+}
+
+
+/**
+ * kicks the CDEngine to detect the collisions between the object groups in the world
+ */
+void GameWorld::collide()
+{
+  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_00),
+      this->dataTank->objectManager->getObjectList(OM_GROUP_01_PROJ));
+  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_01),
+      this->dataTank->objectManager->getObjectList(OM_COMMON));
+}
+
+/**
+ *  render the current frame
+ *
+ * clear all buffers and draw the world
+ */
+void GameWorld::display ()
+{
+  // clear buffer
+  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
+  // set camera
+  this->dataTank->localCamera->apply ();
+  // draw world
+  this->draw();
+  // flip buffers
+  GraphicsEngine::swapBuffers();
+}
+
+
+/**
+ *  runs through all entities calling their draw() methods
+ */
+void GameWorld::draw ()
+{
+  GraphicsEngine* engine = GraphicsEngine::getInstance();
+
+   /* to draw the bounding boxes of the objects at level 2 for debug purp */
+
+  /* debug draw the PNodes */
+
+  /* draw all WorldEntiy groups */
+  engine->draw(State::getObjectManager()->getObjectList(OM_ENVIRON_NOTICK));
+  engine->draw(State::getObjectManager()->getObjectList(OM_ENVIRON));
+  engine->draw(State::getObjectManager()->getObjectList(OM_COMMON));
+  engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_00));
+  engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_01));
+  engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_01_PROJ));
+  /* draws the particles */
+  ParticleEngine::getInstance()->draw();
+
+  if( unlikely( this->showBV))
+  {
+    CDEngine* engine = CDEngine::getInstance();
+    engine->drawBV(State::getObjectManager()->getObjectList(OM_ENVIRON_NOTICK));
+    engine->drawBV(State::getObjectManager()->getObjectList(OM_ENVIRON));
+    engine->drawBV(State::getObjectManager()->getObjectList(OM_COMMON));
+    engine->drawBV(State::getObjectManager()->getObjectList(OM_GROUP_00));
+    engine->drawBV(State::getObjectManager()->getObjectList(OM_GROUP_01));
+    engine->drawBV(State::getObjectManager()->getObjectList(OM_GROUP_01_PROJ));
+  }
+
+  if( unlikely(this->showPNodes))
+    PNode::getNullParent()->debugDraw(0);
+
+  /* final draw command */
+  engine->draw();
+}
+
+
+/**
+ *  sets the track path of this world
+ * @param name the name of the path
+ */
+void GameWorld::setPath( const char* name)
+{
+  if (this->path)
+    delete this->path;
+  if (ResourceManager::isFile(name))
+  {
+    this->path = new char[strlen(name)+1];
+    strcpy(this->path, name);
+  }
+  else
+  {
+    this->path = new char[strlen(ResourceManager::getInstance()->getDataDir()) + strlen(name) +1];
+    sprintf(this->path, "%s%s", ResourceManager::getInstance()->getDataDir(), name);
+  }
+}
+
+
+/**
+ *  shows the loading screen
+ */
+void GameWorld::displayLoadScreen ()
+{
+  PRINTF(3)("GameWorld::displayLoadScreen - start\n");
+  this->dataTank->glmis = new GLMenuImageScreen();
+  this->dataTank->glmis->setMaximum(8);
+  PRINTF(3)("GameWorld::displayLoadScreen - end\n");
+}
+
+
+/**
+ *  removes the loadscreen, and changes over to the game
+ */
+void GameWorld::releaseLoadScreen ()
+{
+  PRINTF(3)("GameWorld::releaseLoadScreen - start\n");
+  this->dataTank->glmis->setValue(this->dataTank->glmis->getMaximum());
+  PRINTF(3)("GameWorld::releaseLoadScreen - end\n");
+}
+
Index: trunk/src/story_entities/game_world.h
===================================================================
--- trunk/src/story_entities/game_world.h	(revision 6424)
+++ trunk/src/story_entities/game_world.h	(revision 6424)
@@ -0,0 +1,94 @@
+/*!
+ * @file game_world.h
+ *  container for all game worlds (singleplayers, multiplayers..)
+ */
+
+#ifndef _GAME_WORLD_H
+#define _GAME_WORLD_H
+
+
+#include "story_entity.h"
+
+
+class TiXmlElement;
+class Shell;
+class WorldEntity;
+class GameWorldData;
+
+
+//! The game world
+/**
+ *  this class initializes everything that should be displayed inside of the current level.
+ *  it is the main driving factor during gameplay.
+ */
+class GameWorld : public StoryEntity
+{
+
+  public:
+    GameWorld (const TiXmlElement* root = NULL);
+    virtual ~GameWorld ();
+
+    void loadParams(const TiXmlElement* root);
+
+    /* functions from story-entity */
+    virtual ErrorMessage init();
+    virtual ErrorMessage loadData();
+    virtual ErrorMessage unloadData();
+
+    virtual bool start();
+    virtual bool stop();
+    virtual bool pause();
+    virtual bool resume();
+    virtual void run();
+
+    /**  this returns the current game time @returns elapsed game time     */
+    inline double getGameTime() { return this->gameTime; }
+    /** sets the game speed @param speed speed of the Game */
+    inline void setSpeed(float speed) { this->speed = speed; };
+    /**  returns the track path of this world @returns the track path */
+    const char* getPath() { return this->path; }
+    void setPath( const char* name);
+
+    /** toggles the PNode visibility in the world (drawn as boxes) */
+    void togglePNodeVisibility() { this->showPNodes = !this->showPNodes; };
+    /** toggles the bounding volume (BV) visibility */
+    void toggleBVVisibility() { this->showBV = !this->showBV; };
+
+
+  protected:
+    /* world - running functions */
+    virtual void synchronize();
+    virtual void handleInput();
+    virtual void tick(std::list<WorldEntity*> worldEntity, float dt);
+    virtual void tick();
+    virtual void update();
+    virtual void collide();
+    virtual void draw();
+    virtual void display();
+
+
+  private:
+    void displayLoadScreen();
+    void releaseLoadScreen();
+
+
+  protected:
+    GameWorldData*      dataTank;                     //!< reference to the GameWorld Data Tank
+    char*               path;                         //!< The file from which this world is loaded
+
+    bool                showPNodes;                   //!< if the PNodes should be visible.
+    bool                showBV;                       //!< if the Bounding Volumes should be visible.
+
+    /* world timing */
+    Uint32              lastFrame;                    //!< last time of frame
+    Uint32              cycle;                        //!< The cycle we are in (starts with 0 and rises with every frame)
+    Uint32              dt;                           //!< time needed to calculate this frame (in milliSeconds)
+    float               dtS;                          //!< The time needed for caluculations in seconds
+    float               speed;                        //!< how fast the game flows
+    double              gameTime;                     //!< this is where the game time is saved
+
+    /* external modules interfaces */
+    Shell*              shell;
+};
+
+#endif /* _GAME_WORLD_H */
Index: trunk/src/story_entities/game_world_data.cc
===================================================================
--- trunk/src/story_entities/game_world_data.cc	(revision 6424)
+++ trunk/src/story_entities/game_world_data.cc	(revision 6424)
@@ -0,0 +1,314 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+### File Specific:
+   main-programmer: Patrick Boenzli
+*/
+
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD
+
+#include "game_world_data.h"
+
+#include "resource_manager.h"
+#include "state.h"
+#include "class_list.h"
+#include "substring.h"
+
+#include "game_loader.h"
+
+#include "p_node.h"
+#include "world_entity.h"
+#include "player.h"
+#include "camera.h"
+#include "environment.h"
+#include "terrain.h"
+#include "test_entity.h"
+#include "terrain.h"
+#include "md2Model.h"
+#include "weapons/projectile.h"
+#include "npcs/npc_test1.h"
+#include "playable.h"
+
+#include "light.h"
+
+#include "factory.h"
+#include "fast_factory.h"
+#include "load_param.h"
+
+#include "particle_engine.h"
+#include "graphics_engine.h"
+#include "event_handler.h"
+#include "sound_engine.h"
+#include "cd_engine.h"
+#include "network_manager.h"
+#include "physics_engine.h"
+#include "fields.h"
+
+#include "glmenu_imagescreen.h"
+
+#include "animation_player.h"
+#include "animation3d.h"
+
+#include "ogg_player.h"
+#include "shader.h"
+
+
+
+using namespace std;
+
+
+/**
+ * constructor of the GameWorldData
+ */
+GameWorldData::GameWorldData()
+{
+  this->setClassID(CL_GAME_WORLD_DATA, "GameWorldData");
+
+  this->localPlayer = NULL;
+  this->localCamera = NULL;
+
+  this->glmis = NULL;
+
+  this->localCamera = NULL;
+  this->localPlayer = NULL;
+  this->sky = NULL;
+  this->terrain = NULL;
+
+  this->music = NULL;
+  this->objectManager = NULL;
+}
+
+
+/**
+ * destructor for the GameWorldData
+ */
+GameWorldData::~GameWorldData()
+{}
+
+
+
+/**
+ *  initialize the GameWorldData
+ */
+ErrorMessage GameWorldData::init()
+{
+  this->objectManager = new ObjectManager();
+  State::setObjectManager(this->objectManager);
+
+  PNode::getNullParent();
+  this->localCamera = new Camera();
+  this->localCamera->setName ("GameWorld-Camera");
+  State::setCamera(this->localCamera, this->localCamera->getTarget());
+
+  LightManager::getInstance();
+
+  GraphicsEngine::getInstance()->displayFPS(true);
+
+  /* initialize some graphics engines and graphical elements */
+  AnimationPlayer::getInstance();
+  ParticleEngine::getInstance();
+  PhysicsEngine::getInstance();
+}
+
+
+/**
+ *  loads the data from the xml file
+ * @param root reference to the xml root element
+ */
+ErrorMessage GameWorldData::loadData(TiXmlElement* root)
+{
+  // load the parameters
+  // name
+  const char* string = grabParameter( root, "name");
+  if( string == NULL)
+  {
+    PRINTF(2)("GameWorld is missing a proper 'name'\n");
+    this->setName("Unknown");
+  }
+  else
+    this->setName(string);
+
+  this->loadGUI(root);
+  this->loadWorldEntities(root);
+  this->loadScene(root);
+}
+
+
+/**
+ *  unloads the data from the xml file
+ */
+ErrorMessage GameWorldData::unloadData()
+{
+  this->unloadGUI();
+  this->unloadWorldEntities();
+  this->unloadScene();
+}
+
+
+/**
+ *  loads the GUI data
+ * @param root reference to the xml root element
+ */
+ErrorMessage GameWorldData::loadGUI(TiXmlElement* root)
+{
+  TiXmlElement* element = root->FirstChildElement("LoadScreen");
+  if( element == NULL)
+  {
+    PRINTF(2)("no LoadScreen specified, loading default\n");
+
+    glmis->setBackgroundImage("pictures/load_screen.jpg");
+    this->glmis->setMaximum(8);
+//     this->glmis->draw();
+  }
+  else
+  {
+    this->glmis->loadParams(element);
+//     this->glmis->draw();
+  }
+  this->glmis->draw();
+}
+
+
+/**
+ *  unloads the GUI data
+ */
+ErrorMessage GameWorldData::unloadGUI()
+{
+  delete this->glmis;
+}
+
+
+/**
+ *  loads the world entities from the xml file
+ * @param root reference to the xml root parameter
+ */
+ErrorMessage GameWorldData::loadWorldEntities(TiXmlElement* root)
+{
+  TiXmlElement* element = root->FirstChildElement("WorldEntities");
+
+  if( element == NULL)
+  {
+    PRINTF(1)("GameWorld is missing 'WorldEntities'\n");
+  }
+  else
+  {
+    element = element->FirstChildElement();
+    // load Players/Objects/Whatever
+    PRINTF(4)("Loading WorldEntities\n");
+    while( element != NULL)
+    {
+      BaseObject* created = Factory::fabricate(element);
+      if( created != NULL )
+        printf("Created a %s: %s\n", created->getClassName(), created->getName());
+
+      //todo do this more elegant
+      if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))
+        this->sky = dynamic_cast<WorldEntity*>(created);
+      if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
+      {
+        this->terrain = dynamic_cast<Terrain*>(created);
+        CDEngine::getInstance()->setTerrain(terrain);
+      }
+      element = element->NextSiblingElement();
+      this->glmis->step(); //! @todo temporary
+    }
+    PRINTF(4)("Done loading WorldEntities\n");
+  }
+
+  // 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);
+  }
+
+  /* init the pnode tree */
+  PNode::getNullParent()->init();
+}
+
+
+/**
+ *  unloads the world entities
+ */
+ErrorMessage GameWorldData::unloadWorldEntities()
+{
+  FastFactory::flushAll(true);
+
+  // erease everything that is left.
+  delete PNode::getNullParent();
+
+  //secondary cleanup of PNodes;
+  const std::list<BaseObject*>* nodeList = ClassList::getList(CL_PARENT_NODE);
+  if (nodeList != NULL)
+    while (!nodeList->empty())
+      delete nodeList->front();
+
+  /* remove the player object */
+  if( this->localPlayer)
+    delete this->localPlayer;
+
+  // unload the resources !!
+  ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL);
+
+  if (State::getObjectManager() == this->objectManager)
+  {
+    State::setObjectManager(NULL);
+    delete this->objectManager;
+  }
+}
+
+
+/**
+ *  loads the scene data
+ * @param root reference to the xml root element
+ */
+ErrorMessage GameWorldData::loadScene(TiXmlElement* root)
+{
+  LoadParamXML(root, "LightManager", LightManager::getInstance(), LightManager, loadParams);
+
+  LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams);
+  //LoadParamXML(root, "PhysicsEngine", PhysicsEngine::getInstance(), PhysicsEngine, loadParams);
+
+  this->localCamera->setClipRegion(1, 10000.0);
+  if( this->sky != NULL)
+    this->localCamera->addChild(this->sky);
+
+  /* sound loading */
+  this->music = NULL;
+  //(OggPlayer*)ResourceManager::getInstance()->load("sound/00-luke_grey_-_hypermode.ogg", OGG, RP_LEVEL);
+  //music->playback();
+  SoundEngine::getInstance()->setListener(this->localCamera);
+}
+
+
+/**
+ *  unloads the scene data
+ */
+ErrorMessage GameWorldData::unloadScene()
+{
+  /* delete some garphics and scene eingines */
+  delete LightManager::getInstance();
+  delete ParticleEngine::getInstance();
+  delete AnimationPlayer::getInstance();
+  delete PhysicsEngine::getInstance();
+
+  /* stop the sound eninge */
+  SoundEngine::getInstance()->flushAllBuffers();
+  SoundEngine::getInstance()->flushAllSources();
+
+  /* unload the shaders */
+  Shader::suspendShader();
+}
+
Index: trunk/src/story_entities/game_world_data.h
===================================================================
--- trunk/src/story_entities/game_world_data.h	(revision 6424)
+++ trunk/src/story_entities/game_world_data.h	(revision 6424)
@@ -0,0 +1,66 @@
+/*!
+ * @file game_world_data.h
+ *  container for all game world data
+ */
+
+#ifndef _GAME_WORLD_DATA_H
+#define _GAME_WORLD_DATA_H
+
+#include "sdlincl.h"
+#include "data_tank.h"
+#include "error.h"
+
+
+class Camera;
+class Player;
+class Terrain;
+class WorldEntity;
+class ObjectManager;
+
+class GLMenuImageScreen;
+
+class TiXmlElement;
+class OggPlayer;
+
+
+//! The game world data
+/**
+ * this class is a containter for the data of the GameWorld. It just loads and unloads it
+ * the game start/stop process is not contained here and can be found in the GameWorld class.
+ */
+class GameWorldData : public DataTank
+{
+
+  public:
+    GameWorldData();
+    virtual ~GameWorldData();
+
+    virtual ErrorMessage init();
+    virtual ErrorMessage loadData(TiXmlElement* root);
+    virtual ErrorMessage unloadData();
+
+
+  protected:
+    virtual ErrorMessage loadGUI(TiXmlElement* root);
+    virtual ErrorMessage loadWorldEntities(TiXmlElement* root);
+    virtual ErrorMessage loadScene(TiXmlElement* root);
+
+    virtual ErrorMessage unloadGUI();
+    virtual ErrorMessage unloadWorldEntities();
+    virtual ErrorMessage unloadScene();
+
+
+  public:
+    GLMenuImageScreen*  glmis;                       //!< The Level-Loader Display
+
+    Camera*             localCamera;                 //!< The current camera
+    Player*             localPlayer;                 //!< The player, you fly through the level.
+    WorldEntity*        sky;                         //!< The environmental sky of orxonox
+    Terrain*            terrain;                     //!< The terrain - ground
+
+    OggPlayer*          music;                       //!< Reference to the SoundEngine's music player (OggPlayer)
+    ObjectManager*      objectManager;               //!< Reference to the objects manager
+};
+
+#endif /* _GAME_WORLD_DATA_H */
+
Index: trunk/src/story_entities/multi_player_world.cc
===================================================================
--- trunk/src/story_entities/multi_player_world.cc	(revision 6424)
+++ trunk/src/story_entities/multi_player_world.cc	(revision 6424)
@@ -0,0 +1,80 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Patrick Boenzli
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD
+
+
+#include "multi_player_world.h"
+#include "multi_player_world_data.h"
+
+#include "factory.h"
+#include "load_param.h"
+
+#include "network_manager.h"
+
+
+using namespace std;
+
+
+//! This creates a Factory to fabricate a MultiPlayerWorld
+CREATE_FACTORY(MultiPlayerWorld, CL_MULTI_PLAYER_WORLD);
+
+
+MultiPlayerWorld::MultiPlayerWorld(const TiXmlElement* root)
+  : GameWorld(root)
+{
+  this->setClassID(CL_MULTI_PLAYER_WORLD, "MultiPlayerWorld");
+
+  this->dataTank = new MultiPlayerWorldData();
+
+  this->loadParams(root);
+}
+
+
+/**
+ *  remove the MultiPlayerWorld from memory
+ *
+ *  delete everything explicitly, that isn't contained in the parenting tree!
+ *  things contained in the tree are deleted automaticaly
+ */
+MultiPlayerWorld::~MultiPlayerWorld ()
+{
+  PRINTF(3)("MultiPlayerWorld::~MultiPlayerWorld() - deleting current world\n");
+  if( this->dataTank)
+    delete this->dataTank;
+}
+
+
+/**
+ * loads the parameters of a MultiPlayerWorld from an XML-element
+ * @param root the XML-element to load from
+ */
+void MultiPlayerWorld::loadParams(const TiXmlElement* root)
+{
+  static_cast<GameWorld*>(this)->loadParams(root);
+
+  PRINTF(4)("Creating a MultiPlayerWorld\n");
+}
+
+
+/**
+ *  synchronizes the network since this is a network world
+ *
+ * this function overrides the synchrinize from the GameWorld
+ */
+void MultiPlayerWorld::synchronize()
+{
+  NetworkManager::getInstance()->synchronize();
+}
+
Index: trunk/src/story_entities/multi_player_world.h
===================================================================
--- trunk/src/story_entities/multi_player_world.h	(revision 6424)
+++ trunk/src/story_entities/multi_player_world.h	(revision 6424)
@@ -0,0 +1,33 @@
+/*!
+ * @file multi_player_world.h
+  *  Holds and manages all game data
+*/
+
+#ifndef _MULTI_PLAYER_WORLD_H
+#define _MULTI_PLAYER_WORLD_H
+
+#include "game_world.h"
+
+
+class TiXmlElement;
+class MultiPlayerWorldData;
+
+
+//! The multiplayer game world
+/**
+ *  this class initializes everything that should be displayed inside of the current level.
+ *  it is the main driving factor during gameplay.
+ */
+class MultiPlayerWorld : public GameWorld {
+
+ public:
+  MultiPlayerWorld (const TiXmlElement* root = NULL);
+  virtual ~MultiPlayerWorld ();
+
+  void loadParams(const TiXmlElement* root);
+
+  protected:
+    virtual void synchronize();
+};
+
+#endif /* _MULTI_PLAYER_WORLD_H */
Index: trunk/src/story_entities/multi_player_world_data.cc
===================================================================
--- trunk/src/story_entities/multi_player_world_data.cc	(revision 6424)
+++ trunk/src/story_entities/multi_player_world_data.cc	(revision 6424)
@@ -0,0 +1,222 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+### File Specific:
+   main-programmer: Patrick Boenzli
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD
+
+
+#include "multi_player_world_data.h"
+
+#include "resource_manager.h"
+#include "state.h"
+#include "class_list.h"
+#include "substring.h"
+
+#include "game_loader.h"
+#include "cd_engine.h"
+
+#include "p_node.h"
+#include "world_entity.h"
+#include "player.h"
+#include "camera.h"
+#include "environment.h"
+#include "terrain.h"
+#include "test_entity.h"
+#include "terrain.h"
+#include "md2Model.h"
+#include "weapons/projectile.h"
+#include "npcs/npc_test1.h"
+#include "playable.h"
+
+#include "factory.h"
+#include "fast_factory.h"
+#include "load_param.h"
+
+#include "network_manager.h"
+#include "network_game_manager.h"
+
+
+#include "glmenu_imagescreen.h"
+
+
+using namespace std;
+
+
+/**
+ * constructor of the GameWorldDataData
+ */
+MultiPlayerWorldData::MultiPlayerWorldData()
+    : GameWorldData()
+{}
+
+
+/**
+ * destructor for the GameWorldDataData
+ */
+MultiPlayerWorldData::~MultiPlayerWorldData()
+{}
+
+
+/**
+ *  initialize the GameWorldDataData
+ */
+ErrorMessage MultiPlayerWorldData::init()
+{
+  /* call underlying function */
+  GameWorldData::init();
+}
+
+
+/**
+ *  loads the GUI data
+ * @param root reference to the xml root element
+ */
+ErrorMessage MultiPlayerWorldData::loadGUI(TiXmlElement* root)
+{
+  /* call underlying function */
+  GameWorldData::loadGUI(root);
+}
+
+
+/**
+ *  unloads the GUI data
+ */
+ErrorMessage MultiPlayerWorldData::unloadGUI()
+{
+  /* call underlying function */
+  GameWorldData::unloadGUI();
+}
+
+
+/**
+ *  overloads the GameWorld::loadWorldEntities(...) class since the network WorldEntity loading is different
+ * @param root reference to the xml root parameter
+ */
+ErrorMessage MultiPlayerWorldData::loadWorldEntities(TiXmlElement* root)
+{
+  /* load the spawning points */
+  TiXmlElement* element = root->FirstChildElement("SpawningPoints");
+  if( element == NULL)
+  {
+    PRINTF(1)("NetworkWorld is missing 'SpawningPoints'\n");
+  }
+  else
+  {
+    element = element->FirstChildElement();
+    // load Players/Objects/Whatever
+    PRINTF(4)("Loading Spawning Points\n");
+    while( element != NULL)
+    {
+      BaseObject* created = Factory::fabricate(element);
+      if( created != NULL )
+        printf("Created a Spawning Point %s: %s\n", created->getClassName(), created->getName());
+
+      element = element->NextSiblingElement();
+      glmis->step();
+    }
+    PRINTF(4)("Done loading Spawning Points\n");
+  }
+
+  /* load the WorldEntities */
+  element = root->FirstChildElement("WorldEntities");
+  if( element == NULL)
+  {
+    PRINTF(1)("NetworkWorld is missing 'WorldEntities'\n");
+  }
+  else
+  {
+    element = element->FirstChildElement();
+
+    while( element != NULL)
+    {
+      if( NetworkManager::getInstance()->isGameServer())
+      {
+        /* pass the entity to the NetworkGameManager to be created */
+        BaseObject* created = NetworkGameManager::getInstance()->createEntity(element);
+        if( created != NULL )
+          PRINTF(1)("Created a %s: %s (0x%8x) from %s\n", created->getClassName(), created->getName(), created->getLeafClassID(), element->Value());
+        else
+          PRINTF(1)("NetworkWorld: could not create this entity\n");
+
+        if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))
+          this->sky = dynamic_cast<WorldEntity*>(created);
+        if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
+        {
+          this->terrain = dynamic_cast<Terrain*>(created);
+          CDEngine::getInstance()->setTerrain(terrain);
+        }
+      }
+      /* 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();
+      PRINTF(4)("Done loading NetworkWorldEntities\n");
+    }
+
+
+    /* 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);
+    }
+
+
+    /* init the pnode tree */
+    PNode::getNullParent()->init();
+  }
+}
+
+
+/**
+ *  unloads the world entities from the xml file
+ */
+ErrorMessage MultiPlayerWorldData::unloadWorldEntities()
+{
+  /* call underlying function */
+  GameWorldData::unloadWorldEntities();
+}
+
+
+/**
+ *  loads the scene data
+ * @param root reference to the xml root element
+ */
+ErrorMessage MultiPlayerWorldData::loadScene(TiXmlElement* root)
+{
+  /* call underlying function */
+  GameWorldData::loadScene(root);
+}
+
+
+/**
+ *  unloads the scene data
+ */
+ErrorMessage MultiPlayerWorldData::unloadScene()
+{
+  /* call underlying function */
+  GameWorldData::unloadScene();
+}
+
Index: trunk/src/story_entities/multi_player_world_data.h
===================================================================
--- trunk/src/story_entities/multi_player_world_data.h	(revision 6424)
+++ trunk/src/story_entities/multi_player_world_data.h	(revision 6424)
@@ -0,0 +1,37 @@
+/*!
+ * @file multi_player_world_data.h
+ *  container for all multiplayer game world data
+ */
+
+#ifndef _MULTI_PLAYER_WORLD_DATA_H
+#define _MULTI_PLAYER_WORLD_DATA_H
+
+
+#include "game_world_data.h"
+
+
+class TiXmlElement;
+
+
+//! The multiplayer world data
+class MultiPlayerWorldData : public GameWorldData
+{
+
+  public:
+    MultiPlayerWorldData();
+    virtual ~MultiPlayerWorldData();
+
+    virtual ErrorMessage init();
+
+
+  protected:
+    virtual ErrorMessage loadGUI(TiXmlElement* root);
+    virtual ErrorMessage loadWorldEntities(TiXmlElement* root);
+    virtual ErrorMessage loadScene(TiXmlElement* root);
+
+    virtual ErrorMessage unloadGUI();
+    virtual ErrorMessage unloadWorldEntities();
+    virtual ErrorMessage unloadScene();
+};
+
+#endif /* _MULTI_PLAYER_WORLD_DATA_H */
Index: trunk/src/story_entities/network_world.cc
===================================================================
--- trunk/src/story_entities/network_world.cc	(revision 6423)
+++ 	(revision )
@@ -1,796 +1,0 @@
-/*
-   orxonox - the future of 3D-vertical-scrollers
-
-   Copyright (C) 2004 orx
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   ### File Specific:
-   main-programmer: Patrick Boenzli
-   co-programmer: Christian Meyer
-   co-programmer: Benjamin Grauer
-*/
-
-#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD
-
-#include "network_world.h"
-
-#include "shell_command.h"
-#include "resource_manager.h"
-#include "state.h"
-
-#include "p_node.h"
-#include "world_entity.h"
-#include "player.h"
-#include "camera.h"
-#include "environment.h"
-#include "terrain.h"
-
-#include "test_entity.h"
-#include "terrain.h"
-#include "light.h"
-#include "load_param.h"
-#include "shell.h"
-
-#include "fast_factory.h"
-#include "animation_player.h"
-#include "particle_engine.h"
-#include "graphics_engine.h"
-#include "physics_engine.h"
-#include "fields.h"
-
-#include "md2Model.h"
-
-#include "glmenu_imagescreen.h"
-#include "game_loader.h"
-
-#include "animation3d.h"
-
-#include "substring.h"
-
-#include "factory.h"
-
-#include "weapons/projectile.h"
-#include "event_handler.h"
-#include "sound_engine.h"
-#include "ogg_player.h"
-
-#include "class_list.h"
-
-#include "cd_engine.h"
-#include "npcs/npc_test1.h"
-#include "shader.h"
-
-#include "playable.h"
-#include "network_manager.h"
-#include "network_game_manager.h"
-#include "playable.h"
-
-
-SHELL_COMMAND(speed, NetworkWorld, setSpeed);
-SHELL_COMMAND(togglePNodeVisibility, NetworkWorld, togglePNodeVisibility);
-SHELL_COMMAND(toggleBVVisibility, NetworkWorld, toggleBVVisibility);
-
-using namespace std;
-
-//! This creates a Factory to fabricate a NetworkWorld
-CREATE_FACTORY(NetworkWorld, CL_WORLD);
-
-NetworkWorld::NetworkWorld(const TiXmlElement* root)
-{
-  this->constuctorInit("", -1);
-  this->path = NULL;
-
-  this->loadParams(root);
-}
-
-/**
- *  remove the NetworkWorld from memory
- *
- *  delete everything explicitly, that isn't contained in the parenting tree!
- *  things contained in the tree are deleted automaticaly
- */
-NetworkWorld::~NetworkWorld ()
-{
-  delete this->shell;
-  PRINTF(3)("NetworkWorld::~NetworkWorld() - deleting current world\n");
-
-  delete this->localPlayer;
-
-  // delete all the initialized Engines.
-  FastFactory::flushAll(true);
-  delete LightManager::getInstance();
-  delete ParticleEngine::getInstance();
-  delete AnimationPlayer::getInstance();
-  delete PhysicsEngine::getInstance();
-
-  // external engines initialized by the orxonox-class get deleted
-  SoundEngine::getInstance()->flushAllBuffers();
-  SoundEngine::getInstance()->flushAllSources();
-
-  if (State::getObjectManager() == &this->objectManager)
-    State::setObjectManager(NULL);
-  // erease everything that is left.
-  delete PNode::getNullParent();
-
-  //secondary cleanup of PNodes;
-  const std::list<BaseObject*>* nodeList = ClassList::getList(CL_PARENT_NODE);
-  if (nodeList != NULL)
-    while (!nodeList->empty())
-      delete nodeList->front();
-
-  Shader::suspendShader();
-
-  // unload the resources !!
-  ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL);
-}
-
-/**
- * initializes the world.
- * @param name the name of the world
- * @param worldID the ID of this world
- *
- * set all stuff here that is world generic and does not use to much memory
- * because the real init() function StoryEntity::init() will be called
- * shortly before start of the game.
- * since all worlds are initiated/referenced before they will be started.
- * NO LEVEL LOADING HERE - NEVER!
-*/
-void NetworkWorld::constuctorInit(const char* name, int worldID)
-{
-  this->setClassID(CL_WORLD, "NetworkWorld");
-  PRINTF(0)("START\n");
-
-  this->setName(name);
-  this->gameTime = 0.0f;
-  this->setSpeed(1.0);
-  this->music = NULL;
-  this->shell = NULL;
-  this->localPlayer = NULL;
-  this->localCamera = NULL;
-
-  this->showPNodes = false;
-  this->showBV = false;
-}
-
-/**
- * loads the parameters of a NetworkWorld from an XML-element
- * @param root the XML-element to load from
- */
-void NetworkWorld::loadParams(const TiXmlElement* root)
-{
-  PRINTF(4)("Creating a NetworkWorld\n");
-
-  LoadParam(root, "identifier", this, NetworkWorld, setStoryID)
-    .describe("Sets the StoryID of this world");
-
-  LoadParam(root, "nextid", this, NetworkWorld, setNextStoryID)
-    .describe("Sets the ID of the next world");
-
-  LoadParam(root, "path", this, NetworkWorld, setPath)
-    .describe("The Filename of this NetworkWorld (relative from the data-dir)");
-}
-
-/**
- * this is executed just before load
- *
- * since the load function sometimes needs data, that has been initialized
- * before the load and after the proceeding storyentity has finished
-*/
-ErrorMessage NetworkWorld::preLoad()
-{
-  State::setObjectManager(&this->objectManager);
-  this->cycle = 0;
-
-  /* init the world interface */
-  this->shell = new Shell();
-
-  LightManager::getInstance();
-  PNode::getNullParent();
-
-  AnimationPlayer::getInstance(); // initializes the animationPlayer
-  ParticleEngine::getInstance();
-  PhysicsEngine::getInstance();
-
-  this->localCamera = new Camera();
-  this->localCamera->setName ("NetworkWorld-Camera");
-
-  State::setCamera(this->localCamera, this->localCamera->getTarget());
-
-  GraphicsEngine::getInstance()->displayFPS(true);
-  this->displayLoadScreen();
-}
-
-
-/**
- *  loads the NetworkWorld by initializing all resources, and set their default values.
- */
-ErrorMessage NetworkWorld::load()
-{
-  PRINTF(3)("> Loading world: '%s'\n", getPath());
-  TiXmlElement* element;
-  GameLoader* loader = GameLoader::getInstance();
-
-  if( getPath() == NULL)
-    {
-      PRINTF(1)("World has no path specified for loading");
-      return (ErrorMessage){213,"Path not specified","World::load()"};
-    }
-
-  TiXmlDocument* XMLDoc = new TiXmlDocument( getPath());
-  // load the campaign document
-  if( !XMLDoc->LoadFile())
-  {
-    // report an error
-    PRINTF(1)("loading XML File: %s @ %s:l%d:c%d\n", XMLDoc->ErrorDesc(), this->getPath(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
-    delete XMLDoc;
-    return (ErrorMessage){213,"XML File parsing error","NetworkWorld::load()"};
-  }
-
-  // check basic validity
-  TiXmlElement* root = XMLDoc->RootElement();
-  assert( root != NULL);
-
-  if( root == NULL || root->Value() == NULL || strcmp( root->Value(), "WorldDataFile"))
-    {
-      // report an error
-      PRINTF(1)("Specified XML File is not an orxonox world data file (WorldDataFile element missing)\n");
-      delete XMLDoc;
-      return (ErrorMessage){213,"Path not a WorldDataFile","NetworkWorld::load()"};
-    }
-
-
-  // load the parameters
-  // name
-  const char* string = grabParameter( root, "name");
-  if( string == NULL)
-    {
-      PRINTF(2)("World is missing a proper 'name'\n");
-      this->setName("Unknown");
-    }
-  else
-    {
-      this->setName(string);
-    }
-
-
-  ////////////////
-  // LOADSCREEN //
-  ////////////////
-  element = root->FirstChildElement("LoadScreen");
-  if (element == NULL)
-    {
-      PRINTF(2)("no LoadScreen specified, loading default\n");
-
-      glmis->setBackgroundImage("pictures/load_screen.jpg");
-      this->glmis->setMaximum(8);
-      this->glmis->draw();
-    }
-  else
-    {
-      this->glmis->loadParams(element);
-      this->glmis->draw();
-    }
-  this->glmis->draw();
-
-
-
-  ////////////////////////////
-  // Loading Spawning Point //
-  ////////////////////////////
-  element = root->FirstChildElement("SpawningPoints");
-  if( element == NULL)
-  {
-    PRINTF(1)("NetworkWorld is missing 'SpawningPoints'\n");
-  }
-  else
-  {
-    element = element->FirstChildElement();
-      // load Players/Objects/Whatever
-    PRINTF(4)("Loading Spawning Points\n");
-    while( element != NULL)
-    {
-      BaseObject* created = Factory::fabricate(element);
-      if( created != NULL )
-      {
-//        if(created->isA(CL_SPAWNING_POINT))
-//          this->spawn(dynamic_cast<WorldEntity*>(created));
-        printf("Created a Spawning Point %s: %s\n", created->getClassName(), created->getName());
-      }
-
-
-      element = element->NextSiblingElement();
-      glmis->step(); //! @todo temporary
-    }
-    PRINTF(4)("Done loading NetworkWorldEntities\n");
-  }
-
-
-  ////////////////////////
-  // find WorldEntities //
-  ////////////////////////
-  element = root->FirstChildElement("WorldEntities");
-  if( element == NULL)
-  {
-    PRINTF(1)("NetworkWorld is missing 'WorldEntities'\n");
-  }
-  else
-  {
-    element = element->FirstChildElement();
-      // load Players/Objects/Whatever
-    PRINTF(4)("Loading NetworkWorldEntities\n");
-    while( element != NULL)
-    {
-      if( NetworkManager::getInstance()->isGameServer())
-      {
-
-        BaseObject* created = NetworkGameManager::getInstance()->createEntity(element);
-        if( created != NULL )
-        {
-//          if(created->isA(CL_WORLD_ENTITY))
-//            this->spawn(dynamic_cast<WorldEntity*>(created));
-          printf("Created a %s: %s\n", created->getClassName(), created->getName());
-        }
-        else
-          PRINTF(1)("NetworkWorld: could not create this entity\n");
-
-          // if we load a 'Player' we use it as localPlayer
-
-
-          //todo do this more elegant
-        if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))
-          sky = dynamic_cast<WorldEntity*>(created);
-        if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
-        {
-          terrain = dynamic_cast<Terrain*>(created);
-          CDEngine::getInstance()->setTerrain(terrain);
-
-        }
-
-      }
-      else if( /* !strcmp( element->Value(), "SkyBox") || */ /* !strcmp( element->Value(), "Terrain") || */ !strcmp( element->Value(), "SpaceShip"))
-      {
-        BaseObject* created = Factory::fabricate(element);
-        if( created != NULL )
-        {
-//          if(created->isA(CL_WORLD_ENTITY))
-//            this->spawn(dynamic_cast<WorldEntity*>(created));
-          printf("Created a %s: %s\n", created->getClassName(), created->getName());
-        }
-        else
-          PRINTF(1)("NetworkWorld: could not create this entity\n");
-
-          // if we load a 'Player' we use it as localPlayer
-
-
-          //todo do this more elegant
-        if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))
-          sky = dynamic_cast<WorldEntity*>(created);
-        if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
-        {
-          terrain = dynamic_cast<Terrain*>(created);
-          CDEngine::getInstance()->setTerrain(terrain);
-        }
-      }
-      element = element->NextSiblingElement();
-      glmis->step(); //! @todo temporary
-      PRINTF(4)("Done loading NetworkWorldEntities\n");
-    }
-  }
-
-
-    //////////////////////////////
-    // LOADING ADDITIONAL STUFF //
-    //////////////////////////////
-
-    LoadParamXML(root, "LightManager", LightManager::getInstance(), LightManager, loadParams);
-
-   LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams);
-//   LoadParamXML(root, "PhysicsEngine", PhysicsEngine::getInstance(), PhysicsEngine, loadParams);
-
-  // free the XML data
-
-  delete XMLDoc;
-  /* GENERIC LOADING PROCESS FINISHED */
-
-
-  // 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);
-  }
-
-
-//   //localCamera->setParent(TrackNode::getInstance());
-//  tn->addChild(this->localCamera);
-  localCamera->setClipRegion(1, 10000.0);
-//  localCamera->lookAt(playable);
-//  this->localPlayer->setParentMode(PNODE_ALL);
-  if (this->sky != NULL)
-  {
-    this->localCamera->addChild(sky);
-  }
-  SoundEngine::getInstance()->setListener(this->localCamera);
-
-
-
-  ////////////
-  // STATIC //
-  ////////////
-
-
-//   TestEntity* testEntity = new TestEntity();
-//   testEntity->setRelCoor(Vector(570, 10, -15));
-//   testEntity->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));
-//   this->spawn(testEntity);
-
-//   for(int i = 0; i < 100; i++)
-//   {
-//     WorldEntity* tmp = NetworkGameManager::;
-//     char npcChar[10];
-//     sprintf (npcChar, "NPC_%d", i);
-//         tmp->setName(npcChar);
-//     tmp->setAbsCoor(((float)rand()/RAND_MAX) * 5000, 50/*+ (float)rand()/RAND_MAX*20*/, ((float)rand()/RAND_MAX -.5) *30);
-//     this->spawn(tmp);
-//   }
-
-  this->music = NULL;
-  //(OggPlayer*)ResourceManager::getInstance()->load("sound/00-luke_grey_-_hypermode.ogg", OGG, RP_LEVEL);
-  //music->playback();
-}
-
-ErrorMessage NetworkWorld::postLoad()
-{
-  /*monitor progress*/
-  this->glmis->step();
-  // stuff beyond this point remains to be loaded properly
-
-  // LIGHT initialisation
-  LightManager::getInstance()->setAmbientColor(.1,.1,.1);
-//  LightManager::getInstance()->addLight();
-  LightManager::getInstance()->debug();
-
-  this->releaseLoadScreen();
-}
-
-
-/**
- *  initializes a new NetworkWorld shortly before start
- *
- * this is the function, that will be loaded shortly before the world is
- * started
-*/
-ErrorMessage NetworkWorld::preStart()
-{
-  this->bPause = false;
-
-  /* update the object position before game start - so there are no wrong coordinates used in the first processing */
-  PNode::getNullParent()->updateNode (0.001f);
-  PNode::getNullParent()->updateNode (0.001f);
-}
-
-
-/**
- *  starts the NetworkWorld
- */
-ErrorMessage NetworkWorld::start()
-{
-  this->bQuitWorld = false;
-  this->mainLoop();
-}
-
-/**
- *  stops the world.
-
-   This happens, when the player decides to end the Level.
-*/
-ErrorMessage NetworkWorld::stop()
-{
-  PRINTF(3)("NetworkWorld::stop() - got stop signal\n");
-  this->bQuitWorld= true;
-}
-
-/**
- *  pauses the Game
-*/
-ErrorMessage NetworkWorld::pause()
-{
-  this->isPaused = true;
-}
-
-/**
- *  ends the pause Phase
-*/
-ErrorMessage NetworkWorld::resume()
-{
-  this->isPaused = false;
-}
-
-/**
- *  destroys the NetworkWorld
-*/
-ErrorMessage NetworkWorld::destroy()
-{
-
-}
-
-/**
- *  shows the loading screen
-*/
-void NetworkWorld::displayLoadScreen ()
-{
-  PRINTF(3)("NetworkWorld::displayLoadScreen - start\n");
-
-  //GLMenuImageScreen*
-  this->glmis = new GLMenuImageScreen();
-  this->glmis->setMaximum(8);
-
-  PRINTF(3)("NetworkWorld::displayLoadScreen - end\n");
-}
-
-/**
- * @brief removes the loadscreen, and changes over to the game
- *
- * @todo take out the delay
-*/
-void NetworkWorld::releaseLoadScreen ()
-{
-  PRINTF(3)("NetworkWorld::releaseLoadScreen - start\n");
-  this->glmis->setValue(this->glmis->getMaximum());
-  PRINTF(3)("NetworkWorld::releaseLoadScreen - end\n");
-  delete this->glmis;
-}
-
-
-/**
- *  this returns the current game time
- * @returns elapsed game time
-*/
-double NetworkWorld::getGameTime()
-{
-  return this->gameTime;
-}
-
-/**
-  \brief main loop of the world: executing all world relevant function
-  in this loop we synchronize (if networked), handle input events, give the heart-beat to
-  all other member-entities of the world (tick to player, enemies etc.), checking for
-  collisions drawing everything to the screen.
-*/
-void NetworkWorld::mainLoop()
-{
-  this->lastFrame = SDL_GetTicks ();
-  PRINTF(3)("World::mainLoop() - Entering main loop\n");
-
-  while(!this->bQuitWorld) /* @todo implement pause */
-  {
-    ++this->cycle;
-      // Network
-    this->synchronize ();
-      // Process input
-    this->handleInput ();
-    if( this->bQuitWorld)
-      break;
-      // Process time
-    this->tick ();
-      // Process collision
-    this->collide ();
-      // Update the state
-    this->update ();
-      // Draw
-    this->display ();
-  }
-
-  PRINTF(3)("NetworkWorld::mainLoop() - Exiting the main loop\n");
-}
-
-
-/**
- *  synchronize local data with remote data
-*/
-void NetworkWorld::synchronize ()
-{
-  // Get remote input
-  // Update synchronizables
-  NetworkManager::getInstance()->synchronize();
-}
-
-
-/**
- *  run all input processing
-
-   the command node is the central input event dispatcher. the node uses the even-queue from
-   sdl and has its own event-passing-queue.
-*/
-void NetworkWorld::handleInput ()
-{
-  EventHandler::getInstance()->process();
-
-  // remoteinput
-}
-
-void NetworkWorld::tick(std::list<WorldEntity*> entityList, float dt)
-{
-  std::list<WorldEntity*>::iterator entity;
-  for (entity = entityList.begin(); entity != entityList.end(); entity++)
-    (*entity)->tick(dt);
-
-}
-
-/**
- *  advance the timeline
-
-   this calculates the time used to process one frame (with all input handling, drawing, etc)
-   the time is mesured in ms and passed to all world-entities and other classes that need
-   a heart-beat.
-*/
-void NetworkWorld::tick ()
-{
-  Uint32 currentFrame = SDL_GetTicks();
-  if(!this->bPause)
-    {
-      this->dt = currentFrame - this->lastFrame;
-
-      if( this->dt > 10)
-        {
-          float fps = 1000/dt;
-
-          // temporary, only for showing how fast the text-engine is
-          char tmpChar[20];
-          sprintf(tmpChar, "fps: %4.0f", fps);
-        }
-      else
-        {
-          /* the frame-rate is limited to 100 frames per second, all other things are for
-             nothing.
-          */
-          PRINTF(3)("fps = 1000 - frame rate is adjusted\n");
-          SDL_Delay(10-dt);
-          this->dt = 10;
-        }
-
-      this->dtS = (float)this->dt / 1000.0 * this->speed;
-      this->gameTime += this->dtS;
-
-      this->tick(this->objectManager.getObjectList(OM_DEAD_TICK), this->dtS);
-      this->tick(this->objectManager.getObjectList(OM_COMMON), this->dtS);
-      this->tick(this->objectManager.getObjectList(OM_GROUP_00), this->dtS);
-      this->tick(this->objectManager.getObjectList(OM_GROUP_01), this->dtS);
-      this->tick(this->objectManager.getObjectList(OM_GROUP_01_PROJ), this->dtS);
-
-      /* update tick the rest */
-      this->localCamera->tick(this->dtS);
-      // tick the engines
-      AnimationPlayer::getInstance()->tick(this->dtS);
-//      if (this->cycle > 5)
-        PhysicsEngine::getInstance()->tick(this->dtS);
-
-      ParticleEngine::getInstance()->tick(this->dtS);
-
-
-      /** actualy the Graphics Engine should tick the world not the other way around...
-         but since we like the things not too complicated we got it this way around
-         until there is need or time to do it the other way around.
-         @todo: GraphicsEngine ticks world: separation of processes and data...
-
-        bensch: in my opinion the GraphicsEngine could draw the world, but not tick it,
-         beceause graphics have nothing(or at least not much) to do with Motion.
-      */
-      GraphicsEngine::getInstance()->tick(this->dtS);
-    }
-  this->lastFrame = currentFrame;
-}
-
-
-/**
- *  this function gives the world a consistant state
-
-   after ticking (updating the world state) this will give a constistant
-   state to the whole system.
-*/
-void NetworkWorld::update()
-{
-  GraphicsEngine::getInstance()->update(this->dtS);
-  PNode::getNullParent()->updateNode (this->dtS);
-  SoundEngine::getInstance()->update();
-  //music->update();
-}
-
-
-void NetworkWorld::collide()
-{
-  CDEngine::getInstance()->checkCollisions(this->objectManager.getObjectList(OM_GROUP_00),
-                                            this->objectManager.getObjectList(OM_GROUP_01_PROJ));
-  CDEngine::getInstance()->checkCollisions(this->objectManager.getObjectList(OM_GROUP_01),
-                                            this->objectManager.getObjectList(OM_COMMON));
-}
-
-/**
- *  render the current frame
-
-   clear all buffers and draw the world
-*/
-void NetworkWorld::display ()
-{
-  // clear buffer
-  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
-  // set camera
-  this->localCamera->apply ();
-  // draw world
-  this->draw();
-  // draw HUD
-  /** @todo draw HUD */
-  // flip buffers
-  GraphicsEngine::swapBuffers();
-  //SDL_Surface* screen = Orxonox::getInstance()->getScreen ();
-  //SDL_Flip (screen);
-}
-
-
-/**
- *  runs through all entities calling their draw() methods
- */
-void NetworkWorld::draw ()
-{
-  GraphicsEngine* engine = GraphicsEngine::getInstance();
-  engine->draw(State::getObjectManager()->getObjectList(OM_ENVIRON_NOTICK));
-  engine->draw(State::getObjectManager()->getObjectList(OM_ENVIRON));
-  engine->draw(State::getObjectManager()->getObjectList(OM_COMMON));
-  engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_00));
-  engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_01));
-  engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_01_PROJ));
-
-   if( unlikely( this->showBV))  // to draw the bounding boxes of the objects at level 2 for debug purp
-   {
-     CDEngine* engine = CDEngine::getInstance();
-     engine->drawBV(State::getObjectManager()->getObjectList(OM_ENVIRON_NOTICK));
-     engine->drawBV(State::getObjectManager()->getObjectList(OM_ENVIRON));
-     engine->drawBV(State::getObjectManager()->getObjectList(OM_COMMON));
-     engine->drawBV(State::getObjectManager()->getObjectList(OM_GROUP_00));
-     engine->drawBV(State::getObjectManager()->getObjectList(OM_GROUP_01));
-     engine->drawBV(State::getObjectManager()->getObjectList(OM_GROUP_01_PROJ));
-   }
-
-//   {
-//     if( entity->isVisible() ) entity->draw();
-  //FIXME
-//     entity = iterator->nextElement();
-//   }
-
-  ParticleEngine::getInstance()->draw();
-
-  if (unlikely(this->showPNodes))
-    PNode::getNullParent()->debugDraw(0);
-
-  engine->draw();
-  //TextEngine::getInstance()->draw();
-}
-
-void NetworkWorld::setPath( const char* name)
-{
-  if (this->path)
-    delete this->path;
-  if (ResourceManager::isFile(name))
-  {
-    this->path = new char[strlen(name)+1];
-    strcpy(this->path, name);
-  }
-  else
-    {
-      this->path = new char[strlen(ResourceManager::getInstance()->getDataDir()) + strlen(name) +1];
-      sprintf(this->path, "%s%s", ResourceManager::getInstance()->getDataDir(), name);
-    }
-}
-
-const char* NetworkWorld::getPath( void)
-{
-  return path;
-}
Index: trunk/src/story_entities/network_world.h
===================================================================
--- trunk/src/story_entities/network_world.h	(revision 6423)
+++ 	(revision )
@@ -1,115 +1,0 @@
-/*!
- * @file world.h
-  *  Holds and manages all game data
-*/
-
-#ifndef _WORLD_H
-#define _WORLD_H
-
-#include "sdlincl.h"
-#include "story_entity.h"
-#include "object_manager.h"
-
-class NetworkWorld;
-
-class WorldEntity;
-class Camera;
-class Player;
-class GLMenuImageScreen;
-class Terrain;
-class TiXmlElement;
-
-class Shell;
-class OggPlayer;
-
-//! The game world
-/**
-   this class initializes everything that should be displayed inside of the current level.
-   it is the main driving factor during gameplay.
-*/
-class NetworkWorld : public StoryEntity {
-
- public:
-  NetworkWorld (const TiXmlElement* root = NULL);
-  virtual ~NetworkWorld ();
-
-  void loadParams(const TiXmlElement* root);
-
-  double getGameTime();
-
-  /* classes from story-entity */
-  virtual ErrorMessage preLoad();
-  virtual ErrorMessage load ();
-  virtual ErrorMessage postLoad();
-
-  virtual ErrorMessage preStart();
-  virtual ErrorMessage start ();
-  virtual ErrorMessage stop ();
-  virtual ErrorMessage pause ();
-  virtual ErrorMessage resume ();
-  virtual ErrorMessage destroy ();
-
-  void displayLoadScreen();
-  void releaseLoadScreen();
-
-  /* interface to world */
-//  void spawn (WorldEntity* entity);
-
-  /** @param speed sets the speed of the Game */
-  inline void setSpeed(float speed) { this->speed = speed; };
-  const char* getPath();
-  void setPath( const char* name);
-
-  void togglePNodeVisibility() { this->showPNodes = !this->showPNodes; };
-  void toggleBVVisibility() { this->showBV = !this->showBV; };
-
- private:
-  void constuctorInit(const char* name, int worldID);
-  /* function for main-loop */
-  void synchronize ();
-  void handleInput ();
-  void tick (std::list<WorldEntity*> worldEntity, float dt);
-  void tick ();
-  void update ();
-  void collide ();
-  void draw ();
-  void mainLoop ();
-
-  void display ();
-  void debug ();
-
-  private:
-    char* path;                         //!< The file from which this world is loaded
-
-    // FLAGS //
-    bool bQuitWorld;                    //!< quit only the current game and return to menu
-    bool bPause;                        //!< pause mode
-
-    bool showPNodes;                    //!< if the PNodes should be visible.
-    bool showBV;                        //!< if the Bounding Volumes should be visible.
-
-    // TIMING //
-    Uint32 lastFrame;                   //!< last time of frame
-    Uint32 cycle;                       //!< The cycle we are in (starts with 0 and rises with every frame)
-    Uint32 dt;                          //!< time needed to calculate this frame (in milliSeconds)
-    float dtS;                          //!< The time needed for caluculations in seconds
-    float speed;                        //!< how fast the game flows
-    double gameTime;                    //!< this is where the game time is saved
-
-    // INTERNAL ENGINES
-    ObjectManager objectManager;        //!< The ObjectManager of this World.
-    Shell*     shell;
-    OggPlayer* music;
-
-    GLMenuImageScreen* glmis;           //!< The Level-Loader Display
-
-
-    // IMPORTANT ENTITIES
-    Camera* localCamera;                //!< The current Camera
-    Player* localPlayer;                //!< The Player, you fly through the level.
-
-    WorldEntity* sky;                   //!< The Environmental Heaven of orxonox @todo insert this to environment insted
-    Terrain* terrain;                   //!< The Terrain of the NetworkWorld.
-};
-
-#endif /* _WORLD_H */
Index: trunk/src/story_entities/single_player_world.cc
===================================================================
--- trunk/src/story_entities/single_player_world.cc	(revision 6424)
+++ trunk/src/story_entities/single_player_world.cc	(revision 6424)
@@ -0,0 +1,77 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Patrick Boenzli
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD
+
+
+#include "single_player_world.h"
+#include "single_player_world_data.h"
+
+#include "state.h"
+#include "class_list.h"
+
+#include "load_param.h"
+#include "fast_factory.h"
+#include "factory.h"
+
+#include "world_entity.h"
+#include "npcs/npc_test1.h"
+
+
+using namespace std;
+
+
+//! This creates a Factory to fabricate a SinglePlayerWorld
+CREATE_FACTORY(SinglePlayerWorld, CL_SINGLE_PLAYER_WORLD);
+
+
+
+SinglePlayerWorld::SinglePlayerWorld(const TiXmlElement* root)
+  : GameWorld(root)
+{
+  this->setClassID(CL_SINGLE_PLAYER_WORLD, "SinglePlayerWorld");
+  this->setName("SinglePlayerWorld uninitialized");
+
+  this->dataTank = new SinglePlayerWorldData();
+
+  this->loadParams(root);
+}
+
+
+/**
+ *  remove the SinglePlayerWorld from memory
+ *
+ *  delete everything explicitly, that isn't contained in the parenting tree!
+ *  things contained in the tree are deleted automaticaly
+ */
+SinglePlayerWorld::~SinglePlayerWorld ()
+{
+  PRINTF(3)("SinglePlayerWorld::~SinglePlayerWorld() - deleting current world\n");
+
+  if( this->dataTank)
+    delete this->dataTank;
+}
+
+
+/**
+ * loads the parameters of a SinglePlayerWorld from an XML-element
+ * @param root the XML-element to load from
+ */
+void SinglePlayerWorld::loadParams(const TiXmlElement* root)
+{
+  static_cast<GameWorld*>(this)->loadParams(root);
+
+  PRINTF(4)("Loaded SinglePlayerWorld specific stuff\n");
+}
+
Index: trunk/src/story_entities/single_player_world.h
===================================================================
--- trunk/src/story_entities/single_player_world.h	(revision 6424)
+++ trunk/src/story_entities/single_player_world.h	(revision 6424)
@@ -0,0 +1,32 @@
+/*!
+ * @file single_player_world.h
+ *  Holds and manages all single player game data
+ */
+
+#ifndef _SINGLE_PLAYER_WORLD_H
+#define _SINGLE_PLAYER_WORLD_H
+
+
+#include "game_world.h"
+
+
+class TiXmlElement;
+class SinglePlayerWorldData;
+
+
+//! The game world
+/**
+ *  this class initializes everything that should be displayed inside of the current level.
+ *  it is the main driving factor during gameplay.
+ */
+class SinglePlayerWorld : public GameWorld
+{
+
+  public:
+    SinglePlayerWorld (const TiXmlElement* root = NULL);
+    virtual ~SinglePlayerWorld ();
+
+    void loadParams(const TiXmlElement* root);
+};
+
+#endif /* _SINGLE_PLAYER_WORLD_H */
Index: trunk/src/story_entities/single_player_world_data.cc
===================================================================
--- trunk/src/story_entities/single_player_world_data.cc	(revision 6424)
+++ trunk/src/story_entities/single_player_world_data.cc	(revision 6424)
@@ -0,0 +1,112 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+### File Specific:
+   main-programmer: Patrick Boenzli
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD
+
+
+#include "single_player_world_data.h"
+
+#include "load_param.h"
+
+
+using namespace std;
+
+
+/**
+ * constructor of the GameWorldDataData
+ */
+SinglePlayerWorldData::SinglePlayerWorldData()
+  : GameWorldData()
+{}
+
+
+/**
+ * destructor for the GameWorldDataData
+ */
+SinglePlayerWorldData::~SinglePlayerWorldData()
+{}
+
+
+/**
+ *  initialize the GameWorldDataData
+ */
+ErrorMessage SinglePlayerWorldData::init()
+{
+  /* call underlying function */
+  GameWorldData::init();
+}
+
+
+/**
+ *  loads the GUI data
+ * @param root reference to the xml root element
+ */
+ErrorMessage SinglePlayerWorldData::loadGUI(TiXmlElement* root)
+{
+  /* call underlying function */
+  GameWorldData::loadGUI(root);
+}
+
+
+/**
+ *  unloads the GUI data
+ */
+ErrorMessage SinglePlayerWorldData::unloadGUI()
+{
+  /* call underlying function */
+  GameWorldData::unloadGUI();
+}
+
+
+/**
+ *  overloads the GameWorld::loadWorldEntities(...) class since the network WorldEntity loading is different
+ * @param root reference to the xml root parameter
+ */
+ErrorMessage SinglePlayerWorldData::loadWorldEntities(TiXmlElement* root)
+{
+  /* call underlying function */
+  GameWorldData::loadWorldEntities(root);
+}
+
+
+/**
+ *  unloads the world entities from the xml file
+ */
+ErrorMessage SinglePlayerWorldData::unloadWorldEntities()
+{
+  /* call underlying function */
+  GameWorldData::unloadWorldEntities();
+}
+
+
+/**
+ *  loads the scene data
+ * @param root reference to the xml root element
+ */
+ErrorMessage SinglePlayerWorldData::loadScene(TiXmlElement* root)
+{
+  /* call underlying function */
+  GameWorldData::loadScene(root);
+}
+
+
+/**
+ *  unloads the scene data
+ */
+ErrorMessage SinglePlayerWorldData::unloadScene()
+{
+  /* call underlying function */
+  GameWorldData::unloadScene();
+}
+
Index: trunk/src/story_entities/single_player_world_data.h
===================================================================
--- trunk/src/story_entities/single_player_world_data.h	(revision 6424)
+++ trunk/src/story_entities/single_player_world_data.h	(revision 6424)
@@ -0,0 +1,37 @@
+/*!
+ * @file single_player_world_data.h
+ *  container for all singleplayer game world data
+ */
+
+#ifndef _SINGLE_PLAYER_WORLD_DATA_H
+#define _SINGLE_PLAYER_WORLD_DATA_H
+
+
+#include "game_world_data.h"
+
+
+class TiXmlElement;
+
+
+//! The singleplayer world data
+class SinglePlayerWorldData : public GameWorldData
+{
+
+  public:
+    SinglePlayerWorldData();
+    virtual ~SinglePlayerWorldData();
+
+    virtual ErrorMessage init();
+
+
+  protected:
+    virtual ErrorMessage loadGUI(TiXmlElement* root);
+    virtual ErrorMessage loadWorldEntities(TiXmlElement* root);
+    virtual ErrorMessage loadScene(TiXmlElement* root);
+
+    virtual ErrorMessage unloadGUI();
+    virtual ErrorMessage unloadWorldEntities();
+    virtual ErrorMessage unloadScene();
+};
+
+#endif /* _SINGLE_PLAYER_WORLD_DATA_H */
Index: trunk/src/story_entities/story_entity.cc
===================================================================
--- trunk/src/story_entities/story_entity.cc	(revision 6423)
+++ trunk/src/story_entities/story_entity.cc	(revision 6424)
@@ -17,5 +17,10 @@
 
 
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD
+
+
 #include "story_entity.h"
+
+#include "load_param.h"
 
 
@@ -23,57 +28,41 @@
 
 
-
+/**
+ *  default constructor initializes all needed data
+ */
 StoryEntity::StoryEntity ()
 {
   this->setClassID(CL_STORY_ENTITY, "StoryEntity");
+
   this->isInit = false;
-  this->readyToRun = false;
   this->isPaused = false;
-  this->isSuspended = false;
-}
+  this->isRunning = false;
 
-StoryEntity::~StoryEntity () {}
-
-
-/**
-  *  sets the story ID
-
-    sets the story id of the current entity, this enables it to be identified in a
-    global context.
-*/
-void StoryEntity::setStoryID(int storyID)
-{
-  this->storyID = storyID;
+  this->storyID = -1;
+  this->nextStoryID = WORLD_ID_GAMEEND;
 }
 
 
 /**
-  *  this reads the story id of the current entity
-  * @returns the story entity id
-*/
-int StoryEntity::getStoryID()
-{
-  return this->storyID;
-}
+ *  deconstructor
+ */
+StoryEntity::~StoryEntity ()
+{}
 
 
 /**
-  *  sets the id of the next story entity
+ *  loads the Parameters of a Campaign
+ * @param root: The XML-element to load from
+ */
+void StoryEntity::loadParams(const TiXmlElement* root)
+{
+  static_cast<BaseObject*>(this)->loadParams(root);
 
-    StoryEntities can choose their following entity themselfs. the entity id defined here
-    will be startet after this entity ends. this can be convenient if you want to have a
-    non linear story with switches.
-*/
-void StoryEntity::setNextStoryID(int nextStoryID)
-{
-  this->nextStoryID = nextStoryID;
+  LoadParam(root, "identifier", this, StoryEntity, setStoryID)
+      .describe("A Unique Identifier for this StoryEntity");
+
+  LoadParam(root, "nextid", this, StoryEntity, setNextStoryID)
+      .describe("Sets the ID of the next StoryEntity");
+
+  PRINTF(4)("Loaded StoryEntity specific stuff\n");
 }
-
-/**
-  *  gets the story id of the current entity
-  * @returns story id
-*/
-int StoryEntity::getNextStoryID()
-{
-  return this->nextStoryID;
-}
Index: trunk/src/story_entities/story_entity.h
===================================================================
--- trunk/src/story_entities/story_entity.h	(revision 6423)
+++ trunk/src/story_entities/story_entity.h	(revision 6424)
@@ -1,6 +1,6 @@
 /*!
  * @file story_entity.h
-  *  holds the base class of everything that is playable - that is part of the story
-*/
+ *  holds the base class of everything that is playable - that is part of the story
+ */
 
 
@@ -12,4 +12,15 @@
 #include "error.h"
 
+
+typedef enum StoryEntityState
+{
+  SE_STATE_RUN     = 0,
+  SE_STATE_STOP,
+  SE_STATE_PAUSE,
+
+  SE_STATE_NUM
+};
+
+
 //! A class that represents something to play in orxonox. it is a container for worlds, movies, mission briefings, etc...
 class StoryEntity : public BaseObject {
@@ -19,49 +30,49 @@
   virtual ~StoryEntity ();
 
-  // INIT AND LOAD //
-  /** @brief initializes a Story Entity to default Values */
+  void loadParams(const TiXmlElement* root);
+
+  /* initialisation and loading */
+  /** initializes a Story Entity to the needed values */
   virtual ErrorMessage init() {};
-  /** @brief called before loading */
-  virtual ErrorMessage preLoad() {};
-  /** @brief called to load. */
-  virtual ErrorMessage load() {};
-  /** @brief called right after loading */
-  virtual ErrorMessage postLoad() {};
-  /** @brief called after postload to check for integrity. (optional) */
-  virtual ErrorMessage check() {};
+  /** called to load the data into the StoryEntity*/
+  virtual ErrorMessage loadData() {};
+  /** function that unloads the data from the StoryEntity */
+  virtual ErrorMessage unloadData() {};
 
-  // RUNNING //
-  /** @brief called shortly before starting the Entity */
-  virtual ErrorMessage preStart() {};
-  /** @brief starts the Entity. Starts the main cycle */
-  virtual ErrorMessage start() = 0;
-  /** @brief pauses the Entity. call to resume required to get it running again */
-  virtual ErrorMessage pause() = 0;
-  /** @brief resumes the Entity after a stop/pause or suspend. */
-  virtual ErrorMessage resume() = 0;
-  /** @brief suspends the Entity detaches all mayor functions  (optional) */
-  virtual ErrorMessage suspend() {};
-  /** @brief rewinds to the beginning/last checkpoint */
-  virtual ErrorMessage rewind() {};
-  /** @brief leaves the Entity. Ends it */
-  virtual ErrorMessage preStop() {};
-  /** @brief Stops the entity. */
-  virtual ErrorMessage stop() = 0;
+  /* running, stopping and pausing */
+  /** starts the Entity. Starts the main cycle */
+  virtual bool start() = 0;
+  /**  Stops the entity. */
+  virtual bool stop() = 0;
+  /** pauses the Entity, you can resume the game by calling the resume() function */
+  virtual bool pause() = 0;
+  /** resumes a paused StoryEntity */
+  virtual bool resume() = 0;
+  /** function that is been called when the StoryEntity is started via start() */
+  virtual void run() = 0;
 
-  // KILLING
-  /** @brief kills the Entity. should also calls prestop stop */
-  virtual ErrorMessage destroy() {};
+  /* properties interface */
+  /** returns the state of this StoryEntity */
+  StoryEntityState getState();
 
-  void setStoryID(int storyID);
-  int getStoryID();
+  /** sets the story id of the current entity, this enables it to be identified in a global context.  @param storyID the story id */
+  inline void setStoryID(int storyID) { this->storyID = storyID; }
+  /** sets the story id of the current entity, this enables it to be identified in a  global context. @returns  the story id  */
+  inline int getStoryID() { return this->storyID; }
+  /**  sets the id of the next story entity: StoryEntities can choose their following entity themselfs.
+   * the entity id defined here  will be startet after this entity ends. this can be convenient if you
+   * want to have a non linear story with switches.
+   * @param nextStoryID the story id of the next StoryEntity   */
+  inline void setNextStoryID(int nextStoryID) { this->nextStoryID = nextStoryID; }
+  /**  gets the story id of the current entity @returns story id */
+  inline int getNextStoryID() { return this->nextStoryID; }
 
-  void setNextStoryID(int nextStoryID);
-  int getNextStoryID();
+
 
   protected:
     bool isInit;         //!< if the entity is initialized, this has to be true.
-    bool readyToRun;     //!< If the entity is ready to run -> post-check.
+    bool isRunning;      //!< is true if the entity is running
     bool isPaused;       //!< is true if the entity is paused
-    bool isSuspended;    //!< if the Entity is suspended.
+
 
  private:
Index: trunk/src/story_entities/world.cc
===================================================================
--- trunk/src/story_entities/world.cc	(revision 6423)
+++ 	(revision )
@@ -1,734 +1,0 @@
-/*
-   orxonox - the future of 3D-vertical-scrollers
-
-   Copyright (C) 2004 orx
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   ### File Specific:
-   main-programmer: Patrick Boenzli
-   co-programmer: Christian Meyer
-   co-programmer: Benjamin Grauer
-*/
-
-#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD
-
-#include "world.h"
-
-#include "shell_command.h"
-#include "resource_manager.h"
-#include "state.h"
-
-#include "p_node.h"
-#include "world_entity.h"
-#include "player.h"
-#include "camera.h"
-#include "environment.h"
-#include "terrain.h"
-
-#include "test_entity.h"
-#include "terrain.h"
-#include "light.h"
-#include "load_param.h"
-#include "shell.h"
-
-#include "fast_factory.h"
-#include "animation_player.h"
-#include "particle_engine.h"
-#include "graphics_engine.h"
-#include "physics_engine.h"
-#include "fields.h"
-
-#include "md2Model.h"
-
-#include "glmenu_imagescreen.h"
-#include "game_loader.h"
-
-#include "animation3d.h"
-
-#include "substring.h"
-
-#include "factory.h"
-
-#include "weapons/projectile.h"
-#include "event_handler.h"
-#include "sound_engine.h"
-#include "ogg_player.h"
-
-#include "class_list.h"
-
-#include "cd_engine.h"
-#include "npcs/npc_test1.h"
-#include "shader.h"
-
-#include "playable.h"
-#include "network_manager.h"
-#include "playable.h"
-
-
-SHELL_COMMAND(speed, World, setSpeed);
-SHELL_COMMAND(togglePNodeVisibility, World, togglePNodeVisibility);
-SHELL_COMMAND(toggleBVVisibility, World, toggleBVVisibility);
-
-using namespace std;
-
-//! This creates a Factory to fabricate a World
-CREATE_FACTORY(World, CL_WORLD);
-
-World::World(const TiXmlElement* root)
-{
-  this->constuctorInit("", -1);
-  this->path = NULL;
-
-  this->loadParams(root);
-}
-
-/**
- *  remove the World from memory
- *
- *  delete everything explicitly, that isn't contained in the parenting tree!
- *  things contained in the tree are deleted automaticaly
- */
-World::~World ()
-{
-  delete this->shell;
-  PRINTF(3)("World::~World() - deleting current world\n");
-
-  delete this->localPlayer;
-
-  // delete all the initialized Engines.
-  FastFactory::flushAll(true);
-  delete LightManager::getInstance();
-  delete ParticleEngine::getInstance();
-  delete AnimationPlayer::getInstance();
-  delete PhysicsEngine::getInstance();
-
-  // external engines initialized by the orxonox-class get deleted
-  SoundEngine::getInstance()->flushAllBuffers();
-  SoundEngine::getInstance()->flushAllSources();
-
-  if (State::getObjectManager() == &this->objectManager)
-    State::setObjectManager(NULL);
-  // erease everything that is left.
-  delete PNode::getNullParent();
-
-  //secondary cleanup of PNodes;
-  const std::list<BaseObject*>* nodeList = ClassList::getList(CL_PARENT_NODE);
-  if (nodeList != NULL)
-    while (!nodeList->empty())
-      delete nodeList->front();
-
-  Shader::suspendShader();
-
-  // unload the resources !!
-  ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL);
-}
-
-/**
- * initializes the world.
- * @param name the name of the world
- * @param worldID the ID of this world
- *
- * set all stuff here that is world generic and does not use to much memory
- * because the real init() function StoryEntity::init() will be called
- * shortly before start of the game.
- * since all worlds are initiated/referenced before they will be started.
- * NO LEVEL LOADING HERE - NEVER!
-*/
-void World::constuctorInit(const char* name, int worldID)
-{
-  this->setClassID(CL_WORLD, "World");
-
-  this->setName(name);
-  this->gameTime = 0.0f;
-  this->setSpeed(1.0);
-  this->music = NULL;
-  this->shell = NULL;
-  this->localPlayer = NULL;
-  this->localCamera = NULL;
-
-  this->showPNodes = false;
-  this->showBV = false;
-}
-
-/**
- * loads the parameters of a World from an XML-element
- * @param root the XML-element to load from
- */
-void World::loadParams(const TiXmlElement* root)
-{
-  PRINTF(4)("Creating a World\n");
-
-  LoadParam(root, "identifier", this, World, setStoryID)
-    .describe("Sets the StoryID of this world");
-
-  LoadParam(root, "nextid", this, World, setNextStoryID)
-    .describe("Sets the ID of the next world");
-
-  LoadParam(root, "path", this, World, setPath)
-    .describe("The Filename of this World (relative from the data-dir)");
-}
-
-/**
- * this is executed just before load
- *
- * since the load function sometimes needs data, that has been initialized
- * before the load and after the proceeding storyentity has finished
-*/
-ErrorMessage World::preLoad()
-{
-  State::setObjectManager(&this->objectManager);
-  this->cycle = 0;
-
-  /* init the world interface */
-  this->shell = new Shell();
-
-  LightManager::getInstance();
-  PNode::getNullParent();
-
-  AnimationPlayer::getInstance(); // initializes the animationPlayer
-  ParticleEngine::getInstance();
-  PhysicsEngine::getInstance();
-
-  this->localCamera = new Camera();
-  this->localCamera->setName ("World-Camera");
-
-  State::setCamera(this->localCamera, this->localCamera->getTarget());
-
-  GraphicsEngine::getInstance()->displayFPS(true);
-  this->displayLoadScreen();
-}
-
-
-/**
- *  loads the World by initializing all resources, and set their default values.
- */
-ErrorMessage World::load()
-{
-  PRINTF(3)("> Loading world: '%s'\n", getPath());
-  TiXmlElement* element;
-  GameLoader* loader = GameLoader::getInstance();
-
-  if( getPath() == NULL)
-    {
-      PRINTF(1)("World has no path specified for loading");
-      return (ErrorMessage){213,"Path not specified","World::load()"};
-    }
-
-  TiXmlDocument* XMLDoc = new TiXmlDocument( getPath());
-  // load the campaign document
-  if( !XMLDoc->LoadFile())
-  {
-    // report an error
-    PRINTF(1)("loading XML File: %s @ %s:l%d:c%d\n", XMLDoc->ErrorDesc(), this->getPath(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
-    delete XMLDoc;
-    return (ErrorMessage){213,"XML File parsing error","World::load()"};
-  }
-
-  // check basic validity
-  TiXmlElement* root = XMLDoc->RootElement();
-  assert( root != NULL);
-
-  if( root == NULL || root->Value() == NULL || strcmp( root->Value(), "WorldDataFile"))
-    {
-      // report an error
-      PRINTF(1)("Specified XML File is not an orxonox world data file (WorldDataFile element missing)\n");
-      delete XMLDoc;
-      return (ErrorMessage){213,"Path not a WorldDataFile","World::load()"};
-    }
-
-  // load the parameters
-  // name
-  const char* string = grabParameter( root, "name");
-  if( string == NULL)
-    {
-      PRINTF(2)("World is missing a proper 'name'\n");
-      this->setName("Unknown");
-    }
-  else
-    {
-      this->setName(string);
-    }
-
-  ////////////////
-  // LOADSCREEN //
-  ////////////////
-  element = root->FirstChildElement("LoadScreen");
-  if (element == NULL)
-    {
-      PRINTF(2)("no LoadScreen specified, loading default\n");
-
-      glmis->setBackgroundImage("pictures/load_screen.jpg");
-      this->glmis->setMaximum(8);
-      this->glmis->draw();
-    }
-  else
-    {
-      this->glmis->loadParams(element);
-      this->glmis->draw();
-    }
-  this->glmis->draw();
-
-  ////////////////////////
-  // find WorldEntities //
-  ////////////////////////
-
-  element = root->FirstChildElement("WorldEntities");
-
-  if( element == NULL)
-    {
-      PRINTF(1)("World is missing 'WorldEntities'\n");
-    }
-  else
-    {
-      element = element->FirstChildElement();
-      // load Players/Objects/Whatever
-      PRINTF(4)("Loading WorldEntities\n");
-      while( element != NULL)
-        {
-          BaseObject* created = Factory::fabricate(element);
-          if( created != NULL )
-          {
-            if(created->isA(CL_WORLD_ENTITY))
-              this->spawn(dynamic_cast<WorldEntity*>(created));
-            printf("Created a %s: %s\n", created->getClassName(), created->getName());
-          }
-
-          // if we load a 'Player' we use it as localPlayer
-
-
-          //todo do this more elegant
-          if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))
-            this->sky = dynamic_cast<WorldEntity*>(created);
-          if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
-          {
-            terrain = dynamic_cast<Terrain*>(created);
-            CDEngine::getInstance()->setTerrain(terrain);
-          }
-          element = element->NextSiblingElement();
-          glmis->step(); //! @todo temporary
-        }
-      PRINTF(4)("Done loading WorldEntities\n");
-    }
-
-    //////////////////////////////
-    // LOADING ADDITIONAL STUFF //
-    //////////////////////////////
-
-    LoadParamXML(root, "LightManager", LightManager::getInstance(), LightManager, loadParams);
-
-   LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams);
-//   LoadParamXML(root, "PhysicsEngine", PhysicsEngine::getInstance(), PhysicsEngine, loadParams);
-
-  // free the XML data
-
-  delete XMLDoc;
-  /* GENERIC LOADING PROCESS FINISHED */
-
-
-  // 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);
-  }
-
-
-//   //localCamera->setParent(TrackNode::getInstance());
-//  tn->addChild(this->localCamera);
-  localCamera->setClipRegion(1, 10000.0);
-//  localCamera->lookAt(playable);
-//  this->localPlayer->setParentMode(PNODE_ALL);
-  if (this->sky != NULL)
-  {
-    this->localCamera->addChild(sky);
-  }
-  SoundEngine::getInstance()->setListener(this->localCamera);
-
-
-
-  ////////////
-  // STATIC //
-  ////////////
-
-
-//   TestEntity* testEntity = new TestEntity();
-//   testEntity->setRelCoor(Vector(570, 10, -15));
-//   testEntity->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));
-//   this->spawn(testEntity);
-
-  for(int i = 0; i < 100; i++)
-  {
-    WorldEntity* tmp = new NPCTest1();
-    char npcChar[10];
-    sprintf (npcChar, "NPC_%d", i);
-        tmp->setName(npcChar);
-    tmp->setAbsCoor(((float)rand()/RAND_MAX) * 5000, 50/*+ (float)rand()/RAND_MAX*20*/, ((float)rand()/RAND_MAX -.5) *30);
-    this->spawn(tmp);
-  }
-
-  this->music = NULL;
-  //(OggPlayer*)ResourceManager::getInstance()->load("sound/00-luke_grey_-_hypermode.ogg", OGG, RP_LEVEL);
-  //music->playback();
-}
-
-ErrorMessage World::postLoad()
-{
-  this->releaseLoadScreen();
-}
-
-
-/**
- *  initializes a new World shortly before start
- *
- * this is the function, that will be loaded shortly before the world is
- * started
-*/
-ErrorMessage World::preStart()
-{
-  this->bPause = false;
-
-  /* update the object position before game start - so there are no wrong coordinates used in the first processing */
-  PNode::getNullParent()->updateNode (0.001f);
-  PNode::getNullParent()->updateNode (0.001f);
-}
-
-
-/**
- *  starts the World
- */
-ErrorMessage World::start()
-{
-  this->bQuitWorld = false;
-  this->mainLoop();
-}
-
-/**
- *  stops the world.
-
-   This happens, when the player decides to end the Level.
-*/
-ErrorMessage World::stop()
-{
-  PRINTF(3)("World::stop() - got stop signal\n");
-  this->bQuitWorld= true;
-}
-
-/**
- *  pauses the Game
-*/
-ErrorMessage World::pause()
-{
-  this->isPaused = true;
-}
-
-/**
- *  ends the pause Phase
-*/
-ErrorMessage World::resume()
-{
-  this->isPaused = false;
-}
-
-/**
- *  destroys the World
-*/
-ErrorMessage World::destroy()
-{
-
-}
-
-/**
- *  shows the loading screen
-*/
-void World::displayLoadScreen ()
-{
-  PRINTF(3)("World::displayLoadScreen - start\n");
-
-  //GLMenuImageScreen*
-  this->glmis = new GLMenuImageScreen();
-  this->glmis->setMaximum(8);
-
-  PRINTF(3)("World::displayLoadScreen - end\n");
-}
-
-/**
- * @brief removes the loadscreen, and changes over to the game
- *
- * @todo take out the delay
-*/
-void World::releaseLoadScreen ()
-{
-  PRINTF(3)("World::releaseLoadScreen - start\n");
-  this->glmis->setValue(this->glmis->getMaximum());
-  PRINTF(3)("World::releaseLoadScreen - end\n");
-  delete this->glmis;
-}
-
-
-/**
- *  this returns the current game time
- * @returns elapsed game time
-*/
-double World::getGameTime()
-{
-  return this->gameTime;
-}
-
-
-
-/**
- *  synchronize local data with remote data
-*/
-void World::synchronize ()
-{
-  // Get remote input
-  // Update synchronizables
-/*  NetworkManager::getInstance()->synchronize();*/
-}
-
-
-/**
- *  run all input processing
-
-   the command node is the central input event dispatcher. the node uses the even-queue from
-   sdl and has its own event-passing-queue.
-*/
-void World::handleInput ()
-{
-  EventHandler::getInstance()->process();
-
-  // remoteinput
-}
-
-void World::tick(std::list<WorldEntity*> entityList, float dt)
-{
-  std::list<WorldEntity*>::iterator entity;
-  for (entity = entityList.begin(); entity != entityList.end(); entity++)
-    (*entity)->tick(dt);
-
-}
-
-/**
- *  advance the timeline
-
-   this calculates the time used to process one frame (with all input handling, drawing, etc)
-   the time is mesured in ms and passed to all world-entities and other classes that need
-   a heart-beat.
-*/
-void World::tick ()
-{
-  Uint32 currentFrame = SDL_GetTicks();
-  if(!this->bPause)
-    {
-      this->dt = currentFrame - this->lastFrame;
-
-      if( this->dt > 10)
-        {
-          float fps = 1000/dt;
-
-          // temporary, only for showing how fast the text-engine is
-          char tmpChar[20];
-          sprintf(tmpChar, "fps: %4.0f", fps);
-        }
-      else
-        {
-          /* the frame-rate is limited to 100 frames per second, all other things are for
-             nothing.
-          */
-          PRINTF(3)("fps = 1000 - frame rate is adjusted\n");
-          SDL_Delay(10-dt);
-          this->dt = 10;
-        }
-
-      this->dtS = (float)this->dt / 1000.0 * this->speed;
-      this->gameTime += this->dtS;
-
-      this->tick(this->objectManager.getObjectList(OM_DEAD_TICK), this->dtS);
-      this->tick(this->objectManager.getObjectList(OM_COMMON), this->dtS);
-      this->tick(this->objectManager.getObjectList(OM_GROUP_00), this->dtS);
-      this->tick(this->objectManager.getObjectList(OM_GROUP_01), this->dtS);
-      this->tick(this->objectManager.getObjectList(OM_GROUP_01_PROJ), this->dtS);
-
-      /* update tick the rest */
-      this->localCamera->tick(this->dtS);
-      // tick the engines
-      AnimationPlayer::getInstance()->tick(this->dtS);
-//      if (this->cycle > 5)
-        PhysicsEngine::getInstance()->tick(this->dtS);
-
-      ParticleEngine::getInstance()->tick(this->dtS);
-
-
-      /** actualy the Graphics Engine should tick the world not the other way around...
-         but since we like the things not too complicated we got it this way around
-         until there is need or time to do it the other way around.
-         @todo: GraphicsEngine ticks world: separation of processes and data...
-
-        bensch: in my opinion the GraphicsEngine could draw the world, but not tick it,
-         beceause graphics have nothing(or at least not much) to do with Motion.
-      */
-      GraphicsEngine::getInstance()->tick(this->dtS);
-    }
-  this->lastFrame = currentFrame;
-}
-
-
-/**
- *  this function gives the world a consistant state
-
-   after ticking (updating the world state) this will give a constistant
-   state to the whole system.
-*/
-void World::update()
-{
-  GraphicsEngine::getInstance()->update(this->dtS);
-  PNode::getNullParent()->updateNode (this->dtS);
-  SoundEngine::getInstance()->update();
-  //music->update();
-}
-
-
-void World::collide()
-{
-  CDEngine::getInstance()->checkCollisions(this->objectManager.getObjectList(OM_GROUP_00),
-                                            this->objectManager.getObjectList(OM_GROUP_01_PROJ));
-  CDEngine::getInstance()->checkCollisions(this->objectManager.getObjectList(OM_GROUP_01),
-                                            this->objectManager.getObjectList(OM_COMMON));
-}
-
-/**
- *  render the current frame
-
-   clear all buffers and draw the world
-*/
-void World::display ()
-{
-  // clear buffer
-  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
-  // set camera
-  this->localCamera->apply ();
-  // draw world
-  this->draw();
-  // draw HUD
-  /** @todo draw HUD */
-  // flip buffers
-  GraphicsEngine::swapBuffers();
-  //SDL_Surface* screen = Orxonox::getInstance()->getScreen ();
-  //SDL_Flip (screen);
-}
-
-
-/**
- *  runs through all entities calling their draw() methods
- */
-void World::draw ()
-{
-  GraphicsEngine* engine = GraphicsEngine::getInstance();
-  engine->draw(State::getObjectManager()->getObjectList(OM_ENVIRON_NOTICK));
-  engine->draw(State::getObjectManager()->getObjectList(OM_ENVIRON));
-  engine->draw(State::getObjectManager()->getObjectList(OM_COMMON));
-  engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_00));
-  engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_01));
-  engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_01_PROJ));
-
-   if( unlikely( this->showBV))  // to draw the bounding boxes of the objects at level 2 for debug purp
-   {
-     CDEngine* engine = CDEngine::getInstance();
-     engine->drawBV(State::getObjectManager()->getObjectList(OM_ENVIRON_NOTICK));
-     engine->drawBV(State::getObjectManager()->getObjectList(OM_ENVIRON));
-     engine->drawBV(State::getObjectManager()->getObjectList(OM_COMMON));
-     engine->drawBV(State::getObjectManager()->getObjectList(OM_GROUP_00));
-     engine->drawBV(State::getObjectManager()->getObjectList(OM_GROUP_01));
-     engine->drawBV(State::getObjectManager()->getObjectList(OM_GROUP_01_PROJ));
-   }
-
-//   {
-//     if( entity->isVisible() ) entity->draw();
-  //FIXME
-//     entity = iterator->nextElement();
-//   }
-
-  ParticleEngine::getInstance()->draw();
-
-  if (unlikely(this->showPNodes))
-    PNode::getNullParent()->debugDraw(0);
-
-  engine->draw();
-  //TextEngine::getInstance()->draw();
-}
-
-
-/**
- * \brief main loop of the world: executing all world relevant function
- *
- * in this loop we synchronize (if networked), handle input events, give the heart-beat to
- * all other member-entities of the world (tick to player, enemies etc.), checking for
- * collisions drawing everything to the screen.
- */
-void World::mainLoop()
-{
-  this->lastFrame = SDL_GetTicks ();
-  PRINTF(3)("World::mainLoop() - Entering main loop\n");
-
-  while(!this->bQuitWorld) /* @todo implement pause */
-  {
-    ++this->cycle;
-      // Network
-    this->synchronize ();
-      // Process input
-    this->handleInput ();
-    if( this->bQuitWorld)
-      break;
-      // Process time
-    this->tick ();
-      // Process collision
-    this->collide ();
-      // Update the state
-    this->update ();
-      // Draw
-    this->display ();
-  }
-
-  PRINTF(3)("World::mainLoop() - Exiting the main loop\n");
-}
-
-
-
-/**
- *  add and spawn a new entity to this world
- * @param entity to be added
-*/
-void World::spawn(WorldEntity* entity)
-{
-//   this->entities->add (entity);
-  entity->postSpawn ();
-}
-
-void World::setPath( const char* name)
-{
-  if (this->path)
-    delete this->path;
-  if (ResourceManager::isFile(name))
-  {
-    this->path = new char[strlen(name)+1];
-    strcpy(this->path, name);
-  }
-  else
-    {
-      this->path = new char[strlen(ResourceManager::getInstance()->getDataDir()) + strlen(name) +1];
-      sprintf(this->path, "%s%s", ResourceManager::getInstance()->getDataDir(), name);
-    }
-}
-
-const char* World::getPath( void)
-{
-  return path;
-}
Index: trunk/src/story_entities/world.h
===================================================================
--- trunk/src/story_entities/world.h	(revision 6423)
+++ 	(revision )
@@ -1,113 +1,0 @@
-/*!
- * @file world.h
-  *  Holds and manages all game data
-*/
-
-#ifndef _WORLD_H
-#define _WORLD_H
-
-#include "sdlincl.h"
-#include "story_entity.h"
-#include "object_manager.h"
-
-class WorldEntity;
-class Camera;
-class Player;
-class GLMenuImageScreen;
-class Terrain;
-class TiXmlElement;
-
-class Shell;
-class OggPlayer;
-
-//! The game world
-/**
-   this class initializes everything that should be displayed inside of the current level.
-   it is the main driving factor during gameplay.
-*/
-class World : public StoryEntity {
-
- public:
-  World (const TiXmlElement* root = NULL);
-  virtual ~World ();
-
-  void loadParams(const TiXmlElement* root);
-
-  double getGameTime();
-
-  /* classes from story-entity */
-  virtual ErrorMessage preLoad();
-  virtual ErrorMessage load ();
-  virtual ErrorMessage postLoad();
-
-  virtual ErrorMessage preStart();
-  virtual ErrorMessage start ();
-  virtual ErrorMessage stop ();
-  virtual ErrorMessage pause ();
-  virtual ErrorMessage resume ();
-  virtual ErrorMessage destroy ();
-
-  void displayLoadScreen();
-  void releaseLoadScreen();
-
-  /* interface to world */
-  void spawn (WorldEntity* entity);
-
-  /** @param speed sets the speed of the Game */
-  inline void setSpeed(float speed) { this->speed = speed; };
-  const char* getPath();
-  void setPath( const char* name);
-
-  void togglePNodeVisibility() { this->showPNodes = !this->showPNodes; };
-  void toggleBVVisibility() { this->showBV = !this->showBV; };
-
- private:
-  void constuctorInit(const char* name, int worldID);
-  /* function for main-loop */
-  void synchronize ();
-  void handleInput ();
-  void tick (std::list<WorldEntity*> worldEntity, float dt);
-  void tick ();
-  void update ();
-  void collide ();
-  void draw ();
-  void mainLoop ();
-
-  void display ();
-  void debug ();
-
-  private:
-    char* path;                         //!< The file from which this world is loaded
-
-    // FLAGS //
-    bool bQuitWorld;                    //!< quit only the current game and return to menu
-    bool bPause;                        //!< pause mode
-
-    bool showPNodes;                    //!< if the PNodes should be visible.
-    bool showBV;                        //!< if the Bounding Volumes should be visible.
-
-    // TIMING //
-    Uint32 lastFrame;                   //!< last time of frame
-    Uint32 cycle;                       //!< The cycle we are in (starts with 0 and rises with every frame)
-    Uint32 dt;                          //!< time needed to calculate this frame (in milliSeconds)
-    float dtS;                          //!< The time needed for caluculations in seconds
-    float speed;                        //!< how fast the game flows
-    double gameTime;                    //!< this is where the game time is saved
-
-    // INTERNAL ENGINES
-    ObjectManager objectManager;        //!< The ObjectManager of this World.
-    Shell*     shell;
-    OggPlayer* music;
-
-    GLMenuImageScreen* glmis;           //!< The Level-Loader Display
-
-
-    // IMPORTANT ENTITIES
-    Camera* localCamera;                //!< The current Camera
-    Player* localPlayer;                //!< The Player, you fly through the level.
-
-    WorldEntity* sky;                   //!< The Environmental Heaven of orxonox @todo insert this to environment insted
-    Terrain* terrain;                   //!< The Terrain of the World.
-};
-
-#endif /* _WORLD_H */
Index: trunk/src/subprojects/network/network_unit_test.cc
===================================================================
--- trunk/src/subprojects/network/network_unit_test.cc	(revision 6423)
+++ trunk/src/subprojects/network/network_unit_test.cc	(revision 6424)
@@ -136,5 +136,5 @@
 
   /* create a server stream */
-  nm->createServer(*serverSync, port);
+  nm->createServer(port);
 
   /* esatblish a connection */
@@ -289,5 +289,5 @@
   printf("%f = ", f);
   printf(s); printf("\n");
-  
+
   byte* res = Converter::floatToByteArray(f);
   printf("Byte Array: ");
@@ -295,5 +295,5 @@
     printf("%i  ", res[i]);
   printf("\n");
-  
+
   float b = Converter::byteArrayToFloat(res);
   printf("ReConvert: %f \n", b);
@@ -305,5 +305,5 @@
   printf("### %f = ", f);
   printf(s); printf("\n");
-  
+
   byte* res = Converter::_floatToByteArray(f);
   printf("Byte Array: ");
@@ -311,5 +311,5 @@
     printf("%i  ", res[i]);
   printf("\n");
-  
+
   float b = Converter::_byteArrayToFloat(res);
   printf("ReConvert: %f \n", b);
@@ -324,46 +324,46 @@
     printf("%i  ", res[i]);
   printf("\n");
-  
+
   int z = Converter::byteArrayToInt(res);
-  
+
   printf("ReConvert: %i\n", z);
 
-  
+
   //float a = 5.4f;
   //float b = 2.0f;
   //printf("%f mod %f = %f", a, b, a % b);
-  
-  printf("\n");
-  
+
+  printf("\n");
+
   */
   /*
   float y;
   char* s;
-  
+
   y = 12.0f;
   s = Converter::floatToBinString(y);
   printf("%f = ", y);
   printf(s); printf("\n");
-  
+
   y = 24549026.0f;
   s = Converter::floatToBinString(y);
   printf("%f = ", y);
   printf(s); printf("\n");
-  
+
   y = 12.4e20f;
   s = Converter::floatToBinString(y);
   printf("%f = ", y);
   printf(s); printf("\n");
-  
+
   y = 4.7824f;
   s = Converter::floatToBinString(y);
   printf("%f = ", y);
   printf(s); printf("\n");
-  
+
   y = -4.7824f;
   s = Converter::floatToBinString(y);
   printf("%f = ", y);
   printf(s); printf("\n");
-  
+
   y = -14.35e14f;
   s = Converter::floatToBinString(y);
@@ -371,13 +371,13 @@
   printf(s); printf("\n");
                                                             */
-  
-  
+
+
   /*
   float a = 12.3f;
-  
+
   char* s = Converter::floatToBinString(a);
   printf("%f = ", a);
   printf(s); printf("\n");
-  
+
   byte* res = Converter::floatToByteArray(a);
   printf("Byte Array: \n");
@@ -385,5 +385,5 @@
     printf("%i  ", res[i]);
   printf("\n");
-  
+
   float b = Converter::byteArrayToFloat(res);
   printf("ReConvert: %f \n", b);
@@ -392,9 +392,9 @@
 //  testFloatConverter(134.26455646546548741661675165f); printf("\n");
  // testFloatConverter(35.67e14f); printf("\n");
-  
+
   testFloatConverter(12.3e-7f); printf("\n");
   testFloatConverter(134.26455646546548741661675165f); printf("\n");
   testFloatConverter(35.67e14f); printf("\n");
-  
+
   return 0;
 }
Index: trunk/src/util/loading/game_loader.cc
===================================================================
--- trunk/src/util/loading/game_loader.cc	(revision 6423)
+++ trunk/src/util/loading/game_loader.cc	(revision 6424)
@@ -61,17 +61,4 @@
 }
 
-
-/**
- *  this class is a singleton class
- * @returns an instance of itself
- *
- * if you are unsure about singleton classes, check the theory out on the internet :)
- */
-GameLoader* GameLoader::getInstance()
-{
-  if(singletonRef == NULL)
-    singletonRef = new GameLoader();
-  return singletonRef;
-}
 
 /**
@@ -124,5 +111,5 @@
   if (campaignName)
   {
-    this->currentCampaign = this->fileToNetworkCampaign(campaignName);
+    this->currentCampaign = this->fileToCampaign(campaignName);
     delete[] campaignName;
   }
@@ -225,13 +212,4 @@
 
 /**
- *  release the mem ATTENTION: not implemented
- */
-ErrorMessage GameLoader::destroy()
-{
-
-}
-
-
-/**
  *  reads a campaign definition file into a campaign class
  * @param fileName to be loaded
@@ -285,55 +263,4 @@
 
 
-/**
- *  reads a campaign definition file into a campaign class
- * @param fileName to be loaded
- * @returns the loaded campaign
- *
- *  this will interprete the map/campaign files and recursivly load a tree of worlds/campaigns
- */
-Campaign* GameLoader::fileToNetworkCampaign(const char* fileName)
-{
-  /* do not entirely load the campaign. just the current world
-  before start of each world, it has to be initialized so it
-  can load everything it needs into memory then.
-  */
-
-  if( fileName == NULL)
-  {
-    PRINTF(2)("No filename specified for loading");
-    return NULL;
-  }
-
-  TiXmlDocument* XMLDoc = new TiXmlDocument( fileName);
-  // load the campaign document
-  if( !XMLDoc->LoadFile())
-  {
-      // report an error
-    PRINTF(1)("Could not load XML File %s: %s @ %d:%d\n", fileName, XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
-    delete XMLDoc;
-    return NULL;
-  }
-
-  // check basic validity
-  TiXmlElement* root = XMLDoc->RootElement();
-  assert( root != NULL);
-
-  if( strcmp( root->Value(), "Campaign"))
-  {
-      // report an error
-    PRINTF(2)("Specified XML File is not an orxonox campaign file (Campaign element missing)\n");
-    delete XMLDoc;
-    return NULL;
-  }
-
-  // construct campaign
-  Campaign* c = new Campaign( root);
-
-  // free the XML data
-  delete XMLDoc;
-
-  return c;
-}
-
 
 /**
@@ -347,12 +274,5 @@
     if( likely(event.bPressed))
     {
-      this->nextLevel();
-    }
-  }
-  else if( event.type == KeyMapper::PEV_PREVIOUS_WORLD)
-  {
-    if( likely(event.bPressed))
-    {
-      this->previousLevel();
+      this->switchToNextLevel();
     }
   }
@@ -377,21 +297,11 @@
 
 /**
- *  \brief this changes to the next level
- */
-void GameLoader::nextLevel()
-{
-  if(this->currentCampaign != NULL)
-    this->currentCampaign->nextLevel();
-}
-
-
-/**
- *  change to the previous level - not implemented
- *
- * this propably useless
- */
-void GameLoader::previousLevel()
-{
-  if(this->currentCampaign != NULL)
-    this->currentCampaign->previousLevel();
-}
+ *  this changes to the next level
+ */
+void GameLoader::switchToNextLevel()
+{
+  if(this->currentCampaign != NULL)
+    this->currentCampaign->switchToNextLevel();
+}
+
+
Index: trunk/src/util/loading/game_loader.h
===================================================================
--- trunk/src/util/loading/game_loader.h	(revision 6423)
+++ trunk/src/util/loading/game_loader.h	(revision 6424)
@@ -41,6 +41,10 @@
  public:
   ~GameLoader ();
+  /**  this class is a singleton class @returns an instance of itself  */
+  static GameLoader* getInstance() { if(singletonRef == NULL) singletonRef = new GameLoader(); return singletonRef; }
 
-  static GameLoader* getInstance();
+  ErrorMessage loadCampaign(const char* name);
+  ErrorMessage loadDebugCampaign(Uint32 campaignID);
+  ErrorMessage loadNetworkCampaign(const char* fileName);
 
   ErrorMessage init();
@@ -49,12 +53,6 @@
   ErrorMessage pause();
   ErrorMessage resume();
-  ErrorMessage destroy();
 
-  ErrorMessage loadCampaign(const char* name);
-  ErrorMessage loadDebugCampaign(Uint32 campaignID);
-  ErrorMessage loadNetworkCampaign(const char* fileName);
-
-  void nextLevel();
-  void previousLevel();
+  void switchToNextLevel();
 
   void process(const Event &event);
@@ -65,5 +63,4 @@
 
   Campaign* fileToCampaign(const char* name);
-  Campaign* fileToNetworkCampaign(const char* fileName);
 
 
Index: trunk/src/world_entities/camera.cc
===================================================================
--- trunk/src/world_entities/camera.cc	(revision 6423)
+++ trunk/src/world_entities/camera.cc	(revision 6424)
@@ -11,5 +11,5 @@
    ### File Specific:
    main-programmer: Christian Meyer
-   co-programmer: ...
+   co-programmer: Benjamin Grauer
 */
 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
@@ -17,15 +17,8 @@
 #include "camera.h"
 
-#include "world.h"
-#include "world_entity.h"
-#include "vector.h"
-#include "event.h"
 #include "event_handler.h"
 
 using namespace std;
 
-////////////
-// CAMERA //
-////////////
 
 /**
@@ -58,6 +51,5 @@
 */
 Camera::~Camera()
-{
-}
+{}
 
 /**
@@ -115,41 +107,41 @@
   currentMode = mode;
   switch (mode)
-    {
+  {
     default:
     case VIEW_NORMAL:
       this->toFovy = 60.0;
-/*      this->setParentSoft("TrackNode");
-      this->target->setParentSoft("TrackNode"); */
+      /*      this->setParentSoft("TrackNode");
+            this->target->setParentSoft("TrackNode"); */
       this->setRelCoorSoft(-10, 5, 0);
       this->target->setRelCoorSoft(0,0,0);
       break;
     case VIEW_BEHIND:
-//      this->toFovy = 120.0;
-//      this->setRelCoorSoft(Vector(3.5, 0, 0));
-  //    this->target->setRelCoorSoft(Vector(10,0,0));
-
-//       if (!strcmp(this->target->getParent()->getName(), "Player"))
-//         this->target->setParentSoft("TrackNode");
-//       else
-//         this->target->setParentSoft("Player");
-//       this->getParent()->debugNode(0);
-
-//      this->setParent("main-Turret");
-//      this->setParentMode(PNODE_ALL);
-//      this->target->setParentSoft("Player");
+      //      this->toFovy = 120.0;
+      //      this->setRelCoorSoft(Vector(3.5, 0, 0));
+      //    this->target->setRelCoorSoft(Vector(10,0,0));
+
+      //       if (!strcmp(this->target->getParent()->getName(), "Player"))
+      //         this->target->setParentSoft("TrackNode");
+      //       else
+      //         this->target->setParentSoft("Player");
+      //       this->getParent()->debugNode(0);
+
+      //      this->setParent("main-Turret");
+      //      this->setParentMode(PNODE_ALL);
+      //      this->target->setParentSoft("Player");
 
       break;
     case VIEW_FRONT:
       this->toFovy = 120.0;
-/*       this->setParentSoft("Player");
-       this->target->setParentSoft("Player");*/
-       this->setRelCoorSoft(4, 0, 0, 5);
-       this->target->setRelCoorSoft(Vector(10,0,0), 5);
-//      this->target->setRelDirSoft(Quaternion(M_PI/4.0, Vector(0,1,0)));
+      /*       this->setParentSoft("Player");
+             this->target->setParentSoft("Player");*/
+      this->setRelCoorSoft(4, 0, 0, 5);
+      this->target->setRelCoorSoft(Vector(10,0,0), 5);
+      //      this->target->setRelDirSoft(Quaternion(M_PI/4.0, Vector(0,1,0)));
       break;
     case VIEW_LEFT:
       this->toFovy = 90;
-/*      this->setParentSoft("TrackNode");
-      this->target->setParentSoft("TrackNode");*/
+      /*      this->setParentSoft("TrackNode");
+            this->target->setParentSoft("TrackNode");*/
       this->setRelCoorSoft(0, 1, -10, .5);
       this->target->setRelCoorSoft(0,0,0);
@@ -157,6 +149,6 @@
     case VIEW_RIGHT:
       this->toFovy = 90;
-/*      this->setParentSoft("TrackNode");
-      this->target->setParentSoft("TrackNode");*/
+      /*      this->setParentSoft("TrackNode");
+            this->target->setParentSoft("TrackNode");*/
       this->setRelCoorSoft(Vector(0, 1, 10));
       this->target->setRelCoorSoft(0,0,0);
@@ -164,9 +156,9 @@
     case VIEW_TOP:
       this->toFovy= 120;
-/*      this->setParentSoft("TrackNode");
-      this->target->setParentSoft("TrackNode");*/
+      /*      this->setParentSoft("TrackNode");
+            this->target->setParentSoft("TrackNode");*/
       this->setRelCoorSoft(Vector(30, 50, 0));
       this->target->setRelCoorSoft(35,0,0);
-    }
+  }
 }
 
@@ -216,5 +208,5 @@
   // switching back to Modeling Matrix
   glMatrixMode (GL_MODELVIEW);
-//  this->target->getParent()->getParent()->debugDraw(0, 2, Vector(1,0,0));
+  //  this->target->getParent()->getParent()->debugDraw(0, 2, Vector(1,0,0));
 }
 
@@ -226,27 +218,27 @@
 {
   if( event.type == KeyMapper::PEV_VIEW0)
-    {
-      this->setViewMode(VIEW_NORMAL);
-    }
+  {
+    this->setViewMode(VIEW_NORMAL);
+  }
   else if( event.type == KeyMapper::PEV_VIEW1)
-    {
-      this->setViewMode(VIEW_BEHIND);
-    }
+  {
+    this->setViewMode(VIEW_BEHIND);
+  }
   else if( event.type == KeyMapper::PEV_VIEW2)
-    {
-      this->setViewMode(VIEW_FRONT);
-    }
+  {
+    this->setViewMode(VIEW_FRONT);
+  }
   else if( event.type == KeyMapper::PEV_VIEW3)
-    {
-      this->setViewMode(VIEW_LEFT);
-    }
+  {
+    this->setViewMode(VIEW_LEFT);
+  }
   else if( event.type == KeyMapper::PEV_VIEW4)
-    {
-      this->setViewMode(VIEW_RIGHT);
-    }
+  {
+    this->setViewMode(VIEW_RIGHT);
+  }
   else if( event.type == KeyMapper::PEV_VIEW5)
-    {
-      this->setViewMode(VIEW_TOP);
-    }
+  {
+    this->setViewMode(VIEW_TOP);
+  }
 }
 
@@ -260,5 +252,5 @@
 {
   this->setClassID(CL_CAMERA_TARGET, "CameraTarget");
-//  this->setParentMode(PNODE_MOVEMENT);
-}
-
+  //  this->setParentMode(PNODE_MOVEMENT);
+}
+
Index: trunk/src/world_entities/power_ups/laser_power_up.cc
===================================================================
--- trunk/src/world_entities/power_ups/laser_power_up.cc	(revision 6423)
+++ trunk/src/world_entities/power_ups/laser_power_up.cc	(revision 6424)
@@ -19,4 +19,5 @@
 #include "factory.h"
 #include "state.h"
+#include "network_game_manager.h"
 
 #include "primitive_model.h"
@@ -118,2 +119,40 @@
 }
 
+int LaserPowerUp::writeBytes( const byte * data, int length, int sender )
+{
+  setRequestedSync( false );
+  setIsOutOfSync( false );
+
+  SYNCHELP_READ_BEGIN();
+
+  SYNCHELP_READ_FKT( PowerUp::writeState );
+
+  return SYNCHELP_READ_N;
+}
+
+
+
+int LaserPowerUp::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;
+
+    SYNCHELP_WRITE_BEGIN();
+
+    SYNCHELP_WRITE_FKT( PowerUp::readState );
+
+    return SYNCHELP_WRITE_N;
+  }
+
+  *reciever = 0;
+  return 0;
+}
+
Index: trunk/src/world_entities/power_ups/laser_power_up.h
===================================================================
--- trunk/src/world_entities/power_ups/laser_power_up.h	(revision 6423)
+++ trunk/src/world_entities/power_ups/laser_power_up.h	(revision 6424)
@@ -23,4 +23,7 @@
   virtual void draw() const;
 
+  virtual int writeBytes(const byte* data, int length, int sender);
+  virtual int readBytes(byte* data, int maxLength, int * reciever );
+
   private:
    void init();
Index: trunk/src/world_entities/power_ups/param_power_up.cc
===================================================================
--- trunk/src/world_entities/power_ups/param_power_up.cc	(revision 6423)
+++ trunk/src/world_entities/power_ups/param_power_up.cc	(revision 6424)
@@ -25,4 +25,5 @@
 #include "factory.h"
 #include "load_param.h"
+#include "network_game_manager.h"
 
 using namespace std;
@@ -53,4 +54,5 @@
 void ParamPowerUp::init()
 {
+  this->setClassID(CL_PARAM_POWER_UP, "ParamPowerUp");
   this->value = 0;
   this->max_value = 0;
@@ -63,5 +65,7 @@
   static_cast<PowerUp*>(this)->loadParams(root);
   LoadParam(root, "type", this, ParamPowerUp, setType);
-  if(root->FirstChildElement("value") != NULL) {
+
+  if( root != NULL && root->FirstChildElement("value") != NULL) {
+
     LoadParam(root, "value", this, ParamPowerUp, setValue);
   }
@@ -116,3 +120,61 @@
 }
 
+int ParamPowerUp::writeBytes( const byte * data, int length, int sender )
+{
+  setRequestedSync( false );
+  setIsOutOfSync( false );
 
+  SYNCHELP_READ_BEGIN();
+
+  SYNCHELP_READ_FKT( PowerUp::writeState );
+
+  int i;
+  SYNCHELP_READ_INT( i );
+  this->type = (EnumParamPowerUpType)i;
+  SYNCHELP_READ_INT( this->value );
+
+  if ( this->value != 0 )
+  {
+    SYNCHELP_READ_INT( this->min_value );
+    SYNCHELP_READ_INT( this->max_value );
+  }
+
+  return SYNCHELP_READ_N;
+}
+
+
+
+int ParamPowerUp::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;
+
+    SYNCHELP_WRITE_BEGIN();
+
+    SYNCHELP_WRITE_FKT( PowerUp::readState );
+
+    int i = this->type;
+    SYNCHELP_WRITE_INT( i );
+    SYNCHELP_WRITE_INT( this->value );
+
+    if ( this->value != 0 )
+    {
+      SYNCHELP_WRITE_INT( this->min_value );
+      SYNCHELP_WRITE_INT( this->max_value );
+    }
+
+    return SYNCHELP_WRITE_N;
+  }
+
+  *reciever = 0;
+  return 0;
+}
+
Index: trunk/src/world_entities/power_ups/param_power_up.h
===================================================================
--- trunk/src/world_entities/power_ups/param_power_up.h	(revision 6423)
+++ trunk/src/world_entities/power_ups/param_power_up.h	(revision 6424)
@@ -30,4 +30,7 @@
   int getValue();
 
+  virtual int writeBytes(const byte* data, int length, int sender);
+  virtual int readBytes(byte* data, int maxLength, int * reciever );
+
 protected:
   virtual void respawn();
Index: trunk/src/world_entities/power_ups/power_up.cc
===================================================================
--- trunk/src/world_entities/power_ups/power_up.cc	(revision 6423)
+++ trunk/src/world_entities/power_ups/power_up.cc	(revision 6424)
@@ -25,4 +25,6 @@
 PowerUp::PowerUp(float r, float g, float b)
 {
+  this->setClassID(CL_POWER_UP, "PowerUp");
+
   this->respawnType = RESPAWN_NONE;
 /*  if(!PowerUp::sphereModel) {*/
@@ -52,5 +54,5 @@
 void PowerUp::collidesWith (WorldEntity* entity, const Vector& location)
 {
- if(entity->isA(CL_EXTENDABLE))
+  if(entity->isA(CL_EXTENDABLE))
   {
     if(dynamic_cast<Extendable*>(entity)->pickup(this))
@@ -94,2 +96,28 @@
 }
 
+/**
+ * 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 PowerUp::readState( byte * data, int maxLength )
+{
+  SYNCHELP_WRITE_BEGIN();
+  SYNCHELP_WRITE_FKT( WorldEntity::readState );
+  return SYNCHELP_WRITE_N;
+}
+
+/**
+ * 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 PowerUp::writeState( const byte * data, int length, int sender )
+{
+  SYNCHELP_READ_BEGIN();
+  SYNCHELP_READ_FKT( WorldEntity::writeState );
+  return SYNCHELP_READ_N;
+}
+
Index: trunk/src/world_entities/power_ups/power_up.h
===================================================================
--- trunk/src/world_entities/power_ups/power_up.h	(revision 6423)
+++ trunk/src/world_entities/power_ups/power_up.h	(revision 6424)
@@ -26,4 +26,7 @@
   void setRespawnType(const char* type);
 
+  int       writeState(const byte* data, int length, int sender);
+  int       readState(byte* data, int maxLength );
+
 protected:
   PowerUp(float r, float g, float b);
Index: trunk/src/world_entities/power_ups/turret_power_up.cc
===================================================================
--- trunk/src/world_entities/power_ups/turret_power_up.cc	(revision 6423)
+++ trunk/src/world_entities/power_ups/turret_power_up.cc	(revision 6424)
@@ -18,4 +18,5 @@
 #include "turret_power_up.h"
 #include "factory.h"
+#include "network_game_manager.h"
 #include "state.h"
 
@@ -118,2 +119,39 @@
 }
 
+int TurretPowerUp::writeBytes( const byte * data, int length, int sender )
+{
+  setRequestedSync( false );
+  setIsOutOfSync( false );
+
+  SYNCHELP_READ_BEGIN();
+
+  SYNCHELP_READ_FKT( PowerUp::writeState );
+
+  return SYNCHELP_READ_N;
+}
+
+
+
+int TurretPowerUp::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;
+
+    SYNCHELP_WRITE_BEGIN();
+
+    SYNCHELP_WRITE_FKT( PowerUp::readState );
+
+    return SYNCHELP_WRITE_N;
+  }
+
+  *reciever = 0;
+  return 0;
+}
Index: trunk/src/world_entities/power_ups/turret_power_up.h
===================================================================
--- trunk/src/world_entities/power_ups/turret_power_up.h	(revision 6423)
+++ trunk/src/world_entities/power_ups/turret_power_up.h	(revision 6424)
@@ -23,4 +23,7 @@
   virtual void draw() const;
 
+  virtual int writeBytes(const byte* data, int length, int sender);
+  virtual int readBytes(byte* data, int maxLength, int * reciever );
+
   private:
    void init();
Index: trunk/src/world_entities/power_ups/weapon_power_up.cc
===================================================================
--- trunk/src/world_entities/power_ups/weapon_power_up.cc	(revision 6423)
+++ trunk/src/world_entities/power_ups/weapon_power_up.cc	(revision 6424)
@@ -20,4 +20,5 @@
 #include "state.h"
 #include "list.h"
+#include "network_game_manager.h"
 
 #include "primitive_model.h"
@@ -85,2 +86,44 @@
   this->weapon = dynamic_cast<Weapon*>(Factory::fabricate(name));
 }
+
+int WeaponPowerUp::writeBytes( const byte * data, int length, int sender )
+{
+  setRequestedSync( false );
+  setIsOutOfSync( false );
+
+  SYNCHELP_READ_BEGIN();
+
+  SYNCHELP_READ_FKT( PowerUp::writeState );
+
+  //TODO: sync weapon class ( see loadParams )
+
+  return SYNCHELP_READ_N;
+}
+
+
+
+int WeaponPowerUp::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;
+
+    SYNCHELP_WRITE_BEGIN();
+
+    SYNCHELP_WRITE_FKT( PowerUp::readState );
+
+    //TODO: sync weapon class ( see loadParams )
+
+    return SYNCHELP_WRITE_N;
+  }
+
+  *reciever = 0;
+  return 0;
+}
Index: trunk/src/world_entities/power_ups/weapon_power_up.h
===================================================================
--- trunk/src/world_entities/power_ups/weapon_power_up.h	(revision 6423)
+++ trunk/src/world_entities/power_ups/weapon_power_up.h	(revision 6424)
@@ -22,4 +22,7 @@
   void setWeaponClass(const char* name);
 
+  virtual int writeBytes(const byte* data, int length, int sender);
+  virtual int readBytes(byte* data, int maxLength, int * reciever );
+
 protected:
   virtual void respawn();
Index: trunk/src/world_entities/space_ships/space_ship.cc
===================================================================
--- trunk/src/world_entities/space_ships/space_ship.cc	(revision 6423)
+++ trunk/src/world_entities/space_ships/space_ship.cc	(revision 6424)
@@ -31,4 +31,6 @@
 #include "key_mapper.h"
 #include "event_handler.h"
+
+#include "network_game_manager.h"
 
 #include "power_ups/weapon_power_up.h"
@@ -121,5 +123,5 @@
   PRINTF(4)("SPACESHIP INIT\n");
 
-  //  EventHandler::getInstance()->grabEvents(true);
+    EventHandler::getInstance()->grabEvents(true);
 
   bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false;
@@ -516,2 +518,39 @@
   }
 }
+
+
+int SpaceShip::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 SpaceShip::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;
+
+    SYNCHELP_WRITE_BEGIN();
+
+    SYNCHELP_WRITE_FKT( WorldEntity::readState );
+
+    return SYNCHELP_WRITE_N;
+  }
+
+  *reciever = 0;
+  return 0;
+}
Index: trunk/src/world_entities/space_ships/space_ship.h
===================================================================
--- trunk/src/world_entities/space_ships/space_ship.h	(revision 6423)
+++ trunk/src/world_entities/space_ships/space_ship.h	(revision 6424)
@@ -44,4 +44,7 @@
     bool pickup(PowerUp* powerUp);
 
+    virtual int       writeBytes(const byte* data, int length, int sender);
+    virtual int       readBytes(byte* data, int maxLength, int * reciever);
+
 
   private:
Index: trunk/src/world_entities/spawning_point.cc
===================================================================
--- trunk/src/world_entities/spawning_point.cc	(revision 6423)
+++ trunk/src/world_entities/spawning_point.cc	(revision 6424)
@@ -16,8 +16,10 @@
 
 #include "spawning_point.h"
+
 #include "load_param.h"
 #include "factory.h"
+
 #include "compiler.h"
-#include "world.h" /* only temp. until the object manager is implemented*/
+
 
 /**
@@ -97,6 +99,7 @@
             this->frequency, this->seed);
   BaseObject* spawningEntity = Factory::fabricate(this->classID);
-  if( likely(this->world != NULL))
-    this->world->spawn(dynamic_cast<WorldEntity*>(spawningEntity));
+
+//   if( likely(this->world != NULL))
+//     this->world->spawn(dynamic_cast<WorldEntity*>(spawningEntity));
 }
 
Index: trunk/src/world_entities/weapons/ground_turret.cc
===================================================================
--- trunk/src/world_entities/weapons/ground_turret.cc	(revision 6423)
+++ trunk/src/world_entities/weapons/ground_turret.cc	(revision 6424)
@@ -119,20 +119,6 @@
 void GroundTurret::draw () const
 {
-  glMatrixMode(GL_MODELVIEW);
-  glPushMatrix();
-  float matrix[4][4];
-
-  /* translate */
-  glTranslatef (this->getAbsCoor ().x,
-                this->getAbsCoor ().y,
-                this->getAbsCoor ().z);
-  /* rotate */
-  this->getAbsDir().matrix(matrix);
-  glMultMatrixf((float*)matrix);
-
-  if (this->getModel())
-    this->getModel()->draw();
-
-  glPopMatrix();
+  WorldEntity::draw();
+
   if (this->left != NULL)
     this->left->draw();
Index: trunk/src/world_entities/world_entity.cc
===================================================================
--- trunk/src/world_entities/world_entity.cc	(revision 6423)
+++ trunk/src/world_entities/world_entity.cc	(revision 6424)
@@ -35,4 +35,5 @@
     ->defaultValues(2, "models/ships/fighter.obj", 1.0);
 
+SHELL_COMMAND(debugEntity, WorldEntity, debugWE);
 
 /**
@@ -48,4 +49,6 @@
 
   this->obbTree = NULL;
+
+  this->md2TextureFileName = NULL;
 
   if (root != NULL)
@@ -105,4 +108,5 @@
 void WorldEntity::loadModel(const char* fileName, float scaling, unsigned int modelNumber)
 {
+  this->scaling = scaling;
   if ( fileName != NULL && strcmp(fileName, "") )
   {
@@ -123,5 +127,9 @@
       return;
     }
-
+    if (scaling == 0.0)
+    {
+      scaling = 1.0;
+      PRINTF(1)("YOU GAVE ME A CRAPY SCALE resetting to 1\n");
+    }
     if(strstr(fileName, ".obj"))
     {
@@ -343,4 +351,23 @@
 }
 
+
+/**
+ * Debug the WorldEntity
+ */
+void WorldEntity::debugEntity() const
+{
+  PRINT(0)("WorldEntity %s::%s  (DEBUG)\n", this->getClassName(), this->getName());
+  this->debugNode();
+  PRINT(0)("List: %s ; ModelCount %d - ", ObjectManager::OMListToString(this->objectListNumber) , this->models.size());
+  for (unsigned int i = 0; i < this->models.size(); i++)
+  {
+    if (models[i] != NULL)
+      PRINT(0)(" : %d:%s", i, this->models[i]->getName());
+  }
+  PRINT(0)("\n");
+
+}
+
+
 /**
  * Writes data from network containing information about the state
@@ -359,13 +386,22 @@
   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 );
+
+  if ( strcmp(modelFileName, "") )
+  {
+
+    if ( strstr(modelFileName, ResourceManager::getInstance()->getDataDir()) )
+    {
+      loadModel( modelFileName+strlen(ResourceManager::getInstance()->getDataDir()), scaling );
+    }
+    else
+    {
+      loadModel( modelFileName, scaling );
+    }
   }
   delete[] modelFileName;
+
+  SYNCHELP_READ_STRINGM( modelFileName );
+  if ( strcmp(modelFileName, "") )
+    this->md2TextureFileName = modelFileName;
 
   return SYNCHELP_READ_N;
@@ -386,4 +422,13 @@
   SYNCHELP_WRITE_STRING( getModel( 0 )->getName() );
   SYNCHELP_WRITE_FLOAT( scaling );
+  if ( this->md2TextureFileName!=NULL && strcmp(this->md2TextureFileName, "") )
+  {
+    SYNCHELP_WRITE_STRING(this->md2TextureFileName);
+  }
+  else
+  {
+    SYNCHELP_WRITE_STRING("");
+  }
+
   return SYNCHELP_WRITE_N;
 }
Index: trunk/src/world_entities/world_entity.h
===================================================================
--- trunk/src/world_entities/world_entity.h	(revision 6423)
+++ trunk/src/world_entities/world_entity.h	(revision 6424)
@@ -60,4 +60,9 @@
   void drawBVTree(unsigned int depth, int drawMode) const;
 
+
+  void debugWE() { this->debugEntity(); };  ///FIXME
+  void debugEntity() const;
+
+
   /* @returns the Count of Faces on this WorldEntity */
   //unsigned int getFaceCount () const { return (this->model != NULL)?this->model->getFaceCount():0; };
