Index: code/trunk/TODO
===================================================================
--- code/trunk/TODO	(revision 1937)
+++ code/trunk/TODO	(revision 2087)
@@ -1,6 +1,10 @@
 todo: 
+
+	bidirectional
+
+	minimize synchronisableHeader
+
+
 	!!! check that enet does not cause a packet traffic jam when a reliable packet gets missed !!!
-	[implemented] new gamestate concept
-
 	!!! ensure that objects get synched, when newly created, even if not their tick
 
@@ -12,3 +16,3 @@
 
 REMARKS:
-	try to allocate sort the bytestream before copy (putt all 0's in one place)
+	try to sort the bytestream before copy (putt all 0's in one place)
Index: code/trunk/bin/def_keybindings.ini
===================================================================
--- code/trunk/bin/def_keybindings.ini	(revision 1937)
+++ code/trunk/bin/def_keybindings.ini	(revision 2087)
@@ -1,4 +1,4 @@
 [Keys]
-KeyA="scale -1 moveLateral"
+KeyA="scale -1 moveRightLeft"
 KeyABNT_C1=
 KeyABNT_C2=
@@ -10,5 +10,5 @@
 KeyBack=
 KeyBackslash=
-KeyC=
+KeyC=switchCamera
 KeyCalculator=
 KeyCapsLock=
@@ -16,13 +16,13 @@
 KeyComma=
 KeyConvert=
-KeyD="scale 1 moveLateral"
+KeyD="scale 1 moveRightLeft"
 KeyDelete=
 KeyDivide=
 KeyDown=
-KeyE="scale -1 moveRoll"
+KeyE="scale -1 rotateRoll"
 KeyEnd=
 KeyEquals=
 KeyEscape="exit"
-KeyF=
+KeyF="scale -1 moveUpDown"
 KeyF1="OverlayGroup toggleVisibility Debug"
 KeyF10=
@@ -40,5 +40,5 @@
 KeyF8=
 KeyF9=
-KeyG=
+KeyG=greet
 KeyGrave="openConsole"
 KeyH=
@@ -105,6 +105,6 @@
 KeyPower=
 KeyPreviousTrack=
-KeyQ="scale 1 moveRoll"
-KeyR=
+KeyQ="scale 1 rotateRoll"
+KeyR="scale 1 moveUpDown"
 KeyReturn=
 KeyRight=
@@ -114,5 +114,5 @@
 KeyRightShift=
 KeyRightWindows=
-KeyS="scale -1 moveLongitudinal"
+KeyS="scale -1 moveFrontBack"
 KeyScrollLock=
 KeySemicolon=
@@ -132,5 +132,5 @@
 KeyVolumeDown=
 KeyVolumeUp=
-KeyW="scale 1 moveLongitudinal"
+KeyW="scale 1 moveFrontBack"
 KeyWake=
 KeyWebBack=
@@ -254,7 +254,7 @@
 
 [MouseAxes]
-MouseXNeg="scale 1 moveYaw"
-MouseXPos="scale -1 moveYaw"
-MouseYNeg="scale 1 movePitch"
-MouseYPos="scale -1 movePitch"
+MouseXNeg="scale -1 rotateYaw"
+MouseXPos="scale 1 rotateYaw"
+MouseYNeg="scale 1 rotatePitch"
+MouseYPos="scale -1 rotatePitch"
 
Index: code/trunk/init/common/def_keybindings.ini
===================================================================
--- code/trunk/init/common/def_keybindings.ini	(revision 1937)
+++ code/trunk/init/common/def_keybindings.ini	(revision 2087)
@@ -1,4 +1,4 @@
 [Keys]
-KeyA="scale -1 moveLateral"
+KeyA="scale -1 moveRightLeft"
 KeyABNT_C1=
 KeyABNT_C2=
@@ -16,13 +16,13 @@
 KeyComma=
 KeyConvert=
-KeyD="scale 1 moveLateral"
+KeyD="scale 1 moveRightLeft"
 KeyDelete=
 KeyDivide=
 KeyDown=
-KeyE="scale -1 moveRoll"
+KeyE="scale -1 rotateRoll"
 KeyEnd=
 KeyEquals=
 KeyEscape="exit"
-KeyF=
+KeyF="scale -1 moveUpDown"
 KeyF1="OverlayGroup toggleVisibility Debug"
 KeyF10=
@@ -40,5 +40,5 @@
 KeyF8=
 KeyF9=
-KeyG=
+KeyG=greet
 KeyGrave="openConsole"
 KeyH=
@@ -105,6 +105,6 @@
 KeyPower=
 KeyPreviousTrack=
-KeyQ="scale 1 moveRoll"
-KeyR=
+KeyQ="scale 1 rotateRoll"
+KeyR="scale 1 moveUpDown"
 KeyReturn=
 KeyRight=
@@ -114,5 +114,5 @@
 KeyRightShift=
 KeyRightWindows=
-KeyS="scale -1 moveLongitudinal"
+KeyS="scale -1 moveFrontBack"
 KeyScrollLock=
 KeySemicolon=
@@ -132,5 +132,5 @@
 KeyVolumeDown=
 KeyVolumeUp=
-KeyW="scale 1 moveLongitudinal"
+KeyW="scale 1 moveFrontBack"
 KeyWake=
 KeyWebBack=
@@ -254,7 +254,7 @@
 
 [MouseAxes]
-MouseXNeg="scale 1 moveYaw"
-MouseXPos="scale -1 moveYaw"
-MouseYNeg="scale 1 movePitch"
-MouseYPos="scale -1 movePitch"
+MouseXNeg="scale -1 rotateYaw"
+MouseXPos="scale 1 rotateYaw"
+MouseYNeg="scale 1 rotatePitch"
+MouseYPos="scale -1 rotatePitch"
 
Index: code/trunk/src/core/ArgumentCompletionFunctions.cc
===================================================================
--- code/trunk/src/core/ArgumentCompletionFunctions.cc	(revision 1937)
+++ code/trunk/src/core/ArgumentCompletionFunctions.cc	(revision 2087)
@@ -30,5 +30,5 @@
 #include <map>
 
-#include "boost/filesystem.hpp"
+#include <boost/filesystem.hpp>
 
 #include "ArgumentCompletionFunctions.h"
Index: code/trunk/src/core/BaseObject.cc
===================================================================
--- code/trunk/src/core/BaseObject.cc	(revision 1937)
+++ code/trunk/src/core/BaseObject.cc	(revision 2087)
@@ -35,6 +35,10 @@
 #include "tinyxml/tinyxml.h"
 #include "CoreIncludes.h"
+#include "EventIncludes.h"
 #include "XMLPort.h"
-#include "Level.h"
+#include "XMLFile.h"
+#include "XMLNameListener.h"
+#include "Template.h"
+#include "util/String.h"
 
 namespace orxonox
@@ -45,5 +49,5 @@
         @brief Constructor: Registers the object in the BaseObject-list.
     */
-    BaseObject::BaseObject() : bInitialized_(false)
+    BaseObject::BaseObject(BaseObject* creator) : bInitialized_(false)
     {
         RegisterRootObject(BaseObject);
@@ -53,7 +57,21 @@
         this->bActive_ = true;
         this->bVisible_ = true;
-
-        this->level_ = 0;
-        this->namespace_ = 0;
+        this->oldGametype_ = 0;
+
+        this->setCreator(creator);
+        if (this->creator_)
+        {
+            this->setFile(this->creator_->getFile());
+            this->setNamespace(this->creator_->getNamespace());
+            this->setScene(this->creator_->getScene());
+            this->setGametype(this->creator_->getGametype());
+        }
+        else
+        {
+            this->file_ = 0;
+            this->namespace_ = 0;
+            this->scene_ = 0;
+            this->gametype_ = 0;
+        }
     }
 
@@ -63,4 +81,9 @@
     BaseObject::~BaseObject()
     {
+        for (std::list<BaseObject*>::const_iterator it = this->events_.begin(); it != this->events_.end(); ++it)
+            (*it)->unregisterEventListener(this);
+
+        for (std::map<BaseObject*, std::string>::const_iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it)
+            it->first->removeEvent(this);
     }
 
@@ -73,7 +96,56 @@
     void BaseObject::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
-        XMLPortParam(BaseObject, "name", setName, getName, xmlelement, mode);
+        XMLPortParam(BaseObject, "name", setXMLName, getName, xmlelement, mode);
         XMLPortParam(BaseObject, "visible", setVisible, isVisible, xmlelement, mode);
         XMLPortParam(BaseObject, "active", setActive, isActive, xmlelement, mode);
+
+        XMLPortObjectTemplate(BaseObject, Template, "templates", addTemplate, getTemplate, xmlelement, mode, Template*);
+
+        Element* events = xmlelement.FirstChildElement("events", false);
+
+        if (events)
+        {
+            std::list<std::string> eventnames;
+
+            if (mode == XMLPort::LoadObject)
+            {
+                for (ticpp::Iterator<ticpp::Element> child = events->FirstChildElement(false); child != child.end(); child++)
+                    eventnames.push_back(child->Value());
+            }
+            else if (mode == XMLPort::SaveObject)
+            {
+                for (std::map<std::string, XMLPortObjectContainer*>::const_iterator it = this->getIdentifier()->getXMLPortEventMapBegin(); it != this->getIdentifier()->getXMLPortEventMapEnd(); ++it)
+                    eventnames.push_back(it->first);
+            }
+
+            for (std::list<std::string>::iterator it = eventnames.begin(); it != eventnames.end(); ++it)
+            {
+                std::string sectionname = (*it);
+                ExecutorMember<BaseObject>* loadexecutor = createExecutor(createFunctor(&BaseObject::addEvent), std::string( "BaseObject" ) + "::" + "addEvent");
+                ExecutorMember<BaseObject>* saveexecutor = createExecutor(createFunctor(&BaseObject::getEvent), std::string( "BaseObject" ) + "::" + "getEvent");
+                loadexecutor->setDefaultValue(1, sectionname);
+
+                XMLPortClassObjectContainer<BaseObject, BaseObject>* container = 0;
+                container = (XMLPortClassObjectContainer<BaseObject, BaseObject>*)(this->getIdentifier()->getXMLPortEventContainer(sectionname));
+                if (!container)
+                {
+                    container = new XMLPortClassObjectContainer<BaseObject, BaseObject>(sectionname, this->getIdentifier(), loadexecutor, saveexecutor, false, true);
+                    this->getIdentifier()->addXMLPortEventContainer(sectionname, container);
+                }
+                container->port(this, *events, mode);
+            }
+        }
+    }
+
+    /**
+        @brief Loads the name of the object through XML and calls all XMLNameListener.
+        @param name The name of the object
+    */
+    void BaseObject::setXMLName(const std::string& name)
+    {
+        this->setName(name);
+
+        for (ObjectList<XMLNameListener>::iterator it = ObjectList<XMLNameListener>::begin(); it != ObjectList<XMLNameListener>::end(); ++it)
+            it->loadedNewXMLName(this);
     }
 
@@ -82,7 +154,127 @@
         @return The levelfile
     */
-    const std::string& BaseObject::getLevelfile() const
-    {
-        return this->level_->getFile();
+    const std::string& BaseObject::getFilename() const
+    {
+        if (this->file_)
+            return this->file_->getFilename();
+        else
+            return BLANKSTRING;
+    }
+
+    /**
+        @brief Adds a Template to the object.
+        @param name The name of the Template
+    */
+    void BaseObject::addTemplate(const std::string& name)
+    {
+        Template* temp = Template::getTemplate(name);
+        if (temp)
+            this->addTemplate(temp);
+        else
+            COUT(1) << "Error: \"" << name << "\" is not a valid Template name (in class: " << this->getIdentifier()->getName() << ", name: " << this->getName() << ")." << std::endl;
+    }
+
+    /**
+        @brief Adds a Template to the object.
+        @param temp The Template
+    */
+    void BaseObject::addTemplate(Template* temp)
+    {
+        this->templates_.insert(temp);
+        temp->applyOn(this);
+    }
+
+    /**
+        @brief Returns the Template with the given index.
+        @param index The index
+    */
+    Template* BaseObject::getTemplate(unsigned int index) const
+    {
+        unsigned int i = 0;
+        for (std::set<Template*>::const_iterator it = this->templates_.begin(); it != this->templates_.end(); ++it)
+        {
+            if (i == index)
+                return (*it);
+            i++;
+        }
+        return 0;
+    }
+
+    void BaseObject::addEvent(BaseObject* event, const std::string& sectionname)
+    {
+        event->registerEventListener(this, sectionname);
+        this->events_.push_back(event);
+    }
+
+    void BaseObject::removeEvent(BaseObject* event)
+    {
+        this->events_.remove(event);
+    }
+
+    BaseObject* BaseObject::getEvent(unsigned int index) const
+    {
+        unsigned int i = 0;
+        for (std::list<BaseObject*>::const_iterator it = this->events_.begin(); it != this->events_.end(); ++it)
+        {
+            if (i == index)
+                return (*it);
+            ++i;
+        }
+        return 0;
+    }
+
+    void BaseObject::addEventContainer(const std::string& sectionname, EventContainer* container)
+    {
+        std::map<std::string, EventContainer*>::const_iterator it = this->eventContainers_.find(sectionname);
+        if (it != this->eventContainers_.end())
+        {
+            COUT(2) << "Warning: Overwriting EventContainer in class " << this->getIdentifier()->getName() << "." << std::endl;
+            delete (it->second);
+        }
+
+        this->eventContainers_[sectionname] = container;
+    }
+
+    EventContainer* BaseObject::getEventContainer(const std::string& sectionname) const
+    {
+        std::map<std::string, EventContainer*>::const_iterator it = this->eventContainers_.find(sectionname);
+        if (it != this->eventContainers_.end())
+            return ((*it).second);
+        else
+            return 0;
+    }
+
+    void BaseObject::fireEvent()
+    {
+        this->fireEvent(true);
+        this->fireEvent(false);
+    }
+
+    void BaseObject::fireEvent(bool activate)
+    {
+        this->fireEvent(activate, this);
+    }
+
+    void BaseObject::fireEvent(bool activate, BaseObject* originator)
+    {
+        Event event(activate, originator);
+
+        for (std::map<BaseObject*, std::string>::iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it)
+        {
+            event.sectionname_ = it->second;
+            it->first->processEvent(event);
+        }
+    }
+
+    void BaseObject::fireEvent(Event& event)
+    {
+        for (std::map<BaseObject*, std::string>::iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it)
+            it->first->processEvent(event);
+    }
+
+    void BaseObject::processEvent(Event& event)
+    {
+        SetEvent(BaseObject, "activity", setActive, event);
+        SetEvent(BaseObject, "visibility", setVisible, event);
     }
 }
Index: code/trunk/src/core/BaseObject.h
===================================================================
--- code/trunk/src/core/BaseObject.h	(revision 1937)
+++ code/trunk/src/core/BaseObject.h	(revision 2087)
@@ -37,4 +37,6 @@
 #define _BaseObject_H__
 
+#include <map>
+
 #include "CorePrereqs.h"
 
@@ -42,14 +44,16 @@
 #include "OrxonoxClass.h"
 #include "XMLIncludes.h"
+#include "Event.h"
 
 namespace orxonox
 {
+    class Scene;
+    class Gametype;
+
     //! The BaseObject is the parent of all classes representing an instance in the game.
     class _CoreExport BaseObject : virtual public OrxonoxClass
     {
-        friend class WorldEntity;
-
         public:
-            BaseObject();
+            BaseObject(BaseObject* creator);
             virtual ~BaseObject();
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
@@ -59,7 +63,9 @@
 
             /** @brief Sets the name of the object. @param name The name */
-            inline void setName(const std::string& name) { this->name_ = name; this->changedName(); }
-            /** @brief Returns the name of the object. @return The name */
+            inline void setName(const std::string& name) { this->oldName_ = this->name_; this->name_ = name; this->changedName(); }
+            /** @brief Returns the name of the object. */
             inline const std::string& getName() const { return this->name_; }
+            /** @brief Returns the old name of the object. */
+            inline const std::string& getOldName() const { return this->oldName_; }
             /** @brief This function gets called if the name of the object changes. */
             virtual void changedName() {}
@@ -79,12 +85,48 @@
             virtual void changedVisibility() {}
 
-            /** @brief Sets a pointer to the level that loaded this object. @param level The pointer to the level */
-            inline void setLevel(const Level* level) { this->level_ = level; }
-            /** @brief Returns a pointer to the level that loaded this object. @return The level */
-            inline const Level* getLevel() const { return this->level_; }
-            const std::string& getLevelfile() const;
+            /** @brief Sets a pointer to the xml file that loaded this object. @param file The pointer to the XMLFile */
+            inline void setFile(const XMLFile* file) { this->file_ = file; }
+            /** @brief Returns a pointer to the XMLFile that loaded this object. @return The XMLFile */
+            inline const XMLFile* getFile() const { return this->file_; }
+            const std::string& getFilename() const;
+
+            void addTemplate(const std::string& name);
+            void addTemplate(Template* temp);
+            /** @brief Returns the set of all aplied templates. */
+            inline const std::set<Template*>& getTemplates() const
+                { return this->templates_; }
 
             virtual inline void setNamespace(Namespace* ns) { this->namespace_ = ns; }
             inline Namespace* getNamespace() const { return this->namespace_; }
+
+            inline void setCreator(BaseObject* creator) { this->creator_ = creator; }
+            inline BaseObject* getCreator() const { return this->creator_; }
+
+            inline void setScene(Scene* scene) { this->scene_ = scene; }
+            inline Scene* getScene() const { return this->scene_; }
+
+            inline void setGametype(Gametype* gametype) { this->oldGametype_ = this->gametype_; this->gametype_ = gametype; this->changedGametype(); }
+            inline Gametype* getGametype() const { return this->gametype_; }
+            inline Gametype* getOldGametype() const { return this->oldGametype_; }
+            virtual inline void changedGametype() {}
+
+            void fireEvent();
+            void fireEvent(bool activate);
+            void fireEvent(bool activate, BaseObject* originator);
+            void fireEvent(Event& event);
+
+            virtual void processEvent(Event& event);
+
+            inline void registerEventListener(BaseObject* object, const std::string& sectionname)
+                { this->eventListeners_[object] = sectionname; }
+            inline void unregisterEventListener(BaseObject* object)
+                { this->eventListeners_.erase(object); }
+
+            void addEvent(BaseObject* event, const std::string& sectionname);
+            void removeEvent(BaseObject* event);
+            BaseObject* getEvent(unsigned int index) const;
+
+            void addEventContainer(const std::string& sectionname, EventContainer* container);
+            EventContainer* getEventContainer(const std::string& sectionname) const;
 
             /** @brief Sets the indentation of the debug output in the Loader. @param indentation The indentation */
@@ -93,12 +135,26 @@
             inline const std::string& getLoaderIndentation() const { return this->loaderIndentation_; }
 
-        private:
+        protected:
             std::string name_;                          //!< The name of the object
-            bool bInitialized_;                         //!< True if the object was initialized (passed the object registration)
+            std::string oldName_;                       //!< The old name of the object
             bool bActive_;                              //!< True = the object is active
             bool bVisible_;                             //!< True = the object is visible
-            const Level* level_;                        //!< The level that loaded this object
-            std::string loaderIndentation_;             //!< Indentation of the debug output in the Loader
-            Namespace* namespace_;
+
+        private:
+            void setXMLName(const std::string& name);
+            Template* getTemplate(unsigned int index) const;
+
+            bool                  bInitialized_;         //!< True if the object was initialized (passed the object registration)
+            const XMLFile*        file_;                 //!< The XMLFile that loaded this object
+            std::string           loaderIndentation_;    //!< Indentation of the debug output in the Loader
+            Namespace*            namespace_;
+            BaseObject*           creator_;
+            Scene*                scene_;
+            Gametype*             gametype_;
+            Gametype*             oldGametype_;
+            std::set<Template*>   templates_;
+            std::map<BaseObject*, std::string> eventListeners_;
+            std::list<BaseObject*> events_;
+            std::map<std::string, EventContainer*> eventContainers_;
     };
 
@@ -106,4 +162,5 @@
     SUPER_FUNCTION(2, BaseObject, changedActivity, false);
     SUPER_FUNCTION(3, BaseObject, changedVisibility, false);
+    SUPER_FUNCTION(4, BaseObject, processEvent, false);
 }
 
Index: code/trunk/src/core/CMakeLists.txt
===================================================================
--- code/trunk/src/core/CMakeLists.txt	(revision 1937)
+++ code/trunk/src/core/CMakeLists.txt	(revision 2087)
@@ -4,10 +4,11 @@
   ConfigValueContainer.cc
   Core.cc
+  Event.cc
   GameState.cc
   Language.cc
+  LuaBind.cc
   ObjectListBase.cc
   OrxonoxClass.cc
   RootGameState.cc
-  Script.cc
 
   # command
@@ -31,5 +32,7 @@
   Namespace.cc
   NamespaceNode.cc
+  Template.cc
   XMLPort.cc
+  XMLNameListener.cc
 
   # shell
@@ -62,5 +65,5 @@
     tolua_orxonox
     tolua/tolua.pkg
-    Script.h
+    LuaBind.h
     CommandExecutor.h
   WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib
Index: code/trunk/src/core/ClassFactory.h
===================================================================
--- code/trunk/src/core/ClassFactory.h	(revision 1937)
+++ code/trunk/src/core/ClassFactory.h	(revision 2087)
@@ -55,6 +55,6 @@
     {
         public:
-            static bool create(const std::string& name);
-            BaseObject* fabricate();
+            static bool create(const std::string& name, bool bLoadable = true);
+            BaseObject* fabricate(BaseObject* creator);
 
         private:
@@ -63,16 +63,19 @@
             virtual ~ClassFactory() {}                      // Don't delete
 
-            static T* createNewObject();
+            static T* createNewObject(BaseObject* creator);
     };
 
     /**
         @brief Adds the ClassFactory to the Identifier of the same type and the Identifier to the Factory.
+        @param name The name of the class
+        @param bLoadable True if the class can be loaded through XML
         @return Always true (this is needed because the compiler only allows assignments before main())
     */
     template <class T>
-    bool ClassFactory<T>::create(const std::string& name)
+    bool ClassFactory<T>::create(const std::string& name, bool bLoadable)
     {
         COUT(4) << "*** ClassFactory: Create entry for " << name << " in Factory." << std::endl;
         ClassIdentifier<T>::getIdentifier(name)->addFactory(new ClassFactory<T>);
+        ClassIdentifier<T>::getIdentifier()->setLoadable(bLoadable);
         Factory::add(name, ClassIdentifier<T>::getIdentifier());
 
@@ -85,7 +88,7 @@
     */
     template <class T>
-    BaseObject* ClassFactory<T>::fabricate()
+    BaseObject* ClassFactory<T>::fabricate(BaseObject* creator)
     {
-        return ClassFactory<T>::createNewObject();
+        return ClassFactory<T>::createNewObject(creator);
     }
 
@@ -95,7 +98,7 @@
     */
     template <class T>
-    T* ClassFactory<T>::createNewObject()
+    T* ClassFactory<T>::createNewObject(BaseObject* creator)
     {
-        return new T;
+        return new T(creator);
     }
 }
Index: code/trunk/src/core/CommandEvaluation.cc
===================================================================
--- code/trunk/src/core/CommandEvaluation.cc	(revision 1937)
+++ code/trunk/src/core/CommandEvaluation.cc	(revision 2087)
@@ -78,5 +78,5 @@
         if (this->bEvaluatedParams_ && this->function_)
         {
-            COUT(5) << "CE_execute (evaluation): " << this->function_->getName() << " " << this->param_[0] << " " << this->param_[1] << " " << this->param_[2] << " " << this->param_[3] << " " << this->param_[4] << std::endl;
+            COUT(6) << "CE_execute (evaluation): " << this->function_->getName() << " " << this->param_[0] << " " << this->param_[1] << " " << this->param_[2] << " " << this->param_[3] << " " << this->param_[4] << std::endl;
             (*this->function_)(this->param_[0], this->param_[1], this->param_[2], this->param_[3], this->param_[4]);
             return true;
Index: code/trunk/src/core/CommandLine.cc
===================================================================
--- code/trunk/src/core/CommandLine.cc	(revision 1937)
+++ code/trunk/src/core/CommandLine.cc	(revision 2087)
@@ -35,9 +35,50 @@
     /**
     @brief
+        Parses a value string for a command line argument.
+        It simply uses convertValue(Output, Input) to do that.
+        Bools are treated specially. That is necessary
+        so that you can have simple command line switches.
+    */
+    void CommandLineArgument::parse(const std::string& value)
+    {
+        if (value_.getType() == MT_bool)
+        {
+            // simulate command line switch
+            bool temp;
+            if (convertValue(&temp, value))
+            {
+                this->bHasDefaultValue_ = false;
+                this->value_ = temp;
+            }
+            else if (value == "")
+            {
+                this->bHasDefaultValue_ = false;
+                this->value_ = true;
+            }
+            else
+            {
+                ThrowException(Argument, "Could not read command line argument '" + getName() + "'.");
+            }
+        }
+        else
+        {
+            if (!value_.setValue(value))
+            {
+                value_.setValue(defaultValue_);
+                ThrowException(Argument, "Could not read command line argument '" + getName() + "'.");
+            }
+            else
+                this->bHasDefaultValue_ = false;
+        }
+    }
+
+
+    /**
+    @brief
         Destructor destroys all CommandLineArguments with it.
     */
     CommandLine::~CommandLine()
     {
-        for (std::map<std::string, BaseCommandLineArgument*>::const_iterator it = cmdLineArgs_.begin();
+        for (std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgs_.begin();
             it != cmdLineArgs_.end(); ++it)
         {
@@ -73,5 +114,5 @@
         {
             // first shove all the shortcuts in a map
-            for (std::map<std::string, BaseCommandLineArgument*>::const_iterator it = cmdLineArgs_.begin();
+            for (std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgs_.begin();
                 it != cmdLineArgs_.end(); ++it)
             {
@@ -178,5 +219,5 @@
     void CommandLine::checkFullArgument(const std::string& name, const std::string& value)
     {
-        std::map<std::string, BaseCommandLineArgument*>::const_iterator it = cmdLineArgs_.find(name);
+        std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgs_.find(name);
         if (it == cmdLineArgs_.end())
             ThrowException(Argument, "Command line argument '" + name + "' does not exist.");
@@ -195,5 +236,5 @@
     void CommandLine::checkShortcut(const std::string& shortcut, const std::string& value)
     {
-        std::map<std::string, BaseCommandLineArgument*>::const_iterator it = cmdLineArgsShortcut_.find(shortcut);
+        std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgsShortcut_.find(shortcut);
         if (it == cmdLineArgsShortcut_.end())
             ThrowException(Argument, "Command line shortcut '" + shortcut + "' does not exist.");
@@ -206,5 +247,5 @@
         CommandLine* inst = &_getInstance();
         std::string infoStr;
-        for (std::map<std::string, BaseCommandLineArgument*>::const_iterator it = inst->cmdLineArgs_.begin();
+        for (std::map<std::string, CommandLineArgument*>::const_iterator it = inst->cmdLineArgs_.begin();
             it != inst->cmdLineArgs_.end(); ++it)
         {
@@ -214,3 +255,22 @@
     }
 
+    /**
+    @brief
+        Retrieves a CommandLineArgument.
+        The method throws an exception if 'name' was not found or the value could not be converted.
+    @note
+        You shold of course not call this method before the command line has been parsed.
+    */
+    const CommandLineArgument* CommandLine::getArgument(const std::string& name)
+    {
+        std::map<std::string, CommandLineArgument*>::const_iterator it = _getInstance().cmdLineArgs_.find(name);
+        if (it == _getInstance().cmdLineArgs_.end())
+        {
+            ThrowException(Argument, "Could find command line argument '" + name + "'.");
+        }
+        else
+        {
+            return it->second;
+        }
+    }
 }
Index: code/trunk/src/core/CommandLine.h
===================================================================
--- code/trunk/src/core/CommandLine.h	(revision 1937)
+++ code/trunk/src/core/CommandLine.h	(revision 2087)
@@ -35,10 +35,11 @@
 #include "util/Debug.h"
 #include "util/Exception.h"
+#include "util/MultiType.h"
 
 #define SetCommandLineArgument(name, defaultValue) \
-    BaseCommandLineArgument& CmdArgumentDummyBoolVar##name \
+    CommandLineArgument& CmdArgumentDummyBoolVar##name \
     = orxonox::CommandLine::addArgument(#name, defaultValue)
 #define SetCommandLineSwitch(name) \
-    BaseCommandLineArgument& CmdArgumentDummyBoolVar##name \
+    CommandLineArgument& CmdArgumentDummyBoolVar##name \
     = orxonox::CommandLine::addArgument(#name, false)
 
@@ -48,21 +49,20 @@
     /**
     @brief
-        Template struct which creates a distinct type for every integer constant.
-    @note
-        This allows to select a different function depending on a boolean value
-        when creating a new CommandLineArgument.
-        From 'Modern C++ Design' (Alexandrescu 2001).
+        Container class for a command line argument of any type supported by MultiType.
+
+        Whenever you want to have an option specified by a command line switch,
+        you need to first define it with SetCommandLineArgument(name, defaultValue).
+        It is then added to a map and possibly changed when the command line is being parsed.
+        If the option was not given, you can detect this by asking hasDefaultValue().
+
+        There is a possibility to define a short cut so you can write "-p 20" instead of "--port 20".
+        Note the difference between "-" and "--"!
+        Also, there is no restriction to the number of strings you add after --name.
+        So "--startVector (2, 4, 5)" is perfectly legal.
+
+        Retrieving an argument is possible with the getCommandLineArgument function of the
+        CommandLine class. It is a Singleton, but the public interface is static.
     */
-    template <int v>
-    struct Int2Type
-    {
-        enum { value = v };
-    };
-
-    /**
-    @brief
-        Base class for CommandLineArguments.
-    */
-    class _CoreExport BaseCommandLineArgument
+    class _CoreExport CommandLineArgument
     {
         friend class CommandLine;
@@ -78,5 +78,5 @@
         const std::string& getShortcut() const { return shortcut_; }
         //! Sets the shortcut for the argument
-        BaseCommandLineArgument& setShortcut(const std::string& shortcut)
+        CommandLineArgument& shortcut(const std::string& shortcut)
         { this->shortcut_ = shortcut; return *this; }
 
@@ -84,19 +84,27 @@
         const std::string& getInformation() const { return this->usageInformation_; }
         //! Sets the option information when displaying orxonox usage.
-        BaseCommandLineArgument& setInformation(const std::string& usage)
+        CommandLineArgument& information(const std::string& usage)
         { this->usageInformation_ = usage; return *this; }
 
-    protected:
-        BaseCommandLineArgument(const std::string& name)
+        //! Returns the actual value of the argument. Can be equal to default value.
+        MultiType getValue() const { return value_; }
+        //! Returns the given default value as type T.
+        MultiType getDefaultValue() const { return defaultValue_; }
+
+    private:
+        //! Constructor initialises both value_ and defaultValue_ with defaultValue.
+        CommandLineArgument(const std::string& name, const MultiType& defaultValue)
             : bHasDefaultValue_(true)
             , name_(name)
+            , value_(defaultValue)
+            , defaultValue_(defaultValue)
         { }
 
         //! Undefined copy constructor
-        BaseCommandLineArgument(const BaseCommandLineArgument& instance);
-        virtual ~BaseCommandLineArgument() { }
+        CommandLineArgument(const CommandLineArgument& instance);
+        ~CommandLineArgument() { }
 
         //! Parses the value string of a command line argument.
-        virtual void parse(const std::string& value) = 0;
+        void parse(const std::string& value);
 
         //! Tells whether the value has been changed by the command line.
@@ -107,92 +115,8 @@
         std::string shortcut_;         //!< Shortcut of the argument. @see getShortcut().
         std::string usageInformation_; //!< Tells about the usage of this parameter
+
+        MultiType value_;            //!< The actual value
+        MultiType defaultValue_;     //!< Default value. Should not be changed.
     };
-
-
-    /**
-    @brief
-        Container class for a command line argument of type T.
-        
-        Whenever you want to have an option specified by a command line switch,
-        you need to first define it with SetCommandLineArgument(name, defaultValue).
-        It is then added to a map and possibly changed when the command line is being parsed.
-        If the option was not given, you can detect this by asking hasDefaultValue().
-        
-        There is a possibility to define a short cut so you can write "-p 20" instead of "--port 20".
-        Note the difference between "-" and "--"!
-        Also, there is no restriction to the number of strings you add after --name.
-        So "--startVector (2, 4, 5)" is perfectly legal.
-
-        Retrieving an argument is possible with the getCommandLineArgument function of the
-        CommandLine class. It is a Singleton, but the public interface is static.
-    */
-    template <class T>
-    class CommandLineArgument : public BaseCommandLineArgument
-    {
-        // Only let CommandLine change the value.
-        friend class CommandLine;
-
-    public:
-        //! Returns the actual value of the argument. Can be equal to default value.
-        T getValue() const { return value_; }
-        //! Returns the given default value as type T.
-        T getDefaultValue() const { return defaultValue_; }
-
-    private:
-        //! Constructor initialises both value_ and defaultValue_ with defaultValue.
-        CommandLineArgument(const std::string& name, const T& defaultValue)
-            : BaseCommandLineArgument(name)
-            , value_(defaultValue)
-            , defaultValue_(defaultValue)
-        { }
-
-        virtual void parse(const std::string& value);
-
-        T value_;            //!< The actual value
-        T defaultValue_;     //!< Default value. Should not be changed.
-    };
-
-    /**
-    @brief
-        Parses a value string for a command line argument.
-        It simply uses convertValue(Output, Input) to do that.
-    */
-    template <class T>
-    void CommandLineArgument<T>::parse(const std::string& value)
-    {
-        if (convertValue(&this->value_, value))
-        {
-            this->bHasDefaultValue_ = false;
-        }
-        else
-        {
-            ThrowException(Argument, "Could not read command line argument '" + getName() + "'.");
-        }
-    }
-
-    /**
-    @brief
-        Parses a value string for a command line argument.
-        It simply uses convertValue(Output, Input) to do that.
-        This is a template specialisation for bool type. That is necessary
-        so that you can have simple command line switches.
-    */
-    template <>
-    inline void CommandLineArgument<bool>::parse(const std::string& value)
-    {
-        if (convertValue(&this->value_, value))
-        {
-            this->bHasDefaultValue_ = false;
-        }
-        else if (value == "")
-        {
-            this->bHasDefaultValue_ = false;
-            this->value_ = true;
-        }
-        else
-        {
-            ThrowException(Argument, "Could not read command line argument '" + getName() + "'.");
-        }
-    }
 
 
@@ -215,12 +139,20 @@
         static std::string getUsageInformation();
 
-        template <class T>
-        static const CommandLineArgument<T>* getArgument(const std::string& name);
+        static const CommandLineArgument* getArgument(const std::string& name);
         //! Writes the argument value in the given parameter.
         template <class T>
         static void getValue(const std::string& name, T* value)
-        { *value = getArgument<T>(name)->getValue(); }
+        { *value = (T)(getArgument(name)->getValue()); }
+        static MultiType getValue(const std::string& name)
+        { return getArgument(name)->getValue(); }
         template <class T>
-        static BaseCommandLineArgument& addArgument(const std::string& name, T defaultValue);
+        static CommandLineArgument& addArgument(const std::string& name, T defaultValue);
+
+        static bool existsArgument(const std::string& name)
+        {
+            std::map<std::string, CommandLineArgument*>::const_iterator it = _getInstance().cmdLineArgs_.find(name);
+            return !(it == _getInstance().cmdLineArgs_.end());
+        }
+
 
     private:
@@ -237,11 +169,6 @@
         void checkShortcut(const std::string& shortcut, const std::string& value);
 
-        template <class T>
-        BaseCommandLineArgument* createArg(const std::string& name, T defaultValue, Int2Type<0> isString);
-        template <class T>
-        BaseCommandLineArgument* createArg(const std::string& name, T defaultValue, Int2Type<1> isString);
-
         /**
-            Tells whether we parse the first expression. The CommmandLineArguments are added before main().
+            Tells whether we parsed for the first time. The CommmandLineArguments are added before main().
             So when we call parse() the first time, we need to create a map with all shortcuts since these
             get added after addCommandLineArgument().
@@ -250,38 +177,13 @@
 
         //! Holds all pointers to the arguments and serves as a search map by name.
-        std::map<std::string, BaseCommandLineArgument*> cmdLineArgs_;
+        std::map<std::string, CommandLineArgument*> cmdLineArgs_;
         //! Search map by chortcut for the arguments.
-        std::map<std::string, BaseCommandLineArgument*> cmdLineArgsShortcut_;
+        std::map<std::string, CommandLineArgument*> cmdLineArgsShortcut_;
     };
 
-
-    /**
-    @brief
-        Retrieves a CommandLineArgument.
-        The method throws an exception if 'name' was not found or the value could not be converted.
-    @note
-        You shold of course not call this method before the command line has been parsed.
-    */
-    template <class T>
-    const CommandLineArgument<T>* CommandLine::getArgument(const std::string& name)
-    {
-        std::map<std::string, BaseCommandLineArgument*>::const_iterator it = _getInstance().cmdLineArgs_.find(name);
-        if (it == _getInstance().cmdLineArgs_.end())
-        {
-            ThrowException(Argument, "Could find command line argument '" + name + "'.");
-        }
-        else
-        {
-            CommandLineArgument<T>* arg = dynamic_cast<CommandLineArgument<T>* >(it->second);
-            if (arg == 0)
-            {
-                ThrowException(Argument, "Could not convert command line argument value to requested type. " \
-                    "You should use exactly the same type as predefined.");
-            }
-            else
-            {
-                return arg;
-            }
-        }
+    template <>
+    inline void CommandLine::getValue<std::string>(const std::string& name, std::string* value)
+    {
+        *value = (std::string)(getArgument(name)->getValue().getString());
     }
 
@@ -294,38 +196,12 @@
     @param defaultValue
         Default value that is used when argument was not given.
-    @note
-        In order to store char* strings as std::string too, there's
-        little bit of template programming involved:
-        StaticConversions::exists determines whether T converts to std::string.
-        Int2Type<int> is then used to call the right function. One returns
-        a CommandLineArgument<T> and the other CommandLineArgument<std::string>.
     */
     template <class T>
-    BaseCommandLineArgument& CommandLine::addArgument(const std::string& name, T defaultValue)
-    {
-        std::map<std::string, BaseCommandLineArgument*>::const_iterator it = _getInstance().cmdLineArgs_.find(name);
-        OrxAssert(it == _getInstance().cmdLineArgs_.end(),
+    CommandLineArgument& CommandLine::addArgument(const std::string& name, T defaultValue)
+    {
+        OrxAssert(!_getInstance().existsArgument(name),
             "Cannot add a command line argument with name '" + name + "' twice.");
 
-        return *(_getInstance().cmdLineArgs_[name] = 
-            _getInstance().createArg(name, defaultValue, Int2Type<StaticConversion<T, std::string>::exists>()));
-    }
-
-    /**
-        Returns a new CommandLineArgument<T>.
-    */
-    template <class T>
-    BaseCommandLineArgument* CommandLine::createArg(const std::string& name, T defaultValue, Int2Type<0> isPrime)
-    {
-        return new CommandLineArgument<T>(name, defaultValue);
-    }
-
-    /**
-        Returns a new CommandLineArgument<std::string>.
-    */
-    template <class T>
-    BaseCommandLineArgument* CommandLine::createArg(const std::string& name, T defaultValue, Int2Type<1> isPrime)
-    {
-        return new CommandLineArgument<std::string>(name, defaultValue);
+        return *(_getInstance().cmdLineArgs_[name] = new CommandLineArgument(name, defaultValue));
     }
 }
Index: code/trunk/src/core/ConfigValueContainer.h
===================================================================
--- code/trunk/src/core/ConfigValueContainer.h	(revision 1937)
+++ code/trunk/src/core/ConfigValueContainer.h	(revision 2087)
@@ -52,4 +52,5 @@
 #include "util/MultiType.h"
 #include "ConfigFileManager.h"
+#include "Identifier.h"
 
 namespace orxonox
@@ -69,5 +70,5 @@
             inline virtual ~ConfigValueCallback() {}
             inline virtual void call(void* object)
-                { (((T*)object)->*this->function_)(); }
+                { if (!Identifier::isCreatingHierarchy()) { (((T*)object)->*this->function_)(); } }
 
         private:
Index: code/trunk/src/core/ConsoleCommand.cc
===================================================================
--- code/trunk/src/core/ConsoleCommand.cc	(revision 1937)
+++ code/trunk/src/core/ConsoleCommand.cc	(revision 2087)
@@ -41,6 +41,5 @@
 
         this->keybindMode_ = KeybindMode::OnPress;
-        this->axisParamIndex_ = -1;
-        this->bAxisRelative_ = false;
+        this->inputConfiguredParam_ = -1;
     }
 
Index: code/trunk/src/core/ConsoleCommand.h
===================================================================
--- code/trunk/src/core/ConsoleCommand.h	(revision 1937)
+++ code/trunk/src/core/ConsoleCommand.h	(revision 2087)
@@ -122,4 +122,12 @@
                 { return this->argumentList_.end(); }
 
+            inline ConsoleCommand& setAsInputCommand()
+            {
+                this->keybindMode(KeybindMode::OnHold);
+                this->defaultValue(0, Vector2(0.0f, 0.0f));
+                this->inputConfiguredParam(0);
+                return *this;
+            }
+
             inline ConsoleCommand& keybindMode(KeybindMode::Enum mode)
                 { this->keybindMode_ = mode; return *this; }
@@ -127,13 +135,8 @@
                 { return this->keybindMode_; }
 
-            inline ConsoleCommand& axisParamIndex(int index)
-                { this->axisParamIndex_ = index; return *this; }
-            inline int getAxisParamIndex() const
-                { return this->axisParamIndex_; }
-
-            inline ConsoleCommand& isAxisRelative(bool val)
-                { this->bAxisRelative_ = val; return *this; }
-            inline int getIsAxisRelative() const
-                { return this->bAxisRelative_; }
+            inline ConsoleCommand& inputConfiguredParam(int index)
+                { this->inputConfiguredParam_ = index; return *this; }
+            inline int getInputConfiguredParam_() const
+                { return this->inputConfiguredParam_; }
 
         private:
@@ -143,6 +146,5 @@
 
             KeybindMode::Enum keybindMode_;
-            int axisParamIndex_;
-            bool bAxisRelative_;
+            int inputConfiguredParam_;
     };
 
Index: code/trunk/src/core/Core.cc
===================================================================
--- code/trunk/src/core/Core.cc	(revision 1937)
+++ code/trunk/src/core/Core.cc	(revision 2087)
@@ -37,9 +37,13 @@
 #include "CoreIncludes.h"
 #include "ConfigValueIncludes.h"
-//#include "input/InputManager.h"
-//#include "TclThreadManager.h"
 
 namespace orxonox
 {
+    bool Core::bShowsGraphics_s = false;
+    bool Core::bHasServer_s     = false;
+    bool Core::bIsClient_s      = false;
+    bool Core::bIsStandalone_s  = false;
+    bool Core::bIsMaster_s      = false;
+
     /**
         @brief Constructor: Registers the object and sets the config-values.
@@ -205,14 +209,3 @@
         ResetConfigValue(language_);
     }
-
-    ///**
-    //    @brief Ticks every core class in a specified sequence. Has to be called
-    //           every Orxonox tick!
-    //    @param dt Delta Time
-    //*/
-    //void Core::tick(float dt)
-    //{
-    //    TclThreadManager::getInstance().tick(dt);
-    //    InputManager::getInstance().tick(dt);
-    //}
 }
Index: code/trunk/src/core/Core.h
===================================================================
--- code/trunk/src/core/Core.h	(revision 1937)
+++ code/trunk/src/core/Core.h	(revision 2087)
@@ -60,5 +60,15 @@
             static void resetLanguage();
 
-            //static void tick(float dt);
+            // fast access global variables.
+            static bool showsGraphics() { return bShowsGraphics_s; }
+            static bool hasServer()     { return bHasServer_s; }
+            static bool isClient()      { return bIsClient_s; }
+            static bool isStandalone()  { return bIsStandalone_s; }
+            static bool isMaster()      { return bIsMaster_s; }
+            static void setShowsGraphics(bool val) { bShowsGraphics_s = val; updateIsMaster(); }
+            static void setHasServer    (bool val) { bHasServer_s     = val; updateIsMaster(); }
+            static void setIsClient     (bool val) { bIsClient_s      = val; updateIsMaster(); }
+            static void setIsStandalone (bool val) { bIsStandalone_s  = val; updateIsMaster(); }
+            static void updateIsMaster  ()         { bIsMaster_s      = (bHasServer_s || bIsStandalone_s); }
 
         private:
@@ -74,4 +84,10 @@
             int softDebugLevelShell_;                       //!< The debug level for the ingame shell
             std::string language_;                          //!< The language
+
+            static bool bShowsGraphics_s;                   //!< global variable that tells whether to show graphics
+            static bool bHasServer_s;                       //!< global variable that tells whether this is a server
+            static bool bIsClient_s;
+            static bool bIsStandalone_s;
+            static bool bIsMaster_s;
     };
 }
Index: code/trunk/src/core/CoreIncludes.h
===================================================================
--- code/trunk/src/core/CoreIncludes.h	(revision 1937)
+++ code/trunk/src/core/CoreIncludes.h	(revision 2087)
@@ -46,4 +46,5 @@
 #include "Factory.h"
 #include "ClassFactory.h"
+#include "Functor.h"
 #include "util/Debug.h"
 
@@ -98,5 +99,12 @@
 */
 #define CreateFactory(ClassName) \
-    bool bCreated##ClassName##Factory = orxonox::ClassFactory<ClassName>::create(#ClassName)
+    bool bCreated##ClassName##Factory = orxonox::ClassFactory<ClassName>::create(#ClassName, true)
+
+/**
+    @brief Creates the entry in the Factory for classes which should not be loaded through XML.
+    @param ClassName The name of the class
+*/
+#define CreateUnloadableFactory(ClassName) \
+    bool bCreated##ClassName##Factory = orxonox::ClassFactory<ClassName>::create(#ClassName, false)
 
 /**
@@ -105,5 +113,5 @@
 */
 #define Class(ClassName) \
-    ClassIdentifier<ClassName>::getIdentifier()
+    orxonox::ClassIdentifier<ClassName>::getIdentifier()
 
 /**
@@ -111,5 +119,5 @@
     @param String The name of the class
 */
-#define ClassByName(String) \
+#define ClassByString(String) \
     orxonox::Factory::getIdentifier(String)
 
@@ -121,3 +129,11 @@
     orxonox::Factory::getIdentifier(networkID)
 
+/**
+    @brief Registers a member function as callback when an object of 'type' is created.
+    @param
+*/
+#define RegisterConstructionCallback(ThisClassName, TargetClassName, FunctionName) \
+    orxonox::ClassIdentifier<TargetClassName>::getIdentifier()->addConstructionCallback( \
+        createFunctor(&ThisClassName::FunctionName)->setObject(this))
+
 #endif /* _CoreIncludes_H__ */
Index: code/trunk/src/core/CorePrereqs.h
===================================================================
--- code/trunk/src/core/CorePrereqs.h	(revision 1937)
+++ code/trunk/src/core/CorePrereqs.h	(revision 2087)
@@ -103,6 +103,4 @@
   class CommandExecutor;
   class CommandLine;
-  class BaseCommandLineArgument;
-  template <class T>
   class CommandLineArgument;
   class ConfigFile;
@@ -115,4 +113,6 @@
   class ConsoleCommand;
   class Core;
+  struct Event;
+  class EventContainer;
   class Executor;
   template <class T>
@@ -131,5 +131,4 @@
   class Language;
   class LanguageEntry;
-  class Level;
   class Loader;
   class MetaObjectList;
@@ -153,5 +152,8 @@
   struct TclInterpreterBundle;
   class TclThreadManager;
+  class Template;
   class Tickable;
+  class XMLFile;
+  class XMLNameListener;
   template <class T, class O>
   class XMLPortClassObjectContainer;
Index: code/trunk/src/core/Event.cc
===================================================================
--- code/trunk/src/core/Event.cc	(revision 2087)
+++ code/trunk/src/core/Event.cc	(revision 2087)
@@ -0,0 +1,78 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "Event.h"
+#include "BaseObject.h"
+#include "Executor.h"
+
+namespace orxonox
+{
+    EventContainer::~EventContainer()
+    {
+        delete this->eventfunction_;
+    }
+
+    void EventContainer::process(BaseObject* object, const Event& event)
+    {
+        if (this->bActive_)
+        {
+            COUT(2) << "Warning: Detected Event loop in section \"" << this->eventname_ << "\" of object \"" << object->getName() << "\" and fired by \"" << event.originator_->getName() << "\"" << std::endl;
+            return;
+        }
+
+        this->bActive_ = true;
+
+        if (this->eventname_ == event.sectionname_)
+        {
+            if (event.originator_->isA(this->subclass_))
+            {
+                if (event.activate_)
+                    ++this->activeEvents_;
+                else
+                {
+                    --this->activeEvents_;
+
+                    if (this->activeEvents_ < 0)
+                        this->activeEvents_ = 0;
+                }
+
+                if (this->eventfunction_->getParamCount() == 0 && event.activate_)
+                    (*this->eventfunction_)();
+                else if ((this->activeEvents_ == 1 && event.activate_) || (this->activeEvents_ == 0 && !event.activate_))
+                {
+                    if (this->eventfunction_->getParamCount() == 1)
+                        (*this->eventfunction_)(this->activeEvents_);
+                    else if (this->eventfunction_->getParamCount() >= 2 && event.castedOriginator_)
+                        (*this->eventfunction_)(this->activeEvents_, event.castedOriginator_);
+                }
+            }
+        }
+
+        this->bActive_ = false;
+    }
+}
Index: code/trunk/src/core/Event.h
===================================================================
--- code/trunk/src/core/Event.h	(revision 2087)
+++ code/trunk/src/core/Event.h	(revision 2087)
@@ -0,0 +1,64 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Event_H__
+#define _Event_H__
+
+#include "CorePrereqs.h"
+
+namespace orxonox
+{
+    struct _CoreExport Event
+    {
+            Event(bool activate, BaseObject* originator) : activate_(activate), originator_(originator), castedOriginator_(0) {}
+
+            bool        activate_;
+            BaseObject* originator_;
+            void*       castedOriginator_;
+            std::string sectionname_;
+    };
+
+    class _CoreExport EventContainer
+    {
+        public:
+            EventContainer(const std::string& eventname, Executor* eventfunction, Identifier* subclass) : bActive_(false), eventname_(eventname), eventfunction_(eventfunction), subclass_(subclass), activeEvents_(0) {}
+            virtual ~EventContainer();
+
+            void process(BaseObject* object, const Event& event);
+
+        private:
+            bool bActive_;
+            std::string eventname_;
+            Executor* eventfunction_;
+            Identifier* subclass_;
+
+            int activeEvents_;
+    };
+}
+
+#endif /* _Event_H__ */
Index: code/trunk/src/core/EventIncludes.h
===================================================================
--- code/trunk/src/core/EventIncludes.h	(revision 2087)
+++ code/trunk/src/core/EventIncludes.h	(revision 2087)
@@ -0,0 +1,71 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _EventIncludes_H__
+#define _EventIncludes_H__
+
+#include "CorePrereqs.h"
+#include "Executor.h"
+
+#define SetEvent(classname, eventname, functionname, event) \
+    SetEventGeneric(eventcontainer##classname##functionname, classname, eventname, functionname, event, BaseObject)
+
+#define SetEventTemplate(classname, eventname, functionname, event, ...) \
+    SetEventGenericTemplate(eventcontainer##classname##functionname, classname, eventname, functionname, event, BaseObject, __VA_ARGS__)
+
+#define SetSubclassEvent(classname, eventname, functionname, event, subclassname) \
+    SetEventGeneric(eventcontainer##classname##functionname, classname, eventname, functionname, event, subclassname)
+
+#define SetSubclassEventTemplate(classname, eventname, functionname, event, subclassname, ...) \
+    SetEventGenericTemplate(eventcontainer##classname##functionname, classname, eventname, functionname, event, subclassname, __VA_ARGS__)
+
+#define SetEventGeneric(containername, classname, eventname, functionname, event, subclassname) \
+    orxonox::EventContainer* containername = this->getEventContainer(eventname); \
+    if (!containername) \
+    { \
+        ExecutorMember<classname>* executor = orxonox::createExecutor(orxonox::createFunctor(&classname::functionname), std::string( #classname ) + "::" + #functionname); \
+        executor->setObject(this); \
+        containername = new orxonox::EventContainer(std::string(eventname), executor, orxonox::ClassIdentifier<subclassname>::getIdentifier()); \
+        this->addEventContainer(eventname, containername); \
+    } \
+    event.castedOriginator_ = dynamic_cast<subclassname*>(event.originator_); \
+    containername->process(this, event)
+
+#define SetEventGenericTemplate(containername, classname, eventname, functionname, event, subclassname, ...) \
+    orxonox::EventContainer* containername = this->getEventContainer(eventname); \
+    if (!containername) \
+    { \
+        ExecutorMember<classname>* executor = orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::functionname), std::string( #classname ) + "::" + #functionname); \
+        executor->setObject(this); \
+        containername = new orxonox::EventContainer(std::string(eventname), executor, orxonox::ClassIdentifier<subclassname>::getIdentifier()); \
+        this->addEventContainer(eventname, containername); \
+    } \
+    event.castedOriginator_ = dynamic_cast<subclassname*>(event.originator_); \
+    containername->process(this, event)
+
+#endif /* _EventIncludes_H__ */
Index: code/trunk/src/core/Factory.cc
===================================================================
--- code/trunk/src/core/Factory.cc	(revision 1937)
+++ code/trunk/src/core/Factory.cc	(revision 2087)
@@ -46,5 +46,9 @@
     Identifier* Factory::getIdentifier(const std::string& name)
     {
-        return getFactoryPointer()->identifierStringMap_[name];
+        std::map<std::string, Identifier*>::const_iterator it = getFactoryPointer()->identifierStringMap_.find(name);
+        if (it != getFactoryPointer()->identifierStringMap_.end())
+            return it->second;
+        else
+            return 0;
     }
 
@@ -56,5 +60,9 @@
     Identifier* Factory::getIdentifier(const unsigned int id)
     {
-        return getFactoryPointer()->identifierNetworkIDMap_[id];
+        std::map<unsigned int, Identifier*>::const_iterator it = getFactoryPointer()->identifierNetworkIDMap_.find(id);
+        if (it != getFactoryPointer()->identifierNetworkIDMap_.end())
+            return it->second;
+        else
+            return 0;
     }
 
@@ -68,4 +76,5 @@
         getFactoryPointer()->identifierStringMap_[name] = identifier;
         getFactoryPointer()->identifierNetworkIDMap_[identifier->getNetworkID()] = identifier;
+//std::cout << identifier->getName() << ": " << identifier->getNetworkID() << std::endl;
     }
 
@@ -80,4 +89,5 @@
         getFactoryPointer()->identifierNetworkIDMap_.erase(oldID);
         getFactoryPointer()->identifierNetworkIDMap_[newID] = identifier;
+//std::cout << identifier->getName() << ": " << oldID << " -> " << newID << std::endl;
     }
 
@@ -94,5 +104,5 @@
         {
             // To create the new branch of the class-hierarchy, we create a new object and delete it afterwards.
-            BaseObject* temp = (*it).second->fabricate();
+            BaseObject* temp = (*it).second->fabricate(0);
             delete temp;
         }
Index: code/trunk/src/core/Factory.h
===================================================================
--- code/trunk/src/core/Factory.h	(revision 1937)
+++ code/trunk/src/core/Factory.h	(revision 2087)
@@ -93,5 +93,5 @@
     {
         public:
-            virtual BaseObject* fabricate() = 0;
+            virtual BaseObject* fabricate(BaseObject* creator) = 0;
             virtual ~BaseFactory() {};
     };
Index: code/trunk/src/core/Functor.h
===================================================================
--- code/trunk/src/core/Functor.h	(revision 1937)
+++ code/trunk/src/core/Functor.h	(revision 2087)
@@ -106,5 +106,5 @@
             inline const MultiType& getReturnvalue() const { return this->returnedValue_; }
 
-            const std::string& getTypenameParam(unsigned int param) const { return (param < 5) ? this->typeParam_[param] : blankString; }
+            const std::string& getTypenameParam(unsigned int param) const { return (param < 5) ? this->typeParam_[param] : BLANKSTRING; }
             const std::string& getTypenameReturnvalue() const { return this->typeReturnvalue_; }
 
@@ -167,14 +167,16 @@
             }
 
-            void setObject(T* object)
+            FunctorMember* setObject(T* object)
             {
                 this->bConstObject_ = false;
                 this->object_ = object;
+                return this;
             }
 
-            void setObject(const T* object)
+            FunctorMember* setObject(const T* object)
             {
                 this->bConstObject_ = true;
                 this->constObject_ = object;
+                return this;
             }
 
Index: code/trunk/src/core/Identifier.cc
===================================================================
--- code/trunk/src/core/Identifier.cc	(revision 1937)
+++ code/trunk/src/core/Identifier.cc	(revision 2087)
@@ -59,7 +59,9 @@
         this->bSetName_ = false;
         this->factory_ = 0;
+        this->bLoadable_ = true;
 
         this->bHasConfigValues_ = false;
         this->bHasConsoleCommands_ = false;
+        this->bHasConstructionCallback_ = false;
 
         this->children_ = new std::set<const Identifier*>();
@@ -213,9 +215,9 @@
         @return The new object
     */
-    BaseObject* Identifier::fabricate()
+    BaseObject* Identifier::fabricate(BaseObject* creator)
     {
         if (this->factory_)
         {
-            return this->factory_->fabricate(); // We have to return a BaseObject, because we don't know the exact type.
+            return this->factory_->fabricate(creator); // We have to return a BaseObject, because we don't know the exact type.
         }
         else
@@ -420,6 +422,6 @@
     XMLPortParamContainer* Identifier::getXMLPortParamContainer(const std::string& paramname)
     {
-        std::map<std::string, XMLPortParamContainer*>::const_iterator it = xmlportParamContainers_.find(paramname);
-        if (it != xmlportParamContainers_.end())
+        std::map<std::string, XMLPortParamContainer*>::const_iterator it = this->xmlportParamContainers_.find(paramname);
+        if (it != this->xmlportParamContainers_.end())
             return ((*it).second);
         else
@@ -434,4 +436,11 @@
     void Identifier::addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container)
     {
+        std::map<std::string, XMLPortParamContainer*>::const_iterator it = this->xmlportParamContainers_.find(paramname);
+        if (it != this->xmlportParamContainers_.end())
+        {
+            COUT(2) << "Warning: Overwriting XMLPortParamContainer in class " << this->getName() << "." << std::endl;
+            delete (it->second);
+        }
+
         this->xmlportParamContainers_[paramname] = container;
     }
@@ -444,6 +453,6 @@
     XMLPortObjectContainer* Identifier::getXMLPortObjectContainer(const std::string& sectionname)
     {
-        std::map<std::string, XMLPortObjectContainer*>::const_iterator it = xmlportObjectContainers_.find(sectionname);
-        if (it != xmlportObjectContainers_.end())
+        std::map<std::string, XMLPortObjectContainer*>::const_iterator it = this->xmlportObjectContainers_.find(sectionname);
+        if (it != this->xmlportObjectContainers_.end())
             return ((*it).second);
         else
@@ -458,5 +467,75 @@
     void Identifier::addXMLPortObjectContainer(const std::string& sectionname, XMLPortObjectContainer* container)
     {
+        std::map<std::string, XMLPortObjectContainer*>::const_iterator it = this->xmlportObjectContainers_.find(sectionname);
+        if (it != this->xmlportObjectContainers_.end())
+        {
+            COUT(2) << "Warning: Overwriting XMLPortObjectContainer in class " << this->getName() << "." << std::endl;
+            delete (it->second);
+        }
+
         this->xmlportObjectContainers_[sectionname] = container;
+    }
+
+    /**
+        @brief Returns a XMLPortEventContainer that attaches an event to this class.
+        @param sectionname The name of the section that contains the event
+        @return The container
+    */
+    XMLPortObjectContainer* Identifier::getXMLPortEventContainer(const std::string& eventname)
+    {
+        std::map<std::string, XMLPortObjectContainer*>::const_iterator it = this->xmlportEventContainers_.find(eventname);
+        if (it != this->xmlportEventContainers_.end())
+            return ((*it).second);
+        else
+            return 0;
+    }
+
+    /**
+        @brief Adds a new XMLPortEventContainer that attaches an event to this class.
+        @param sectionname The name of the section that contains the event
+        @param container The container
+    */
+    void Identifier::addXMLPortEventContainer(const std::string& eventname, XMLPortObjectContainer* container)
+    {
+        std::map<std::string, XMLPortObjectContainer*>::const_iterator it = this->xmlportEventContainers_.find(eventname);
+        if (it != this->xmlportEventContainers_.end())
+        {
+            COUT(2) << "Warning: Overwriting XMLPortEventContainer in class " << this->getName() << "." << std::endl;
+            delete (it->second);
+        }
+
+        this->xmlportEventContainers_[eventname] = container;
+    }
+
+    /**
+        @brief Adds a construction callback functor that gets called every time an object is created.
+        @param functor Functor pointer to any function with no argument.
+    */
+    void Identifier::addConstructionCallback(Functor* functor)
+    {
+        for (unsigned int i = 0; i < this->constructionCallbacks_.size(); ++i)
+        {
+            if (this->constructionCallbacks_[i] == functor)
+                return;
+        }
+        this->constructionCallbacks_.push_back(functor);
+        this->bHasConstructionCallback_ = true;
+    }
+
+    /**
+        @brief Removes a construction callback functor that gets called every time an object is created.
+        @param functor Functor pointer to any function with no argument.
+    */
+    void Identifier::removeConstructionCallback(Functor* functor)
+    {
+        for (unsigned int i = 0; i < this->constructionCallbacks_.size(); ++i)
+        {
+            if (this->constructionCallbacks_[i] == functor)
+            {
+                this->constructionCallbacks_.erase(this->constructionCallbacks_.begin() + i);
+            }
+        }
+        if (constructionCallbacks_.empty())
+            this->bHasConstructionCallback_ = false;
     }
 
Index: code/trunk/src/core/Identifier.h
===================================================================
--- code/trunk/src/core/Identifier.h	(revision 1937)
+++ code/trunk/src/core/Identifier.h	(revision 2087)
@@ -57,12 +57,15 @@
 #include <set>
 #include <map>
+#include <vector>
 #include <string>
 #include <utility>
 #include <typeinfo>
 #include <stdlib.h>
+#include <cassert>
 
 #include "MetaObjectList.h"
 #include "Iterator.h"
 #include "Super.h"
+#include "Functor.h"
 #include "util/Debug.h"
 #include "util/String.h"
@@ -99,5 +102,5 @@
             inline void addFactory(BaseFactory* factory) { this->factory_ = factory; }
 
-            BaseObject* fabricate();
+            BaseObject* fabricate(BaseObject* creator);
             bool isA(const Identifier* identifier) const;
             bool isExactlyA(const Identifier* identifier) const;
@@ -107,4 +110,9 @@
             bool isDirectParentOf(const Identifier* identifier) const;
 
+            /** @brief Returns true if the class can be loaded through XML. */
+            inline bool isLoadable() const { return this->bLoadable_; }
+            /** @brief Set the class to be loadable through XML or not. */
+            inline void setLoadable(bool bLoadable) { this->bLoadable_ = bLoadable; }
+
             /** @brief Returns the list of all existing objects of this class. @return The list */
             inline ObjectListBase* getObjects() const
@@ -204,8 +212,17 @@
             inline std::map<std::string, XMLPortObjectContainer*>::const_iterator getXMLPortObjectMapEnd() const { return this->xmlportObjectContainers_.end(); }
 
+            /** @brief Returns the map that stores all XMLPort events. @return The const_iterator */
+            inline const std::map<std::string, XMLPortObjectContainer*>& getXMLPortEventMap() const { return this->xmlportEventContainers_; }
+            /** @brief Returns a const_iterator to the beginning of the map that stores all XMLPort events. @return The const_iterator */
+            inline std::map<std::string, XMLPortObjectContainer*>::const_iterator getXMLPortEventMapBegin() const { return this->xmlportEventContainers_.begin(); }
+            /** @brief Returns a const_iterator to the end of the map that stores all XMLPort events. @return The const_iterator */
+            inline std::map<std::string, XMLPortObjectContainer*>::const_iterator getXMLPortEventMapEnd() const { return this->xmlportEventContainers_.end(); }
+
             /** @brief Returns true if this class has at least one config value. @return True if this class has at least one config value */
             inline bool hasConfigValues() const { return this->bHasConfigValues_; }
             /** @brief Returns true if this class has at least one console command. @return True if this class has at least one console command */
             inline bool hasConsoleCommands() const { return this->bHasConsoleCommands_; }
+            /** @brief Returns true if this class has at least one construction callback Functor registered. */
+            inline bool hasConstructionCallback() const { return this->bHasConstructionCallback_; }
 
             /** @brief Returns true, if a branch of the class-hierarchy is being created, causing all new objects to store their parents. @return The status of the class-hierarchy creation */
@@ -228,7 +245,13 @@
             XMLPortObjectContainer* getXMLPortObjectContainer(const std::string& sectionname);
 
+            void addXMLPortEventContainer(const std::string& eventname, XMLPortObjectContainer* container);
+            XMLPortObjectContainer* getXMLPortEventContainer(const std::string& eventname);
+
             ConsoleCommand& addConsoleCommand(ConsoleCommand* command, bool bCreateShortcut);
             ConsoleCommand* getConsoleCommand(const std::string& name) const;
             ConsoleCommand* getLowercaseConsoleCommand(const std::string& name) const;
+
+            void addConstructionCallback(Functor* functor);
+            void removeConstructionCallback(Functor* functor);
 
             void initializeClassHierarchy(std::set<const Identifier*>* parents, bool bRootClass);
@@ -252,4 +275,7 @@
             inline std::set<const Identifier*>& getDirectChildrenIntern() const { return (*this->directChildren_); }
 
+            bool bHasConstructionCallback_;                                //!< True if at least one Functor is registered to get informed when an object of type T is created.
+            std::vector<Functor*> constructionCallbacks_;                  //!< All construction callback Functors of this class.
+
             ObjectListBase* objects_;                                      //!< The list of all objects of this class
 
@@ -285,4 +311,5 @@
             bool bCreatedOneObject_;                                       //!< True if at least one object of the given type was created (used to determine the need of storing the parents)
             bool bSetName_;                                                //!< True if the name is set
+            bool bLoadable_;                                               //!< False = it's not permitted to load the object through XML
             std::string name_;                                             //!< The name of the class the Identifier belongs to
             BaseFactory* factory_;                                         //!< The Factory, able to create new objects of the given class (if available)
@@ -300,4 +327,5 @@
             std::map<std::string, XMLPortParamContainer*> xmlportParamContainers_;     //!< All loadable parameters
             std::map<std::string, XMLPortObjectContainer*> xmlportObjectContainers_;   //!< All attachable objects
+            std::map<std::string, XMLPortObjectContainer*> xmlportEventContainers_;    //!< All events
     };
 
@@ -423,4 +451,11 @@
         COUT(5) << "*** ClassIdentifier: Added object to " << this->getName() << "-list." << std::endl;
         object->getMetaList().add(this->objects_, this->objects_->add(new ObjectListElement<T>(object)));
+        if (this->bHasConstructionCallback_)
+        {
+            // Call all registered callbacks that a new object of type T has been created.
+            // Do NOT deliver a T* pointer here because it's way too risky (object not yet fully created).
+            for (unsigned int i = 0; i < this->constructionCallbacks_.size(); ++i)
+                (*constructionCallbacks_[i])();
+        }
     }
 
@@ -480,13 +515,21 @@
             SubclassIdentifier<T>& operator=(Identifier* identifier)
             {
-                if (!identifier->isA(ClassIdentifier<T>::getIdentifier()))
+                if (!identifier || !identifier->isA(ClassIdentifier<T>::getIdentifier()))
                 {
                     COUT(1) << "An error occurred in SubclassIdentifier (Identifier.h):" << std::endl;
-                    COUT(1) << "Error: Class " << identifier->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << "!" << std::endl;
-                    COUT(1) << "Error: SubclassIdentifier<" << ClassIdentifier<T>::getIdentifier()->getName() << "> = Class(" << identifier->getName() << ") is forbidden." << std::endl;
-                    COUT(1) << "Aborting..." << std::endl;
-                    abort();
+                    if (identifier)
+                    {
+                        COUT(1) << "Error: Class " << identifier->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << "!" << std::endl;
+                        COUT(1) << "Error: SubclassIdentifier<" << ClassIdentifier<T>::getIdentifier()->getName() << "> = Class(" << identifier->getName() << ") is forbidden." << std::endl;
+                    }
+                    else
+                    {
+                        COUT(1) << "Error: Can't assign NULL identifier" << std::endl;
+                    }
                 }
-                this->identifier_ = identifier;
+                else
+                {
+                    this->identifier_ = identifier;
+                }
                 return *this;
             }
@@ -495,5 +538,5 @@
                 @brief Overloading of the * operator: returns the assigned identifier.
             */
-            inline Identifier* operator*()
+            inline Identifier* operator*() const
             {
                 return this->identifier_;
@@ -520,7 +563,7 @@
                 @return The new object
             */
-            T* fabricate()
-            {
-                BaseObject* newObject = this->identifier_->fabricate();
+            T* fabricate(BaseObject* creator) const
+            {
+                BaseObject* newObject = this->identifier_->fabricate(creator);
 
                 // Check if the creation was successful
@@ -546,5 +589,6 @@
                     }
 
-                    abort();
+                    assert(false);
+                    return 0;
                 }
             }
Index: code/trunk/src/core/Level.h
===================================================================
--- code/trunk/src/core/Level.h	(revision 1937)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _Level_H__
-#define _Level_H__
-
-#include "CorePrereqs.h"
-
-#include <string>
-
-#include "ClassTreeMask.h"
-
-namespace orxonox
-{
-    class _CoreExport Level
-    {
-        public:
-            Level(const std::string& file) : file_(file) {}
-            Level(const std::string& file, const ClassTreeMask& mask) : file_(file), mask_(mask) {};
-
-            const std::string& getFile() const { return this->file_; }
-            const ClassTreeMask& getMask() const { return this->mask_; }
-
-        private:
-            std::string file_;
-            ClassTreeMask mask_;
-    };
-}
-
-#endif /* _Level_H__ */
Index: code/trunk/src/core/Loader.cc
===================================================================
--- code/trunk/src/core/Loader.cc	(revision 1937)
+++ code/trunk/src/core/Loader.cc	(revision 2087)
@@ -28,5 +28,5 @@
 
 #include "Loader.h"
-#include "Level.h"
+#include "XMLFile.h"
 #include "BaseObject.h"
 #include "Identifier.h"
@@ -34,5 +34,5 @@
 #include "ObjectList.h"
 #include "CoreIncludes.h"
-#include "Script.h"
+#include "LuaBind.h"
 #include "Namespace.h"
 #include "util/Debug.h"
@@ -42,11 +42,11 @@
 namespace orxonox
 {
-    std::vector<std::pair<const Level*, ClassTreeMask> > Loader::levels_s;
+    std::vector<std::pair<const XMLFile*, ClassTreeMask> > Loader::files_s;
     ClassTreeMask Loader::currentMask_s;
 
-    bool Loader::open(const Level* level, const ClassTreeMask& mask)
+    bool Loader::open(const XMLFile* file, const ClassTreeMask& mask)
     {
-        Loader::add(level, mask);
-        return Loader::load(level, mask);
+        Loader::add(file, mask);
+        return Loader::load(file, mask);
     }
 
@@ -54,29 +54,29 @@
     {
         Loader::unload();
-        Loader::levels_s.clear();
+        Loader::files_s.clear();
     }
 
-    void Loader::close(const Level* level)
+    void Loader::close(const XMLFile* file)
     {
-        Loader::unload(level);
-        Loader::remove(level);
+        Loader::unload(file);
+        Loader::remove(file);
     }
 
-    void Loader::add(const Level* level, const ClassTreeMask& mask)
+    void Loader::add(const XMLFile* file, const ClassTreeMask& mask)
     {
-        if (!level)
+        if (!file)
             return;
-        Loader::levels_s.insert(Loader::levels_s.end(), std::pair<const Level*, ClassTreeMask>(level, mask));
+        Loader::files_s.insert(Loader::files_s.end(), std::pair<const XMLFile*, ClassTreeMask>(file, mask));
     }
 
-    void Loader::remove(const Level* level)
+    void Loader::remove(const XMLFile* file)
     {
-        if (!level)
+        if (!file)
             return;
-        for (std::vector<std::pair<const Level*, ClassTreeMask> >::iterator it = Loader::levels_s.begin(); it != Loader::levels_s.end(); ++it)
+        for (std::vector<std::pair<const XMLFile*, ClassTreeMask> >::iterator it = Loader::files_s.begin(); it != Loader::files_s.end(); ++it)
         {
-            if ((*it).first == level)
+            if ((*it).first == file)
             {
-                Loader::levels_s.erase(it);
+                Loader::files_s.erase(it);
                 break;
             }
@@ -87,5 +87,5 @@
     {
         bool success = true;
-        for (std::vector<std::pair<const Level*, ClassTreeMask> >::iterator it = Loader::levels_s.begin(); it != Loader::levels_s.end(); ++it)
+        for (std::vector<std::pair<const XMLFile*, ClassTreeMask> >::iterator it = Loader::files_s.begin(); it != Loader::files_s.end(); ++it)
             if (!Loader::load((*it).first, (*it).second * mask))
                 success = false;
@@ -111,27 +111,23 @@
     }
 
-    bool Loader::load(const Level* level, const ClassTreeMask& mask)
+    bool Loader::load(const XMLFile* file, const ClassTreeMask& mask)
     {
-        if (!level)
+        if (!file)
             return false;
 
-        Loader::currentMask_s = level->getMask() * mask;
+        Loader::currentMask_s = file->getMask() * mask;
 
         // let Lua work this out:
-        //Script* lua;
-        /*Script::loadFile(level->getFile(), true);
-        Script::init(Script::getLuaState());
-        Script::run();*/
-        Script* lua = Script::getInstance();
+        LuaBind* lua = LuaBind::getInstance();
         lua->clearLuaOutput();
-        lua->loadFile(level->getFile(), true);
+        lua->loadFile(file->getFilename(), true);
         lua->run();
 
         try
         {
-            COUT(0) << "Start loading " << level->getFile() << "..." << std::endl;
+            COUT(0) << "Start loading " << file->getFilename() << "..." << std::endl;
             COUT(3) << "Mask: " << Loader::currentMask_s << std::endl;
 
-            //ticpp::Document xmlfile(level->getFile());
+            //ticpp::Document xmlfile(file->getFilename());
             //xmlfile.LoadFile();
             //ticpp::Element myelement(*Script::getFileString());
@@ -148,12 +144,12 @@
 
             COUT(4) << "  creating root-namespace..." << std::endl;
-            Namespace* rootNamespace = new Namespace();
+            Namespace* rootNamespace = new Namespace(0);
             rootNamespace->setLoaderIndentation("    ");
-            rootNamespace->setLevel(level);
+            rootNamespace->setFile(file);
             rootNamespace->setNamespace(rootNamespace);
             rootNamespace->setRoot(true);
             rootNamespace->XMLPort(rootElement, XMLPort::LoadObject);
 
-            COUT(0) << "Finished loading " << level->getFile() << "." << std::endl;
+            COUT(0) << "Finished loading " << file->getFilename() << "." << std::endl;
 
             COUT(4) << "Namespace-tree:" << std::endl << rootNamespace->toString("  ") << std::endl;
@@ -164,5 +160,5 @@
         {
             COUT(1) << std::endl;
-            COUT(1) << "An error occurred in Loader.cc while loading " << level->getFile() << ":" << std::endl;
+            COUT(1) << "An error occurred in Loader.cc while loading " << file->getFilename() << ":" << std::endl;
             COUT(1) << ex.what() << std::endl;
             COUT(1) << "Loading aborted." << std::endl;
@@ -171,11 +167,11 @@
     }
 
-    void Loader::unload(const Level* level, const ClassTreeMask& mask)
+    void Loader::unload(const XMLFile* file, const ClassTreeMask& mask)
     {
-        if (!level)
+        if (!file)
             return;
         for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it; )
         {
-            if ((it->getLevel() == level) && mask.isIncluded(it->getIdentifier()))
+            if ((it->getFile() == file) && mask.isIncluded(it->getIdentifier()))
                 delete (*(it++));
             else
@@ -184,8 +180,8 @@
     }
 
-    bool Loader::reload(const Level* level, const ClassTreeMask& mask)
+    bool Loader::reload(const XMLFile* file, const ClassTreeMask& mask)
     {
-        Loader::unload(level, mask);
-        return Loader::load(level, mask);
+        Loader::unload(file, mask);
+        return Loader::load(file, mask);
     }
 }
Index: code/trunk/src/core/Loader.h
===================================================================
--- code/trunk/src/core/Loader.h	(revision 1937)
+++ code/trunk/src/core/Loader.h	(revision 2087)
@@ -35,5 +35,4 @@
 
 #include "ClassTreeMask.h"
-#include "Level.h"
 
 namespace orxonox
@@ -42,10 +41,10 @@
     {
         public:
-            static bool open(const Level* level, const ClassTreeMask& mask = ClassTreeMask());
+            static bool open(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask());
             static void close();
-            static void close(const Level* level);
+            static void close(const XMLFile* file);
 
-            static void add(const Level* level, const ClassTreeMask& mask = ClassTreeMask());
-            static void remove(const Level* level);
+            static void add(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask());
+            static void remove(const XMLFile* file);
 
             static bool load(const ClassTreeMask& mask = ClassTreeMask());
@@ -53,12 +52,12 @@
             static bool reload(const ClassTreeMask& mask = ClassTreeMask());
 
-            static bool load(const Level* level, const ClassTreeMask& mask = ClassTreeMask());
-            static void unload(const Level* level, const ClassTreeMask& mask = ClassTreeMask());
-            static bool reload(const Level* level, const ClassTreeMask& mask = ClassTreeMask());
+            static bool load(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask());
+            static void unload(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask());
+            static bool reload(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask());
 
             static ClassTreeMask currentMask_s;
 
         private:
-            static std::vector<std::pair<const Level*, ClassTreeMask> > levels_s;
+            static std::vector<std::pair<const XMLFile*, ClassTreeMask> > files_s;
     };
 }
Index: code/trunk/src/core/LuaBind.cc
===================================================================
--- code/trunk/src/core/LuaBind.cc	(revision 2087)
+++ code/trunk/src/core/LuaBind.cc	(revision 2087)
@@ -0,0 +1,291 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Knecht
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "LuaBind.h"
+
+#include <fstream>
+#include <map>
+
+#include "lua/lua.hpp"
+#include "tolua/tolua++.h"
+#include "tolua/tolua_bind.h"
+#include "util/String.h"
+#include "CoreIncludes.h"
+
+namespace orxonox
+{
+  LuaBind* LuaBind::singletonRef = NULL;
+
+  LuaBind::LuaBind()
+  {
+    luaState_ = lua_open();
+    luaSource_ = "";
+#if LUA_VERSION_NUM == 501
+    luaL_openlibs(luaState_);
+#else
+    luaopen_base(luaState_);
+    luaopen_string(luaState_);
+    luaopen_table(luaState_);
+    luaopen_math(luaState_);
+    luaopen_io(luaState_);
+    luaopen_debug(luaState_);
+#endif
+    tolua_Core_open(luaState_);
+    output_ = "";
+    isRunning_ = false;
+  }
+
+  void LuaBind::luaPrint(std::string str)
+  {
+    output_ += str;
+//    COUT(4) << "Lua_output!:" << std::endl << str << std::endl << "***" << std::endl;
+    COUT(5) << str;
+  }
+
+  /**
+      @brief Loads the specified file line by line
+      @param filename The filename of the file
+      @param luaTags if true, the loaded file gets stripped off luaTags
+  */
+  void LuaBind::loadFile(std::string filename, bool luaTags)
+  {
+    output_ = "";
+    std::ifstream file;
+    file.open(filename.c_str(), std::fstream::in);
+
+    if (!file.is_open())
+    {
+      // some error msg
+    }
+
+    char line[1024];
+    std::string levelString = "";
+
+    while (file.good() && !file.eof())
+    {
+      file.getline(line, 1024);
+      levelString += line;
+      levelString += "\n";
+    }
+
+    file.close();
+    //std::string output;
+
+    if (luaTags) luaSource_ = replaceLuaTags(levelString);
+    COUT(5) << "ParsedSourceCode: " << luaSource_ << std::endl;
+  }
+
+  void LuaBind::loadString(std::string code)
+  {
+    luaSource_ = code;
+    output_ = "";
+  }
+
+#if LUA_VERSION_NUM != 501
+  const char * LuaBind::lua_Chunkreader(lua_State *L, void *data, size_t *size)
+  {
+    LoadS* ls = ((LoadS*)data);
+    if (ls->size == 0) return NULL;
+    *size = ls->size;
+    ls->size = 0;
+    return ls->s;
+  }
+#endif
+  void LuaBind::run()
+  {
+    if (!isRunning_)
+    {
+      isRunning_ = true;
+      int error = 0;
+      std::string init = "local scr = orxonox.LuaBind:getInstance()\nlocal debug = print\nprint = function(s)\nscr:luaPrint(s)\nend\ninclude = function(f)\nfile = assert(io.open(\"" + this->includePath_ + "\"..\"/\"..f))\ncontent = file:read(\"*a\")\nfile:close()\nsource = scr:replaceLuaTags(content)\nassert(loadstring(source))()\nend\n";
+      init += luaSource_;
+  #if LUA_VERSION_NUM == 501
+      error = luaL_loadstring(luaState_, init.c_str());
+  #else
+      LoadS ls;
+      ls.s = init.c_str();
+      ls.size = init.size();
+      error = lua_load(luaState_, &orxonox::LuaBind::lua_Chunkreader, &ls, init.c_str());
+  #endif
+      if (error == 0)
+      {
+        error = lua_pcall(luaState_, 0, 0, 0);
+      }
+      if (error != 0)
+      {
+        COUT(2) << "Error in Lua-script: " << lua_tostring(luaState_, -1) << std::endl;
+      }
+      isRunning_ = false;
+    }
+    else
+    {
+      COUT(2) << "Warning: Lua's run is called while running!" << std::endl;
+    }
+  }
+
+  std::string LuaBind::replaceLuaTags(const std::string& text)
+  {
+    // chreate map with all Lua tags
+    std::map<size_t, bool> luaTags;
+    {
+      size_t pos = 0;
+      while ((pos = text.find("<?lua", pos)) != std::string::npos)
+        luaTags[pos++] = true;
+    }
+    {
+      size_t pos = 0;
+      while ((pos = text.find("?>", pos)) != std::string::npos)
+        luaTags[pos++] = false;
+    }
+
+    // erase all tags from the map that are between two quotes
+    {
+      std::map<size_t, bool>::iterator it = luaTags.begin();
+      std::map<size_t, bool>::iterator it2 = it;
+      bool bBetweenQuotes = false;
+      size_t pos = 0;
+      while ((pos = getNextQuote(text, pos)) != std::string::npos)
+      {
+        while ((it != luaTags.end()) && (it->first < pos))
+        {
+          if (bBetweenQuotes) {
+            it2++;
+            if(it->second && !(it2->second) && it2->first < pos)
+              it = ++it2;
+            else
+              luaTags.erase(it++);
+          }
+          else
+            ++it;
+        }
+        bBetweenQuotes = !bBetweenQuotes;
+        pos++;
+      }
+    }
+
+    // check whether on every opening <?lua tag a closing ?> tag follows
+    {
+      bool expectedValue = true;
+      for (std::map<size_t, bool>::iterator it = luaTags.begin(); it != luaTags.end(); ++it)
+      {
+        if (it->second == expectedValue)
+          expectedValue = !expectedValue;
+        else
+        {
+          expectedValue = false;
+          break;
+        }
+      }
+      if (!expectedValue) {
+        COUT(2) << "Warning: Error in level file" << std::endl;
+        // todo: errorhandling
+        return "";
+      }
+    }
+
+    // cut the original string into pieces and put them together with print() instead of lua tags
+    std::string output;
+    {
+      std::map<size_t, bool>::iterator it = luaTags.begin();
+      bool bInPrintFunction = true;
+      size_t start = 0;
+      size_t end = 0;
+
+      do
+      {
+        if (it != luaTags.end())
+          end = (*(it++)).first;
+        else
+          end = std::string::npos;
+
+        unsigned int equalSignCounter = 0;
+
+        if (bInPrintFunction)
+        {
+          // count ['='[ and ]'='] and replace tags with print([[ and ]])
+          std::string temp = text.substr(start, end - start);
+          {
+            size_t pos = 0;
+            while ((pos = temp.find('[', pos)) != std::string::npos)
+            {
+              unsigned int tempCounter = 1;
+              size_t tempPos = pos++;
+              while(temp[++tempPos] == '=') {
+                tempCounter++;
+              }
+              if(temp[tempPos] != '[') {
+                tempCounter = 0;
+              }
+              else if(tempCounter == 0) {
+                tempCounter = 1;
+              }
+              if (tempCounter > equalSignCounter)
+                equalSignCounter = tempCounter;
+            }
+          }
+          {
+            size_t pos = 0;
+            while ((pos = temp.find(']', pos)) != std::string::npos)
+            {
+              unsigned int tempCounter = 1;
+              size_t tempPos = pos++;
+              while(temp[++tempPos] == '=') {
+                tempCounter++;
+              }
+              if(temp[tempPos] != ']') {
+                tempCounter = 0;
+              }
+              else if(tempCounter == 0) {
+                tempCounter = 1;
+              }
+              if (tempCounter > equalSignCounter)
+                equalSignCounter = tempCounter;
+            }
+          }
+          std::string equalSigns = "";
+          for(unsigned int i = 0; i < equalSignCounter; i++) {
+            equalSigns += "=";
+          }
+          output += "print([" + equalSigns + "[" + temp + "]" + equalSigns +"])";
+          start = end + 5;
+        }
+        else
+        {
+          output += text.substr(start, end - start);
+          start = end + 2;
+        }
+
+        bInPrintFunction = !bInPrintFunction;
+      }
+      while (end != std::string::npos);
+    }
+
+    return output;
+  }
+
+}
Index: code/trunk/src/core/LuaBind.h
===================================================================
--- code/trunk/src/core/LuaBind.h	(revision 2087)
+++ code/trunk/src/core/LuaBind.h	(revision 2087)
@@ -0,0 +1,96 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Knecht
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+ @file
+ @brief Representation of an interface to lua
+ @author Benjamin Knecht <beni_at_orxonox.net>
+ */
+
+#ifndef _LuaBind_H__
+#define _LuaBind_H__
+
+#include "CorePrereqs.h"
+
+extern "C" {
+#include <lua/lua.h>
+}
+
+#include <list>
+#include <string>
+
+namespace orxonox // tolua_export
+{ // tolua_export
+  class _CoreExport LuaBind
+  {
+  /*
+  class LuaBind { // tolua_export
+  */
+    struct LoadS {
+      const char *s;
+      size_t size;
+    };
+
+    public:
+      inline static LuaBind* getInstance() { if (!LuaBind::singletonRef) LuaBind::singletonRef = new LuaBind(); return LuaBind::singletonRef; } // tolua_export
+      inline ~LuaBind() { LuaBind::singletonRef = NULL; };
+
+    void loadFile(std::string filename, bool luaTags);
+    void loadString(std::string code);
+    //void init(lua_State *state_);
+    //void xmlToLua();
+    void run();
+    void luaPrint(std::string str); // tolua_export
+
+#if LUA_VERSION_NUM != 501
+    static const char * lua_Chunkreader(lua_State *L, void *data, size_t *size);
+#endif
+
+    inline lua_State* getLuaState() { return luaState_; };
+    inline std::string getLuaOutput() { return output_; };
+    //inline std::string* getFileString() { return &fileString_; };
+    inline void clearLuaOutput() { output_ = ""; }
+
+    std::string replaceLuaTags(const std::string& text); // tolua_export
+
+    inline void setIncludePath(const std::string& includepath)
+        { this->includePath_ = includepath; }
+
+    private:
+      LuaBind();
+      static LuaBind* singletonRef;
+
+      std::string luaSource_;
+      std::string output_;
+      lua_State* luaState_;
+      bool isRunning_;
+      std::string includePath_;
+
+  }; // tolua_export
+} // tolua_export
+#endif /* _LuaBind_H__ */
Index: code/trunk/src/core/Namespace.cc
===================================================================
--- code/trunk/src/core/Namespace.cc	(revision 1937)
+++ code/trunk/src/core/Namespace.cc	(revision 2087)
@@ -37,5 +37,5 @@
     CreateFactory(Namespace);
 
-    Namespace::Namespace() :
+    Namespace::Namespace(BaseObject* creator) : BaseObject(creator),
       bAutogeneratedFileRootNamespace_(false),
       bRoot_(false),
Index: code/trunk/src/core/Namespace.h
===================================================================
--- code/trunk/src/core/Namespace.h	(revision 1937)
+++ code/trunk/src/core/Namespace.h	(revision 2087)
@@ -42,5 +42,5 @@
     {
         public:
-            Namespace();
+            Namespace(BaseObject* creator);
             virtual ~Namespace();
 
Index: code/trunk/src/core/RootGameState.cc
===================================================================
--- code/trunk/src/core/RootGameState.cc	(revision 1937)
+++ code/trunk/src/core/RootGameState.cc	(revision 2087)
@@ -39,5 +39,5 @@
 namespace orxonox
 {
-    SetCommandLineArgument(state, "gui").setShortcut("s");
+    SetCommandLineArgument(state, "gui").shortcut("s");
 
     RootGameState::RootGameState(const std::string& name)
@@ -147,7 +147,5 @@
 
             // get initial state from command line
-            std::string initialState;
-            CommandLine::getValue<std::string>("state", &initialState);
-            gotoState(initialState);
+            gotoState(CommandLine::getValue("state"));
 
             while (this->activeChild_)
Index: code/trunk/src/core/Script.cc
===================================================================
--- code/trunk/src/core/Script.cc	(revision 1937)
+++ 	(revision )
@@ -1,274 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Benjamin Knecht
- *   Co-authors:
- *      ...
- *
- */
-
-#include "Script.h"
-
-#include <fstream>
-#include <map>
-
-#include "CoreIncludes.h"
-
-#include "util/String.h"
-
-#include "lua/lua.hpp"
-
-#include "tolua/tolua++.h"
-#include "tolua/tolua_bind.h"
-
-namespace orxonox
-{
-  Script* Script::singletonRef = NULL;
-
-  Script::Script()
-  {
-    luaState_ = lua_open();
-    luaSource_ = "";
-#if LUA_VERSION_NUM == 501
-    luaL_openlibs(luaState_);
-#else
-    luaopen_base(luaState_);
-    luaopen_string(luaState_);
-    luaopen_table(luaState_);
-    luaopen_math(luaState_);
-    luaopen_io(luaState_);
-    luaopen_debug(luaState_);
-#endif
-    tolua_Core_open(luaState_);
-    output_ = "";
-  }
-
-  void Script::luaPrint(std::string str)
-  {
-    output_ += str;
-//    COUT(4) << "Lua_output!:" << std::endl << str << std::endl << "***" << std::endl;
-    COUT(5) << str;
-  }
-
-  /**
-      @brief Loads the specified file line by line
-      @param filename The filename of the file
-      @param luaTags if true, the loaded file gets stripped off luaTags
-  */
-  void Script::loadFile(std::string filename, bool luaTags)
-  {
-    std::ifstream file;
-    file.open(filename.c_str(), std::fstream::in);
-
-    if (!file.is_open())
-    {
-      // some error msg
-    }
-
-    char line[1024];
-    std::string levelString = "";
-
-    while (file.good() && !file.eof())
-    {
-      file.getline(line, 1024);
-      levelString += line;
-      levelString += "\n";
-    }
-
-    file.close();
-    //std::string output;
-
-    if (luaTags) luaSource_ = replaceLuaTags(levelString);
-    COUT(5) << "ParsedSourceCode: " << luaSource_ << std::endl;
-  }
-
-#if LUA_VERSION_NUM != 501
-  const char * Script::lua_Chunkreader(lua_State *L, void *data, size_t *size)
-  {
-    LoadS* ls = ((LoadS*)data);
-    if (ls->size == 0) return NULL;
-    *size = ls->size;
-    ls->size = 0;
-    return ls->s;
-  }
-#endif
-  void Script::run()
-  {
-    int error = 0;
-    std::string init = "local scr = orxonox.Script:getInstance()\nprint = function(s)\nscr:luaPrint(s)\nend\n";
-    init += luaSource_;
-#if LUA_VERSION_NUM == 501
-    error = luaL_loadstring(luaState_, init.c_str());
-#else
-    LoadS ls;
-    ls.s = init.c_str();
-    ls.size = init.size();
-    error = lua_load(luaState_, &orxonox::Script::lua_Chunkreader, &ls, init.c_str());
-#endif
-    if (error == 0)
-      error = lua_pcall(luaState_, 0, 0, 0);
-    if (error != 0)
-    {
-      COUT(2) << "Error in Lua-script: " << lua_tostring(luaState_, -1) << std::endl;
-    }
-  }
-
-  std::string Script::replaceLuaTags(const std::string& text)
-  {
-    // chreate map with all Lua tags
-    std::map<size_t, bool> luaTags;
-    {
-      size_t pos = 0;
-      while ((pos = text.find("<?lua", pos)) != std::string::npos)
-        luaTags[pos++] = true;
-    }
-    {
-      size_t pos = 0;
-      while ((pos = text.find("?>", pos)) != std::string::npos)
-        luaTags[pos++] = false;
-    }
-
-    // erase all tags from the map that are between two quotes
-    {
-      std::map<size_t, bool>::iterator it = luaTags.begin();
-      std::map<size_t, bool>::iterator it2 = it;
-      bool bBetweenQuotes = false;
-      size_t pos = 0;
-      while ((pos = getNextQuote(text, pos)) != std::string::npos)
-      {
-        while ((it != luaTags.end()) && (it->first < pos))
-        {
-          if (bBetweenQuotes) {
-            it2++;
-            if(it->second && !(it2->second) && it2->first < pos)
-              it = ++it2;
-            else
-              luaTags.erase(it++);
-          }
-          else
-            ++it;
-        }
-        bBetweenQuotes = !bBetweenQuotes;
-        pos++;
-      }
-    }
-
-    // check whether on every opening <?lua tag a closing ?> tag follows
-    {
-      bool expectedValue = true;
-      for (std::map<size_t, bool>::iterator it = luaTags.begin(); it != luaTags.end(); ++it)
-      {
-        if (it->second == expectedValue)
-          expectedValue = !expectedValue;
-        else
-        {
-          expectedValue = false;
-          break;
-        }
-      }
-      if (!expectedValue) {
-        // todo: errorhandling
-        return "";
-      }
-    }
-
-    // cut the original string into pieces and put them together with print() instead of lua tags
-    std::string output;
-    {
-      std::map<size_t, bool>::iterator it = luaTags.begin();
-      bool bInPrintFunction = true;
-      size_t start = 0;
-      size_t end = 0;
-
-      do
-      {
-        if (it != luaTags.end())
-          end = (*(it++)).first;
-        else
-          end = std::string::npos;
-
-        unsigned int equalSignCounter = 0;
-
-        if (bInPrintFunction)
-        {
-          // count ['='[ and ]'='] and replace tags with print([[ and ]])
-          std::string temp = text.substr(start, end - start);
-          {
-            size_t pos = 0;
-            while ((pos = temp.find('[', pos)) != std::string::npos)
-            {
-              unsigned int tempCounter = 1;
-              size_t tempPos = pos++;
-              while(temp[++tempPos] == '=') {
-                tempCounter++;
-              }
-              if(temp[tempPos] != '[') {
-                tempCounter = 0;
-              }
-              else if(tempCounter == 0) {
-                tempCounter = 1;
-              }
-              if (tempCounter > equalSignCounter)
-                equalSignCounter = tempCounter;
-            }
-          }
-          {
-            size_t pos = 0;
-            while ((pos = temp.find(']', pos)) != std::string::npos)
-            {
-              unsigned int tempCounter = 1;
-              size_t tempPos = pos++;
-              while(temp[++tempPos] == '=') {
-                tempCounter++;
-              }
-              if(temp[tempPos] != ']') {
-                tempCounter = 0;
-              }
-              else if(tempCounter == 0) {
-                tempCounter = 1;
-              }
-              if (tempCounter > equalSignCounter)
-                equalSignCounter = tempCounter;
-            }
-          }
-          std::string equalSigns = "";
-          for(unsigned int i = 0; i < equalSignCounter; i++) {
-            equalSigns += "=";
-          }
-          output += "print([" + equalSigns + "[" + temp + "]" + equalSigns +"])";
-          start = end + 5;
-        }
-        else
-        {
-          output += text.substr(start, end - start);
-          start = end + 2;
-        }
-
-        bInPrintFunction = !bInPrintFunction;
-      }
-      while (end != std::string::npos);
-    }
-
-    return output;
-  }
-
-}
Index: code/trunk/src/core/Script.h
===================================================================
--- code/trunk/src/core/Script.h	(revision 1937)
+++ 	(revision )
@@ -1,90 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Benjamin Knecht
- *   Co-authors:
- *      ...
- *
- */
-
-/**
- @file
- @brief Representation of an interface to lua
- @author Benjamin Knecht <beni_at_orxonox.net>
- */
-
-#ifndef _Script_H__
-#define _Script_H__
-
-#include "CorePrereqs.h"
-
-extern "C" {
-#include "lua/lua.h"
-}
-
-#include <list>
-#include <string>
-
-namespace orxonox // tolua_export
-{ // tolua_export
-  class _CoreExport Script
-  /*
-  class Script { // tolua_export
-  */
-  {
-    struct LoadS {
-      const char *s;
-      size_t size;
-    };
-
-    public:
-      inline static Script* getInstance() { if (!Script::singletonRef) Script::singletonRef = new Script(); return Script::singletonRef; } // tolua_export
-      inline ~Script() { Script::singletonRef = NULL; };
-
-    void loadFile(std::string filename, bool luaTags);
-    //void init(lua_State *state_);
-    //void xmlToLua();
-    void run();
-    void luaPrint(std::string str); // tolua_export
-
-#if LUA_VERSION_NUM != 501
-    static const char * lua_Chunkreader(lua_State *L, void *data, size_t *size);
-#endif
-
-    inline lua_State* getLuaState() { return luaState_; };
-    inline std::string getLuaOutput() { return output_; };
-    //inline std::string* getFileString() { return &fileString_; };
-    inline void clearLuaOutput() { output_ = ""; }
-
-    std::string replaceLuaTags(const std::string& text);
-
-    private:
-      Script();
-      static Script* singletonRef;
-
-      std::string luaSource_;
-      std::string output_;
-      lua_State* luaState_;
-
-  }; // tolua_export
-} // tolua_export
-#endif /* _Script_H__ */
Index: code/trunk/src/core/Super.h
===================================================================
--- code/trunk/src/core/Super.h	(revision 1937)
+++ code/trunk/src/core/Super.h	(revision 2087)
@@ -73,4 +73,5 @@
 #include "util/Debug.h"
 #include "XMLIncludes.h"
+#include "Event.h"
 
 ///////////////////////
@@ -229,4 +230,7 @@
     #define SUPER_changedVisibility(classname, functionname, ...) \
         SUPER_NOARGS(classname, functionname)
+
+    #define SUPER_processEvent(classname, functionname, ...) \
+        SUPER_ARGS(classname, functionname, __VA_ARGS__)
     // (1/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
 
@@ -433,4 +437,8 @@
             ()
         SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
+
+        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(4, processEvent, true, Event& event)
+            (event)
+        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
         // (2/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
 
@@ -479,4 +487,5 @@
     SUPER_INTRUSIVE_DECLARATION(changedActivity);
     SUPER_INTRUSIVE_DECLARATION(changedVisibility);
+    SUPER_INTRUSIVE_DECLARATION(processEvent);
     // (3/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
 
Index: code/trunk/src/core/Template.cc
===================================================================
--- code/trunk/src/core/Template.cc	(revision 2087)
+++ code/trunk/src/core/Template.cc	(revision 2087)
@@ -0,0 +1,163 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "Template.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "util/Debug.h"
+#include "tinyxml/ticpp.h"
+
+namespace orxonox
+{
+    CreateFactory(Template);
+
+    Template::Template(BaseObject* creator) : BaseObject(creator), xmlelement_("")
+    {
+        RegisterObject(Template);
+
+        this->bIsLink_ = false;
+        this->bIsReturningXMLElement_ = false;
+        this->baseclassIdentifier_ = 0;
+    }
+
+    Template::~Template()
+    {
+        Template::getTemplateMap().erase(this->getName());
+    }
+
+    void Template::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(Template, XMLPort, xmlelement, mode);
+
+        XMLPortParam(Template, "link", setLink, getLink, xmlelement, mode);
+        XMLPortParam(Template, "baseclass", setBaseclass, getBaseclass, xmlelement, mode);
+
+        Element* element = xmlelement.FirstChildElement(false);
+        if (element)
+        {
+            TiXmlElement* tixmlelement = dynamic_cast<TiXmlElement*>(element->GetTiXmlPointer());
+            if (tixmlelement)
+                this->setXMLElement(*tixmlelement);
+        }
+    }
+
+    void Template::changedName()
+    {
+        if (this->getName() != "")
+        {
+            std::map<std::string, Template*>::iterator it;
+            it = Template::getTemplateMap().find(this->getOldName());
+            if (it != Template::getTemplateMap().end())
+                Template::getTemplateMap().erase(it);
+
+            it = Template::getTemplateMap().find(this->getName());
+            if (it != Template::getTemplateMap().end())
+                COUT(2) << "Warning: Template with name \"" << this->getName() << "\" already exists." << std::endl;
+            else
+                Template::getTemplateMap()[this->getName()] = this;
+        }
+    }
+
+    const TiXmlElement& Template::getXMLElement() const
+    {
+        if (this->bIsLink_)
+        {
+            Template* temp = Template::getTemplate(this->link_);
+            if (temp)
+            {
+                if (!temp->bIsReturningXMLElement_)
+                {
+                    this->bIsReturningXMLElement_ = true;
+                    const TiXmlElement& element = temp->getXMLElement();
+                    this->bIsReturningXMLElement_ = false;
+                    return element;
+                }
+                else
+                {
+                    COUT(2) << "Warning: Linking from " << this->getName() << " to " << this->link_ << " leads to an infinite loop. Returning own element." << std::endl;
+                }
+            }
+            else
+            {
+                COUT(2) << "Warning: " << this->link_ << " is not an existing Template name. Returning own element." << std::endl;
+            }
+        }
+
+        return this->xmlelement_;
+    }
+
+    void Template::setBaseclass(const std::string& baseclass)
+    {
+        this->baseclassIdentifier_ = ClassByString(baseclass);
+        if (this->baseclassIdentifier_)
+            this->baseclass_ = baseclass;
+    }
+
+    void Template::applyOn(BaseObject* object)
+    {
+        if (this->baseclassIdentifier_)
+        {
+            if (!object->isA(this->baseclassIdentifier_))
+            {
+                COUT(1) << "Error: Can't apply template (name: " << this->getName() << "), object (name: " << object->getName() << ", class: " << object->getIdentifier()->getName() << ") is not a " << this->baseclassIdentifier_->getName() << std::endl;
+                return;
+            }
+        }
+
+        COUT(4) << object->getLoaderIndentation() << " aplying Template \"" << this->getName() << "\"..." << std::endl;
+
+        Element temp = ((TiXmlElement*)&this->getXMLElement());
+        object->XMLPort(temp, XMLPort::LoadObject);
+    }
+
+    std::map<std::string, Template*>& Template::getTemplateMap()
+    {
+        static std::map<std::string, Template*> templateMap;
+        return templateMap;
+    }
+
+    Template* Template::getTemplate(const std::string& name)
+    {
+        std::map<std::string, Template*>::iterator it = Template::getTemplateMap().find(name);
+        if (it != Template::getTemplateMap().end())
+            return it->second;
+        else
+        {
+            COUT(2) << "Warning: Template with name " << name << " doesn't exist." << std::endl;
+            return 0;
+        }
+    }
+
+    void Template::apply(const std::string& name, BaseObject* object)
+    {
+        std::map<std::string, Template*>::iterator it = Template::getTemplateMap().find(name);
+        if (it != Template::getTemplateMap().end())
+            it->second->applyOn(object);
+    }
+}
Index: code/trunk/src/core/Template.h
===================================================================
--- code/trunk/src/core/Template.h	(revision 2087)
+++ code/trunk/src/core/Template.h	(revision 2087)
@@ -0,0 +1,81 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Template_H__
+#define _Template_H__
+
+#include <map>
+
+#include "CorePrereqs.h"
+
+#include "BaseObject.h"
+#include "tinyxml/tinyxml.h"
+
+namespace orxonox
+{
+    class _CoreExport Template : public BaseObject
+    {
+        public:
+            Template(BaseObject* creator);
+            virtual ~Template();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            virtual void changedName();
+
+            inline void setLink(const std::string& link)
+                { this->link_ = link; this->bIsLink_ = (link != ""); }
+            inline const std::string& getLink() const
+                { return this->link_; }
+
+            inline void setXMLElement(const TiXmlElement& xmlelement)
+                { this->xmlelement_ = xmlelement; }
+            const TiXmlElement& getXMLElement() const;
+
+            void setBaseclass(const std::string& baseclass);
+            inline const std::string& getBaseclass() const
+                { return this->baseclass_; }
+            inline Identifier* getBaseclassIdentifier() const
+                { return this->baseclassIdentifier_; }
+
+            void applyOn(BaseObject* object);
+
+            static std::map<std::string, Template*>& getTemplateMap();
+            static Template* getTemplate(const std::string& name);
+            static void apply(const std::string& name, BaseObject* object);
+
+        private:
+            TiXmlElement xmlelement_;
+            std::string link_;
+            std::string baseclass_;
+            Identifier* baseclassIdentifier_;
+            bool bIsLink_;
+            mutable bool bIsReturningXMLElement_;
+    };
+}
+
+#endif /* _Template_H__ */
Index: code/trunk/src/core/XMLFile.h
===================================================================
--- code/trunk/src/core/XMLFile.h	(revision 2087)
+++ code/trunk/src/core/XMLFile.h	(revision 2087)
@@ -0,0 +1,55 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _XMLFile_H__
+#define _XMLFile_H__
+
+#include "CorePrereqs.h"
+
+#include <string>
+
+#include "ClassTreeMask.h"
+
+namespace orxonox
+{
+    class _CoreExport XMLFile
+    {
+        public:
+            XMLFile(const std::string& filename) : filename_(filename) {}
+            XMLFile(const std::string& filename, const ClassTreeMask& mask) : filename_(filename), mask_(mask) {};
+
+            const std::string& getFilename() const { return this->filename_; }
+            const ClassTreeMask& getMask() const { return this->mask_; }
+
+        private:
+            std::string filename_;
+            ClassTreeMask mask_;
+    };
+}
+
+#endif /* _XMLFile_H__ */
Index: code/trunk/src/core/XMLNameListener.cc
===================================================================
--- code/trunk/src/core/XMLNameListener.cc	(revision 2087)
+++ code/trunk/src/core/XMLNameListener.cc	(revision 2087)
@@ -0,0 +1,38 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "XMLNameListener.h"
+#include "CoreIncludes.h"
+
+namespace orxonox
+{
+    XMLNameListener::XMLNameListener()
+    {
+        RegisterRootObject(XMLNameListener);
+    }
+}
Index: code/trunk/src/core/XMLNameListener.h
===================================================================
--- code/trunk/src/core/XMLNameListener.h	(revision 2087)
+++ code/trunk/src/core/XMLNameListener.h	(revision 2087)
@@ -0,0 +1,47 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _XMLNameListener_H__
+#define _XMLNameListener_H__
+
+#include "CorePrereqs.h"
+#include "OrxonoxClass.h"
+
+namespace orxonox
+{
+    class _CoreExport XMLNameListener : virtual public OrxonoxClass
+    {
+        public:
+            XMLNameListener();
+            virtual ~XMLNameListener() {}
+
+            virtual void loadedNewXMLName(BaseObject* object) = 0;
+    };
+}
+
+#endif /* _XMLNameListener_H__ */
Index: code/trunk/src/core/XMLPort.h
===================================================================
--- code/trunk/src/core/XMLPort.h	(revision 1937)
+++ code/trunk/src/core/XMLPort.h	(revision 2087)
@@ -70,5 +70,7 @@
 */
 #define XMLPortParam(classname, paramname, loadfunction, savefunction, xmlelement, mode) \
-    XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, classname, this, paramname, orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction), xmlelement, mode)
+    static ExecutorMember<classname>* xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \
+    static ExecutorMember<classname>* xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction); \
+    XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, classname, this, paramname, xmlcontainer##loadfunction##savefunction##loadexecutor, xmlcontainer##loadfunction##savefunction##saveexecutor, xmlelement, mode)
 /**
     @brief This is the same as XMLPortParam, but you can set the template arguments needed to store the loadfunction.
@@ -83,5 +85,7 @@
 */
 #define XMLPortParamTemplate(classname, paramname, loadfunction, savefunction, xmlelement, mode, ...) \
-    XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, classname, this, paramname, orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction), xmlelement, mode)
+    static ExecutorMember<classname>* xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \
+    static ExecutorMember<classname>* xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction); \
+    XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, classname, this, paramname, xmlcontainer##loadfunction##savefunction##loadexecutor, xmlcontainer##loadfunction##savefunction##saveexecutor, xmlelement, mode)
 
 // --------------------
@@ -100,10 +104,12 @@
 */
 #define XMLPortParamLoadOnly(classname, paramname, loadfunction, xmlelement, mode) \
-    XMLPortParamGeneric(xmlcontainer##loadfunction##0, classname, classname, this, paramname, orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), 0, xmlelement, mode)
+    static ExecutorMember<classname>* xmlcontainer##loadfunction##0##loadexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \
+    XMLPortParamGeneric(xmlcontainer##loadfunction##0, classname, classname, this, paramname, xmlcontainer##loadfunction##0##loadexecutor, 0, xmlelement, mode)
 /**
     @brief This is the same as XMLPortParamTemplate, but for load-only attributes (see XMLPortParamLoadOnly).
 */
 #define XMLPortParamLoadOnlyTemplate(classname, paramname, loadfunction, xmlelement, mode, ...) \
-    XMLPortParamGeneric(xmlcontainer##loadfunction##0, classname, classname, this, paramname, orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), 0, xmlelement, mode)
+    static ExecutorMember<classname>* xmlcontainer##loadfunction##0##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \
+    XMLPortParamGeneric(xmlcontainer##loadfunction##0, classname, classname, this, paramname, xmlcontainer##loadfunction##0##loadexecutor, 0, xmlelement, mode)
 
 // ------------------
@@ -130,10 +136,14 @@
 */
 #define XMLPortParamExtern(classname, externclass, object, paramname, loadfunction, savefunction, xmlelement, mode) \
-    XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, externclass, object, paramname, orxonox::createExecutor(orxonox::createFunctor(&externclass::loadfunction), std::string( #externclass ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&externclass::savefunction), std::string( #externclass ) + "::" + #savefunction), xmlelement, mode);
+    static ExecutorMember<externclass>* xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor(&externclass::loadfunction), std::string( #externclass ) + "::" + #loadfunction); \
+    static ExecutorMember<externclass>* xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&externclass::savefunction), std::string( #externclass ) + "::" + #savefunction); \
+    XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, externclass, object, paramname, xmlcontainer##loadfunction##savefunction##loadexecutor, xmlcontainer##loadfunction##savefunction##saveexecutor, xmlelement, mode);
 /**
     @brief This is the same as XMLPortParamTemplate, but for extern attributes (see XMLPortParamExtern).
 */
 #define XMLPortParamExternTemplate(classname, externclass, object, paramname, loadfunction, savefunction, xmlelement, mode, ...) \
-    XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, externclass, object, paramname, orxonox::createExecutor(orxonox::createFunctor<externclass, __VA_ARGS__ >(&externclass::loadfunction), std::string( #externclass ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&externclass::savefunction), std::string( #externclass ) + "::" + #savefunction), xmlelement, mode);
+    static ExecutorMember<externclass>* xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<externclass, __VA_ARGS__ >(&externclass::loadfunction), std::string( #externclass ) + "::" + #loadfunction); \
+    static ExecutorMember<externclass>* xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&externclass::savefunction), std::string( #externclass ) + "::" + #savefunction); \
+    XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, externclass, object, paramname, xmlcontainer##loadfunction##savefunction##loadexecutor, xmlcontainer##loadfunction##savefunction##saveexecutor, xmlelement, mode);
 
 // -------------------
@@ -214,10 +224,14 @@
 */
 #define XMLPortObjectExtended(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode, bApplyLoaderMask, bLoadBefore) \
-    XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction), xmlelement, mode, bApplyLoaderMask, bLoadBefore)
+    static ExecutorMember<classname>* xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \
+    static ExecutorMember<classname>* xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction); \
+    XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, xmlcontainer##loadfunction##savefunction##loadexecutor, xmlcontainer##loadfunction##savefunction##saveexecutor, xmlelement, mode, bApplyLoaderMask, bLoadBefore)
 /**
     @brief This is the same as XMLPortObjectExtended, but you can specify the loadfunction by adding the param types. See XMLPortParamTemplate for more details about the types.
 */
 #define XMLPortObjectExtendedTemplate(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode, bApplyLoaderMask, bLoadBefore, ...) \
-    XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, orxonox::createExecutor(orxonox::createFunctor< __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction), xmlelement, mode, bApplyLoaderMask, bLoadBefore)
+    static ExecutorMember<classname>* xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \
+    static ExecutorMember<classname>* xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction); \
+    XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, xmlcontainer##loadfunction##savefunction##loadexecutor, xmlcontainer##loadfunction##savefunction##saveexecutor, xmlelement, mode, bApplyLoaderMask, bLoadBefore)
 
 // -------------
@@ -228,10 +242,14 @@
 */
 #define XMLPortObject(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode) \
-    XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction), xmlelement, mode, false, true)
+    static ExecutorMember<classname>* xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \
+    static ExecutorMember<classname>* xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction); \
+    XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, xmlcontainer##loadfunction##savefunction##loadexecutor, xmlcontainer##loadfunction##savefunction##saveexecutor, xmlelement, mode, false, true)
 /**
     @brief This is the same as XMLPortObject, but you can specify the loadfunction by adding the param types. See XMLPortParamTemplate for more details about the types.
 */
 #define XMLPortObjectTemplate(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode, ...) \
-    XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, orxonox::createExecutor(orxonox::createFunctor< __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction), xmlelement, mode, false, true)
+    static ExecutorMember<classname>* xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \
+    static ExecutorMember<classname>* xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction); \
+    XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, xmlcontainer##loadfunction##savefunction##loadexecutor, xmlcontainer##loadfunction##savefunction##saveexecutor, xmlelement, mode, false, true)
 
 // --------------------
@@ -336,5 +354,5 @@
                     {
                         COUT(1) << std::endl;
-                        COUT(1) << "An error occurred in XMLPort.h while loading attribute '" << this->paramname_ << "' of '" << this->identifier_->getName() << "' (objectname: " << this->owner_->getName() << ") in " << this->owner_->getLevelfile() << ":" << std::endl;
+                        COUT(1) << "An error occurred in XMLPort.h while loading attribute '" << this->paramname_ << "' of '" << this->identifier_->getName() << "' (objectname: " << this->owner_->getName() << ") in " << this->owner_->getFilename() << ":" << std::endl;
                         COUT(1) << ex.what() << std::endl;
                     }
@@ -468,35 +486,44 @@
                             for (ticpp::Iterator<ticpp::Element> child = xmlsubelement->FirstChildElement(false); child != child.end(); child++)
                             {
-                                Identifier* identifier = ClassByName(child->Value());
+                                Identifier* identifier = ClassByString(child->Value());
                                 if (identifier)
                                 {
                                     if (identifier->isA(Class(O)))
                                     {
-                                        if (this->identifierIsIncludedInLoaderMask(identifier))
+                                        if (identifier->isLoadable())
                                         {
-                                            COUT(4) << ((BaseObject*)object)->getLoaderIndentation() << "fabricating " << child->Value() << "..." << std::endl;
-
-                                            BaseObject* newObject = identifier->fabricate();
-                                            newObject->setLoaderIndentation(((BaseObject*)object)->getLoaderIndentation() + "  ");
-                                            newObject->setLevel(((BaseObject*)object)->getLevel());
-                                            newObject->setNamespace(((BaseObject*)object)->getNamespace());
-
-                                            if (this->bLoadBefore_)
+                                            if (this->identifierIsIncludedInLoaderMask(identifier))
                                             {
-                                                newObject->XMLPort(*child, XMLPort::LoadObject);
-                                                COUT(4) << ((BaseObject*)object)->getLoaderIndentation() << "assigning " << child->Value() << " (objectname " << newObject->getName() << ") to " << this->identifier_->getName() << " (objectname " << ((BaseObject*)object)->getName() << ")" << std::endl;
+                                                COUT(4) << ((BaseObject*)object)->getLoaderIndentation() << "fabricating " << child->Value() << "..." << std::endl;
+
+                                                BaseObject* newObject = identifier->fabricate((BaseObject*)object);
+                                                assert(newObject);
+                                                newObject->setLoaderIndentation(((BaseObject*)object)->getLoaderIndentation() + "  ");
+
+                                                O* castedObject = dynamic_cast<O*>(newObject);
+                                                assert(castedObject);
+
+                                                if (this->bLoadBefore_)
+                                                {
+                                                    newObject->XMLPort(*child, XMLPort::LoadObject);
+                                                    COUT(4) << ((BaseObject*)object)->getLoaderIndentation() << "assigning " << child->Value() << " (objectname " << newObject->getName() << ") to " << this->identifier_->getName() << " (objectname " << ((BaseObject*)object)->getName() << ")" << std::endl;
+                                                }
+                                                else
+                                                {
+                                                    COUT(4) << ((BaseObject*)object)->getLoaderIndentation() << "assigning " << child->Value() << " (object not yet loaded) to " << this->identifier_->getName() << " (objectname " << ((BaseObject*)object)->getName() << ")" << std::endl;
+                                                }
+
+                                                COUT(5) << ((BaseObject*)object)->getLoaderIndentation();
+                                                (*this->loadexecutor_)(object, castedObject);
+
+                                                if (!this->bLoadBefore_)
+                                                    newObject->XMLPort(*child, XMLPort::LoadObject);
+
+                                                COUT(5) << ((BaseObject*)object)->getLoaderIndentation() << "...fabricated " << child->Value() << " (objectname " << newObject->getName() << ")." << std::endl;
                                             }
-                                            else
-                                            {
-                                                COUT(4) << ((BaseObject*)object)->getLoaderIndentation() << "assigning " << child->Value() << " (object not yet loaded) to " << this->identifier_->getName() << " (objectname " << ((BaseObject*)object)->getName() << ")" << std::endl;
-                                            }
-
-                                            COUT(5) << ((BaseObject*)object)->getLoaderIndentation();
-                                            (*this->loadexecutor_)(object, newObject);
-
-                                            if (!this->bLoadBefore_)
-                                                newObject->XMLPort(*child, XMLPort::LoadObject);
-
-                                            COUT(5) << ((BaseObject*)object)->getLoaderIndentation() << "...fabricated " << child->Value() << " (objectname " << newObject->getName() << ")." << std::endl;
+                                        }
+                                        else
+                                        {
+                                            COUT(2) << ((BaseObject*)object)->getLoaderIndentation() << "Warning: '" << child->Value() << "' is not loadable." << std::endl;
                                         }
                                     }
@@ -508,5 +535,12 @@
                                 else
                                 {
-                                    COUT(2) << object->getLoaderIndentation() << "Warning: '" << child->Value() << "' is not a valid classname." << std::endl;
+                                    if (this->sectionname_ != "")
+                                    {
+                                        COUT(2) << object->getLoaderIndentation() << "Warning: '" << child->Value() << "' is not a valid classname." << std::endl;
+                                    }
+                                    else
+                                    {
+                                        // It's probably just another subsection
+                                    }
                                 }
                             }
@@ -516,5 +550,5 @@
                     {
                         COUT(1) << std::endl;
-                        COUT(1) << "An error occurred in XMLPort.h while loading a '" << Class(O)->getName() << "' in '" << this->sectionname_ << "' of '" << this->identifier_->getName() << "' (objectname: " << ((BaseObject*)object)->getName() << ") in " << object->getLevelfile() << ":" << std::endl;
+                        COUT(1) << "An error occurred in XMLPort.h while loading a '" << Class(O)->getName() << "' in '" << this->sectionname_ << "' of '" << this->identifier_->getName() << "' (objectname: " << ((BaseObject*)object)->getName() << ") in " << object->getFilename() << ":" << std::endl;
                         COUT(1) << ex.what() << std::endl;
                     }
Index: code/trunk/src/core/input/Button.cc
===================================================================
--- code/trunk/src/core/input/Button.cc	(revision 1937)
+++ code/trunk/src/core/input/Button.cc	(revision 2087)
@@ -175,17 +175,16 @@
 
                 // check for param command
-                int paramIndex = eval.getConsoleCommand()->getAxisParamIndex();
+                int paramIndex = eval.getConsoleCommand()->getInputConfiguredParam_();
                 if (paramIndex >= 0)
                 {
                     // parameter supported command
                     ParamCommand* cmd = new ParamCommand();
-                    cmd->paramModifier_ = paramModifier;
-                    cmd->bRelative_ = eval.getConsoleCommand()->getIsAxisRelative();
+                    cmd->scale_ = paramModifier;
 
                     // add command to the buffer if not yet existing
                     for (unsigned int iParamCmd = 0; iParamCmd < paramCommandBuffer_->size(); iParamCmd++)
                     {
-                        if (getLowercase((*paramCommandBuffer_)[iParamCmd]->evaluation_.getOriginalCommand())
-                            == getLowercase(commandStr))
+                        if ((*paramCommandBuffer_)[iParamCmd]->evaluation_.getConsoleCommand()
+                            == eval.getConsoleCommand())
                         {
                             // already in list
Index: code/trunk/src/core/input/HalfAxis.h
===================================================================
--- code/trunk/src/core/input/HalfAxis.h	(revision 1937)
+++ code/trunk/src/core/input/HalfAxis.h	(revision 2087)
@@ -50,5 +50,5 @@
             , paramCommands_(0)
             , nParamCommands_(0)
-            , wasDown_(false)
+            , pressed_(false)
             , hasChanged_(false)
         { }
@@ -65,5 +65,5 @@
 
         // button related
-        bool wasDown_;
+        bool pressed_;
         bool hasChanged_;
     };
Index: code/trunk/src/core/input/InputCommands.cc
===================================================================
--- code/trunk/src/core/input/InputCommands.cc	(revision 1937)
+++ code/trunk/src/core/input/InputCommands.cc	(revision 2087)
@@ -34,4 +34,5 @@
 
 #include "InputCommands.h"
+#include "util/Math.h"
 #include "core/CommandExecutor.h"
 
@@ -51,12 +52,11 @@
     bool BufferedParamCommand::execute()
     {
-        if (nValuesAdded_)
+        if (this->abs_ != 0.0f || this->rel_ != 0.0f)
         {
-            BufferedParamCommand& cmd = *this;
-            cmd.evaluation_.setEvaluatedParameter(cmd.paramIndex_, cmd.value_);
+            evaluation_.setEvaluatedParameter(paramIndex_, Vector2(abs_, rel_));
             // reset
-            cmd.nValuesAdded_ = 0;
-            cmd.value_ = 0;
-            return cmd.evaluation_.execute();
+            rel_ = 0.0;
+            abs_ = 0.0;
+            return evaluation_.execute();
         }
         else
@@ -79,39 +79,18 @@
         BufferedParamCommand& cmd = *paramCommand_;
         // command has an additional parameter
-        if (bRelative_)
+        if (rel != 0.0f)
         {
-            if (rel != 0.0f)
-            {
-                // we have to calculate a relative movement.
-                // paramModifier_ says how much one keystroke is
-                cmd.value_ += paramModifier_ * rel;
-            }
+            // calculate relative movement.
+            // scale_ says how much one keystroke is
+            cmd.rel_ += scale_ * rel;
         }
-        else if (abs != 0.0f)
+
+        if (abs != 0.0f)
         {
-            // Usually, joy sticks create 'noise' (they return values if they're in 0 position)
-            // and normally this is caught in tickInput(), but that threshold cannot be to high
-            // in order to preserve accuracy. Instead, we have to catch the problem here. An example:
-            // Someone only uses buttons with an active joystick. The joy stick value could then
-            // be 0.05 for instance and the the key value 1. Without handling the problem, the final
-            // value would be computed to (1+0.05)/2=0.5025 which is not what the user expects.
-            float absQ = abs * abs;
-            float valueQ = cmd.value_ * cmd.value_;
-            if (absQ > 50.0f * valueQ) // ease up comparison by using quadratics
-            {
-                cmd.value_ = abs * paramModifier_;
-                cmd.nValuesAdded_ = 1;
-            }
-            else if (absQ * 50.0f < valueQ)
-            {
-                // abs is too small, we just don't do anything
-            }
-            else
-            {
-                // we have to calculate the absolute position of the axis.
-                // Since there might be another axis that is affected, we have to wait and
-                // store the result in a temporary place
-                cmd.value_ = (cmd.value_ * cmd.nValuesAdded_ + paramModifier_ * abs) / ++cmd.nValuesAdded_;
-            }
+            cmd.abs_ += scale_ * abs;
+            if (cmd.abs_ > 1.0)
+                cmd.abs_ = 1.0;
+            if (cmd.abs_ < -1.0)
+                cmd.abs_ = -1.0;
         }
         return true;
Index: code/trunk/src/core/input/InputCommands.h
===================================================================
--- code/trunk/src/core/input/InputCommands.h	(revision 1937)
+++ code/trunk/src/core/input/InputCommands.h	(revision 2087)
@@ -44,9 +44,9 @@
     {
     public:
-        BufferedParamCommand() : value_(0.0f), nValuesAdded_(0), paramIndex_(-1) { }
+        BufferedParamCommand() : abs_(0.0f), rel_(0.0), paramIndex_(-1) { }
         bool execute();
 
-        float value_;
-        unsigned int nValuesAdded_;
+        float abs_;
+        float rel_;
         int paramIndex_;
         CommandEvaluation evaluation_;
@@ -82,9 +82,8 @@
     {
     public:
-        ParamCommand() : bRelative_(false), paramModifier_(1.0f), paramCommand_(0) { }
+        ParamCommand() : scale_(1.0f), paramCommand_(0) { }
         bool execute(float abs = 1.0f, float rel = 1.0f);
 
-        bool bRelative_;
-        float paramModifier_;
+        float scale_;
         BufferedParamCommand* paramCommand_;
     };
Index: code/trunk/src/core/input/KeyBinder.cc
===================================================================
--- code/trunk/src/core/input/KeyBinder.cc	(revision 1937)
+++ code/trunk/src/core/input/KeyBinder.cc	(revision 2087)
@@ -137,4 +137,6 @@
         SetConfigValue(analogThreshold_, 0.05f)
             .description("Threshold for analog axes until which the state is 0.");
+        SetConfigValue(bFilterAnalogNoise_, false)
+            .description("Specifies whether to filter small analog values like joy stick fluctuations.");
         SetConfigValue(mouseSensitivity_, 1.0f)
             .description("Mouse sensitivity.");
@@ -145,5 +147,5 @@
         SetConfigValue(mouseSensitivityDerived_, 1.0f)
             .description("Mouse sensitivity if mouse input is derived.");
-        SetConfigValue(mouseWheelStepSize_, 120.0f)
+        SetConfigValue(mouseWheelStepSize_, 120)
             .description("Equals one step of the mousewheel.");
         SetConfigValue(buttonThreshold_, 0.80f)
@@ -323,8 +325,7 @@
     void KeyBinder::tickMouse(float dt)
     {
-        tickDevices(mouseAxes_, mouseAxes_ + MouseAxisCode::numberOfAxes * 2);
-
         if (bDeriveMouseInput_)
         {
+            // only update when derive dt has passed
             if (deriveTime_ > derivePeriod_)
             {
@@ -357,40 +358,64 @@
                 deriveTime_ += dt;
         }
-    }
-
-    void KeyBinder::tickDevices(HalfAxis* begin, HalfAxis* end)
-    {
-        for (HalfAxis* current = begin; current < end; ++current) // pointer arithmetic
-        {
-            // button mode
-            // TODO: optimize out all the half axes that don't act as a button at the moment
-            if (current->hasChanged_)
-            {
-                if (!current->wasDown_ && current->absVal_ > current->buttonThreshold_)
-                {
-                    current->wasDown_ = true;
-                    if (current->nCommands_[KeybindMode::OnPress])
-                        current->execute(KeybindMode::OnPress);
-                }
-                else if (current->wasDown_ && current->absVal_ < current->buttonThreshold_)
-                {
-                    current->wasDown_ = false;
-                    if (current->nCommands_[KeybindMode::OnRelease])
-                        current->execute(KeybindMode::OnRelease);
-                }
-                current->hasChanged_ = false;
-            }
-
-            if (current->wasDown_)
-            {
-                if (current->nCommands_[KeybindMode::OnHold])
-                    current->execute(KeybindMode::OnHold);
-            }
-
-            // these are the actually useful axis bindings for analog input
-            if (current->relVal_ > analogThreshold_ || current->absVal_ > analogThreshold_)
-            {
-                current->execute();
-            }
+
+        for (unsigned int i = 0; i < MouseAxisCode::numberOfAxes * 2; i++)
+        {
+            // Why dividing relative value by dt? The reason lies in the simple fact, that when you
+            // press a button that has relative movement, that value has to be multiplied by dt to be
+            // frame rate independant. This can easily (and only) be done in tickInput(float).
+            // Hence we need to divide by dt here for the mouse to compensate, because the relative
+            // move movements have nothing to do with dt.
+            if (dt != 0.0f)
+            {
+                // just ignore if dt == 0.0 because we have multiplied by 0.0 anyway..
+                mouseAxes_[i].relVal_ /= dt;
+            }
+
+            tickHalfAxis(mouseAxes_[i]);
+        }
+    }
+
+    void KeyBinder::tickJoyStick(float dt, unsigned int joyStick)
+    {
+        for (unsigned int i = 0; i < JoyStickAxisCode::numberOfAxes * 2; i++)
+        {
+            tickHalfAxis(joyStickAxes_[joyStick][i]);
+        }
+    }
+
+    void KeyBinder::tickHalfAxis(HalfAxis& halfAxis)
+    {
+        // button mode
+        // TODO: optimize out all the half axes that don't act as a button at the moment
+        if (halfAxis.hasChanged_)
+        {
+            if (!halfAxis.pressed_ && halfAxis.absVal_ > halfAxis.buttonThreshold_)
+            {
+                // key pressed event
+                halfAxis.pressed_ = true;
+                if (halfAxis.nCommands_[KeybindMode::OnPress])
+                    halfAxis.execute(KeybindMode::OnPress);
+            }
+            else if (halfAxis.pressed_ && halfAxis.absVal_ < halfAxis.buttonThreshold_)
+            {
+                // key released event
+                halfAxis.pressed_ = false;
+                if (halfAxis.nCommands_[KeybindMode::OnRelease])
+                    halfAxis.execute(KeybindMode::OnRelease);
+            }
+            halfAxis.hasChanged_ = false;
+        }
+
+        if (halfAxis.pressed_)
+        {
+            // key held event
+            if (halfAxis.nCommands_[KeybindMode::OnHold])
+                halfAxis.execute(KeybindMode::OnHold);
+        }
+
+        // these are the actually useful axis bindings for analog input
+        if (!bFilterAnalogNoise_ || halfAxis.relVal_ > analogThreshold_ || halfAxis.absVal_ > analogThreshold_)
+        {
+            halfAxis.execute();
         }
     }
@@ -407,5 +432,10 @@
         int rel[] = { rel_.x, -rel_.y };
 
-        if (!bDeriveMouseInput_)
+        if (bDeriveMouseInput_)
+        {
+            mouseRelative_[0] += rel[0];
+            mouseRelative_[1] += rel[1];
+        }
+        else
         {
             for (int i = 0; i < 2; i++)
@@ -437,9 +467,4 @@
             }
         }
-        else
-        {
-            mouseRelative_[0] += rel[0];
-            mouseRelative_[1] += rel[1];
-        }
 
         // relative
Index: code/trunk/src/core/input/KeyBinder.h
===================================================================
--- code/trunk/src/core/input/KeyBinder.h	(revision 1937)
+++ code/trunk/src/core/input/KeyBinder.h	(revision 2087)
@@ -71,5 +71,5 @@
         void tickJoyStick(float dt, unsigned int joyStick);
         // internal
-        void tickDevices(HalfAxis* begin, HalfAxis* end);
+        void tickHalfAxis(HalfAxis& halfAxis);
 
         void buttonThresholdChanged();
@@ -149,4 +149,6 @@
         //! Filename of default keybindings.
         std::string defaultKeybindings_;
+        //! Whether to filter small value analog input
+        bool bFilterAnalogNoise_;
         //! Threshold for analog triggers until which the state is 0.
         float analogThreshold_;
@@ -162,5 +164,5 @@
         float mouseSensitivityDerived_;
         //! Equals one step of the mousewheel
-        float mouseWheelStepSize_;
+        int mouseWheelStepSize_;
 
         //##### Constant config variables #####
@@ -198,14 +200,12 @@
     { joyStickButtons_[joyStickID][id].execute(KeybindMode::OnHold); }
 
-    inline void KeyBinder::tickJoyStick(float dt, unsigned int joyStick)
-    {
-        tickDevices(&joyStickAxes_[joyStick][0], &joyStickAxes_[joyStick][JoyStickAxisCode::numberOfAxes * 2]);
-    }
-
     inline void KeyBinder::tickInput(float dt)
     {
         // execute all buffered bindings (additional parameter)
         for (unsigned int i = 0; i < paramCommandBuffer_.size(); i++)
+        {
+            paramCommandBuffer_[i]->rel_ *= dt;
             paramCommandBuffer_[i]->execute();
+        }
 
         // always reset the relative movement of the mouse
Index: code/trunk/src/core/tolua/tolua.pkg
===================================================================
--- code/trunk/src/core/tolua/tolua.pkg	(revision 1937)
+++ code/trunk/src/core/tolua/tolua.pkg	(revision 2087)
@@ -1,2 +1,2 @@
-$cfile "../../src/core/Script.h"
+$cfile "../../src/core/LuaBind.h"
 $cfile "../../src/core/CommandExecutor.h"
Index: code/trunk/src/network/CMakeLists.txt
===================================================================
--- code/trunk/src/network/CMakeLists.txt	(revision 1937)
+++ code/trunk/src/network/CMakeLists.txt	(revision 2087)
@@ -1,6 +1,8 @@
 SET( NETWORK_SRC_FILES
+  ChatListener.cc
   Client.cc
   ClientConnection.cc
   ClientInformation.cc
+  ClientConnectionListener.cc
   ConnectionManager.cc
   GamestateManager.cc
Index: code/trunk/src/network/ChatListener.cc
===================================================================
--- code/trunk/src/network/ChatListener.cc	(revision 2087)
+++ code/trunk/src/network/ChatListener.cc	(revision 2087)
@@ -0,0 +1,42 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "ChatListener.h"
+
+#include "core/CoreIncludes.h"
+#include "core/Core.h"
+
+namespace network
+{
+    ChatListener::ChatListener()
+    {
+        RegisterRootObject(ChatListener);
+    }
+}
+
+
Index: code/trunk/src/network/ChatListener.h
===================================================================
--- code/trunk/src/network/ChatListener.h	(revision 2087)
+++ code/trunk/src/network/ChatListener.h	(revision 2087)
@@ -0,0 +1,49 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _NETWORK_ChatListener__
+#define _NETWORK_ChatListener__
+
+#include "NetworkPrereqs.h"
+
+#include "ClientInformation.h"
+#include "core/OrxonoxClass.h"
+
+namespace network
+{
+    class _NetworkExport ChatListener : virtual public orxonox::OrxonoxClass
+    {
+        public:
+            ChatListener();
+            virtual ~ChatListener() {}
+
+            virtual void incomingChat(const std::string& message, unsigned int senderID) = 0;
+    };
+}
+
+#endif /* _NETWORK_ChatListener__ */
Index: code/trunk/src/network/Client.cc
===================================================================
--- code/trunk/src/network/Client.cc	(revision 1937)
+++ code/trunk/src/network/Client.cc	(revision 2087)
@@ -39,4 +39,6 @@
 //
 
+#include <cassert>
+
 #include "Client.h"
 #include "Host.h"
@@ -44,4 +46,5 @@
 #include "core/CoreIncludes.h"
 #include "packet/Packet.h"
+
 // #include "packet/Acknowledgement.h"
 
@@ -67,5 +70,5 @@
   * @param port port of the application on the server
   */
-  Client::Client(std::string address, int port) : client_connection(port, address){
+  Client::Client(const std::string& address, int port) : client_connection(port, address){
     isConnected=false;
     isSynched_=false;
@@ -114,15 +117,15 @@
   }
 
-  bool Client::processChat(std::string message, unsigned int playerID){
-    COUT(1) << "Player " << playerID << ": " << message << std::endl;
+  bool Client::processChat(const std::string& message, unsigned int playerID){
+//    COUT(1) << "Player " << playerID << ": " << message << std::endl;
     return true;
   }
-  
+
   /**
    * This function implements the method of sending a chat message to the server
-   * @param message message to be sent 
+   * @param message message to be sent
    * @return result(true/false)
    */
-  bool Client::chat(std::string message){
+  bool Client::chat(const std::string& message){
     packet::Chat *m = new packet::Chat(message, Host::getPlayerID());
     return m->send();
@@ -132,5 +135,5 @@
   /**
    * Processes incoming packets, sends a gamestate to the server and does the cleanup
-   * @param time 
+   * @param time
    */
   void Client::tick(float time){
@@ -152,4 +155,5 @@
       COUT(5) << "tick packet size " << event->packet->dataLength << std::endl;
       packet::Packet *packet = packet::Packet::createPacket(event->packet, event->peer);
+      // note: packet commits suicide here except for the GameState. That is then deleted by a GamestateHandler
       bool b = packet->process();
       assert(b);
Index: code/trunk/src/network/Client.h
===================================================================
--- code/trunk/src/network/Client.h	(revision 1937)
+++ code/trunk/src/network/Client.h	(revision 2087)
@@ -66,30 +66,26 @@
   public:
     Client();
-    Client(std::string address, int port);
+    Client(const std::string& address, int port);
     Client(const char *address, int port);
     ~Client();
-    
+
     bool establishConnection();
     bool closeConnection();
     bool queuePacket(ENetPacket *packet, int clientID);
-    bool processChat(std::string message, unsigned int playerID);
-    virtual bool chat(std::string message);
+    bool processChat(const std::string& message, unsigned int playerID);
+    virtual bool chat(const std::string& message);
+    virtual bool broadcast(const std::string& message) { return false; }
     //bool sendChat(packet::Chat *chat);
-    
-//    static void Chat( std::string message );
-    
-    //static void setShipID( unsigned int shipID){ dynamic_cast<Client *>(instance_)->shipID_=shipID; }
-    static void setClientID( unsigned int clientID){ dynamic_cast<Client *>(instance_)->clientID_=clientID; }
-    
+
     void tick(float time);
 
   private:
     virtual bool isServer_(){return false;}
-    
+
     ClientConnection client_connection;
     GamestateClient gamestate;
     bool isConnected;
     bool isSynched_;
-    
+
     bool gameStateFailure_;
   };
Index: code/trunk/src/network/ClientConnection.cc
===================================================================
--- code/trunk/src/network/ClientConnection.cc	(revision 1937)
+++ code/trunk/src/network/ClientConnection.cc	(revision 2087)
@@ -54,5 +54,5 @@
   boost::recursive_mutex ClientConnection::enet_mutex_;
 
-  ClientConnection::ClientConnection(int port, std::string address) {
+  ClientConnection::ClientConnection(int port, const std::string& address) {
     quit=false;
     server=NULL;
@@ -72,5 +72,5 @@
   bool ClientConnection::waitEstablished(int milisec) {
     for(int i=0; i<=milisec && !established; i++)
-      usleep(1000);
+      msleep(1);
 
     return established;
@@ -184,5 +184,5 @@
       case ENET_EVENT_TYPE_NONE:
         //receiverThread_->yield();
-        usleep(1000);
+        msleep(1);
         break;
       }
Index: code/trunk/src/network/ClientConnection.h
===================================================================
--- code/trunk/src/network/ClientConnection.h	(revision 1937)
+++ code/trunk/src/network/ClientConnection.h	(revision 2087)
@@ -60,7 +60,7 @@
 
 
-  class ClientConnection{
+  class _NetworkExport ClientConnection{
   public:
-    ClientConnection(int port, std::string address);
+    ClientConnection(int port, const std::string& address);
     ClientConnection(int port, const char* address);
     ~ClientConnection();
@@ -96,5 +96,5 @@
     ENetPeer *server;
     boost::thread *receiverThread_;
-    
+
     static boost::recursive_mutex enet_mutex_;
   };
Index: code/trunk/src/network/ClientConnectionListener.cc
===================================================================
--- code/trunk/src/network/ClientConnectionListener.cc	(revision 2087)
+++ code/trunk/src/network/ClientConnectionListener.cc	(revision 2087)
@@ -0,0 +1,24 @@
+#include "ClientConnectionListener.h"
+#include "core/CoreIncludes.h"
+#include "core/Core.h"
+
+namespace network{
+
+  ClientConnectionListener::ClientConnectionListener()
+  { 
+    RegisterRootObject(ClientConnectionListener); 
+  }
+
+  void ClientConnectionListener::getConnectedClients(){
+    if(orxonox::Core::showsGraphics())
+      this->clientConnected(0); //server client id
+    ClientInformation *client = ClientInformation::getBegin();
+    while(client){
+      this->clientConnected(client->getID());
+      client=client->next();
+    }
+  }
+
+}
+
+
Index: code/trunk/src/network/ClientConnectionListener.h
===================================================================
--- code/trunk/src/network/ClientConnectionListener.h	(revision 2087)
+++ code/trunk/src/network/ClientConnectionListener.h	(revision 2087)
@@ -0,0 +1,28 @@
+#ifndef _NETWORK_CLIENTCONNECTIONLISTENER__
+#define _NETWORK_CLIENTCONNECTIONLISTENER__
+
+#include "NetworkPrereqs.h"
+#include "ClientInformation.h"
+#include "core/OrxonoxClass.h"
+
+namespace network{
+
+  class _NetworkExport ClientConnectionListener : virtual public orxonox::OrxonoxClass
+  {
+    friend class Server;
+
+  public:
+    ClientConnectionListener();
+    virtual ~ClientConnectionListener() {}
+
+    void getConnectedClients();
+
+  protected:
+    virtual void clientConnected(unsigned int clientID) = 0;
+    virtual void clientDisconnected(unsigned int clientID) = 0;
+  };
+
+}
+
+
+#endif
Index: code/trunk/src/network/ClientInformation.cc
===================================================================
--- code/trunk/src/network/ClientInformation.cc	(revision 1937)
+++ code/trunk/src/network/ClientInformation.cc	(revision 2087)
@@ -45,7 +45,7 @@
 namespace network
 {
-  
+
   ClientInformation *ClientInformation::head_=0;
-  
+
   ClientInformation::ClientInformation() {
     if(!head_)
@@ -59,10 +59,10 @@
 
   ClientInformation::~ClientInformation() {
-    if(this==head_)
-      head_=next();
     if(prev()!=0)
       prev()->setNext(this->next());
     if(next()!=0)
       next()->setPrev(this->prev());
+    if(this==head_)
+      head_=next();
   }
 
@@ -129,5 +129,5 @@
     return true;
   }
-  
+
   bool ClientInformation::setPartialGamestateID(int id){
     if(!this)
@@ -137,5 +137,5 @@
   }
 
-  int ClientInformation::getID() {
+  unsigned int ClientInformation::getID() {
     if(!this)
       return CLIENTID_UNKNOWN;
@@ -150,5 +150,5 @@
       return NULL;
   }
-  
+
   int ClientInformation::getFailures(){
     return failures_;
@@ -160,30 +160,30 @@
     failures_=0;
   }
-  
+
   enet_uint32 ClientInformation::getRTT(){
-    return peer_->roundTripTime;
-  }
-  
-  enet_uint32 ClientInformation::getPacketLoss(){
-    return peer_->packetLoss;
-  }
-
-  int ClientInformation::getGamestateID() {
+    return this->peer_->roundTripTime;
+  }
+
+  double ClientInformation::getPacketLoss(){
+    return ((double)this->peer_->packetLoss)/ENET_PEER_PACKET_LOSS_SCALE;
+  }
+
+  unsigned int ClientInformation::getGamestateID() {
     if(this)
       return gamestateID_;
     else
-      return -1;
-  }
-  
-  int ClientInformation::getPartialGamestateID() {
+      return (unsigned int)-1;
+  }
+
+  unsigned int ClientInformation::getPartialGamestateID() {
     if(this)
       return partialGamestateID_;
     else
-      return -1;
+      return (unsigned int)-1;
   }
 
   ClientInformation *ClientInformation::insertBack(ClientInformation *ins) {
     ClientInformation *temp = head_;
-    if(temp==head_){
+    if(temp==ins){
       return head_;
     }
@@ -196,6 +196,6 @@
   }
 
-  bool ClientInformation::removeClient(int clientID) {
-    if(clientID==CLIENTID_UNKNOWN)
+  bool ClientInformation::removeClient(unsigned int clientID) {
+    if((unsigned int)clientID==CLIENTID_UNKNOWN)
       return false;
     ClientInformation *temp = head_;
@@ -229,5 +229,5 @@
   * @return pointer to the last element in the list or 0 if the search was unsuccessfull
   */
-  ClientInformation *ClientInformation::findClient(int clientID, bool look_backwards) {
+  ClientInformation *ClientInformation::findClient(unsigned int clientID, bool look_backwards) {
     ClientInformation *temp = head_;
     while(temp!=0 && temp->getID()!=clientID){
Index: code/trunk/src/network/ClientInformation.h
===================================================================
--- code/trunk/src/network/ClientInformation.h	(revision 1937)
+++ code/trunk/src/network/ClientInformation.h	(revision 2087)
@@ -46,16 +46,16 @@
 #include <boost/thread/recursive_mutex.hpp>
 
-#define GAMESTATEID_INITIAL -1
-#define CLIENTID_UNKNOWN -2
-
 // WATCH OUT: THE CLIENTINFORMATION LIST IS NOT THREADSAFE ANYMORE
 
 namespace network
 {
+  static const unsigned int GAMESTATEID_INITIAL = (unsigned int)-1;
+  static const unsigned int CLIENTID_UNKNOWN = (unsigned int)-2;
+
   /**
   * This class implements a list for client informations
   * @author Oliver Scheuss
   */
-  class ClientInformation{
+  class _NetworkExport ClientInformation{
   public:
     ClientInformation();
@@ -66,5 +66,5 @@
     ClientInformation *prev();
     static ClientInformation *insertBack(ClientInformation *ins);
-    
+
     // set functions
     void setID(int clientID);
@@ -73,21 +73,21 @@
     bool setPartialGamestateID(int id);
     inline void setShipID(unsigned int id){ShipID_=id;}
-    
+
     // get functions
     inline unsigned int getShipID(){return ShipID_;}
-    int getID();
-    int getGamestateID();
-    int getPartialGamestateID();
+    unsigned int getID();
+    unsigned int getGamestateID();
+    unsigned int getPartialGamestateID();
     ENetPeer *getPeer();
-    
+
     int getFailures();
     void addFailure();
     void resetFailures();
     enet_uint32 getRTT();
-    enet_uint32 getPacketLoss();
-    
-    static bool removeClient(int clientID);
+    double getPacketLoss();
+
+    static bool removeClient(unsigned int clientID);
     static bool removeClient(ENetPeer *peer);
-    static ClientInformation *findClient(int clientID, bool look_backwards=false);
+    static ClientInformation *findClient(unsigned int clientID, bool look_backwards=false);
     static ClientInformation *findClient(ENetAddress *address, bool look_backwards=false);
     static ClientInformation *getBegin(){return head_;}
@@ -99,21 +99,21 @@
   private:
     static ClientInformation *head_;
-    
+
     bool setNext(ClientInformation *next);
     bool setPrev(ClientInformation *prev);
     ClientInformation *insertAfter(ClientInformation *ins);
     ClientInformation *insertBefore(ClientInformation *ins);
-    
+
     ClientInformation *preve;
     ClientInformation *nexte;
     //actual information:
     ENetPeer *peer_;
-    int clientID_;
-    int gamestateID_;
-    int partialGamestateID_;
+    unsigned int clientID_;
+    unsigned int gamestateID_;
+    unsigned int partialGamestateID_;
     unsigned int ShipID_;   // this is the unique objectID
     bool synched_;
     unsigned short failures_;
-    
+
   };
 
Index: code/trunk/src/network/ConnectionManager.cc
===================================================================
--- code/trunk/src/network/ConnectionManager.cc	(revision 1937)
+++ code/trunk/src/network/ConnectionManager.cc	(revision 2087)
@@ -49,5 +49,4 @@
 #include "core/BaseObject.h"
 #include "core/Iterator.h"
-#include "objects/SpaceShip.h"
 #include "util/Math.h"
 #include "util/Sleep.h"
@@ -89,5 +88,5 @@
   }
 
-  ConnectionManager::ConnectionManager(int port, std::string address) :receiverThread_(0) {
+  ConnectionManager::ConnectionManager(int port, const std::string& address) :receiverThread_(0) {
     assert(instance_==0);
     instance_=this;
@@ -228,5 +227,5 @@
         case ENET_EVENT_TYPE_NONE:
           //receiverThread_->yield();
-          usleep(1000);
+          msleep(1);
           break;
       }
@@ -331,17 +330,4 @@
 
 
-
-  bool ConnectionManager::removeShip(ClientInformation *client){
-    unsigned int id=client->getShipID();
-    orxonox::ObjectList<orxonox::SpaceShip>::iterator it;
-    for(it = orxonox::ObjectList<orxonox::SpaceShip>::begin(); it; ++it){
-      if(it->getObjectID()!=id)
-        continue;
-      delete *it;
-    }
-    return true;
-  }
-
-
   void ConnectionManager::disconnectClient(ClientInformation *client){
     {
@@ -350,5 +336,4 @@
       lock.unlock();
     }
-    removeShip(client);
   }
 
Index: code/trunk/src/network/ConnectionManager.h
===================================================================
--- code/trunk/src/network/ConnectionManager.h	(revision 1937)
+++ code/trunk/src/network/ConnectionManager.h	(revision 2087)
@@ -66,5 +66,5 @@
     const int NETWORK_DEFAULT_CHANNEL = 0;
 
-  struct ClientList{
+  struct _NetworkExport ClientList{
     ENetEvent *event;
     int ID;
@@ -72,5 +72,5 @@
   };
 
-  class ConnectionManager{
+  class _NetworkExport ConnectionManager{
     public:
     static boost::recursive_mutex enet_mutex;
@@ -79,5 +79,5 @@
     ConnectionManager(int port);
     ConnectionManager(int port, const char *address);
-    ConnectionManager(int port, std::string address);
+    ConnectionManager(int port, const std::string& address);
     ~ConnectionManager();
     //ENetPacket *getPacket(ENetAddress &address); // thread1
@@ -107,6 +107,4 @@
     int getClientID(ENetAddress address);
     ENetPeer *getClientPeer(int clientID);
-    //bool createShip(ClientInformation *client);
-    bool removeShip(ClientInformation *client);
     PacketBuffer buffer;
 
Index: code/trunk/src/network/GamestateClient.cc
===================================================================
--- code/trunk/src/network/GamestateClient.cc	(revision 1937)
+++ code/trunk/src/network/GamestateClient.cc	(revision 2087)
@@ -29,4 +29,5 @@
 #include "GamestateClient.h"
 
+#include <cassert>
 #include <zlib.h>
 
@@ -40,7 +41,7 @@
 namespace network
 {
-  struct GameStateItem{
+  struct _NetworkExport GameStateItem{
     packet::Gamestate *state;
-    int id;
+    unsigned int id;
   };
 
@@ -50,5 +51,4 @@
     last_gamestate_=GAMESTATEID_INITIAL-1;
     tempGamestate_=NULL;
-    myShip_=NULL;
   }
 
@@ -56,9 +56,9 @@
   }
 
-  bool GamestateClient::ack(int gamestateID, int clientID){
+  bool GamestateClient::ack(unsigned int gamestateID, unsigned int clientID){
     return true;
   }
 
-  bool GamestateClient::add(packet::Gamestate *gs, int clientID){
+  bool GamestateClient::add(packet::Gamestate *gs, unsigned int clientID){
     if(tempGamestate_!=NULL){
       //delete the obsolete gamestate
@@ -75,18 +75,12 @@
       return false;
     int id = GAMESTATEID_INITIAL;
-    bool b = saveShipCache();
     packet::Gamestate *processed = processGamestate(tempGamestate_);
-    if(!processed){
-      if(b)
-        loadShipCache();
-      return false;
-    }
 //    assert(processed);
+    if (!processed)
+        return false;
     //successfully loaded data from gamestate. now save gamestate for diff and delete the old gs
     tempGamestate_=NULL;
     gamestateMap_[processed->getID()]=processed;
     last_diff_ = processed->getID();
-    if(b)
-      loadShipCache();
     id = processed->getID();
     sendAck(id);
@@ -108,10 +102,13 @@
   packet::Gamestate *GamestateClient::getGamestate(){
     packet::Gamestate *gs = new packet::Gamestate();
-    gs->collectData(0);
+    if(!gs->collectData(0)){
+      delete gs;
+      return 0;
+    }
     return gs;
   }
 
   void GamestateClient::cleanup(){
-    std::map<int, packet::Gamestate*>::iterator temp, it = gamestateMap_.begin();
+    std::map<unsigned int, packet::Gamestate*>::iterator temp, it = gamestateMap_.begin();
     while(it!=gamestateMap_.end()){
       if(it->first>=last_diff_)
@@ -126,5 +123,5 @@
 
   void GamestateClient::printGamestateMap(){
-    std::map<int, packet::Gamestate*>::iterator it;
+    std::map<unsigned int, packet::Gamestate*>::iterator it;
     COUT(4) << "gamestates: ";
     for(it=gamestateMap_.begin(); it!=gamestateMap_.end(); it++){
@@ -134,5 +131,5 @@
 
   }
-  
+
   bool GamestateClient::sendAck(unsigned int gamestateID){
     packet::Acknowledgement *ack = new packet::Acknowledgement(gamestateID, 0);
@@ -142,40 +139,7 @@
     }
     else{
-      COUT(3) << "acked a gamestate: " << gamestateID << std::endl;
+      COUT(5) << "acked a gamestate: " << gamestateID << std::endl;
       return true;
     }
-  }
-
-  bool GamestateClient::saveShipCache(){
-    if(myShip_==NULL){
-      myShip_ = orxonox::SpaceShip::getLocalShip();
-//      COUT(2) << "myShip_: " << myShip_ << " getLocalShip(): " << orxonox::SpaceShip::getLocalShip() << std::endl;
-      if(!myShip_)
-	return false;
-    }
-    if(myShip_){
-      //      unsigned char *data = new unsigned char[myShip_->getSize()];
-      int size=myShip_->getSize(0, 0x1);
-      if(size==0)
-        return false;
-      shipCache_ = new unsigned char [size];
-      unsigned char *temp = shipCache_;
-      if(!myShip_->getData(temp, 0, 0x1))
-        COUT(3) << "could not save shipCache" << std::endl;
-      return true;
-    }else
-      return false;
-  }
-
-  bool GamestateClient::loadShipCache(){
-    myShip_=orxonox::SpaceShip::getLocalShip(); //TODO: remove this (only a hack)
-    if(myShip_ && shipCache_){
-      assert(myShip_->getIdentifier());
-      unsigned char *temp = shipCache_;
-      myShip_->updateData(temp, 0x2);
-      delete shipCache_;
-      return true;
-    }else
-      return false;
   }
 
@@ -196,5 +160,5 @@
       delete gs;
       gs=undiffed;
-      COUT(3) << "successfully undiffed gamestate id: " << undiffed->getID() << std::endl;
+      COUT(5) << "successfully undiffed gamestate id: " << undiffed->getID() << std::endl;
     }
     if(gs->spreadData())
Index: code/trunk/src/network/GamestateClient.h
===================================================================
--- code/trunk/src/network/GamestateClient.h	(revision 1937)
+++ code/trunk/src/network/GamestateClient.h	(revision 2087)
@@ -46,12 +46,11 @@
 #include "core/CorePrereqs.h"
 #include "packet/Gamestate.h"
-#include "objects/SpaceShip.h"
 #include "GamestateHandler.h"
 
-#define GAMESTATEID_INITIAL -1
+const unsigned int GAMESTATEID_INITIAL = (unsigned int)-1;
 
 namespace network
 {
-  class GamestateClient: public GamestateHandler
+  class _NetworkExport GamestateClient: public GamestateHandler
   {
   public:
@@ -59,6 +58,6 @@
     ~GamestateClient();
 
-    bool add(packet::Gamestate *gs, int clientID);
-    bool ack(int gamestateID, int clientID);
+    bool add(packet::Gamestate *gs, unsigned int clientID);
+    bool ack(unsigned int gamestateID, unsigned int clientID);
 
     bool processGamestates();
@@ -70,12 +69,9 @@
     void printGamestateMap();
     bool sendAck(unsigned int gamestateID);
-    bool saveShipCache();
-    bool loadShipCache();
 
-    int           last_diff_;
-    int           last_gamestate_;
-    std::map<int, packet::Gamestate *> gamestateMap_;
+    unsigned int           last_diff_;
+    unsigned int           last_gamestate_;
+    std::map<unsigned int, packet::Gamestate *> gamestateMap_;
     packet::Gamestate *tempGamestate_; // we save the received gamestates here during processQueue
-    orxonox::SpaceShip *myShip_;
     unsigned char *shipCache_;
 
Index: code/trunk/src/network/GamestateHandler.h
===================================================================
--- code/trunk/src/network/GamestateHandler.h	(revision 1937)
+++ code/trunk/src/network/GamestateHandler.h	(revision 2087)
@@ -39,8 +39,8 @@
 	@author Oliver Scheuss
 */
-class GamestateHandler{
+class _NetworkExport GamestateHandler{
   private:
-    virtual bool add(packet::Gamestate *gs, int clientID)=0;
-    virtual bool ack(int gamestateID, int clientID)=0;
+    virtual bool add(packet::Gamestate *gs, unsigned int clientID)=0;
+    virtual bool ack(unsigned int gamestateID, unsigned int clientID)=0;
 
     static GamestateHandler *instance_;
@@ -52,6 +52,6 @@
 
   public:
-    static bool addGamestate(packet::Gamestate *gs, int clientID){ return instance_->add(gs, clientID); }
-    static bool ackGamestate(int gamestateID, int clientID){ return instance_->ack(gamestateID, clientID); }
+    static bool addGamestate(packet::Gamestate *gs, unsigned int clientID){ return instance_->add(gs, clientID); }
+    static bool ackGamestate(unsigned int gamestateID, unsigned int clientID){ return instance_->ack(gamestateID, clientID); }
 };
 
Index: code/trunk/src/network/GamestateManager.cc
===================================================================
--- code/trunk/src/network/GamestateManager.cc	(revision 1937)
+++ code/trunk/src/network/GamestateManager.cc	(revision 2087)
@@ -64,8 +64,8 @@
     return getSnapshot();
   }
-  
-  bool GamestateManager::add(packet::Gamestate *gs, int clientID){
+
+  bool GamestateManager::add(packet::Gamestate *gs, unsigned int clientID){
     assert(gs);
-    std::map<int, packet::Gamestate*>::iterator it = gamestateQueue.find(clientID);
+    std::map<unsigned int, packet::Gamestate*>::iterator it = gamestateQueue.find(clientID);
     if(it!=gamestateQueue.end()){
       // delete obsolete gamestate
@@ -75,10 +75,11 @@
     return true;
   }
-  
+
   bool GamestateManager::processGamestates(){
-    std::map<int, packet::Gamestate*>::iterator it;
+    std::map<unsigned int, packet::Gamestate*>::iterator it;
     // now push only the most recent gamestates we received (ignore obsolete ones)
     for(it = gamestateQueue.begin(); it!=gamestateQueue.end(); it++){
-      assert(processGamestate(it->second));
+      bool b = processGamestate(it->second);
+      assert(b);
       delete it->second;
     }
@@ -87,20 +88,20 @@
     return true;
   }
-  
-  
+
+
   bool GamestateManager::getSnapshot(){
     reference = new packet::Gamestate();
-    reference->collectData(++id_);
-    //COUT(4) << "inserting gamestate: " << reference << std::endl;
-    //gamestateMap_.insert(std::pair<int, packet::Gamestate*>(id_, reference));
-//     gamestateUsed[id_]=0;
-    return true;
-  }
-  
+    if(!reference->collectData(++id_)){ //we have no data to send
+      delete reference;
+      reference=0;
+    }
+    return true;
+  }
+
   /**
    * this function is used to keep the memory usage low
    * it tries to delete all the unused gamestates
-   * 
-   * 
+   *
+   *
    */
 /*  void GamestateManager::cleanup(){
@@ -126,9 +127,11 @@
   }*/
 
-  packet::Gamestate *GamestateManager::popGameState(int clientID) {
+  packet::Gamestate *GamestateManager::popGameState(unsigned int clientID) {
     //why are we searching the same client's gamestate id as we searched in
     //Server::sendGameState?
     packet::Gamestate *gs;
-    int gID = ClientInformation::findClient(clientID)->getGamestateID();
+    unsigned int gID = ClientInformation::findClient(clientID)->getGamestateID();
+    if(!reference)
+      return 0;
     gs = reference->doSelection(clientID);
 //     gs = new packet::Gamestate(*reference);
@@ -139,7 +142,7 @@
     packet::Gamestate *client=NULL;
     if(gID != GAMESTATEID_INITIAL){
-      std::map<unsigned int, std::map<int, packet::Gamestate*> >::iterator clientMap = gamestateMap_.find(clientID);
+      std::map<unsigned int, std::map<unsigned int, packet::Gamestate*> >::iterator clientMap = gamestateMap_.find(clientID);
       if(clientMap!=gamestateMap_.end()){
-        std::map<int, packet::Gamestate*>::iterator it = clientMap->second.find(gID);
+        std::map<unsigned int, packet::Gamestate*>::iterator it = clientMap->second.find(gID);
         if(it!=clientMap->second.end())
           client = it->second;
@@ -158,19 +161,19 @@
     return gs;
   }
-  
-  
-  bool GamestateManager::ack(int gamestateID, int clientID) {
+
+
+  bool GamestateManager::ack(unsigned int gamestateID, unsigned int clientID) {
     ClientInformation *temp = ClientInformation::findClient(clientID);
     assert(temp);
-    int curid = temp->getGamestateID();
-    
+    unsigned int curid = temp->getGamestateID();
+
     if(gamestateID == 0){
       temp->setGamestateID(GAMESTATEID_INITIAL);
       return true;
     }
-    
-    assert(curid<gamestateID);
+
+    assert(curid==(unsigned int)GAMESTATEID_INITIAL || curid<gamestateID);
     COUT(4) << "acking gamestate " << gamestateID << " for clientid: " << clientID << " curid: " << curid << std::endl;
-    std::map<int, packet::Gamestate*>::iterator it, tempit;
+    std::map<unsigned int, packet::Gamestate*>::iterator it, tempit;
     for(it = gamestateMap_[clientID].begin(); it!=gamestateMap_[clientID].end() && it->first<gamestateID; it++){
       delete it->second;
@@ -184,7 +187,7 @@
   void GamestateManager::removeClient(ClientInformation* client){
     assert(client);
-    std::map<unsigned int, std::map<int, packet::Gamestate*> >::iterator clientMap = gamestateMap_.find(client->getID());
+    std::map<unsigned int, std::map<unsigned int, packet::Gamestate*> >::iterator clientMap = gamestateMap_.find(client->getID());
     // first delete all remained gamestates
-    std::map<int, packet::Gamestate*>::iterator it;
+    std::map<unsigned int, packet::Gamestate*>::iterator it;
     for(it=clientMap->second.begin(); it!=clientMap->second.end(); it++)
       delete it->second;
@@ -192,5 +195,5 @@
     gamestateMap_.erase(clientMap);
   }
-  
+
   bool GamestateManager::processGamestate(packet::Gamestate *gs){
     if(gs->isCompressed())
Index: code/trunk/src/network/GamestateManager.h
===================================================================
--- code/trunk/src/network/GamestateManager.h	(revision 1937)
+++ code/trunk/src/network/GamestateManager.h	(revision 2087)
@@ -66,17 +66,17 @@
   * @author Oliver Scheuss
   */
-  class GamestateManager: public GamestateHandler{
+  class _NetworkExport GamestateManager: public GamestateHandler{
   public:
     GamestateManager();
     ~GamestateManager();
 
-    bool add(packet::Gamestate *gs, int clientID);
+    bool add(packet::Gamestate *gs, unsigned int clientID);
     bool processGamestates();
     bool update();
-    packet::Gamestate *popGameState(int clientID);
+    packet::Gamestate *popGameState(unsigned int clientID);
 
     bool getSnapshot();
 
-    bool ack(int gamestateID, int clientID);
+    bool ack(unsigned int gamestateID, unsigned int clientID);
     void removeClient(ClientInformation *client);
     private:
@@ -84,10 +84,10 @@
     bool processGamestate(packet::Gamestate *gs);
 
-    std::map<unsigned int, std::map<int, packet::Gamestate*> > gamestateMap_;
+    std::map<unsigned int, std::map<unsigned int, packet::Gamestate*> > gamestateMap_;
     //std::map<int, packet::Gamestate*> gamestateMap; //map gsID to gamestate*
     //std::map<int, int> gamestateUsed; // save the number of clients, that use the specific gamestate
-    std::map<int, packet::Gamestate*> gamestateQueue;
+    std::map<unsigned int, packet::Gamestate*> gamestateQueue;
     packet::Gamestate *reference;
-    int id_;
+    unsigned int id_;
   };
 
Index: code/trunk/src/network/Host.cc
===================================================================
--- code/trunk/src/network/Host.cc	(revision 1937)
+++ code/trunk/src/network/Host.cc	(revision 2087)
@@ -32,4 +32,5 @@
 #include "core/ConsoleCommand.h"
 #include "packet/Packet.h"
+#include "ChatListener.h"
 
 namespace network {
@@ -38,5 +39,5 @@
 
 Host *Host::instance_=0;
-  
+
 /**
  * @brief Constructor: assures that only one reference will be created and sets the pointer
@@ -90,5 +91,5 @@
  * @return playerID
  */
-unsigned int Host::getPlayerID(){ 
+unsigned int Host::getPlayerID(){
   if(!instance_)
     return 0;
@@ -96,5 +97,5 @@
 }
 
-bool Host::Chat(std::string message){
+bool Host::Chat(const std::string& message){
   if(!instance_)
     return false;
@@ -102,5 +103,14 @@
 }
 
-bool Host::incomingChat(std::string message, unsigned int playerID){
+bool Host::Broadcast(const std::string& message){
+  if(!instance_)
+    return false;
+  return instance_->broadcast(message);
+}
+
+bool Host::incomingChat(const std::string& message, unsigned int playerID){
+  for (orxonox::ObjectList<ChatListener>::iterator it = orxonox::ObjectList<ChatListener>::begin(); it != orxonox::ObjectList<ChatListener>::end(); ++it)
+    it->incomingChat(message, playerID);
+
   return instance_->processChat(message, playerID);
 }
Index: code/trunk/src/network/Host.h
===================================================================
--- code/trunk/src/network/Host.h	(revision 1937)
+++ code/trunk/src/network/Host.h	(revision 2087)
@@ -44,5 +44,5 @@
 *	@author Oliver Scheuss
 */
-class Host{
+class _NetworkExport Host{
   private:
     //TODO add theese functions or adequate
@@ -50,6 +50,7 @@
     //virtual bool sendChat(packet::Chat *chat)=0;
     virtual bool queuePacket(ENetPacket *packet, int clientID)=0;
-    virtual bool chat(std::string message)=0;
-    virtual bool processChat(std::string message, unsigned int playerID)=0;
+    virtual bool chat(const std::string& message)=0;
+    virtual bool broadcast(const std::string& message)=0;
+    virtual bool processChat(const std::string& message, unsigned int playerID)=0;
     virtual bool isServer_()=0;
 
@@ -72,7 +73,8 @@
     static void setClientID(unsigned int id){ instance_->clientID_ = id; }
     static void setShipID(unsigned int id){ instance_->shipID_ = id; }
-    static bool isServer(){ return instance_->isServer_(); }		
-    static bool Chat(std::string message);
-    static bool incomingChat(std::string message, unsigned int playerID);
+    static bool isServer(){ return instance_->isServer_(); }
+    static bool Chat(const std::string& message);
+    static bool Broadcast(const std::string& message);
+    static bool incomingChat(const std::string& message, unsigned int playerID);
   private:
 };
Index: code/trunk/src/network/NetworkCallback.h
===================================================================
--- code/trunk/src/network/NetworkCallback.h	(revision 1937)
+++ code/trunk/src/network/NetworkCallback.h	(revision 2087)
@@ -2,6 +2,8 @@
 #define _NETWORK_CALLBACK__
 
+#include "NetworkPrereqs.h"
+
 namespace network{
-  class NetworkCallbackBase
+  class _NetworkExport NetworkCallbackBase
   {
     public:
@@ -9,5 +11,5 @@
 	  virtual ~NetworkCallbackBase() {}
   };
-  
+
   template <class T>
   class NetworkCallback: public NetworkCallbackBase
@@ -18,9 +20,9 @@
       virtual void call()
         { (this->object_->*function_)(); }
-  
+
     private:
       T* object_;
       void (T::*function_) (void);
-  }; 
+  };
 
 
Index: code/trunk/src/network/NetworkPrereqs.h
===================================================================
--- code/trunk/src/network/NetworkPrereqs.h	(revision 1937)
+++ code/trunk/src/network/NetworkPrereqs.h	(revision 2087)
@@ -63,4 +63,5 @@
   class Client;
   class ClientConnection;
+  class ClientConnectionListener;
   class ClientFrameListener;
   class ClientInformation;
Index: code/trunk/src/network/PacketBuffer.h
===================================================================
--- code/trunk/src/network/PacketBuffer.h	(revision 1937)
+++ code/trunk/src/network/PacketBuffer.h	(revision 2087)
@@ -49,10 +49,10 @@
 namespace network
 {
-  struct PacketEnvelope{
+  struct _NetworkExport PacketEnvelope{
     int length;
     int data;
   };
 
-  struct QueueItem{
+  struct _NetworkExport QueueItem{
     ENetEvent *event;
     //ENetAddress address;
@@ -60,5 +60,5 @@
   };
 
-  class PacketBuffer{
+  class _NetworkExport PacketBuffer{
   public:
     PacketBuffer();
Index: code/trunk/src/network/Server.cc
===================================================================
--- code/trunk/src/network/Server.cc	(revision 1937)
+++ code/trunk/src/network/Server.cc	(revision 2087)
@@ -46,8 +46,8 @@
 
 #include "ConnectionManager.h"
+#include "ClientConnectionListener.h"
 #include "GamestateManager.h"
 #include "ClientInformation.h"
 #include "util/Sleep.h"
-#include "objects/SpaceShip.h"
 #include "core/ConsoleCommand.h"
 #include "core/CoreIncludes.h"
@@ -58,9 +58,11 @@
 #include "packet/DeleteObjects.h"
 #include <util/Convert.h>
+#include "ChatListener.h"
 
 namespace network
 {
-  const int MAX_FAILURES = 20;
-  const int NETWORK_FREQUENCY = 30;
+  const unsigned int MAX_FAILURES = 20;
+  const unsigned int NETWORK_FREQUENCY = 25;
+  const float NETWORK_PERIOD = (float)1/NETWORK_FREQUENCY;
 
   /**
@@ -85,5 +87,5 @@
   * @param bindAddress Address to listen on
   */
-  Server::Server(int port, std::string bindAddress) {
+  Server::Server(int port, const std::string& bindAddress) {
     timeSinceLastUpdate_=0;
     connection = new ConnectionManager(port, bindAddress);
@@ -101,5 +103,5 @@
     gamestates_ = new GamestateManager();
   }
-  
+
   /**
   * @brief Destructor
@@ -128,5 +130,5 @@
   }
 
-  bool Server::processChat(std::string message, unsigned int playerID){
+  bool Server::processChat(const std::string& message, unsigned int playerID){
     ClientInformation *temp = ClientInformation::getBegin();
     packet::Chat *chat;
@@ -138,5 +140,5 @@
       temp = temp->next();
     }
-    COUT(1) << "Player " << playerID << ": " << message << std::endl;
+//    COUT(1) << "Player " << playerID << ": " << message << std::endl;
     return true;
   }
@@ -152,6 +154,6 @@
     //this steers our network frequency
     timeSinceLastUpdate_+=time;
-    if(timeSinceLastUpdate_>=(1./NETWORK_FREQUENCY)){
-      timeSinceLastUpdate_=(float)((int)(timeSinceLastUpdate_*NETWORK_FREQUENCY))/timeSinceLastUpdate_;
+    if(timeSinceLastUpdate_>=NETWORK_PERIOD){
+      timeSinceLastUpdate_ -= static_cast<unsigned int>( timeSinceLastUpdate_ / NETWORK_PERIOD ) * NETWORK_PERIOD;
       gamestates_->processGamestates();
       updateGamestate();
@@ -162,5 +164,21 @@
     return connection->addPacket(packet, clientID);
   }
-
+  
+  /**
+   * @brief: returns ping time to client in milliseconds 
+   */
+  unsigned int Server::getPing(unsigned int clientID){
+    assert(ClientInformation::findClient(clientID));
+    return ClientInformation::findClient(clientID)->getRTT();
+  }
+
+  /**
+   * @brief: return packet loss ratio to client (scales from 0 to 1)
+   */
+  double Server::getPacketLoss(unsigned int clientID){
+    assert(ClientInformation::findClient(clientID));
+    return ClientInformation::findClient(clientID)->getPacketLoss();
+  }
+  
   /**
   * processes all the packets waiting in the queue
@@ -239,4 +257,5 @@
       if(gs==NULL){
         COUT(2) << "Server: could not generate gamestate (NULL from compress)" << std::endl;
+        temp = temp->next();
         continue;
       }
@@ -281,4 +300,7 @@
 
   bool Server::addClient(ENetEvent *event){
+    static unsigned int newid=1;
+
+    COUT(2) << "Server: adding client" << std::endl;
     ClientInformation *temp = ClientInformation::insertBack(new ClientInformation);
     if(!temp){
@@ -286,13 +308,24 @@
       return false;
     }
-    if(temp==ClientInformation::getBegin()) { //not good if you use anything else than insertBack
-      temp->setID(1);
+    /*if(temp==ClientInformation::getBegin()) { //not good if you use anything else than insertBack
+      newid=1;
     }
     else
-      temp->setID(temp->prev()->getID()+1);
+      newid=temp->prev()->getID()+1;*/
+    temp->setID(newid);
     temp->setPeer(event->peer);
+
+    // inform all the listeners
+    orxonox::ObjectList<ClientConnectionListener>::iterator listener = orxonox::ObjectList<ClientConnectionListener>::begin();
+    while(listener){
+      listener->clientConnected(newid);
+      listener++;
+    }
+
+    newid++;
+
     COUT(3) << "Server: added client id: " << temp->getID() << std::endl;
     return createClient(temp->getID());
-  }
+}
 
   bool Server::createClient(int clientID){
@@ -304,10 +337,4 @@
     COUT(4) << "Con.Man: creating client id: " << temp->getID() << std::endl;
     connection->syncClassid(temp->getID());
-    COUT(5) << "creating spaceship for clientid: " << temp->getID() << std::endl;
-    // TODO: this is only a hack, untill we have a possibility to define default player-join actions
-    if(!createShip(temp))
-      COUT(2) << "Con.Man. could not create ship for clientid: " << clientID << std::endl;
-    else
-      COUT(3) << "created spaceship" << std::endl;
     temp->setSynched(true);
     COUT(3) << "sending welcome" << std::endl;
@@ -319,5 +346,6 @@
     g->setClientID(temp->getID());
     b = g->collectData(0);
-    assert(b);
+    if(!b)
+      return false; //no data for the client
     b = g->compressData();
     assert(b);
@@ -327,32 +355,4 @@
   }
 
-  bool Server::createShip(ClientInformation *client){
-    if(!client)
-      return false;
-    orxonox::Identifier* id = ClassByName("SpaceShip");
-    if(!id){
-      COUT(4) << "We could not create the SpaceShip for client: " << client->getID() << std::endl;
-      return false;
-    }
-    orxonox::SpaceShip *no = dynamic_cast<orxonox::SpaceShip *>(id->fabricate());
-    no->classID = id->getNetworkID();
-    client->setShipID(no->getObjectID());
-    no->setPosition(orxonox::Vector3(0,0,80));
-    no->setScale(10);
-    //no->setYawPitchRoll(orxonox::Degree(-90),orxonox::Degree(-90),orxonox::Degree(0));
-    no->setMesh("assff.mesh");
-    no->setMaxSpeed(500);
-    no->setMaxSideAndBackSpeed(50);
-    no->setMaxRotation(1.0);
-    no->setTransAcc(200);
-    no->setRotAcc(3.0);
-    no->setTransDamp(75);
-    no->setRotDamp(1.0);
-    no->setCamera(std::string("cam_") + convertToString(client->getID()));
-    no->create();
-
-    return true;
-  }
-
   bool Server::disconnectClient(ENetEvent *event){
     COUT(4) << "removing client from list" << std::endl;
@@ -360,20 +360,17 @@
 
     //boost::recursive_mutex::scoped_lock lock(head_->mutex_);
-    orxonox::ObjectList<orxonox::SpaceShip>::iterator it = orxonox::ObjectList<orxonox::SpaceShip>::begin();
     ClientInformation *client = ClientInformation::findClient(&event->peer->address);
     if(!client)
       return false;
     gamestates_->removeClient(client);
-    while(it){
-      if(it->getObjectID()!=client->getShipID()){
-        ++it;
-        continue;
-      }
-      orxonox::ObjectList<orxonox::SpaceShip>::iterator temp=it;
-      ++it;
-      delete  *temp;
-      return ClientInformation::removeClient(event->peer);
-    }
-    return false;
+
+// inform all the listeners
+    orxonox::ObjectList<ClientConnectionListener>::iterator listener = orxonox::ObjectList<ClientConnectionListener>::begin();
+    while(listener){
+      listener->clientDisconnected(client->getID());
+      listener++;
+    }
+
+    return ClientInformation::removeClient(event->peer);
   }
 
@@ -387,10 +384,18 @@
     gamestates_->removeClient(client);
   }
-  
-  bool Server::chat(std::string message){
+
+  bool Server::chat(const std::string& message){
+      return this->sendChat(message, Host::getPlayerID());
+  }
+
+  bool Server::broadcast(const std::string& message){
+      return this->sendChat(message, CLIENTID_UNKNOWN);
+  }
+
+  bool Server::sendChat(const std::string& message, unsigned int clientID){
     ClientInformation *temp = ClientInformation::getBegin();
     packet::Chat *chat;
     while(temp){
-      chat = new packet::Chat(message, Host::getPlayerID());
+      chat = new packet::Chat(message, clientID);
       chat->setClientID(temp->getID());
       if(!chat->send())
@@ -398,5 +403,8 @@
       temp = temp->next();
     }
-    COUT(1) << "Player " << Host::getPlayerID() << ": " << message << std::endl;
+//    COUT(1) << "Player " << Host::getPlayerID() << ": " << message << std::endl;
+    for (orxonox::ObjectList<ChatListener>::iterator it = orxonox::ObjectList<ChatListener>::begin(); it != orxonox::ObjectList<ChatListener>::end(); ++it)
+      it->incomingChat(message, clientID);
+
     return true;
   }
Index: code/trunk/src/network/Server.h
===================================================================
--- code/trunk/src/network/Server.h	(revision 1937)
+++ code/trunk/src/network/Server.h	(revision 2087)
@@ -52,5 +52,5 @@
 {
   const int CLIENTID_SERVER = 0;
-  
+
   /**
   * This class is the root class of the network module for a server.
@@ -61,13 +61,15 @@
     Server();
     Server(int port);
-    Server(int port, std::string bindAddress);
+    Server(int port, const std::string& bindAddress);
     Server(int port, const char *bindAddress);
     ~Server();
-    
+
     void open();
     void close();
-    bool processChat(std::string message, unsigned int playerID);
+    bool processChat(const std::string& message, unsigned int playerID);
     bool queuePacket(ENetPacket *packet, int clientID);
     void tick(float time);
+    unsigned int getPing(unsigned int clientID);
+    double getPacketLoss(unsigned int clientID);
   protected:
     void processQueue();
@@ -77,8 +79,7 @@
     unsigned int shipID(){return 0;}
     unsigned int playerID(){return 0;}
-    
+
     bool addClient(ENetEvent *event);
     bool createClient(int clientID);
-    bool createShip(ClientInformation *client);
     bool disconnectClient(ENetEvent *event);
     void disconnectClient(int clientID);
@@ -87,11 +88,13 @@
     bool sendGameState();
     bool sendObjectDeletes();
-    virtual bool chat(std::string message);
-    
+    virtual bool chat(const std::string& message);
+    virtual bool broadcast(const std::string& message);
+    bool sendChat(const std::string& message, unsigned int clientID);
+
     //void processChat( chat *data, int clientId);
     ConnectionManager *connection;
     GamestateManager *gamestates_;
 
-    
+
     float timeSinceLastUpdate_;
   };
Index: code/trunk/src/network/Synchronisable.cc
===================================================================
--- code/trunk/src/network/Synchronisable.cc	(revision 1937)
+++ code/trunk/src/network/Synchronisable.cc	(revision 2087)
@@ -42,4 +42,5 @@
 
 #include <cstring>
+#include <string>
 #include <iostream>
 #include <assert.h>
@@ -51,5 +52,5 @@
 namespace network
 {
-  
+
 
   std::map<unsigned int, Synchronisable *> Synchronisable::objectMap_;
@@ -62,5 +63,5 @@
   * Initializes all Variables and sets the right objectID
   */
-  Synchronisable::Synchronisable(){
+  Synchronisable::Synchronisable(orxonox::BaseObject* creator){
     RegisterRootObject(Synchronisable);
     static uint32_t idCounter=0;
@@ -68,9 +69,27 @@
     objectMode_=0x1; // by default do not send data to server
     objectID=idCounter++;
+    classID = (unsigned int)-1;
     syncList = new std::list<synchronisableVariable *>;
-  }
-
-  /**
-   * Destructor: 
+
+    this->creatorID = OBJECTID_UNKNOWN;
+
+    searchcreatorID:
+    if (creator)
+    {
+        Synchronisable* synchronisable_creator = dynamic_cast<Synchronisable*>(creator);
+        if (synchronisable_creator && synchronisable_creator->objectMode_)
+        {
+            this->creatorID = synchronisable_creator->getObjectID();
+        }
+        else if (creator != creator->getCreator())
+        {
+            creator = creator->getCreator();
+            goto searchcreatorID;
+        }
+    }
+  }
+
+  /**
+   * Destructor:
    * Delete all callback objects and remove objectID from the objectMap_
    */
@@ -80,5 +99,6 @@
       for(std::list<synchronisableVariable *>::iterator it = syncList->begin(); it!=syncList->end(); it++)
         delete (*it)->callback;
-      deletedObjects_.push(objectID);
+      if (this->objectMode_ != 0x0)
+        deletedObjects_.push(objectID);
 //       COUT(3) << "destruct synchronisable +++" << objectID << " | " << classID << std::endl;
 //       COUT(3) << " bump ---" << objectID << " | " << &objectMap_ << std::endl;
@@ -96,5 +116,5 @@
     this->classID = this->getIdentifier()->getNetworkID();
 //     COUT(4) << "creating synchronisable: setting classid from " << this->getIdentifier()->getName() << " to: " << classID << std::endl;
-    
+
 //     COUT(3) << "construct synchronisable +++" << objectID << " | " << classID << std::endl;
 //     objectMap_[objectID]=this;
@@ -127,23 +147,46 @@
     synchronisableHeader *header = (synchronisableHeader *)mem;
 
-    COUT(3) << "fabricating object with id: " << header->objectID << std::endl;
+    if(!header->dataAvailable)
+    {
+      mem += header->size;
+      return 0;
+    }
+    
+    COUT(4) << "fabricating object with id: " << header->objectID << std::endl;
 
     orxonox::Identifier* id = ClassByID(header->classID);
     assert(id);
-    orxonox::BaseObject *bo = id->fabricate();
+    orxonox::BaseObject* creator = 0;
+    if (header->creatorID != OBJECTID_UNKNOWN)
+    {
+      Synchronisable* synchronisable_creator = Synchronisable::getSynchronisable(header->creatorID);
+      if (!synchronisable_creator)
+      {
+        mem += header->size; //.TODO: this suckz.... remove size from header
+        return 0;
+      }
+      else
+        creator = dynamic_cast<orxonox::BaseObject*>(synchronisable_creator);
+    }
+    orxonox::BaseObject *bo = id->fabricate(creator);
+    assert(bo);
     Synchronisable *no = dynamic_cast<Synchronisable *>(bo);
     assert(no);
     no->objectID=header->objectID;
+    no->creatorID=header->creatorID; //TODO: remove this
     no->classID=header->classID;
-    COUT(3) << "fabricate objectID: " << no->objectID << " classID: " << no->classID << std::endl;
+    COUT(4) << "fabricate objectID: " << no->objectID << " classID: " << no->classID << std::endl;
           // update data and create object/entity...
-    bool b = no->updateData(mem, mode);
+    bool b = no->updateData(mem, mode, true);
     assert(b);
-    b = no->create();
-    assert(b);
+    if (b)
+    {
+        b = no->create();
+        assert(b);
+    }
     return no;
   }
 
-  
+
   /**
    * Finds and deletes the Synchronisable with the appropriate objectID
@@ -164,5 +207,5 @@
     return true;
   }
-  
+
   /**
    * This function looks up the objectID in the objectMap_ and returns a pointer to the right Synchronisable
@@ -185,5 +228,5 @@
   }
 
-  
+
   /**
   * This function is used to register a variable to be synchronized
@@ -196,4 +239,5 @@
   */
   void Synchronisable::registerVar(void *var, int size, variableType t, int mode, NetworkCallbackBase *cb){
+    assert( mode==direction::toclient || mode==direction::toserver || mode==direction::serverMaster || mode==direction::clientMaster);
     // create temporary synch.Var struct
     synchronisableVariable *temp = new synchronisableVariable;
@@ -203,4 +247,10 @@
     temp->type = t;
     temp->callback = cb;
+    if( ( mode & direction::bidirectional ) )
+    {
+      temp->varBuffer = new uint8_t[size];
+      memcpy(temp->varBuffer, temp->var, size); //now fill the buffer for the first time
+      temp->varReference = 0;
+    }
     COUT(5) << "Syncronisable::registering var with size: " << temp->size << " and type: " << temp->type << std::endl;
     //std::cout << "push temp to syncList (at the bottom) " << datasize << std::endl;
@@ -228,9 +278,9 @@
    *             0x2: client->server (not recommended)
    *             0x3: bidirectional
-   * @return true: if !isMyTick or if everything was successfully saved
+   * @return true: if !doSync or if everything was successfully saved
    */
   bool Synchronisable::getData(uint8_t*& mem, unsigned int id, int mode){
     //if this tick is we dont synchronise, then abort now
-    if(!isMyTick(id))
+    if(!doSync(id))
       return true;
     //std::cout << "inside getData" << std::endl;
@@ -240,4 +290,8 @@
     if(classID==0)
       COUT(3) << "classid 0 " << this->getIdentifier()->getName() << std::endl;
+
+    if (this->classID == (unsigned int)-1)
+        this->classID = this->getIdentifier()->getNetworkID();
+
     assert(this->classID==this->getIdentifier()->getNetworkID());
 //     this->classID=this->getIdentifier()->getNetworkID(); // TODO: correct this
@@ -250,4 +304,5 @@
     header->size = size;
     header->objectID = this->objectID;
+    header->creatorID = this->creatorID;
     header->classID = this->classID;
     header->dataAvailable = true;
@@ -263,4 +318,11 @@
         COUT(5) << "not getting data: " << std::endl;
         continue;  // this variable should only be received
+      }
+      // if the variable gets synchronised bidirectional, then add the reference to the bytestream
+      if( ( (*i)->mode & direction::bidirectional ) == direction::bidirectional )
+      {
+        *(uint8_t*)mem = (*i)->varReference;
+        mem += sizeof( (*i)->varReference );
+        tempsize += sizeof( (*i)->varReference );
       }
       switch((*i)->type){
@@ -271,11 +333,11 @@
           break;
         case STRING:
-          memcpy( (void *)(mem), (void *)&((*i)->size), sizeof(int) );
-          mem+=sizeof(int);
+          memcpy( (void *)(mem), (void *)&((*i)->size), sizeof(size_t) );
+          mem+=sizeof(size_t);
           const char *data = ( ( *(std::string *) (*i)->var).c_str());
           memcpy( mem, (void*)data, (*i)->size);
           COUT(5) << "synchronisable: char: " << (const char *)(mem) << " data: " << data << " string: " << *(std::string *)((*i)->var) << std::endl;
           mem+=(*i)->size;
-          tempsize+=(*i)->size + 4;
+          tempsize+=(*i)->size + sizeof(size_t);
           break;
       }
@@ -292,5 +354,5 @@
    * @return true/false
    */
-  bool Synchronisable::updateData(uint8_t*& mem, int mode){
+  bool Synchronisable::updateData(uint8_t*& mem, int mode, bool forceCallback){
     if(mode==0x0)
       mode=state_;
@@ -305,4 +367,5 @@
     synchronisableHeader *syncHeader = (synchronisableHeader *)mem;
     assert(syncHeader->objectID==this->objectID);
+//    assert(syncHeader->creatorID==this->creatorID);
     if(syncHeader->dataAvailable==false){
       mem+=syncHeader->size;
@@ -314,5 +377,5 @@
     assert(this->objectID==syncHeader->objectID);
 //    assert(this->classID==syncHeader->classID); //TODO: fix this!!! maybe a problem with the identifier ?
-    
+
     COUT(5) << "Synchronisable: objectID " << syncHeader->objectID << ", classID " << syncHeader->classID << " size: " << syncHeader->size << " synchronising data" << std::endl;
     for(i=syncList->begin(); i!=syncList->end() && mem <= data+syncHeader->size; i++){
@@ -325,4 +388,22 @@
       switch((*i)->type){
         case DATA:
+          if( ( (*i)->mode & direction::bidirectional ) == direction::bidirectional )
+          {
+            if( ( mode == 0x1 && (*i)->mode == direction::serverMaster ) || \
+                  ( mode == 0x2 && (*i)->mode == direction::clientMaster ) )    // if true we are master on this variable
+            {
+              uint8_t refNr = *(uint8_t *)mem;
+              if( refNr != (*i)->varReference )
+              {
+                mem += sizeof((*i)->varReference) + (*i)->size; // the reference for this variable is not recent, discard data
+                break;
+              }
+            }
+            else //we are slave for this variable
+            {
+              (*i)->varReference = *(uint8_t *)mem; //copy the reference value for this variable
+            }
+            mem += sizeof((*i)->varReference);
+          }
           if((*i)->callback) // check whether this variable changed (but only if callback was set)
             if(strncmp((char *)(*i)->var, (char *)mem, (*i)->size)!=0)
@@ -332,7 +413,25 @@
           break;
         case STRING:
-          (*i)->size = *(uint32_t *)mem;
+          if( ( (*i)->mode & direction::bidirectional ) == direction::bidirectional )
+          {
+            if( ( mode == 0x1 && (*i)->mode == direction::serverMaster ) || \
+                  ( mode == 0x2 && (*i)->mode == direction::clientMaster ) )    // if true we are master for this variable
+            {
+              uint8_t refNr = *(uint8_t *)mem;
+              mem += sizeof( (*i)->varReference );
+              if( refNr != (*i)->varReference ){
+                mem += sizeof(size_t) + *(size_t *)mem; // the reference for this variable is not recent, discard data
+                break;
+              }
+            }
+            else //we are slave for this variable
+            {
+              (*i)->varReference = *(uint8_t *)mem; //copy the reference value for this variable
+            }
+            mem += sizeof( (*i)->varReference );
+          }
+          (*i)->size = *(size_t *)mem;
           COUT(5) << "string size: " << (*i)->size << std::endl;
-          mem+=sizeof(int);
+          mem += sizeof(size_t);
           if((*i)->callback) // check whether this string changed
             if( *(std::string *)((*i)->var) != std::string((char *)mem) )
@@ -344,5 +443,5 @@
       }
       // call the callback function, if defined
-      if(callback && (*i)->callback)
+      if((callback || forceCallback) && (*i)->callback)
         (*i)->callback->call();
     }
@@ -357,5 +456,5 @@
   */
   uint32_t Synchronisable::getSize(unsigned int id, int mode){
-    if(!isMyTick(id))
+    if(!doSync(id))
       return 0;
     int tsize=sizeof(synchronisableHeader);
@@ -377,4 +476,8 @@
         break;
       }
+      if( ( (*i)->mode & direction::bidirectional ) == direction::bidirectional )
+      {
+        tsize+=sizeof( (*i)->varReference );
+      }
     }
     return tsize;
@@ -386,6 +489,6 @@
    * @return true/false
    */
-  bool Synchronisable::isMyTick(unsigned int id){
-    return ( (objectMode_&state_)!=0 );
+  bool Synchronisable::doSync(unsigned int id){
+    return ( (objectMode_&state_)!=0 && (!syncList->empty() ) );
   }
 
@@ -413,5 +516,5 @@
    */
   void Synchronisable::setObjectMode(int mode){
-    assert(mode==0x1 || mode==0x2 || mode==0x3);
+    assert(mode==0x0 || mode==0x1 || mode==0x2 || mode==0x3);
     objectMode_=mode;
   }
Index: code/trunk/src/network/Synchronisable.h
===================================================================
--- code/trunk/src/network/Synchronisable.h	(revision 1937)
+++ code/trunk/src/network/Synchronisable.h	(revision 2087)
@@ -41,24 +41,23 @@
 #include "util/Integers.h"
 
-#define REGISTERDATA(varname) registerVar(&varname, sizeof(varname), network::DATA)
-#define REGISTERDATA_WITHDIR(varname, mode) registerVar(&varname, sizeof(varname), network::DATA, mode)
-#define REGISTERSTRING(stringname) registerVar(&stringname, stringname.length()+1, network::STRING)
-#define REGISTERSTRING_WITHDIR(stringname, mode) registerVar(&stringname, stringname.length()+1, network::STRING, mode)
-
-//TODO: this is only a very ugly hack ...
-namespace orxonox{
-class SpaceShip;
-}
+#define REGISTERDATA(varname, ...) \
+    registerVar((void*)&varname, sizeof(varname), network::DATA, __VA_ARGS__)
+#define REGISTERSTRING(stringname, ...) \
+    registerVar(&stringname, stringname.length()+1, network::STRING, __VA_ARGS__)
 
 namespace network
 {
+  static const unsigned int OBJECTID_UNKNOWN = (unsigned int)-1;
+
   namespace direction{
     enum syncdirection{
       toclient=0x1,
       toserver=0x2,
-      bidirectional=0x3
+      bidirectional=0x3,
+      serverMaster=0x3,
+      clientMaster=0x7
     };
   }
-  
+
   namespace syncmode{
     enum mode{
@@ -67,5 +66,5 @@
     };
   }
-  
+
   enum variableType{
     DATA,
@@ -73,12 +72,13 @@
   };
 
-  struct synchronisableHeader{
+  struct _NetworkExport synchronisableHeader{
     uint32_t size:31;
     bool dataAvailable:1;
     uint32_t objectID;
+    uint32_t creatorID;
     uint32_t classID;
   };
 
-  typedef struct synchronisableVariable{
+  struct _NetworkExport synchronisableVariable{
     unsigned int size;
     int mode; // this determines in which direction the variable gets synchronised
@@ -86,5 +86,7 @@
     variableType type;
     NetworkCallbackBase *callback;
-  }SYNCVAR;
+    void *varBuffer;
+    uint8_t varReference;
+  };
 
   /**
@@ -98,11 +100,10 @@
     friend class GamestateClient;
     friend class Server;
-    friend class orxonox::SpaceShip;
     virtual ~Synchronisable();
 
-    
+
     virtual bool create();
     static void setClient(bool b);
-    
+
     static Synchronisable *fabricate(uint8_t*& mem, int mode=0x0);
     static bool deleteObject(unsigned int objectID);
@@ -110,26 +111,26 @@
     static unsigned int getNumberOfDeletedObject(){ return deletedObjects_.size(); }
     static unsigned int popDeletedObject(){ unsigned int i = deletedObjects_.front(); deletedObjects_.pop(); return i; }
-    
+
     inline unsigned int getObjectID(){return objectID;}
     inline unsigned int getClassID(){return classID;}
   protected:
-    Synchronisable();
+    Synchronisable(orxonox::BaseObject* creator);
     void registerVar(void *var, int size, variableType t, int mode=1, NetworkCallbackBase *cb=0);
     void setObjectMode(int mode);
     void setObjectFrequency(unsigned int freq){ objectFrequency_ = freq; }
-    virtual void registerAllVariables()=0;
-    
-    
+
+
   private:
     bool getData(uint8_t*& men, unsigned int id, int mode=0x0);
     uint32_t getSize(unsigned int id, int mode=0x0);
-    bool updateData(uint8_t*& mem, int mode=0x0);
+    bool updateData(uint8_t*& mem, int mode=0x0, bool forceCallback=false);
     bool isMyData(uint8_t* mem);
     bool doSelection(unsigned int id);
-    bool isMyTick(unsigned int id);
-    
+    bool doSync(unsigned int id);
+
     unsigned int objectID;
+    unsigned int creatorID;
     unsigned int classID;
-    
+
     std::list<synchronisableVariable *> *syncList;
     static int state_; // detemines wheter we are server (default) or client
Index: code/trunk/src/network/packet/Acknowledgement.h
===================================================================
--- code/trunk/src/network/packet/Acknowledgement.h	(revision 1937)
+++ code/trunk/src/network/packet/Acknowledgement.h	(revision 2087)
@@ -29,4 +29,5 @@
 #define NETWORKACKNOLEDGEMENT_H
 
+#include "../NetworkPrereqs.h"
 #include "Packet.h"
 
@@ -35,7 +36,7 @@
 namespace packet {
 /**
-	@author 
+	@author
 */
-class Acknowledgement : public Packet
+class _NetworkExport Acknowledgement : public Packet
 {
 public:
@@ -43,8 +44,8 @@
   Acknowledgement( uint8_t* data, unsigned int clientID );
   ~Acknowledgement();
-  
+
   inline unsigned int getSize() const;
   bool process();
-  
+
   unsigned int getAckID();
 private:
Index: code/trunk/src/network/packet/Chat.h
===================================================================
--- code/trunk/src/network/packet/Chat.h	(revision 1937)
+++ code/trunk/src/network/packet/Chat.h	(revision 2087)
@@ -2,4 +2,6 @@
 #ifndef NETWORKCHAT_H
 #define NETWORKCHAT_H
+
+#include "../NetworkPrereqs.h"
 
 #include <string>
@@ -11,7 +13,7 @@
 namespace packet {
 /**
-	@author 
+	@author
 */
-class Chat : public Packet
+class _NetworkExport Chat : public Packet
 {
 public:
@@ -19,8 +21,8 @@
   Chat( uint8_t* data, unsigned int clientID );
   ~Chat();
-  
+
   inline unsigned int getSize() const;
   bool process();
-  
+
   unsigned int getMessageLength(){ return messageLength_; };
   unsigned char *getMessage();
Index: code/trunk/src/network/packet/ClassID.h
===================================================================
--- code/trunk/src/network/packet/ClassID.h	(revision 1937)
+++ code/trunk/src/network/packet/ClassID.h	(revision 2087)
@@ -29,4 +29,6 @@
 #define NETWORKCLASSID_H
 
+#include "../NetworkPrereqs.h"
+
 #include <string>
 
@@ -37,7 +39,7 @@
 
 /**
-	@author 
+	@author
 */
-class ClassID : public Packet
+class _NetworkExport ClassID : public Packet
 {
 public:
@@ -45,8 +47,8 @@
   ClassID( uint8_t* data, unsigned int clientID );
   ~ClassID();
-  
+
   inline unsigned int getSize() const;
   bool process();
-  
+
   unsigned int getClassID();
   unsigned int getClassNameLength(){ return classNameLength_; }
Index: code/trunk/src/network/packet/DeleteObjects.h
===================================================================
--- code/trunk/src/network/packet/DeleteObjects.h	(revision 1937)
+++ code/trunk/src/network/packet/DeleteObjects.h	(revision 2087)
@@ -29,4 +29,6 @@
 #define NETWORKPACKETDELETEOBJECTS_H
 
+#include "../NetworkPrereqs.h"
+
 #include "Packet.h"
 
@@ -35,7 +37,7 @@
 namespace packet {
 /**
-	@author 
+	@author
 */
-class DeleteObjects : public Packet
+class _NetworkExport DeleteObjects : public Packet
 {
 public:
@@ -43,10 +45,10 @@
   DeleteObjects( uint8_t* data, unsigned int clientID );
   ~DeleteObjects();
-  
+
   bool fetchIDs();
-  
+
   inline unsigned int getSize() const;
   bool process();
-  
+
 private:
 };
Index: code/trunk/src/network/packet/Gamestate.cc
===================================================================
--- code/trunk/src/network/packet/Gamestate.cc	(revision 1937)
+++ code/trunk/src/network/packet/Gamestate.cc	(revision 2087)
@@ -46,7 +46,7 @@
 #define HEADER GAMESTATE_HEADER(data_)
 
-  
+
 #define PACKET_FLAG_GAMESTATE  ENET_PACKET_FLAG_RELIABLE
-  
+
 Gamestate::Gamestate()
 {
@@ -85,5 +85,5 @@
     return false;
   }
-  
+
 #ifndef NDEBUG
   std::list<Synchronisable*> slist;
@@ -115,5 +115,5 @@
     slist.push_back(*it);
 #endif
-    
+
     //if(it->doSelection(id))
     dataMap_[mem-data_]=(*it);  // save the mem location of the synchronisable data
@@ -157,8 +157,5 @@
     if(!s)
     {
-      s = Synchronisable::fabricate(mem, mode);
-      assert(s);
-//       if(!s)
-//         return false;
+      Synchronisable::fabricate(mem, mode);
     }
     else
@@ -257,5 +254,5 @@
   HEADER->compressed = true;
   assert(HEADER->compressed);
-  COUT(3) << "gamestate compress datasize: " << HEADER->datasize << " compsize: " << HEADER->compsize << std::endl;
+  COUT(4) << "gamestate compress datasize: " << HEADER->datasize << " compsize: " << HEADER->compsize << std::endl;
   return true;
 }
@@ -264,9 +261,9 @@
   assert(HEADER);
   assert(HEADER->compressed);
-  COUT(3) << "GameStateClient: uncompressing gamestate. id: " << HEADER->id << ", baseid: " << HEADER->base_id << ", datasize: " << HEADER->datasize << ", compsize: " << HEADER->compsize << std::endl;
+  COUT(4) << "GameStateClient: uncompressing gamestate. id: " << HEADER->id << ", baseid: " << HEADER->base_id << ", datasize: " << HEADER->datasize << ", compsize: " << HEADER->compsize << std::endl;
   unsigned int datasize = HEADER->datasize;
   unsigned int compsize = HEADER->compsize;
   unsigned int bufsize;
-  assert(compsize<=datasize);
+//  assert(compsize<=datasize);
   bufsize = datasize;
   assert(bufsize!=0);
@@ -289,6 +286,16 @@
   //copy over the header
   *GAMESTATE_HEADER(ndata) = *HEADER;
-  //delete old (compressed data)
-  delete[] data_;
+
+  if (this->bDataENetAllocated_){
+    // Memory was allocated by ENet. --> We let it be since enet_packet_destroy will
+    // deallocated it anyway. So data and packet stay together.
+    this->bDataENetAllocated_ = false;
+  }
+  else{
+    // We allocated the memory in the first place (unlikely). So we destroy the old data
+    // and overwrite it with the new decompressed data.
+    delete[] this->data_;
+  }
+
   //set new pointers
   data_ = ndata;
@@ -339,5 +346,5 @@
   assert(data_);
   std::map<unsigned int, Synchronisable *>::iterator it;
-  
+
   // allocate memory for new data
   uint8_t *gdata = new uint8_t[HEADER->datasize+sizeof(GamestateHeader)];
@@ -346,11 +353,11 @@
   uint8_t *newdata = gdata + sizeof(GamestateHeader);
   uint8_t *origdata = GAMESTATE_START(data_);
-  
+
   //copy the GamestateHeader
   *(GamestateHeader*)gdata = *HEADER;
-  
+
   synchronisableHeader *oldobjectheader, *newobjectheader;
   unsigned int objectOffset;
-  
+
   //copy in the zeros
   for(it=dataMap_.begin(); it!=dataMap_.end(); it++){
@@ -360,5 +367,5 @@
     assert(it->second->objectID==oldobjectheader->objectID);
     *newobjectheader = *oldobjectheader;
-    objectOffset=sizeof(uint8_t)+sizeof(bool); //skip the size and the availableDate variables in the objectheader
+    objectOffset=sizeof(uint8_t)+sizeof(bool); //skip the size and the availableData variables in the objectheader
     if(it->second->doSelection(HEADER->id)){
       newobjectheader->dataAvailable=true; //TODO: probably not neccessary
@@ -390,18 +397,18 @@
   assert(!HEADER->compressed);
   assert(!HEADER->diffed);
-  
+
   //preparations
   std::map<unsigned int, Synchronisable *>::iterator it;
   uint8_t *origdata, *basedata, *destdata, *ndata;
   unsigned int objectOffset, streamOffset=0;    //data offset
-  unsigned int minsize = (HEADER->datasize < GAMESTATE_HEADER(base->data_)->datasize) ? HEADER->datasize : GAMESTATE_HEADER(base->data_)->datasize; 
+  unsigned int minsize = (HEADER->datasize < GAMESTATE_HEADER(base->data_)->datasize) ? HEADER->datasize : GAMESTATE_HEADER(base->data_)->datasize;
   synchronisableHeader *origheader;
   synchronisableHeader *destheader;
-  
+
   origdata = GAMESTATE_START(this->data_);
   basedata = GAMESTATE_START(base->data_);
   ndata = new uint8_t[HEADER->datasize + sizeof(GamestateHeader)];
   destdata = ndata + sizeof(GamestateHeader);
-  
+
   // do the diff
   for(it=dataMap_.begin(); it!=dataMap_.end(); it++){
@@ -410,5 +417,5 @@
     origheader = (synchronisableHeader *)(origdata+streamOffset);
     destheader = (synchronisableHeader *)(destdata+streamOffset);
-    
+
     //copy and partially diff the object header
     assert(sizeof(synchronisableHeader)==3*sizeof(unsigned int)+sizeof(bool));
@@ -420,12 +427,12 @@
     }else{
       *(uint32_t*)(destdata+sizeof(uint32_t)+sizeof(bool)) = 0;
-      *(uint32_t*)(destdata+2*sizeof(uint32_t)+sizeof(bool)) = 0; 
+      *(uint32_t*)(destdata+2*sizeof(uint32_t)+sizeof(bool)) = 0;
     }
     objectOffset=sizeof(synchronisableHeader);
     streamOffset+=sizeof(synchronisableHeader);
-    
+
     //now handle the object data or fill with zeros
     while(objectOffset<origheader->size ){
-      
+
       if(sendData && streamOffset<minsize)
         *(destdata+objectOffset)=*(basedata+objectOffset)^*(origdata+objectOffset); // do the xor
@@ -434,5 +441,5 @@
       else
         *(destdata+objectOffset)=0; // set to 0 because this object should not be transfered
-      
+
       objectOffset++;
       streamOffset++;
@@ -442,5 +449,5 @@
     basedata+=objectOffset;
   }
-  
+
   //copy over the gamestate header and set the diffed flag
   *(GamestateHeader *)ndata = *HEADER; //copy over the header
@@ -458,18 +465,18 @@
   assert(!HEADER->compressed);
   assert(HEADER->diffed);
-  
+
   //preparations
   std::map<unsigned int, Synchronisable *>::iterator it;
   uint8_t *origdata, *basedata, *destdata, *ndata;
   unsigned int objectOffset, streamOffset=0;    //data offset
-  unsigned int minsize = (HEADER->datasize < GAMESTATE_HEADER(base->data_)->datasize) ? HEADER->datasize : GAMESTATE_HEADER(base->data_)->datasize; 
+  unsigned int minsize = (HEADER->datasize < GAMESTATE_HEADER(base->data_)->datasize) ? HEADER->datasize : GAMESTATE_HEADER(base->data_)->datasize;
   synchronisableHeader *origheader;
   synchronisableHeader *destheader;
-  
+
   origdata = GAMESTATE_START(this->data_);
   basedata = GAMESTATE_START(base->data_);
   ndata = new uint8_t[HEADER->datasize + sizeof(GamestateHeader)];
   destdata = ndata + sizeof(GamestateHeader);
-  
+
   // do the undiff
   for(it=dataMap_.begin(); it!=dataMap_.end(); it++){
@@ -478,5 +485,5 @@
     destheader = (synchronisableHeader *)(destdata+streamOffset);
     bool sendData;
-    
+
     //copy and partially diff the object header
     assert(sizeof(synchronisableHeader)==3*sizeof(unsigned int)+sizeof(bool));
@@ -489,12 +496,12 @@
     }else{
       *(unsigned int*)(destdata+sizeof(unsigned int)+sizeof(bool)) = 0;
-      *(unsigned int*)(destdata+2*sizeof(unsigned int)+sizeof(bool)) = 0; 
+      *(unsigned int*)(destdata+2*sizeof(unsigned int)+sizeof(bool)) = 0;
     }
     objectOffset=sizeof(synchronisableHeader);
     streamOffset+=sizeof(synchronisableHeader);
-    
+
     //now handle the object data or fill with zeros
     while(objectOffset<origheader->size ){
-      
+
       if(sendData && streamOffset<minsize)
         *(destdata+objectOffset)=*(basedata+objectOffset)^*(origdata+objectOffset); // do the xor
@@ -503,5 +510,5 @@
       else
         *(destdata+objectOffset)=0; // set to 0 because this object should not be transfered
-      
+
       objectOffset++;
       streamOffset++;
@@ -511,5 +518,5 @@
     basedata+=objectOffset;
   }
-  
+
   //copy over the gamestate header and set the diffed flag
   *(GamestateHeader *)ndata = *HEADER; //copy over the header
Index: code/trunk/src/network/packet/Gamestate.h
===================================================================
--- code/trunk/src/network/packet/Gamestate.h	(revision 1937)
+++ code/trunk/src/network/packet/Gamestate.h	(revision 2087)
@@ -27,4 +27,10 @@
  */
 
+
+#ifndef NETWORK_PACKETGAMESTATE_H
+#define NETWORK_PACKETGAMESTATE_H
+
+#include "../NetworkPrereqs.h"
+
 #include "Packet.h"
 #include "network/Synchronisable.h"
@@ -34,13 +40,9 @@
 #endif
 
-
-#ifndef NETWORK_PACKETGAMESTATE_H
-#define NETWORK_PACKETGAMESTATE_H
-
 namespace network {
 
 namespace packet {
 
-struct GamestateHeader{
+struct _NetworkExport GamestateHeader{
   ENUM::Type packetType;
   int32_t id; // id of the gamestate
@@ -59,5 +61,5 @@
 	@author Oliver Scheuss
 */
-class Gamestate: public Packet{
+class _NetworkExport Gamestate: public Packet{
   public:
     Gamestate();
Index: code/trunk/src/network/packet/Packet.cc
===================================================================
--- code/trunk/src/network/packet/Packet.cc	(revision 1937)
+++ code/trunk/src/network/packet/Packet.cc	(revision 2087)
@@ -49,10 +49,10 @@
 
 namespace packet{
-  
+
 #define PACKET_FLAG_DEFAULT ENET_PACKET_FLAG_NO_ALLOCATE
 #define _PACKETID           0
-  
+
 std::map<ENetPacket *, Packet *> Packet::packetMap_;
-  
+
 Packet::Packet(){
   flags_ = PACKET_FLAG_DEFAULT;
@@ -61,4 +61,5 @@
   data_=0;
   enetPacket_=0;
+  bDataENetAllocated_ = false;
 }
 
@@ -73,4 +74,5 @@
   data_=data;
   enetPacket_=0;
+  bDataENetAllocated_ = false;
 }
 
@@ -86,13 +88,32 @@
   }else
     data_=0;
-}
-
+  bDataENetAllocated_ = p.bDataENetAllocated_;
+}
+
+/**
+@brief
+    Destroys a packet completely.
+    
+    That also means destroying the ENetPacket if one exists. There 
+*/
 Packet::~Packet(){
-  if(enetPacket_){
-    assert(enetPacket_->freeCallback==0);
+  // Deallocate data_ memory if necessary.
+  if (this->bDataENetAllocated_){
+    // In this case ENet allocated data_ and will destroy it.
+  }
+  else if (this->data_) {
+    // This destructor was probably called as a consequence to ENet executing our callback.
+    // It simply serves us to be able to deallocate the packet content (data_) ourselves since
+    // we have created it in the first place.
+    delete[] this->data_;
+  }
+
+  // Destroy the ENetPacket if necessary.
+  // Note: For the case ENet used the callback to destroy the packet, we have already set
+  // enetPacket_ to NULL to avoid destroying it again.
+  if (this->enetPacket_){
+    // enetPacket_->data gets destroyed too by ENet if it was allocated by it.
     enet_packet_destroy(enetPacket_);
   }
-  if(data_)
-    delete[] data_;
 }
 
@@ -107,10 +128,13 @@
       return false;
     }
+    // We deliver ENet the data address so that it doesn't memcpy everything again.
+    // --> We have to delete data_ ourselves!
     enetPacket_ = enet_packet_create(getData(), getSize(), getFlags());
     enetPacket_->freeCallback = &Packet::deletePacket;
-//     enetPacket_->freeCallback = &blub;
+    // Add the packet to a global list so we can access it again once enet calls our
+    // deletePacket method. We can of course only give a one argument function to the ENet C library.
     packetMap_[enetPacket_] = this;
   }
-#ifndef NDEBUG 
+#ifndef NDEBUG
   switch( *(ENUM::Type *)(data_ + _PACKETID) )
   {
@@ -127,7 +151,7 @@
   }
 #endif
-  ENetPacket *temp = enetPacket_;
-  enetPacket_ = 0; // otherwise we have a double free because enet already handles the deallocation of the packet
-  network::Host::addPacket( temp, clientID_);
+//  ENetPacket *temp = enetPacket_;
+//  enetPacket_ = 0; // otherwise we have a double free because enet already handles the deallocation of the packet
+  network::Host::addPacket( enetPacket_, clientID_);
   return true;
 }
@@ -135,4 +159,5 @@
 Packet *Packet::createPacket(ENetPacket *packet, ENetPeer *peer){
   uint8_t *data = packet->data;
+  assert(ClientInformation::findClient(&peer->address)->getID() != (unsigned int)-2 || !Host::isServer());
   unsigned int clientID = ClientInformation::findClient(&peer->address)->getID();
   Packet *p;
@@ -169,11 +194,25 @@
       break;
   }
+
+  // Data was created by ENet
+  p->bDataENetAllocated_ = true;
+
   return p;
 }
 
-void Packet::deletePacket(ENetPacket *packet){
-  assert(packetMap_[packet]);
-  assert(packetMap_[packet]->enetPacket_==0);
-  delete packetMap_[packet];
+/**
+@brief
+    ENet calls this method whenever it wants to destroy a packet that contains
+    data we allocated ourselves.
+*/
+void Packet::deletePacket(ENetPacket *enetPacket){
+  // Get our Packet from a gloabal map with all Packets created in the send() method of Packet.
+  std::map<ENetPacket*, Packet*>::iterator it = packetMap_.find(enetPacket);
+  assert(it != packetMap_.end());
+  // Make sure we don't delete it again in the destructor
+  it->second->enetPacket_ = 0;
+  delete it->second;
+  //packetMap_.erase(it);
+  COUT(4) << "PacketMap size: " << packetMap_.size() << std::endl;
 }
 
Index: code/trunk/src/network/packet/Packet.h
===================================================================
--- code/trunk/src/network/packet/Packet.h	(revision 1937)
+++ code/trunk/src/network/packet/Packet.h	(revision 2087)
@@ -29,4 +29,6 @@
 #define NETWORKPACKET_H
 
+#include "../NetworkPrereqs.h"
+
 #include <map>
 #include <enet/enet.h>
@@ -37,5 +39,5 @@
 
 namespace packet{
-  
+
 namespace ENUM{
   enum Direction{
@@ -53,9 +55,9 @@
   };
 }
-  
+
 /**
 	@author Oliver Scheuss <scheusso [at] ee.ethz.ch>
 */
-class Packet{
+class _NetworkExport Packet{
   public:
     Packet(const Packet &p);
@@ -63,5 +65,5 @@
     static Packet *createPacket(ENetPacket *packet, ENetPeer *peer);
     static void deletePacket(ENetPacket *packet);
-    
+
     virtual unsigned char *getData(){ return data_; };
     virtual unsigned int getSize() const =0;
@@ -73,5 +75,5 @@
     void setClientID( int id )
       { clientID_ = id; }
-    
+
     bool send();
   protected:
@@ -82,5 +84,11 @@
     unsigned int clientID_;
     ENUM::Direction packetDirection_;
+    /** Pointer to the data. Be careful when deleting it because it might
+        point to a location that was allocated by ENet.
+        See bDataENetAllocated_ */
     uint8_t *data_;
+    /** Tells whether data_ was allocated by ENet or ourselves.
+        data_ might no correlate with enetPacket_->data. */
+    bool bDataENetAllocated_;
   private:
     static std::map<ENetPacket *, Packet *> packetMap_;
Index: code/trunk/src/network/packet/Welcome.h
===================================================================
--- code/trunk/src/network/packet/Welcome.h	(revision 1937)
+++ code/trunk/src/network/packet/Welcome.h	(revision 2087)
@@ -29,4 +29,6 @@
 #define NETWORKWELCOME_H
 
+#include "../NetworkPrereqs.h"
+
 #include "Packet.h"
 
@@ -35,7 +37,7 @@
 
 /**
-	@author 
+	@author
 */
-class Welcome : public Packet
+class _NetworkExport Welcome : public Packet
 {
 public:
@@ -43,9 +45,9 @@
   Welcome( uint8_t* data, unsigned int clientID );
   virtual ~Welcome();
-  
+
   uint8_t *getData();
   inline unsigned int getSize() const;
   bool process();
-  
+
 private:
 };
Index: code/trunk/src/orxonox/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/CMakeLists.txt	(revision 1937)
+++ code/trunk/src/orxonox/CMakeLists.txt	(revision 2087)
@@ -1,7 +1,8 @@
 SET( ORXONOX_SRC_FILES
+  CameraManager.cc
   GraphicsEngine.cc
+  LevelManager.cc
   Main.cc
   Settings.cc
-  SignalHandler.cc
 
   gamestates/GSClient.cc
@@ -33,7 +34,7 @@
   overlays/hud/HUDRadar.cc
   overlays/hud/HUDSpeedBar.cc
+  overlays/hud/ChatOverlay.cc
 
   tools/BillboardSet.cc
-  tools/Light.cc
   tools/Mesh.cc
   tools/ParticleInterface.cc
@@ -42,24 +43,47 @@
   tools/WindowEventListener.cc
 
-  objects/Ambient.cc
-  objects/Backlight.cc
-  objects/Camera.cc
-  objects/CameraHandler.cc
-  objects/Model.cc
-  objects/NPC.cc
-  objects/ParticleSpawner.cc
+  objects/EventListener.cc
+  objects/EventDispatcher.cc
+  objects/EventTarget.cc
   objects/Radar.cc
   objects/RadarListener.cc
   objects/RadarViewable.cc
-  objects/Skybox.cc
-  objects/SpaceShip.cc
-  objects/SpaceShipAI.cc
   objects/Tickable.cc
-  objects/WorldEntity.cc
+  objects/Test.cc
+  objects/Script.cc
 
-  objects/Projectile.cc
-  objects/BillboardProjectile.cc
-  objects/RotatingProjectile.cc
-  objects/ParticleProjectile.cc
+  objects/Scene.cc
+  objects/worldentities/WorldEntity.cc
+  objects/worldentities/PositionableEntity.cc
+  objects/worldentities/MovableEntity.cc
+  objects/worldentities/ControllableEntity.cc
+  objects/worldentities/Model.cc
+  objects/worldentities/Billboard.cc
+  objects/worldentities/BlinkingBillboard.cc
+  objects/worldentities/Light.cc
+  objects/worldentities/Camera.cc
+  objects/worldentities/CameraPosition.cc
+  objects/worldentities/SpawnPoint.cc
+  objects/worldentities/ParticleEmitter.cc
+  objects/worldentities/ParticleSpawner.cc
+#  objects/worldentities/Backlight.cc
+
+  objects/worldentities/triggers/Trigger.cc
+  objects/worldentities/triggers/DistanceTrigger.cc
+  objects/worldentities/triggers/EventTrigger.cc
+
+  objects/worldentities/pawns/Spectator.cc
+  objects/worldentities/pawns/Pawn.cc
+  objects/worldentities/pawns/SpaceShip.cc
+
+  objects/controllers/Controller.cc
+  objects/controllers/HumanController.cc
+
+  objects/infos/Info.cc
+  objects/infos/Level.cc
+  objects/infos/PlayerInfo.cc
+  objects/infos/HumanPlayer.cc
+
+  objects/gametypes/Gametype.cc
 
   tolua/tolua_bind.cc
@@ -76,5 +100,6 @@
   WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib
 )
-	
+
+
 ADD_EXECUTABLE( orxonox ${ORXONOX_SRC_FILES} )
 
@@ -83,14 +108,6 @@
   SET( ORXONOXS_SRC_FILES
     GraphicsEngine.cc
-    objects/Ambient.cc
     objects/Camera.cc
-    objects/CameraHandler.cc
-    objects/Explosion.cc
-    objects/Model.cc
-    objects/NPC.cc
-    objects/Projectile.cc
-    objects/Skybox.cc
-    objects/SpaceShip.cc
-    objects/WorldEntity.cc
+    CameraManager.cc
   )
 
Index: code/trunk/src/orxonox/CameraManager.cc
===================================================================
--- code/trunk/src/orxonox/CameraManager.cc	(revision 2087)
+++ code/trunk/src/orxonox/CameraManager.cc	(revision 2087)
@@ -0,0 +1,103 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Knecht
+ *   Co-authors:
+ *      Fabian 'x3n' Landau
+ *
+ */
+#include "OrxonoxStableHeaders.h"
+#include "CameraManager.h"
+
+#include <OgreViewport.h>
+
+#include "core/Core.h"
+#include "objects/worldentities/Camera.h"
+
+
+namespace orxonox
+{
+    CameraManager* CameraManager::singletonRef_s = 0;
+
+    CameraManager::CameraManager(Ogre::Viewport* viewport)
+        : viewport_(viewport)
+    {
+        assert(singletonRef_s == 0);
+        singletonRef_s = this;
+    }
+
+    CameraManager::~CameraManager()
+    {
+        assert(singletonRef_s != 0);
+        singletonRef_s = 0;
+    }
+
+    Camera* CameraManager::getActiveCamera() const
+    {
+        if (this->cameraList_.size() > 0)
+            return this->cameraList_.front();
+        else
+            return 0;
+    }
+
+    void CameraManager::requestFocus(Camera* camera)
+    {
+        if (!Core::showsGraphics())
+            return;
+
+        // notify old camera (if it exists)
+        if (this->cameraList_.size() > 0)
+            this->cameraList_.front()->removeFocus();
+
+        camera->setFocus(this->viewport_);
+
+        // add to list
+        std::list<Camera*>::iterator it;
+        for (it = this->cameraList_.begin(); it != this->cameraList_.end(); ++it)
+        {
+            if ((*it) == camera)
+                return; // make sure we don't add it twice
+        }
+        this->cameraList_.push_front(camera);
+    }
+
+    void CameraManager::releaseFocus(Camera* camera)
+    {
+        if (!Core::showsGraphics())
+            return;
+
+        // notify the cam of releasing the focus
+        if (this->cameraList_.front() == camera)
+        {
+            camera->removeFocus();
+            this->cameraList_.pop_front();
+
+            // set new focus if necessary
+            if (cameraList_.size() > 0)
+                cameraList_.front()->setFocus(this->viewport_);
+        }
+        else
+        {
+            this->cameraList_.remove(camera);
+        }
+    }
+}
Index: code/trunk/src/orxonox/CameraManager.h
===================================================================
--- code/trunk/src/orxonox/CameraManager.h	(revision 2087)
+++ code/trunk/src/orxonox/CameraManager.h	(revision 2087)
@@ -0,0 +1,69 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Knecht
+ *   Co-authors:
+ *      Fabian 'x3n' Landau
+ *
+ */
+
+ /**
+ @file  CameraManager.h
+ @brief Handles the instances of Camera class
+ @author Benjamin Knecht <beni_at_orxonox.net>
+  */
+
+#ifndef _CameraManager_H__
+#define _CameraManager_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <cassert>
+#include <list>
+#include <OgrePrerequisites.h>
+
+namespace orxonox
+{
+    class _OrxonoxExport CameraManager
+    {
+        public:
+            CameraManager(Ogre::Viewport* viewport);
+            ~CameraManager();
+
+            Camera* getActiveCamera() const;
+
+            void requestFocus(Camera* camera);
+            void releaseFocus(Camera* camera);
+
+            static CameraManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
+
+        private:
+            CameraManager(const CameraManager&);
+
+            std::list<Camera*> cameraList_;
+            Ogre::Viewport* viewport_;
+
+            static CameraManager* singletonRef_s;
+    };
+}
+
+#endif /* _CameraManager_H__ */
Index: code/trunk/src/orxonox/GraphicsEngine.cc
===================================================================
--- code/trunk/src/orxonox/GraphicsEngine.cc	(revision 1937)
+++ code/trunk/src/orxonox/GraphicsEngine.cc	(revision 2087)
@@ -68,8 +68,7 @@
     */
     GraphicsEngine::GraphicsEngine()
-        : root_(0)
-        , renderWindow_(0)
-        , levelSceneManager_(0)
-        , viewport_(0)
+//        : root_(0)
+//        , renderWindow_(0)
+//        , viewport_(0)
     {
         RegisterObject(GraphicsEngine);
@@ -103,45 +102,3 @@
         singletonRef_s = 0;
     }
-
-    /**
-    @brief
-        Get the width of the render window
-    @return
-        The width of the render window
-    */
-    int GraphicsEngine::getWindowWidth() const
-    {
-        if (this->renderWindow_)
-            return this->renderWindow_->getWidth();
-        else
-            return 0;
-    }
-
-    /**
-    @brief
-        Get the height of the render window
-    @return
-        The height of the render window
-    */
-    int GraphicsEngine::getWindowHeight() const
-    {
-        if (this->renderWindow_)
-            return this->renderWindow_->getHeight();
-        else
-            return 0;
-    }
-
-    /**
-    @brief
-        Returns the window aspect ratio height/width.
-    @return
-        The window aspect ratio
-    */
-    float GraphicsEngine::getWindowAspectRatio() const
-    {
-        if (this->renderWindow_)
-            return (float)this->renderWindow_->getHeight() / (float)this->renderWindow_->getWidth();
-        else
-            return 1.0f;
-    }
 }
Index: code/trunk/src/orxonox/GraphicsEngine.h
===================================================================
--- code/trunk/src/orxonox/GraphicsEngine.h	(revision 1937)
+++ code/trunk/src/orxonox/GraphicsEngine.h	(revision 2087)
@@ -61,14 +61,4 @@
         void detailLevelParticleChanged();
 
-        void setLevelSceneManager(Ogre::SceneManager* sceneMgr) { this->levelSceneManager_ = sceneMgr; }
-        Ogre::SceneManager* getLevelSceneManager() { return levelSceneManager_; }
-
-        Ogre::Viewport* getViewport() { return this->viewport_; }
-        Ogre::Root*     getOgreRoot() { return this->root_; }
-
-        // several window properties
-        int getWindowWidth() const;
-        int getWindowHeight() const;
-        float getWindowAspectRatio() const;
         float getAverageFramesPerSecond() const   { return this->avgFramesPerSecond_; }
         float getAverageTickTime() const          { return this->avgTickTime_; }
@@ -86,9 +76,4 @@
         GraphicsEngine(GraphicsEngine&);
 
-        Ogre::Root*         root_;                  //!< Ogre's root
-        Ogre::RenderWindow* renderWindow_;          //!< the current render window
-        Ogre::SceneManager* levelSceneManager_;     //!< scene manager of the game
-        Ogre::Viewport*     viewport_;              //!< default full size viewport
-
         // stats
         float               avgTickTime_;           //!< time in ms to tick() one frame
Index: code/trunk/src/orxonox/LevelManager.cc
===================================================================
--- code/trunk/src/orxonox/LevelManager.cc	(revision 2087)
+++ code/trunk/src/orxonox/LevelManager.cc	(revision 2087)
@@ -0,0 +1,144 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+
+#include "LevelManager.h"
+
+#include "core/CoreIncludes.h"
+
+#include "objects/infos/Level.h"
+#include "objects/infos/HumanPlayer.h"
+
+namespace orxonox
+{
+    LevelManager* LevelManager::singletonRef_s = 0;
+
+    LevelManager::LevelManager()
+    {
+        RegisterRootObject(LevelManager);
+
+        assert(singletonRef_s == 0);
+        singletonRef_s = this;
+
+        this->getConnectedClients();
+    }
+
+    LevelManager::~LevelManager()
+    {
+        assert(singletonRef_s != 0);
+        singletonRef_s = 0;
+    }
+
+    void LevelManager::requestActivity(Level* level)
+    {
+        this->levels_s.push_back(level);
+        if (this->levels_s.size() == 1)
+            this->activateNextLevel();
+    }
+
+    void LevelManager::releaseActivity(Level* level)
+    {
+        if (this->levels_s.size() > 0)
+        {
+            if (this->levels_s.front() == level)
+            {
+                level->setActive(false);
+                this->levels_s.pop_front();
+                this->activateNextLevel();
+            }
+            else
+            {
+                for (std::list<Level*>::iterator it = this->levels_s.begin(); it != this->levels_s.end(); ++it)
+                    if ((*it) == level)
+                        this->levels_s.erase(it);
+            }
+        }
+    }
+
+    Level* LevelManager::getActiveLevel()
+    {
+        if (this->levels_s.size() > 0)
+            return this->levels_s.front();
+        else
+            return 0;
+    }
+
+    void LevelManager::activateNextLevel()
+    {
+        if (this->levels_s.size() > 0)
+        {
+            this->levels_s.front()->setActive(true);
+            for (std::map<unsigned int, PlayerInfo*>::iterator it = this->clients_.begin(); it != this->clients_.end(); ++it)
+                this->levels_s.front()->playerEntered(it->second);
+        }
+    }
+
+
+    void LevelManager::clientConnected(unsigned int clientID)
+    {
+        COUT(3) << "client connected" << std::endl;
+
+        // create new HumanPlayer instance
+        HumanPlayer* player = new HumanPlayer(0);
+        player->setClientID(clientID);
+
+        // add to clients-map
+        assert(!this->clients_[clientID]);
+        this->clients_[clientID] = player;
+
+        if (this->getActiveLevel())
+            this->getActiveLevel()->playerEntered(player);
+    }
+
+    void LevelManager::clientDisconnected(unsigned int clientID)
+    {
+        COUT(3) << "client disconnected" << std::endl;
+
+        // remove from clients-map
+        PlayerInfo* player = this->clients_[clientID];
+        this->clients_.erase(clientID);
+
+        if (this->getActiveLevel())
+            this->getActiveLevel()->playerLeft(player);
+
+        // delete PlayerInfo instance
+        if (player)
+            delete player;
+    }
+
+
+    PlayerInfo* LevelManager::getClient(unsigned int clientID) const
+    {
+        std::map<unsigned int, PlayerInfo*>::const_iterator it = this->clients_.find(clientID);
+        if (it != this->clients_.end())
+            return it->second;
+        else
+            return 0;
+    }
+}
Index: code/trunk/src/orxonox/LevelManager.h
===================================================================
--- code/trunk/src/orxonox/LevelManager.h	(revision 2087)
+++ code/trunk/src/orxonox/LevelManager.h	(revision 2087)
@@ -0,0 +1,73 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _LevelManager_H__
+#define _LevelManager_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <list>
+#include <map>
+#include <cassert>
+
+#include "network/ClientConnectionListener.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport LevelManager : public network::ClientConnectionListener
+    {
+        public:
+            LevelManager();
+            virtual ~LevelManager();
+
+            void requestActivity(Level* level);
+            void releaseActivity(Level* level);
+            Level* getActiveLevel();
+
+            PlayerInfo* getClient(unsigned int clientID) const;
+            inline const std::map<unsigned int, PlayerInfo*>& getClients() const
+                { return this->clients_; }
+
+            static LevelManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
+
+        private:
+            LevelManager(const LevelManager&);
+
+            void clientConnected(unsigned int clientID);
+            void clientDisconnected(unsigned int clientID);
+
+            void activateNextLevel();
+
+            std::list<Level*> levels_s;
+            std::map<unsigned int, PlayerInfo*> clients_;
+
+            static LevelManager* singletonRef_s;
+    };
+}
+
+#endif /* _LevelManager_H__ */
Index: code/trunk/src/orxonox/Main.cc
===================================================================
--- code/trunk/src/orxonox/Main.cc	(revision 1937)
+++ code/trunk/src/orxonox/Main.cc	(revision 2087)
@@ -40,6 +40,6 @@
 #include "util/OrxonoxPlatform.h"
 #include "util/Debug.h"
+#include "util/SignalHandler.h"
 #include "core/ConfigFileManager.h"
-#include "SignalHandler.h"
 
 #include "gamestates/GSRoot.h"
Index: code/trunk/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/trunk/src/orxonox/OrxonoxPrereqs.h	(revision 1937)
+++ code/trunk/src/orxonox/OrxonoxPrereqs.h	(revision 2087)
@@ -80,20 +80,51 @@
     class RadarListener;
 
+    class CameraManager;
+    class LevelManager;
+
     // objects
-    class Ambient;
+    class Scene;
+
+    class WorldEntity;
+    class PositionableEntity;
+    class MovableEntity;
+    class ControllableEntity;
+    class Sublevel;
+
+    class Model;
+    class Billboard;
+    class BlinkingBillboard;
+    class Light;
     class Backlight;
+    class ParticleEmitter;
+    class ParticleSpawner;
+
     class Camera;
-    class Model;
-    class NPC;
-    class ParticleSpawner;
-    class Skybox;
+    class CameraPosition;
+    class SpawnPoint;
+
+    class Spectator;
+    class Pawn;
     class SpaceShip;
-    class SpaceShipAI;
-    class WorldEntity;
 
-    class Projectile;
-    class BillboardProjectile;
-    class RotatingProjectile;
-    class ParticleProjectile;
+    class Trigger;
+    class DistanceTrigger;
+    class EventTrigger;
+
+    class EventListener;
+    class EventDispatcher;
+    class EventTarget;
+
+    class Controller;
+    class HumanController;
+
+    class Info;
+    class Level;
+    class PlayerInfo;
+    class HumanPlayer;
+
+    class Gametype;
+
+    class Scores;
 
     // tools
Index: code/trunk/src/orxonox/OrxonoxStableHeaders.h
===================================================================
--- code/trunk/src/orxonox/OrxonoxStableHeaders.h	(revision 1937)
+++ code/trunk/src/orxonox/OrxonoxStableHeaders.h	(revision 2087)
@@ -37,5 +37,5 @@
 #include "util/OrxonoxPlatform.h"
 
-#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC && !defined(ORXONOX_DISABLE_PCH)
+#if defined(ORXONOX_ENABLE_PCH)
 
 // including std headers here is useless since they're already precompiled
@@ -47,13 +47,15 @@
 #include <Ogre.h>
 #include <CEGUI.h>
+#include "ois/OIS.h"
 #include <boost/thread/recursive_mutex.hpp>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/condition.hpp>
-#include <boost/thread/thread.hpp>
-
+//#include <boost/thread/mutex.hpp>
+//#include <boost/thread/condition.hpp>
+//#include <boost/thread/thread.hpp>
+#include <boost/static_assert.hpp>
 #include "tinyxml/ticpp.h"
 #include "tinyxml/tinyxml.h"
+#include "tolua/tolua++.h"
 
-//Get around Windows hackery (windows.h is included by Ogre)
+//Get around Windows hackery (windows.h is included by Ogre.h)
 #if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 
 #  ifdef max
@@ -67,13 +69,12 @@
 //----------- Our files ----------
 //--------------------------------
-// only include when not debugging so that we may find issues with missing headers quicker
-#if defined(NDEBUG)
+//// only include when not debugging so that we may find issues with missing headers quicker
+//#if defined(NDEBUG)
 
 #include "util/Convert.h"
 #include "util/Debug.h"
+#include "util/Exception.h"
 #include "util/Math.h"
 #include "util/Multitype.h"
-#include "util/OutputBuffer.h"
-#include "util/OutputHandler.h"
 #include "util/Sleep.h"
 #include "util/String.h"
@@ -85,17 +86,18 @@
 #include "core/ConfigValueIncludes.h"
 #include "core/CommandExecutor.h"
+#include "core/Core.h"
 #include "core/Executor.h"
+#include "core/ObjectList.h"
+#include "core/Super.h"
 #include "core/XMLIncludes.h"
 #include "core/XMLPort.h"
+#include "core/input/SimpleInputState.h"
+#include "core/input/InputManager.h"
 
 #include "network/Synchronisable.h"
 
-//#include "tools/Mesh.h"
-//#include "tools/Timer.h"
-//#include "objects/Model.h"
-//#include "objects/Tickable.h"
-//#include "objects/WorldEntity.h"
+#include "Settings.h"
 
-#endif /* ifdef NDEBUG */
+//#endif /* ifdef NDEBUG */
 
 #endif /* ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC && !defined(ORXONOX_DISABLE_PCH) */
Index: code/trunk/src/orxonox/Settings.cc
===================================================================
--- code/trunk/src/orxonox/Settings.cc	(revision 1937)
+++ code/trunk/src/orxonox/Settings.cc	(revision 2087)
@@ -39,4 +39,5 @@
 #include "core/CoreIncludes.h"
 #include "core/ConfigValueIncludes.h"
+#include "core/LuaBind.h"
 
 namespace orxonox
@@ -49,7 +50,4 @@
     */
     Settings::Settings()
-        : bShowsGraphics_(false)
-        , bHasServer_(false)
-        , bIsClient_(false)
     {
         RegisterRootObject(Settings);
@@ -65,5 +63,5 @@
     void Settings::setConfigValues()
     {
-        SetConfigValue(dataPath_, "../../Media/").description("Relative path to the game data.").callback(this, &Settings::dataPathChanged);
+        SetConfigValue(dataPath_, "../../media/").description("Relative path to the game data.").callback(this, &Settings::dataPathChanged);
     }
 
@@ -84,4 +82,6 @@
             COUT(2) << "Warning: Data path set to \"/\", is that really correct?" << std::endl;
         }
+
+        LuaBind::getInstance()->setIncludePath(this->dataPath_);
     }
 
Index: code/trunk/src/orxonox/Settings.h
===================================================================
--- code/trunk/src/orxonox/Settings.h	(revision 1937)
+++ code/trunk/src/orxonox/Settings.h	(revision 2087)
@@ -50,8 +50,4 @@
         friend class ClassIdentifier<Settings>;
         friend class GSRoot;
-        friend class GSGraphics;
-        friend class GSServer;
-        friend class GSClient;
-        friend class GSDedicated;
 
     public:
@@ -61,15 +57,5 @@
         { assert(singletonRef_s); singletonRef_s->_tsetDataPath(path); }
 
-        // an alternative to a global game mode variable
-        static bool showsGraphics() { assert(singletonRef_s); return singletonRef_s->bShowsGraphics_; }
-        static bool hasServer()     { assert(singletonRef_s); return singletonRef_s->bHasServer_; }
-        static bool isClient()      { assert(singletonRef_s); return singletonRef_s->bIsClient_; }
-
     private:
-        // GSRoot has access to these
-        static void setShowsGraphics(bool val) { assert(singletonRef_s); singletonRef_s->bShowsGraphics_ = val; }
-        static void setHasServer    (bool val) { assert(singletonRef_s); singletonRef_s->bHasServer_     = val; }
-        static void setIsClient     (bool val) { assert(singletonRef_s); singletonRef_s->bIsClient_      = val; }
-
         Settings();
         Settings(const Settings& instance);
@@ -82,8 +68,4 @@
         void setConfigValues();
 
-        bool bShowsGraphics_;                                  //!< global variable that tells whether to show graphics
-        bool bHasServer_;                                      //!< global variable that tells whether this is a server
-        bool bIsClient_;
-
         std::string dataPath_;                                 //!< Path to the game data
 
Index: code/trunk/src/orxonox/SignalHandler.cc
===================================================================
--- code/trunk/src/orxonox/SignalHandler.cc	(revision 1937)
+++ 	(revision )
@@ -1,355 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Christoph Renner
- *   Co-authors:
- *      ...
- *
- */
-
-/**
-    @file SignalHandler.cc
-    @brief Implementation of the SignalHandler class.
-*/
-
-#include "OrxonoxStableHeaders.h"
-#include "SignalHandler.h"
-#include "util/Debug.h"
-
-#include <assert.h>
-#include <iostream>
-#include <cstdlib>
-#include <cstring>
-
-SignalHandler * SignalHandler::singletonRef = NULL;
-
-#if ORXONOX_PLATFORM != ORXONOX_PLATFORM_WIN32
-
-#include <wait.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/keysym.h>
-
-bool SignalHandler::bXAutoKeyRepeatOn_ = false;
-
-SignalHandler::SignalHandler()
-{
-}
-
-/**
- * register signal handlers for SIGSEGV and SIGABRT
- * @param appName path to executable eg argv[0]
- * @param fileName filename to append backtrace to
- */
-void SignalHandler::doCatch( const std::string & appName, const std::string & fileName )
-{
-  this->appName = appName;
-  this->fileName = fileName;
-
-  // prepare for restoring XAutoKeyRepeat
-  Display* display;
-  if ((display = XOpenDisplay(0)))
-  {
-    XKeyboardState oldState;
-    XGetKeyboardControl(display, &oldState);
-    if (oldState.global_auto_repeat == AutoRepeatModeOn)
-      bXAutoKeyRepeatOn_ = true;
-    else
-      bXAutoKeyRepeatOn_ = false;
-    XCloseDisplay(display);
-  }
-  else
-  {
-    std::cout << "Warning: couldn't open X display to restore XAutoKeyRepeat." << std::endl;
-    bXAutoKeyRepeatOn_ = false;
-  }
-
-
-  // make sure doCatch is only called once without calling dontCatch
-  assert( sigRecList.size() == 0 );
-
-  catchSignal( SIGSEGV );
-  catchSignal( SIGABRT );
-  catchSignal( SIGILL );
-}
-
-/**
- * restore previous signal handlers
- */
-void SignalHandler::dontCatch()
-{
-  for ( SignalRecList::iterator it = sigRecList.begin(); it != sigRecList.end(); it++ )
-  {
-    signal( it->signal, it->handler );
-  }
-
-  sigRecList.clear();
-}
-
-/**
- * catch signal sig
- * @param sig signal to catch
- */
-void SignalHandler::catchSignal( int sig )
-{
-  sig_t handler = signal( sig, SignalHandler::sigHandler );
-
-  assert( handler != SIG_ERR );
-
-  SignalRec rec;
-  rec.signal = sig;
-  rec.handler = handler;
-
-  sigRecList.push_front( rec );
-}
-
-/**
- * sigHandler is called when receiving signals
- * @param sig
- */
-void SignalHandler::sigHandler( int sig )
-{
-  for ( SignalCallbackList::iterator it = SignalHandler::getInstance()->callbackList.begin(); it != SignalHandler::getInstance()->callbackList.end(); it++  )
-  {
-    (*(it->cb))( it->someData );
-  }
-
-  std::string sigName = "UNKNOWN";
-
-  switch ( sig )
-  {
-    case SIGSEGV:
-      sigName = "SIGSEGV";
-      break;
-    case SIGABRT:
-      sigName = "SIGABRT";
-      break;
-    case SIGILL:
-      sigName = "SIGILL";
-      break;
-  }
-
-  if (bXAutoKeyRepeatOn_)
-  {
-    std::cout << "Trying to restore XAutoKeyRepeat" << std::endl;
-    Display* display;
-    if ((display = XOpenDisplay(0)))
-    {
-      XAutoRepeatOn(display);
-      XCloseDisplay(display);
-    }
-  }
-
-  COUT(0) << "recieved signal " << sigName.c_str() << std::endl << "try to write backtrace to file orxonox.log" << std::endl;
-
-  int sigPipe[2];
-  if ( pipe(sigPipe) == -1 )
-  {
-    perror("pipe failed!\n");
-    exit(EXIT_FAILURE);
-  }
-
-  int sigPid = fork();
-
-  if ( sigPid == -1 )
-  {
-    perror("fork failed!\n");
-    exit(EXIT_FAILURE);
-  }
-
-  // gdb will be attached to this process
-  if ( sigPid == 0 )
-  {
-    getInstance()->dontCatch();
-    // wait for message from parent when it has attached gdb
-    int someData;
-
-    read( sigPipe[0], &someData, sizeof(someData) );
-
-    if ( someData != 0x12345678 )
-    {
-      COUT(0) << "something went wrong :(" << std::endl;
-    }
-
-    return;
-  }
-
-  int gdbIn[2];
-  int gdbOut[2];
-  int gdbErr[2];
-
-  if ( pipe(gdbIn) == -1 || pipe(gdbOut) == -1 || pipe(gdbErr) == -1 )
-  {
-    perror("pipe failed!\n");
-    kill( sigPid, SIGTERM );
-    waitpid( sigPid, NULL, 0 );
-    exit(EXIT_FAILURE);
-  }
-
-  int gdbPid = fork();
-  // this process will run gdb
-
-  if ( gdbPid == -1 )
-  {
-    perror("fork failed\n");
-    kill( sigPid, SIGTERM );
-    waitpid( sigPid, NULL, 0 );
-    exit(EXIT_FAILURE);
-  }
-
-  if ( gdbPid == 0 )
-  {
-    // start gdb
-
-    close(gdbIn[1]);
-    close(gdbOut[0]);
-    close(gdbErr[0]);
-
-    dup2( gdbIn[0], STDIN_FILENO );
-    dup2( gdbOut[1], STDOUT_FILENO );
-    dup2( gdbErr[1], STDERR_FILENO );
-
-    execlp( "sh", "sh", "-c", "gdb", (void*)NULL);
-  }
-
-  char cmd[256];
-  snprintf( cmd, 256, "file %s\nattach %d\nc\n", getInstance()->appName.c_str(), sigPid );
-  write( gdbIn[1], cmd, strlen(cmd) );
-
-  int charsFound = 0;
-  int promptFound = 0;
-  char byte;
-  while ( read( gdbOut[0], &byte, 1 ) == 1 )
-  {
-    if (
-      charsFound == 0 && byte == '(' ||
-      charsFound == 1 && byte == 'g' ||
-      charsFound == 2 && byte == 'd' ||
-      charsFound == 3 && byte == 'b' ||
-      charsFound == 4 && byte == ')' ||
-      charsFound == 5 && byte == ' '
-        )
-          charsFound++;
-    else
-      charsFound = 0;
-
-    if ( charsFound == 6 )
-    {
-      promptFound++;
-      charsFound = 0;
-    }
-
-    if ( promptFound == 3 )
-    {
-      break;
-    }
-  }
-
-  int someData = 0x12345678;
-  write( sigPipe[1], &someData, sizeof(someData) );
-
-  write( gdbIn[1], "bt\nk\nq\n", 7 );
-
-
-  charsFound = 0;
-  promptFound = 0;
-  std::string bt;
-  while ( read( gdbOut[0], &byte, 1 ) == 1 )
-  {
-    bt += std::string( &byte, 1 );
-
-    if (
-      charsFound == 0 && byte == '(' ||
-      charsFound == 1 && byte == 'g' ||
-      charsFound == 2 && byte == 'd' ||
-      charsFound == 3 && byte == 'b' ||
-      charsFound == 4 && byte == ')' ||
-      charsFound == 5 && byte == ' '
-        )
-          charsFound++;
-    else
-      charsFound = 0;
-
-    if ( charsFound == 6 )
-    {
-      promptFound++;
-      charsFound = 0;
-      bt += "\n";
-    }
-
-    if ( promptFound == 3 )
-    {
-      break;
-    }
-  }
-
-
-  waitpid( sigPid, NULL, 0 );
-  waitpid( gdbPid, NULL, 0 );
-
-  int wsRemoved = 0;
-
-  while ( wsRemoved < 2 && bt.length() > 0 )
-  {
-    if ( bt[1] == '\n' )
-      wsRemoved++;
-    bt.erase(0, 1);
-  }
-
-  if ( bt.length() > 0 )
-    bt.erase(0, 1);
-
-  time_t now = time(NULL);
-
-  std::string timeString = "\n\n\n\n"
-                     "=======================================================\n"
-                     "= time: " + std::string(ctime(&now)) +
-         "=======================================================\n";
-  bt.insert(0, timeString);
-
-  FILE * f = fopen( getInstance()->fileName.c_str(), "a" );
-
-  if ( !f )
-  {
-    perror( ( std::string( "could not append to " ) + getInstance()->fileName ).c_str() );
-    exit(EXIT_FAILURE);
-  }
-
-  if ( fwrite( bt.c_str(), 1, bt.length(), f ) != bt.length() )
-  {
-    COUT(0) << "could not write " << bt.length() << " byte to " << getInstance()->fileName << std::endl;
-    exit(EXIT_FAILURE);
-  }
-
-  exit(EXIT_FAILURE);
-}
-
-void SignalHandler::registerCallback( SignalCallback cb, void * someData )
-{
-  SignalCallbackRec rec;
-  rec.cb = cb;
-  rec.someData = someData;
-
-  callbackList.push_back(rec);
-}
-
-#endif /* ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 */
Index: code/trunk/src/orxonox/SignalHandler.h
===================================================================
--- code/trunk/src/orxonox/SignalHandler.h	(revision 1937)
+++ 	(revision )
@@ -1,109 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Christoph Renner
- *   Co-authors:
- *      ...
- *
- */
-
-/**
-    @file SignalHandler.h
-    @brief Declaration of the SignalHandler class.
-*/
-
-#ifndef _SignalHandler_H__
-#define _SignalHandler_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <list>
-#include <string>
-
-typedef int (*SignalCallback)( void * someData );
-
-#if ORXONOX_PLATFORM != ORXONOX_PLATFORM_WIN32
-#include <signal.h>
-
-struct SignalRec
-{
-  int signal;
-  sig_t handler;
-};
-
-struct SignalCallbackRec
-{
-  SignalCallback cb;
-  void * someData;
-};
-
-
-typedef std::list<SignalRec> SignalRecList;
-typedef std::list<SignalCallbackRec> SignalCallbackList;
-
-class SignalHandler
-{
-  private:
-    SignalHandler();
-  public:
-    inline static SignalHandler* getInstance() { if (!SignalHandler::singletonRef) SignalHandler::singletonRef = new SignalHandler(); return SignalHandler::singletonRef; }
-    ~SignalHandler(){ SignalHandler::singletonRef = NULL; }
-
-    void registerCallback( SignalCallback cb, void * someData );
-
-    void doCatch( const std::string & appName, const std::string & fileName );
-    void dontCatch();
-
-  private:
-    static void sigHandler( int sig );
-
-    void catchSignal( int sig );
-    SignalRecList sigRecList;
-
-    SignalCallbackList callbackList;
-
-    static SignalHandler * singletonRef;
-
-    std::string appName;
-    std::string fileName;
-
-    // used to turn on KeyAutoRepeat if OIS crashes
-    static bool bXAutoKeyRepeatOn_;
-};
-
-#else /* ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 */
-
-class _OrxonoxExport SignalHandler
-{
-  public:
-    inline static SignalHandler* getInstance() { if (!SignalHandler::singletonRef) SignalHandler::singletonRef = new SignalHandler(); return SignalHandler::singletonRef; };
-    void doCatch( const std::string & appName, const std::string & fileName ) {};
-    void dontCatch() {};
-    void registerCallback( SignalCallback cb, void * someData ) {};
-
-  private:
-    static SignalHandler * singletonRef;
-};
-
-#endif /* ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 */
-
-#endif /* _SignalHandler_H__ */
Index: code/trunk/src/orxonox/gamestates/GSClient.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSClient.cc	(revision 1937)
+++ code/trunk/src/orxonox/gamestates/GSClient.cc	(revision 2087)
@@ -32,13 +32,13 @@
 #include "core/input/InputManager.h"
 #include "core/CommandLine.h"
+#include "core/Core.h"
 #include "network/Client.h"
-#include "Settings.h"
 
 namespace orxonox
 {
-    SetCommandLineArgument(ip, "127.0.0.1").setInformation("#.#.#.#");
+    SetCommandLineArgument(ip, "127.0.0.1").information("#.#.#.#");
 
     GSClient::GSClient()
-        : GSLevel("client")
+        : GameState<GSGraphics>("client")
         , client_(0)
     {
@@ -51,26 +51,19 @@
     void GSClient::enter()
     {
-        Settings::_getInstance().bIsClient_ = true;
+        Core::setIsClient(true);
 
-        GSLevel::enter();
-
-        int serverPort = CommandLine::getArgument<int>("port")->getValue();
-        std::string serverIP = CommandLine::getArgument<std::string>("ip")->getValue();
-        this->client_ = new network::Client(serverIP, serverPort);
+        this->client_ = new network::Client(CommandLine::getValue("ip").getString(), CommandLine::getValue("port"));
 
         if(!client_->establishConnection())
             ThrowException(InitialisationFailed, "Could not establish connection with server.");
 
+        GSLevel::enter(this->getParent()->getViewport());
+
         client_->tick(0);
-
-        // level is loaded: we can start capturing the input
-        InputManager::getInstance().requestEnterState("game");
     }
 
     void GSClient::leave()
     {
-        InputManager::getInstance().requestLeaveState("game");
-
-        // TODO: How do we unload the level in client mode?
+        GSLevel::leave();
 
         client_->closeConnection();
@@ -79,7 +72,5 @@
         delete this->client_;
 
-        GSLevel::leave();
-
-        Settings::_getInstance().bIsClient_ = false;
+        Core::setIsClient(false);
     }
 
Index: code/trunk/src/orxonox/gamestates/GSClient.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSClient.h	(revision 1937)
+++ code/trunk/src/orxonox/gamestates/GSClient.h	(revision 2087)
@@ -33,8 +33,9 @@
 #include "network/NetworkPrereqs.h"
 #include "GSLevel.h"
+#include "GSGraphics.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport GSClient : public GSLevel
+    class _OrxonoxExport GSClient : public GameState<GSGraphics>, public GSLevel
     {
     public:
Index: code/trunk/src/orxonox/gamestates/GSDedicated.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSDedicated.cc	(revision 1937)
+++ code/trunk/src/orxonox/gamestates/GSDedicated.cc	(revision 2087)
@@ -30,13 +30,7 @@
 #include "GSDedicated.h"
 
-#include <OgreRoot.h>
-#include <OgreSceneManager.h>
-#include "core/ConsoleCommand.h"
 #include "core/CommandLine.h"
-#include "core/Loader.h"
+#include "core/Core.h"
 #include "network/Server.h"
-#include "objects/Tickable.h"
-#include "GraphicsEngine.h"
-#include "Settings.h"
 
 namespace orxonox
@@ -44,8 +38,5 @@
     GSDedicated::GSDedicated()
         : GameState<GSRoot>("dedicated")
-        , timeFactor_(0)
         , server_(0)
-        , sceneManager_(0)
-        , startLevel_(0)
     {
     }
@@ -57,64 +48,29 @@
     void GSDedicated::enter()
     {
-        Settings::_getInstance().bHasServer_ = true;
+        Core::setHasServer(true);
 
-        // create Ogre SceneManager for the level
-        this->sceneManager_ = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC, "LevelSceneManager");
-        COUT(4) << "Created SceneManager: " << sceneManager_->getName() << std::endl;
+        this->server_ = new network::Server(CommandLine::getValue("port"));
+        COUT(0) << "Loading scene in server mode" << std::endl;
 
-        // temporary hack
-        GraphicsEngine::getInstance().setLevelSceneManager(this->sceneManager_);
-
-        // reset game speed to normal
-        timeFactor_ = 1.0f;
-
-        int serverPort = CommandLine::getArgument<int>("port")->getValue();
-        this->server_ = new network::Server(serverPort);
-
-        // call the loader
-        COUT(0) << "Loading level..." << std::endl;
-        startLevel_ = new Level(Settings::getDataPath() + "levels/sample.oxw");
-        Loader::open(startLevel_);
+        GSLevel::enter(0);
 
         server_->open();
-
-        // add console commands
-        FunctorMember01<GSDedicated, float>* functor = createFunctor(&GSDedicated::setTimeFactor);
-        functor->setObject(this);
-        CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor, "setTimeFactor")).accessLevel(AccessLevel::Offline).defaultValue(0, 1.0);;
     }
 
     void GSDedicated::leave()
     {
-        // TODO: Remove and destroy console command
-
-        Loader::unload(startLevel_);
-        delete this->startLevel_;
+        GSLevel::leave();
 
         this->server_->close();
         delete this->server_;
 
-        Ogre::Root::getSingleton().destroySceneManager(this->sceneManager_);
-
-        Settings::_getInstance().bHasServer_ = false;
+        Core::setHasServer(false);
     }
 
     void GSDedicated::ticked(const Clock& time)
     {
-        // Call the scene objects
-        for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ++it)
-            it->tick(time.getDeltaTime() * this->timeFactor_);
-
+        GSLevel::ticked(time);
         server_->tick(time.getDeltaTime());
         this->tickChild(time);
     }
-
-    /**
-    @brief
-        Changes the speed of Orxonox
-    */
-    void GSDedicated::setTimeFactor(float factor)
-    {
-        this->timeFactor_ = factor;
-    }
 }
Index: code/trunk/src/orxonox/gamestates/GSDedicated.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSDedicated.h	(revision 1937)
+++ code/trunk/src/orxonox/gamestates/GSDedicated.h	(revision 2087)
@@ -32,16 +32,14 @@
 #include "OrxonoxPrereqs.h"
 #include "network/NetworkPrereqs.h"
+#include "GSLevel.h"
 #include "GSRoot.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport GSDedicated : public GameState<GSRoot>
+    class _OrxonoxExport GSDedicated : public GameState<GSRoot>, public GSLevel
     {
     public:
         GSDedicated();
         ~GSDedicated();
-
-        void setTimeFactor(float factor);
-        float getTimeFactor() { return this->timeFactor_; }
 
     private:
@@ -50,11 +48,5 @@
         void ticked(const Clock& time);
 
-        void loadLevel();
-        void unloadLevel();
-
-        float                 timeFactor_;       //!< A factor to change the gamespeed
         network::Server*      server_;
-        Ogre::SceneManager*   sceneManager_;
-        Level*                startLevel_;       //!< current hard coded default level
     };
 }
Index: code/trunk/src/orxonox/gamestates/GSGUI.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSGUI.cc	(revision 1937)
+++ code/trunk/src/orxonox/gamestates/GSGUI.cc	(revision 2087)
@@ -31,5 +31,4 @@
 
 #include <OgreViewport.h>
-#include "GraphicsEngine.h"
 #include "core/input/InputManager.h"
 #include "core/input/SimpleInputState.h"
Index: code/trunk/src/orxonox/gamestates/GSGraphics.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSGraphics.cc	(revision 1937)
+++ code/trunk/src/orxonox/gamestates/GSGraphics.cc	(revision 2087)
@@ -47,10 +47,14 @@
 #include "core/ConfigValueIncludes.h"
 #include "core/CoreIncludes.h"
+#include "core/Core.h"
 #include "core/input/InputManager.h"
 #include "core/input/KeyBinder.h"
 #include "core/input/ExtendedInputState.h"
+#include "core/Loader.h"
+#include "core/XMLFile.h"
 #include "overlays/console/InGameConsole.h"
 #include "gui/GUIManager.h"
 #include "tools/WindowEventListener.h"
+#include "objects/Tickable.h"
 #include "Settings.h"
 
@@ -64,4 +68,5 @@
         , renderWindow_(0)
         , viewport_(0)
+        , bWindowEventListenerUpdateRequired_(false)
         , inputManager_(0)
         , console_(0)
@@ -76,4 +81,5 @@
         , statisticsStartCount_(0)
         , tickTime_(0)
+        , debugOverlay_(0)
     {
         RegisterRootObject(GSGraphics);
@@ -101,5 +107,5 @@
     void GSGraphics::enter()
     {
-        Settings::_getInstance().bShowsGraphics_ = true;
+        Core::setShowsGraphics(true);
 
         // initialise graphics engine. Doesn't load the render window yet!
@@ -113,10 +119,13 @@
         this->initialiseResources();
 
-
-        // HACK: temporary:
-        graphicsEngine_->renderWindow_  = this->renderWindow_;
-        graphicsEngine_->root_          = this->ogreRoot_;
-        graphicsEngine_->viewport_      = this->viewport_;
-
+        // We want to get informed whenever an object of type WindowEventListener is created
+        // in order to later update the window size.
+        bWindowEventListenerUpdateRequired_ = false;
+        RegisterConstructionCallback(GSGraphics, orxonox::WindowEventListener, requestWindowEventListenerUpdate);
+
+        // load debug overlay
+        COUT(3) << "Loading Debug Overlay..." << std::endl;
+        this->debugOverlay_ = new XMLFile(Settings::getDataPath() + "overlay/debug.oxo");
+        Loader::open(debugOverlay_);
 
         // Calls the InputManager which sets up the input devices.
@@ -133,5 +142,5 @@
         // Load the InGameConsole
         console_ = new InGameConsole();
-        console_->initialise();
+        console_->initialise(this->renderWindow_->getWidth(), this->renderWindow_->getHeight());
 
         // load the CEGUI interface
@@ -165,4 +174,7 @@
         //delete this->masterKeyBinder_;
         delete this->inputManager_;
+
+        Loader::unload(this->debugOverlay_);
+        delete this->debugOverlay_;
 
         // destroy render window
@@ -196,5 +208,5 @@
         delete graphicsEngine_;
 
-        Settings::_getInstance().bShowsGraphics_ = false;
+        Core::setShowsGraphics(false);
     }
 
@@ -221,5 +233,18 @@
         this->console_->tick(dt);
         this->tickChild(time);
-        
+
+        /*** HACK *** HACK ***/
+        // Call the Tickable objects
+        for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ++it)
+            it->tick(time.getDeltaTime());
+        /*** HACK *** HACK ***/
+
+        if (this->bWindowEventListenerUpdateRequired_)
+        {
+            // Update all WindowEventListeners for the case a new one was created.
+            this->windowResized(this->renderWindow_);
+            this->bWindowEventListenerUpdateRequired_ = false;
+        }
+
         unsigned long long timeAfterTick = time.getRealMicroseconds();
 
@@ -487,4 +512,8 @@
         for (ObjectList<orxonox::WindowEventListener>::iterator it = ObjectList<orxonox::WindowEventListener>::begin(); it; ++it)
             it->windowResized(this->renderWindow_->getWidth(), this->renderWindow_->getHeight());
+
+        // OIS needs this under linux even if we only use relative input measurement.
+        if (this->inputManager_)
+            this->inputManager_->setWindowExtents(renderWindow_->getWidth(), renderWindow_->getHeight());
     }
 
@@ -501,5 +530,6 @@
 
         // instruct InputManager to clear the buffers (core library so we cannot use the interface)
-        InputManager::getInstance().clearBuffers();
+        if (this->inputManager_)
+            this->inputManager_->clearBuffers();
     }
 
@@ -512,6 +542,4 @@
     void GSGraphics::windowClosed(Ogre::RenderWindow *rw)
     {
-        // using CommandExecutor in order to avoid depending on Orxonox.h.
-        //CommandExecutor::execute("exit", false);
         this->requestState("root");
     }
Index: code/trunk/src/orxonox/gamestates/GSGraphics.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSGraphics.h	(revision 1937)
+++ code/trunk/src/orxonox/gamestates/GSGraphics.h	(revision 2087)
@@ -77,7 +77,10 @@
         void windowClosed      (Ogre::RenderWindow* rw);
 
+        void requestWindowEventListenerUpdate() { this->bWindowEventListenerUpdateRequired_ = true; }
+
     private: // variables
         Ogre::RenderWindow*   renderWindow_;          //!< the current render window
         Ogre::Viewport*       viewport_;              //!< default full size viewport
+        bool bWindowEventListenerUpdateRequired_;     //!< True if a new WindowEventListener was created but not yet updated.
 
         // managed singletons
@@ -97,4 +100,5 @@
         unsigned long         statisticsStartCount_;
         unsigned int          tickTime_;
+        XMLFile*              debugOverlay_;
 
         // config values
Index: code/trunk/src/orxonox/gamestates/GSIOConsole.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSIOConsole.cc	(revision 1937)
+++ code/trunk/src/orxonox/gamestates/GSIOConsole.cc	(revision 2087)
@@ -36,6 +36,4 @@
 
 #include "core/ConsoleCommand.h"
-#include "core/TclThreadManager.h"
-#include "GraphicsEngine.h"
 
 namespace orxonox
Index: code/trunk/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSLevel.cc	(revision 1937)
+++ code/trunk/src/orxonox/gamestates/GSLevel.cc	(revision 2087)
@@ -30,10 +30,9 @@
 #include "GSLevel.h"
 
-#include <OgreSceneManager.h>
-#include <OgreRoot.h>
 #include "core/input/InputManager.h"
 #include "core/input/SimpleInputState.h"
 #include "core/input/KeyBinder.h"
 #include "core/Loader.h"
+#include "core/XMLFile.h"
 #include "core/CommandExecutor.h"
 #include "core/ConsoleCommand.h"
@@ -41,24 +40,26 @@
 #include "core/ConfigValueIncludes.h"
 #include "core/CoreIncludes.h"
-#include "objects/Backlight.h"
+#include "core/Core.h"
+//#include "objects/Backlight.h"
 #include "objects/Tickable.h"
 #include "objects/Radar.h"
-#include "tools/ParticleInterface.h"
+//#include "tools/ParticleInterface.h"
+#include "CameraManager.h"
+#include "LevelManager.h"
 #include "Settings.h"
-#include "GraphicsEngine.h"
 
 namespace orxonox
 {
-    SetCommandLineArgument(level, "sample.oxw").setShortcut("l");
-
-    GSLevel::GSLevel(const std::string& name)
-        : GameState<GSGraphics>(name)
-        , timeFactor_(1.0f)
-        , sceneManager_(0)
+    SetCommandLineArgument(level, "sample2.oxw").shortcut("l");
+
+    GSLevel::GSLevel()
+//        : GameState<GSGraphics>(name)
+        : timeFactor_(1.0f)
         , keyBinder_(0)
         , inputState_(0)
         , radar_(0)
-        , startLevel_(0)
-        , hud_(0)
+        , startFile_(0)
+        , cameraManager_(0)
+        , levelManager_(0)
     {
         RegisterObject(GSLevel);
@@ -75,48 +76,62 @@
     }
 
-    void GSLevel::enter()
-    {
-        inputState_ = InputManager::getInstance().createInputState<SimpleInputState>("game", 20);
-        keyBinder_ = new KeyBinder();
-        keyBinder_->loadBindings("keybindings.ini");
-        inputState_->setHandler(keyBinder_);
-
-        // create Ogre SceneManager for the level
-        this->sceneManager_ = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC, "LevelSceneManager");
-        COUT(4) << "Created SceneManager: " << sceneManager_->getName() << std::endl;
-
-        // temporary hack
-        GraphicsEngine::getInstance().setLevelSceneManager(this->sceneManager_);
-
-        // Start the Radar
-        this->radar_ = new Radar();
-
-        // Load the HUD
-        COUT(3) << "Orxonox: Loading HUD" << std::endl;
-        hud_ = new Level(Settings::getDataPath() + "overlay/hud.oxo");
-        Loader::load(hud_);
-
-        // reset game speed to normal
-        timeFactor_ = 1.0f;
-
-        // TODO: insert slomo console command with
-        // .accessLevel(AccessLevel::Offline).defaultValue(0, 1.0).axisParamIndex(0).isAxisRelative(false);
-
-        // keybind console command
-        FunctorMember<GSLevel>* functor1 = createFunctor(&GSLevel::keybind);
-        functor1->setObject(this);
-        CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor1, "keybind"));
-        FunctorMember<GSLevel>* functor2 = createFunctor(&GSLevel::tkeybind);
-        functor2->setObject(this);
-        CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor2, "tkeybind"));
-        // set our console command as callback for the key detector
-        InputManager::getInstance().setKeyDetectorCallback(std::string("keybind ") + keyDetectorCallbackCode_);
+    void GSLevel::enter(Ogre::Viewport* viewport)
+    {
+        if (Core::showsGraphics())
+        {
+            inputState_ = InputManager::getInstance().createInputState<SimpleInputState>("game", 20);
+            keyBinder_ = new KeyBinder();
+            keyBinder_->loadBindings("keybindings.ini");
+            inputState_->setHandler(keyBinder_);
+
+            // create the global CameraManager
+            assert(viewport);
+            this->cameraManager_ = new CameraManager(viewport);
+
+            // Start the Radar
+            this->radar_ = new Radar();
+        }
+
+        if (Core::isMaster())
+        {
+            // create the global LevelManager
+            this->levelManager_ = new LevelManager();
+
+            // reset game speed to normal
+            timeFactor_ = 1.0f;
+
+            this->loadLevel();
+        }
+
+        if (Core::showsGraphics())
+        {
+            // TODO: insert slomo console command with
+            // .accessLevel(AccessLevel::Offline).defaultValue(0, 1.0).axisParamIndex(0).isAxisRelative(false);
+
+            // keybind console command
+            FunctorMember<GSLevel>* functor1 = createFunctor(&GSLevel::keybind);
+            functor1->setObject(this);
+            CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor1, "keybind"));
+            FunctorMember<GSLevel>* functor2 = createFunctor(&GSLevel::tkeybind);
+            functor2->setObject(this);
+            CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor2, "tkeybind"));
+            // set our console command as callback for the key detector
+            InputManager::getInstance().setKeyDetectorCallback(std::string("keybind ") + keyDetectorCallbackCode_);
+
+            // level is loaded: we can start capturing the input
+            InputManager::getInstance().requestEnterState("game");
+        }
+
+        if (Core::isMaster())
+        {
+            // time factor console command
+            FunctorMember<GSLevel>* functor = createFunctor(&GSLevel::setTimeFactor);
+            functor->setObject(this);
+            CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor, "setTimeFactor")).accessLevel(AccessLevel::Offline).defaultValue(0, 1.0);;
+        }
     }
 
     void GSLevel::leave()
     {
-        Loader::unload(hud_);
-        delete this->hud_;
-
         // this call will delete every BaseObject!
         // But currently this will call methods of objects that exist no more
@@ -125,18 +140,34 @@
         //Loader::close();
 
-        delete this->radar_;
-
-        Ogre::Root::getSingleton().destroySceneManager(this->sceneManager_);
-
-        inputState_->setHandler(0);
-        InputManager::getInstance().requestDestroyState("game");
-        delete this->keyBinder_;
+        if (Core::showsGraphics())
+            InputManager::getInstance().requestLeaveState("game");
+
+        if (Core::isMaster())
+            this->unloadLevel();
+
+        if (this->radar_)
+            delete this->radar_;
+
+        if (this->cameraManager_)
+            delete this->cameraManager_;
+
+        if (this->levelManager_)
+            delete this->levelManager_;
+
+        if (Core::showsGraphics())
+        {
+            inputState_->setHandler(0);
+            InputManager::getInstance().requestDestroyState("game");
+            if (this->keyBinder_)
+                delete this->keyBinder_;
+        }
     }
 
     void GSLevel::ticked(const Clock& time)
     {
-        // Call the scene objects
-        for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ++it)
-            it->tick(time.getDeltaTime() * this->timeFactor_);
+        // Commented by 1337: Temporarily moved to GSGraphics.
+        //// Call the scene objects
+        //for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ++it)
+        //    it->tick(time.getDeltaTime() * this->timeFactor_);
     }
 
@@ -147,6 +178,9 @@
     void GSLevel::setTimeFactor(float factor)
     {
+/*
         float change = factor / this->timeFactor_;
+*/
         this->timeFactor_ = factor;
+/*
         for (ObjectList<ParticleInterface>::iterator it = ObjectList<ParticleInterface>::begin(); it; ++it)
             it->setSpeedFactor(it->getSpeedFactor() * change);
@@ -154,4 +188,5 @@
         for (ObjectList<Backlight>::iterator it = ObjectList<Backlight>::begin(); it; ++it)
             it->setTimeFactor(timeFactor_);
+*/
     }
 
@@ -162,12 +197,17 @@
         std::string levelName;
         CommandLine::getValue("level", &levelName);
-        startLevel_ = new Level(Settings::getDataPath() + std::string("levels/") + levelName);
-        Loader::open(startLevel_);
+        startFile_ = new XMLFile(Settings::getDataPath() + std::string("levels/") + levelName);
+        Loader::open(startFile_);
     }
 
     void GSLevel::unloadLevel()
     {
-        Loader::unload(startLevel_);
-        delete this->startLevel_;
+        //////////////////////////////////////////////////////////////////////////////////////////
+        // TODO // TODO // TODO // TODO // TODO // TODO // TODO // TODO // TODO // TODO // TODO //
+        //////////////////////////////////////////////////////////////////////////////////////////
+        // Loader::unload(startFile_); // TODO: REACTIVATE THIS IF LOADER::UNLOAD WORKS PROPERLY /
+        //////////////////////////////////////////////////////////////////////////////////////////
+
+        delete this->startFile_;
     }
 
@@ -192,33 +232,36 @@
     void GSLevel::keybindInternal(const std::string& command, bool bTemporary)
     {
-        static std::string bindingString = "";
-        static bool bTemporarySaved = false;
-        static bool bound = true;
-        // note: We use a long name to make 'sure' that the user doesn't use it accidentally.
-        // Howerver there will be no real issue if it happens anyway.
-        if (command.find(keyDetectorCallbackCode_) != 0)
-        {
-            if (bound)
+        if (Core::showsGraphics())
+        {
+            static std::string bindingString = "";
+            static bool bTemporarySaved = false;
+            static bool bound = true;
+            // note: We use a long name to make 'sure' that the user doesn't use it accidentally.
+            // Howerver there will be no real issue if it happens anyway.
+            if (command.find(keyDetectorCallbackCode_) != 0)
             {
-                COUT(0) << "Press any button/key or move a mouse/joystick axis" << std::endl;
-                InputManager::getInstance().requestEnterState("detector");
-                bindingString = command;
-                bTemporarySaved = bTemporary;
-                bound = false;
+                if (bound)
+                {
+                    COUT(0) << "Press any button/key or move a mouse/joystick axis" << std::endl;
+                    InputManager::getInstance().requestEnterState("detector");
+                    bindingString = command;
+                    bTemporarySaved = bTemporary;
+                    bound = false;
+                }
+                //else:  We're still in a keybind command. ignore this call.
             }
-            //else:  We're still in a keybind command. ignore this call.
-        }
-        else
-        {
-            if (!bound)
+            else
             {
-                // user has pressed the key
-                std::string name = command.substr(this->keyDetectorCallbackCode_.size());
-                COUT(0) << "Binding string \"" << bindingString << "\" on key '" << name << "'" << std::endl;
-                this->keyBinder_->setBinding(bindingString, name, bTemporarySaved);
-                InputManager::getInstance().requestLeaveState("detector");
-                bound = true;
+                if (!bound)
+                {
+                    // user has pressed the key
+                    std::string name = command.substr(this->keyDetectorCallbackCode_.size());
+                    COUT(0) << "Binding string \"" << bindingString << "\" on key '" << name << "'" << std::endl;
+                    this->keyBinder_->setBinding(bindingString, name, bTemporarySaved);
+                    InputManager::getInstance().requestLeaveState("detector");
+                    bound = true;
+                }
+                // else: A key was pressed within the same tick, ignore it.
             }
-            // else: A key was pressed within the same tick, ignore it.
         }
     }
Index: code/trunk/src/orxonox/gamestates/GSLevel.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSLevel.h	(revision 1937)
+++ code/trunk/src/orxonox/gamestates/GSLevel.h	(revision 2087)
@@ -37,10 +37,10 @@
 namespace orxonox
 {
-    class _OrxonoxExport GSLevel : public GameState<GSGraphics>, public OrxonoxClass
+    class _OrxonoxExport GSLevel : public OrxonoxClass //,public GameState<GSGraphics>
     {
         friend class ClassIdentifier<GSLevel>;
     public:
-        GSLevel(const std::string& name);
-        virtual ~GSLevel();
+        GSLevel();
+        ~GSLevel();
 
         // this has to be public because proteced triggers a bug in msvc
@@ -50,12 +50,12 @@
 
     protected:
-        virtual void enter();
-        virtual void leave();
-        virtual void ticked(const Clock& time);
+        void enter(Ogre::Viewport* viewport);
+        void leave();
+        void ticked(const Clock& time);
 
         void loadLevel();
         void unloadLevel();
 
-        float timeFactor_;       //!< A factor to change the gamespeed
+        float timeFactor_;       //!< A factor that sets the gamespeed. 1 is normal.
 
         // console commands
@@ -64,14 +64,14 @@
         void keybindInternal(const std::string& command, bool bTemporary);
 
-        Ogre::SceneManager*   sceneManager_;
         KeyBinder*            keyBinder_;        //!< tool that loads and manages the input bindings
         SimpleInputState*     inputState_;
         Radar*                radar_;            //!< represents the Radar (not the HUD part)
-        Level*                startLevel_;       //!< current hard coded default level
-        Level*                hud_;              //!< 'level' object fo the HUD
+        XMLFile*              startFile_;        //!< current hard coded default level
+        CameraManager*        cameraManager_;
+        LevelManager*         levelManager_;
 
         // config values
         std::string           keyDetectorCallbackCode_;
-        
+
     private:
         void setConfigValues();
Index: code/trunk/src/orxonox/gamestates/GSRoot.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSRoot.cc	(revision 1937)
+++ code/trunk/src/orxonox/gamestates/GSRoot.cc	(revision 2087)
@@ -41,5 +41,4 @@
 #include "core/TclThreadManager.h"
 #include "tools/Timer.h"
-#include "GraphicsEngine.h"
 #include "Settings.h"
 
@@ -61,6 +60,6 @@
 namespace orxonox
 {
-    SetCommandLineArgument(dataPath, "").setInformation("PATH");
-    SetCommandLineArgument(limitToCPU, 1).setInformation("0: off | #cpu");
+    SetCommandLineArgument(dataPath, "").information("PATH");
+    SetCommandLineArgument(limitToCPU, 1).information("0: off | #cpu");
 
     GSRoot::GSRoot()
@@ -91,6 +90,5 @@
         this->settings_ = new Settings();
 
-        std::string dataPath;
-        CommandLine::getValue("dataPath", &dataPath);
+        std::string dataPath = CommandLine::getValue("dataPath");
         if (dataPath != "")
         {
@@ -111,6 +109,5 @@
         // do this after ogre has initialised. Somehow Ogre changes the settings again (not through
         // the timer though).
-        int limitToCPU;
-        CommandLine::getValue("limitToCPU", &limitToCPU);
+        int limitToCPU = CommandLine::getValue("limitToCPU");
         if (limitToCPU > 0)
             setThreadAffinity((unsigned int)(limitToCPU - 1));
@@ -157,5 +154,5 @@
         Copyright (c) 2000-2008 Torus Knot Software Ltd
         
-        OGRE is licensed under the LGPL. For more info, see ogre license info.
+        OGRE is licensed under the LGPL. For more info, see OGRE license.
     */
     void GSRoot::setThreadAffinity(unsigned int limitToCPU)
Index: code/trunk/src/orxonox/gamestates/GSServer.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSServer.cc	(revision 1937)
+++ code/trunk/src/orxonox/gamestates/GSServer.cc	(revision 2087)
@@ -30,16 +30,14 @@
 #include "GSServer.h"
 
-#include "core/ConsoleCommand.h"
-#include "core/input/InputManager.h"
 #include "core/CommandLine.h"
+#include "core/Core.h"
 #include "network/Server.h"
-#include "Settings.h"
 
 namespace orxonox
 {
-    SetCommandLineArgument(port, 55556).setShortcut("p").setInformation("0-65535");
+    SetCommandLineArgument(port, 55556).shortcut("p").information("0-65535");
 
     GSServer::GSServer()
-        : GSLevel("server")
+        : GameState<GSGraphics>("server")
         , server_(0)
     {
@@ -52,39 +50,22 @@
     void GSServer::enter()
     {
-        Settings::_getInstance().bHasServer_ = true;
+        Core::setHasServer(true);
 
-        GSLevel::enter();
-
-        int serverPort = CommandLine::getArgument<int>("port")->getValue();
-        this->server_ = new network::Server(serverPort);
+        this->server_ = new network::Server(CommandLine::getValue("port"));
         COUT(0) << "Loading scene in server mode" << std::endl;
 
-        this->loadLevel();
+        GSLevel::enter(this->getParent()->getViewport());
 
         server_->open();
-
-        // add console commands
-        FunctorMember<GSLevel>* functor = createFunctor(&GSLevel::setTimeFactor);
-        functor->setObject(this);
-        CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor, "setTimeFactor")).accessLevel(AccessLevel::Offline).defaultValue(0, 1.0);;
-
-        // level is loaded: we can start capturing the input
-        InputManager::getInstance().requestEnterState("game");
     }
 
     void GSServer::leave()
     {
-        InputManager::getInstance().requestLeaveState("game");
-
-        // TODO: Remove and destroy console command
-
-        this->unloadLevel();
+        GSLevel::leave();
 
         this->server_->close();
         delete this->server_;
 
-        GSLevel::leave();
-	
-        Settings::_getInstance().bHasServer_ = false;
+        Core::setHasServer(false);
     }
 
Index: code/trunk/src/orxonox/gamestates/GSServer.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSServer.h	(revision 1937)
+++ code/trunk/src/orxonox/gamestates/GSServer.h	(revision 2087)
@@ -33,13 +33,13 @@
 #include "network/NetworkPrereqs.h"
 #include "GSLevel.h"
+#include "GSGraphics.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport GSServer : public GSLevel
+    class _OrxonoxExport GSServer : public GameState<GSGraphics>, public GSLevel
     {
     public:
         GSServer();
         ~GSServer();
-
 
     private:
Index: code/trunk/src/orxonox/gamestates/GSStandalone.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSStandalone.cc	(revision 1937)
+++ code/trunk/src/orxonox/gamestates/GSStandalone.cc	(revision 2087)
@@ -30,11 +30,10 @@
 #include "GSStandalone.h"
 
-#include "core/input/InputManager.h"
-#include "core/ConsoleCommand.h"
+#include "core/Core.h"
 
 namespace orxonox
 {
     GSStandalone::GSStandalone()
-        : GSLevel("standalone")
+        : GameState<GSGraphics>("standalone")
     {
     }
@@ -46,26 +45,14 @@
     void GSStandalone::enter()
     {
-        GSLevel::enter();
+        Core::setIsStandalone(true);
 
-        this->loadLevel();
-
-        // add console commands
-        FunctorMember<GSLevel>* functor = createFunctor(&GSLevel::setTimeFactor);
-        functor->setObject(this);
-        CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor, "setTimeFactor")).accessLevel(AccessLevel::Offline).defaultValue(0, 1.0);;
-
-        // level is loaded: we can start capturing the input
-        InputManager::getInstance().requestEnterState("game");
+        GSLevel::enter(this->getParent()->getViewport());
     }
 
     void GSStandalone::leave()
     {
-        InputManager::getInstance().requestLeaveState("game");
+        GSLevel::leave();
 
-        // TODO: Remove and destroy console command
-
-        this->unloadLevel();
-
-        GSLevel::leave();
+        Core::setIsStandalone(false);
     }
 
Index: code/trunk/src/orxonox/gamestates/GSStandalone.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSStandalone.h	(revision 1937)
+++ code/trunk/src/orxonox/gamestates/GSStandalone.h	(revision 2087)
@@ -32,8 +32,9 @@
 #include "OrxonoxPrereqs.h"
 #include "GSLevel.h"
+#include "GSGraphics.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport GSStandalone : public GSLevel
+    class _OrxonoxExport GSStandalone : public GameState<GSGraphics>, public GSLevel
     {
     public:
Index: code/trunk/src/orxonox/gui/GUIManager.cc
===================================================================
--- code/trunk/src/orxonox/gui/GUIManager.cc	(revision 1937)
+++ code/trunk/src/orxonox/gui/GUIManager.cc	(revision 2087)
@@ -47,5 +47,4 @@
 #include "core/Core.h"
 #include "tolua/tolua_bind.h"
-#include "GraphicsEngine.h"
 #include "OgreCEGUIRenderer.h"
 
Index: code/trunk/src/orxonox/gui/OgreCEGUIRenderer.cpp
===================================================================
--- code/trunk/src/orxonox/gui/OgreCEGUIRenderer.cpp	(revision 1937)
+++ code/trunk/src/orxonox/gui/OgreCEGUIRenderer.cpp	(revision 2087)
@@ -25,4 +25,5 @@
 *************************************************************************/
 
+#include "OrxonoxStableHeaders.h"
 #include <CEGUIImagesetManager.h>
 #include <CEGUIImageset.h>
Index: code/trunk/src/orxonox/gui/OgreCEGUIResourceProvider.cpp
===================================================================
--- code/trunk/src/orxonox/gui/OgreCEGUIResourceProvider.cpp	(revision 1937)
+++ code/trunk/src/orxonox/gui/OgreCEGUIResourceProvider.cpp	(revision 2087)
@@ -24,4 +24,5 @@
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *************************************************************************/
+#include "OrxonoxStableHeaders.h"
 #include "OgreCEGUIResourceProvider.h"
 
Index: code/trunk/src/orxonox/gui/OgreCEGUITexture.cpp
===================================================================
--- code/trunk/src/orxonox/gui/OgreCEGUITexture.cpp	(revision 1937)
+++ code/trunk/src/orxonox/gui/OgreCEGUITexture.cpp	(revision 2087)
@@ -25,4 +25,5 @@
 *************************************************************************/
 
+#include "OrxonoxStableHeaders.h"
 #include <CEGUISystem.h>
 #include <CEGUIExceptions.h>
Index: code/trunk/src/orxonox/objects/Ambient.cc
===================================================================
--- code/trunk/src/orxonox/objects/Ambient.cc	(revision 1937)
+++ 	(revision )
@@ -1,102 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      ...
- *   Co-authors:
- *      ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "Ambient.h"
-
-#include <vector>
-#include <string>
-
-#include <OgreSceneManager.h>
-
-#include "tinyxml/tinyxml.h"
-#include "util/SubString.h"
-#include "util/Math.h"
-#include "util/Debug.h"
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "core/ConsoleCommand.h"
-#include "Settings.h"
-#include "GraphicsEngine.h"
-
-namespace orxonox
-{
-    SetConsoleCommandAlias(Ambient, setAmbientLightTest, "setAmbientLight", false).defaultValues(ColourValue(1, 1, 1, 1)).accessLevel(AccessLevel::Offline);
-
-    CreateFactory(Ambient);
-
-    Ambient* Ambient::instance_s;
-
-    Ambient::Ambient()
-    {
-        RegisterObject(Ambient);
-        Ambient::instance_s = this;
-        registerAllVariables();
-    }
-
-    Ambient::~Ambient()
-    {
-    }
-
-    bool Ambient::create()
-    {
-        if (Settings::showsGraphics())
-            GraphicsEngine::getInstance().getLevelSceneManager()->setAmbientLight(ambientLight_);
-        return Synchronisable::create();
-    }
-
-    void Ambient::registerAllVariables()
-    {
-        registerVar(&ambientLight_, sizeof(ColourValue), network::DATA);
-    }
-
-    void Ambient::setAmbientLight(const ColourValue& colour)
-    {
-        if (Settings::showsGraphics())
-            GraphicsEngine::getInstance().getLevelSceneManager()->setAmbientLight(colour);
-        ambientLight_ = colour;
-    }
-
-    /**
-    @brief
-        XML loading and saving.
-    @param
-        xmlelement The XML-element
-    @param
-        loading Loading (true) or saving (false)
-    @return
-        The XML-element
-    */
-    void Ambient::XMLPort(Element& xmlelement, XMLPort::Mode mode)
-    {
-        SUPER(Ambient, XMLPort, xmlelement, mode);
-
-        XMLPortParam(Ambient, "colourvalue", setAmbientLight, getAmbienetLight, xmlelement, mode);
-        create();
-    }
-}
Index: code/trunk/src/orxonox/objects/Ambient.h
===================================================================
--- code/trunk/src/orxonox/objects/Ambient.h	(revision 1937)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _Ambient_H__
-#define _Ambient_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "util/Math.h"
-#include "core/BaseObject.h"
-#include "network/Synchronisable.h"
-
-namespace orxonox
-{
-    class _OrxonoxExport Ambient : public BaseObject, public network::Synchronisable
-    {
-        public:
-            Ambient();
-            virtual ~Ambient();
-
-            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-            virtual bool create();
-            void registerAllVariables();
-
-            void setAmbientLight(const ColourValue& colour);
-            inline const ColourValue& getAmbienetLight() const
-                { return this->ambientLight_; }
-
-            static void setAmbientLightTest(const ColourValue& colour)
-                { Ambient::instance_s->setAmbientLight(colour); }
-
-        private:
-            static Ambient* instance_s;
-            ColourValue ambientLight_;
-
-    };
-}
-
-#endif /* _Ambient_H__ */
Index: code/trunk/src/orxonox/objects/Backlight.cc
===================================================================
--- code/trunk/src/orxonox/objects/Backlight.cc	(revision 1937)
+++ 	(revision )
@@ -1,170 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "Backlight.h"
-
-#include <OgreBillboard.h>
-#include <OgreRibbonTrail.h>
-#include <OgreSceneManager.h>
-
-#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
-#include "core/Executor.h"
-#include "util/Math.h"
-#include "GraphicsEngine.h"
-
-namespace orxonox
-{
-    CreateFactory(Backlight);
-
-    float Backlight::timeFactor_s = 1.0;
-
-    Backlight::Backlight(float maxspeed, float brakingtime, float scale)
-    {
-        RegisterObject(Backlight);
-
-        this->setConfigValues();
-        this->traillength_ = 1;
-
-        this->configure(maxspeed, brakingtime, scale);
-    }
-    
-    bool Backlight::create(){
-      if(!WorldEntity::create())
-        return false;
-      
-      this->getNode()->setInheritScale(false);
-
-      this->billboard_.setBillboardSet("Flares/backlightflare");
-      this->attachObject(this->billboard_.getBillboardSet());
-
-      this->ribbonTrail_ = GraphicsEngine::getInstance().getLevelSceneManager()->createRibbonTrail(this->getName() + "RibbonTrail");
-      this->ribbonTrailNode_ = GraphicsEngine::getInstance().getLevelSceneManager()->getRootSceneNode()->createChildSceneNode(this->getName() + "RibbonTrailNode");
-      this->ribbonTrailNode_->attachObject(this->ribbonTrail_);
-      this->ribbonTrail_->addNode(this->getNode());
-
-
-      this->ribbonTrail_->setTrailLength(this->maxTraillength_);
-      this->ribbonTrail_->setMaterialName("Trail/backlighttrail");
-
-        //this->setTimeFactor(Orxonox::getInstance().getTimeFactor());
-      this->setTimeFactor(1.0f);
-      
-      this->ribbonTrail_->setMaxChainElements(this->maxTrailsegments_);
-      this->ribbonTrail_->setTrailLength(this->traillength_ = 2 * this->maxTrailsegments_);
-      this->ribbonTrail_->setInitialWidth(0, this->width_ * this->getScale());
-      this->ribbonTrail_->setWidthChange(0, this->width_ * this->getScale() / this->maxLifeTime_ * Backlight::timeFactor_s);
-      return true;
-    }
-
-    Backlight::~Backlight()
-    {
-        if (this->isInitialized())
-        {
-            this->detachObject(this->billboard_.getBillboardSet());
-            GraphicsEngine::getInstance().getLevelSceneManager()->destroySceneNode(this->getName() + "RibbonTrailNode");
-            GraphicsEngine::getInstance().getLevelSceneManager()->destroyRibbonTrail(this->ribbonTrail_);
-        }
-    }
-
-    void Backlight::setConfigValues()
-    {
-        SetConfigValue(maxLifeTime_, 4.0).description("The maximal amount of seconds the trail behind a SpaceShip stays visible");
-        SetConfigValue(trailSegmentLength_, 50).description("The length of one segment of the trail behind a SpaceShip (lower values make it more smooth)");
-        SetConfigValue(width_, 7.0).description("The width of the trail");
-    }
-
-    void Backlight::setTimeFactor(float factor)
-    {
-        Backlight::timeFactor_s = factor;
-        float change = Backlight::timeFactor_s / this->maxLifeTime_;
-        this->ribbonTrail_->setWidthChange(0, this->width_ * change);
-        this->updateColourChange();
-    }
-
-    void Backlight::updateColourChange()
-    {
-        this->ribbonTrail_->setColourChange(0, ColourValue(0, 0, 0, this->maxTraillength_ / this->traillength_ / this->maxLifeTime_ * Backlight::timeFactor_s));
-    }
-    
-    
-    void Backlight::XMLPort(Element& xmlelement, XMLPort::Mode mode){
-      SUPER(Backlight, XMLPort, xmlelement, mode);
-      
-      Backlight::create();
-    }
-
-    void Backlight::tick(float dt)
-    {
-        SUPER(Backlight, tick, dt);
-
-        if (this->isActive())
-        {
-            if (this->traillength_ < this->maxTraillength_)
-            {
-                this->traillength_ = min<float>(this->maxTraillength_, this->traillength_ + dt * this->maxTraillength_ / this->maxLifeTime_);
-                this->updateColourChange();
-            }
-        }
-        else
-        {
-            if (this->traillength_ > 1)
-            {
-                this->traillength_ = max<float>(1, this->traillength_ - this->brakefactor_ * dt * this->maxTraillength_ / this->maxLifeTime_);
-                this->updateColourChange();
-            }
-        }
-
-        this->ribbonTrail_->setTrailLength(this->traillength_);
-    }
-
-    void Backlight::setColour(const ColourValue& colour)
-    {
-        this->billboard_.getBillboardSet()->getBillboard(0)->setColour(colour);
-        this->ribbonTrail_->setInitialColour(0, ColourValue(colour.r / 4 + 0.75, colour.g / 4 + 0.75, colour.b / 4 + 0.75));
-    }
-
-    void Backlight::configure(float maxspeed, float brakingtime, float scale)
-    {
-        this->maxTraillength_ = this->maxLifeTime_ * maxspeed;
-        this->maxTrailsegments_ = (size_t)(this->maxTraillength_ / this->trailSegmentLength_);
-
-        this->brakefactor_ = this->maxLifeTime_ / brakingtime;
-
-        this->scale(scale);
-    }
-
-    void Backlight::changedVisibility()
-    {
-        SUPER(Backlight, changedVisibility);
-
-        this->billboard_.setVisible(this->isVisible());
-        this->ribbonTrail_->setVisible(this->isVisible());
-    }
-}
Index: code/trunk/src/orxonox/objects/Backlight.h
===================================================================
--- code/trunk/src/orxonox/objects/Backlight.h	(revision 1937)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _Backlight_H__
-#define _Backlight_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "WorldEntity.h"
-#include "tools/Timer.h"
-#include "tools/BillboardSet.h"
-
-namespace orxonox
-{
-    class _OrxonoxExport Backlight : public WorldEntity
-    {
-        public:
-            Backlight(float maxspeed = 1.0, float brakingtime = 1.0, float scale = 1.0);
-            virtual ~Backlight();
-
-            void setConfigValues();
-            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-            virtual void tick(float dt);
-            virtual void changedVisibility();
-            virtual bool create();
-
-            void setColour(const ColourValue& colour);
-            void setTimeFactor(float factor);
-
-        private:
-            void configure(float maxspeed, float brakingtime, float scale = 1);
-            void updateColourChange();
-
-            static float timeFactor_s;
-            BillboardSet billboard_;
-            Ogre::SceneNode* ribbonTrailNode_;
-            Ogre::RibbonTrail* ribbonTrail_;
-
-            float maxLifeTime_;
-            float trailSegmentLength_;
-            float width_;
-
-            float brakefactor_;
-
-            float maxTraillength_;
-            float traillength_;
-
-            size_t maxTrailsegments_;
-    };
-}
-
-#endif /* _Backlight_H__ */
Index: code/trunk/src/orxonox/objects/BillboardProjectile.cc
===================================================================
--- code/trunk/src/orxonox/objects/BillboardProjectile.cc	(revision 1937)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "BillboardProjectile.h"
-
-#include <OgreBillboard.h>
-
-#include "core/CoreIncludes.h"
-
-namespace orxonox
-{
-    CreateFactory(BillboardProjectile);
-
-    BillboardProjectile::BillboardProjectile(SpaceShip* owner) : Projectile(owner)
-    {
-        RegisterObject(BillboardProjectile);
-
-        this->billboard_.setBillboardSet("Examples/Flare", ColourValue(1.0, 1.0, 0.5), 1);
-        this->attachObject(this->billboard_.getBillboardSet());
-        this->scale(0.5);
-    }
-
-    BillboardProjectile::~BillboardProjectile()
-    {
-        if (this->isInitialized() && this->owner_)
-            this->detachObject(this->billboard_.getBillboardSet());
-    }
-
-    void BillboardProjectile::setColour(const ColourValue& colour)
-    {
-        this->billboard_.getBillboardSet()->getBillboard(0)->setColour(colour);
-    }
-
-    void BillboardProjectile::changedVisibility()
-    {
-        SUPER(BillboardProjectile, changedVisibility);
-        this->billboard_.setVisible(this->isVisible());
-    }
-}
Index: code/trunk/src/orxonox/objects/BillboardProjectile.h
===================================================================
--- code/trunk/src/orxonox/objects/BillboardProjectile.h	(revision 1937)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _BillboardProjectile_H__
-#define _BillboardProjectile_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "Projectile.h"
-#include "tools/BillboardSet.h"
-#include "util/Math.h"
-
-namespace orxonox
-{
-    class _OrxonoxExport BillboardProjectile : public Projectile
-    {
-        public:
-            BillboardProjectile(SpaceShip* owner = 0);
-            virtual ~BillboardProjectile();
-
-            virtual void setColour(const ColourValue& colour);
-            virtual void changedVisibility();
-
-        private:
-            BillboardSet billboard_;
-    };
-}
-
-#endif /* _BillboardProjectile_H__ */
Index: code/trunk/src/orxonox/objects/Camera.cc
===================================================================
--- code/trunk/src/orxonox/objects/Camera.cc	(revision 1937)
+++ 	(revision )
@@ -1,121 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      Benjamin Knecht
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "Camera.h"
-#include "CameraHandler.h"
-
-#include <string>
-
-#include <OgreSceneManager.h>
-#include <OgreSceneNode.h>
-#include <OgreRenderWindow.h>
-#include <OgreViewport.h>
-
-#include "tinyxml/tinyxml.h"
-#include "util/SubString.h"
-#include "util/Math.h"
-#include "util/Debug.h"
-#include "core/CoreIncludes.h"
-#include "GraphicsEngine.h"
-
-namespace orxonox
-{
-
-  Camera::Camera(Ogre::SceneNode* node)
-  {
-    this->bHasFocus_ = false;
-    this->cameraNode_ = GraphicsEngine::getInstance().getLevelSceneManager()->getRootSceneNode()->createChildSceneNode(node->getName() + "Camera");
-    if( node != NULL )
-      this->setPositionNode(node);
-  }
-
-  Camera::~Camera()
-  {
-    CameraHandler::getInstance()->releaseFocus(this);
-    GraphicsEngine::getInstance().getLevelSceneManager()->getRootSceneNode()->removeAndDestroyChild(cameraNode_->getName());
-  }
-
-  void Camera::setPositionNode(Ogre::SceneNode* node)
-  {
-    this->positionNode_ = node;
-    // set camera to node values according to camera mode
-  }
-
-  void Camera::setTargetNode(Ogre::SceneNode* obj)
-  {
-    this->targetNode_ = obj;
-  }
-
-  void Camera::tick(float dt)
-  {
-    if (this->positionNode_ != NULL)
-    {
-      // this stuff here may need some adjustments
-      Vector3 offset = this->positionNode_->getWorldPosition() - this->cameraNode_->getWorldPosition();
-      float coeff = 15.0f * dt;
-      if (coeff > 1.0f)
-        coeff = 1.0f;
-
-      this->cameraNode_->translate(coeff * offset);
-
-      this->cameraNode_->setOrientation(Quaternion::Slerp(1-coeff, this->positionNode_->getWorldOrientation(), this->cameraNode_->getWorldOrientation(), false));
-    }
-  }
-
-  /**
-    don't move anything before here! here the Ogre camera is set to values of this camera
-    always call update after changes
-  */
-  void Camera::update()
-  {
-    if(this->positionNode_ != NULL)
-    {
-      this->cameraNode_->setPosition(this->positionNode_->getWorldPosition());
-      this->cameraNode_->setOrientation(this->positionNode_->getWorldOrientation());
-    }
-  }
-
-  /**
-    what to do when camera loses focus (do not request focus in this function!!)
-    this is called by the CameraHandler singleton class to notify the camera
-  */
-  void Camera::removeFocus()
-  {
-    this->bHasFocus_ = false;
-    this->cameraNode_->detachObject(this->cam_);
-  }
-
-  void Camera::setFocus(Ogre::Camera* ogreCam)
-  {
-    this->bHasFocus_ = true;
-    this->cam_ = ogreCam;
-    this->cam_->setOrientation(this->cameraNode_->getWorldOrientation());
-    this->cameraNode_->attachObject(this->cam_);
-  }
-}
Index: code/trunk/src/orxonox/objects/Camera.h
===================================================================
--- code/trunk/src/orxonox/objects/Camera.h	(revision 1937)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      Benjamin Knecht
- *
- */
-
-#ifndef _Camera_H__
-#define _Camera_H__
-
-#include <OgrePrerequisites.h>
-#include <OgreSceneNode.h>
-#include <OgreCamera.h>
-
-#include "OrxonoxPrereqs.h"
-
-namespace orxonox
-{
-    class _OrxonoxExport Camera
-    {
-      friend class CameraHandler;
-      public:
-        Camera(Ogre::SceneNode* node = NULL);
-        virtual ~Camera();
-
-        void setPositionNode(Ogre::SceneNode* node);
-        inline Ogre::SceneNode* getCameraNode() { return this->positionNode_; }
-        // maybe also BaseObject
-        void setTargetNode(Ogre::SceneNode* obj);
-
-        Ogre::Camera* cam_;
-
-        void tick(float dt);
-        void update();
-        inline bool hasFocus() { return this->bHasFocus_; }
-
-      private:
-        void removeFocus();
-        void setFocus(Ogre::Camera* ogreCam);
-
-      private:
-        Ogre::SceneNode* targetNode_;
-        Ogre::SceneNode* positionNode_;
-        Ogre::SceneNode* cameraNode_;
-        Ogre::Vector3 oldPos;
-        bool bHasFocus_;
-    };
-}
-
-#endif /* _Camera_H__ */
Index: code/trunk/src/orxonox/objects/CameraHandler.cc
===================================================================
--- code/trunk/src/orxonox/objects/CameraHandler.cc	(revision 1937)
+++ 	(revision )
@@ -1,96 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Benjamin Knecht
- *   Co-authors:
- *      ...
- *
- */
-#include "OrxonoxStableHeaders.h"
-#include "CameraHandler.h"
-
-#include <OgreSceneManager.h>
-#include <OgreRenderWindow.h>
-
-#include "core/ObjectList.h"
-#include "Camera.h"
-#include "GraphicsEngine.h"
-
-#include <OgreCamera.h>
-
-namespace orxonox {
-
-  CameraHandler* CameraHandler::singletonRef = NULL;
-
-  CameraHandler::CameraHandler()
-  {
-    this->cam_ = GraphicsEngine::getInstance().getLevelSceneManager()->createCamera("Cam");
-    GraphicsEngine::getInstance().getViewport()->setCamera(this->cam_);
-    //GraphicsEngine::getInstance().getRenderWindow()->addViewport(this->cam_, 2, 0.4, 0.4, 0.2, 0.2);
-    /*this->activeCamera_ = *ObjectList<Camera>::begin();
-    this->activeCamera_->cam_ = this->cam_;*/
-  }
-
-  void CameraHandler::requestFocus(Camera* requestCam)
-  {
-    // notify old camera (if it exists)
-    if(focusList_.size() > 0)
-      focusList_.back()->removeFocus();
-    // add to list
-    focusList_.push_back(requestCam);
-    // set focus to new camera and update (if necessary)
-    if(!requestCam->hasFocus()) {
-      requestCam->setFocus(this->cam_);
-      requestCam->update();
-    }
-    // delete dublicates
-    focusList_.unique();
-  }
-
-  void CameraHandler::releaseFocus(Camera* cam)
-  {
-    // notify the cam of releasing the focus
-    if(cam->hasFocus())
-      cam->removeFocus();
-    // delete camera from list
-    focusList_.remove(cam);
-    // set new focus if necessary
-    if(focusList_.size() > 0 && !(focusList_.back()->hasFocus()))
-      focusList_.back()->setFocus(this->cam_);
-  }
-/*
-  void CameraHandler::changeActiveCamera(Camera* setCam)
-  {
-    cam_->getParentSceneNode()->detachObject(cam_);
-    //setCam->attachCamera(cam_);
-    activeCamera_ = setCam;
-  }
-*/
-/*  bool isInVector(Camera* cam)
-  {
-    for(std::vector<Camera*>::iterator it = cams_.begin(); it != cams_.end(); it++)
-    {
-      if (*it == cam) return true;
-    }
-    return false;
-  }*/
-}
Index: code/trunk/src/orxonox/objects/CameraHandler.h
===================================================================
--- code/trunk/src/orxonox/objects/CameraHandler.h	(revision 1937)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Benjamin Knecht
- *   Co-authors:
- *      ...
- *
- */
-
- /**
- @file  CameraHandler.h
- @brief Handles the instances of Camera class
- @author Benjamin Knecht <beni_at_orxonox.net>
-  */
-
-#ifndef _Camera_Handler_H__
-#define _Camera_Handler_H__
-
-#include <list>
-
-#include <OgreCamera.h>
-
-#include "OrxonoxPrereqs.h"
-
-#include "core/BaseObject.h"
-
-#include "Camera.h"
-
-namespace orxonox
-{
-  class _OrxonoxExport CameraHandler
-  {
-
-    public:
-      inline static CameraHandler* getInstance() { if (!CameraHandler::singletonRef) CameraHandler::singletonRef = new CameraHandler(); return CameraHandler::singletonRef; }
-      inline ~CameraHandler() { CameraHandler::singletonRef = NULL; }
-      inline Camera* getActiveCamera() { return this->focusList_.back(); }
-      /*void registerCamera(Camera* newCam);
-      void changeActiveCamera(Camera* setCam);*/
-      void requestFocus(Camera* requestCam);
-      void releaseFocus(Camera* cam);
-
-    private:
-      CameraHandler();
-      //bool isInVector(Camera* cam);
-
-    private:
-      static CameraHandler* singletonRef;
-      Ogre::Camera* cam_;
-      std::list<Camera*> focusList_;
-      //std::vector<Camera*> cams_;
-
-  };
-}
-
-#endif /* _Camera_Handler_H__ */
Index: code/trunk/src/orxonox/objects/EventDispatcher.cc
===================================================================
--- code/trunk/src/orxonox/objects/EventDispatcher.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/EventDispatcher.cc	(revision 2087)
@@ -0,0 +1,83 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "EventDispatcher.h"
+
+#include "core/CoreIncludes.h"
+#include "core/EventIncludes.h"
+#include "core/XMLPort.h"
+#include "core/EventIncludes.h"
+#include "EventTarget.h"
+
+namespace orxonox
+{
+    CreateFactory(EventDispatcher);
+
+    EventDispatcher::EventDispatcher(BaseObject* creator) : BaseObject(creator)
+    {
+        RegisterObject(EventDispatcher);
+    }
+
+    EventDispatcher::~EventDispatcher()
+    {
+        if (this->isInitialized())
+            for (std::list<EventTarget*>::iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)
+                delete (*it);
+    }
+
+    void EventDispatcher::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(EventDispatcher, XMLPort, xmlelement, mode);
+
+        XMLPortObject(EventDispatcher, EventTarget, "targets", addTarget, getTarget, xmlelement, mode);
+    }
+
+    void EventDispatcher::processEvent(Event& event)
+    {
+        for (std::list<EventTarget*>::iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)
+            (*it)->fireEvent(event);
+    }
+
+    void EventDispatcher::addTarget(EventTarget* target)
+    {
+        this->targets_.push_back(target);
+    }
+
+    EventTarget* EventDispatcher::getTarget(unsigned int index) const
+    {
+        unsigned int i = 0;
+        for (std::list<EventTarget*>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)
+        {
+            if (i == index)
+                return (*it);
+            ++i;
+        }
+        return 0;
+    }
+}
Index: code/trunk/src/orxonox/objects/EventDispatcher.h
===================================================================
--- code/trunk/src/orxonox/objects/EventDispatcher.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/EventDispatcher.h	(revision 2087)
@@ -0,0 +1,55 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _EventDispatcher_H__
+#define _EventDispatcher_H__
+
+#include "OrxonoxPrereqs.h"
+#include "core/BaseObject.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport EventDispatcher : public BaseObject
+    {
+        public:
+            EventDispatcher(BaseObject* creator);
+            virtual ~EventDispatcher();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            virtual void processEvent(Event& event);
+
+            void addTarget(EventTarget* target);
+            EventTarget* getTarget(unsigned int index) const;
+
+        private:
+            std::list<EventTarget*> targets_;
+    };
+}
+
+#endif /* _EventDispatcher_H__ */
Index: code/trunk/src/orxonox/objects/EventListener.cc
===================================================================
--- code/trunk/src/orxonox/objects/EventListener.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/EventListener.cc	(revision 2087)
@@ -0,0 +1,98 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "EventListener.h"
+
+#include "core/CoreIncludes.h"
+#include "core/EventIncludes.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+    CreateFactory(EventListener);
+
+    EventListener::EventListener(BaseObject* creator) : BaseObject(creator)
+    {
+        RegisterObject(EventListener);
+
+        this->bActive_ = false;
+    }
+
+    EventListener::~EventListener()
+    {
+    }
+
+    void EventListener::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(EventListener, XMLPort, xmlelement, mode);
+
+        XMLPortParam(EventListener, "event", setEventName, getEventName, xmlelement, mode);
+    }
+
+    void EventListener::processEvent(Event& event)
+    {
+        if (this->bActive_)
+        {
+            COUT(2) << "Warning: Detected Event loop in EventListener \"" << this->getName() << "\"" << std::endl;
+            return;
+        }
+
+        this->bActive_ = true;
+
+        this->fireEvent(event.activate_, event.originator_);
+
+        this->bActive_ = false;
+    }
+
+    void EventListener::setEventName(const std::string& eventname)
+    {
+        this->eventName_ = eventname;
+
+        if (this->eventName_ == "")
+            return;
+
+        for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)
+            if (it->getName() == this->eventName_)
+                this->registerAsListener(*it);
+    }
+
+    void EventListener::loadedNewXMLName(BaseObject* object)
+    {
+        if (this->eventName_ == "")
+            return;
+
+        if (object->getName() == this->eventName_)
+            this->registerAsListener(object);
+    }
+
+    void EventListener::registerAsListener(BaseObject* object)
+    {
+        object->registerEventListener(this, "");
+    }
+}
Index: code/trunk/src/orxonox/objects/EventListener.h
===================================================================
--- code/trunk/src/orxonox/objects/EventListener.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/EventListener.h	(revision 2087)
@@ -0,0 +1,61 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _EventListener_H__
+#define _EventListener_H__
+
+#include "OrxonoxPrereqs.h"
+#include "core/BaseObject.h"
+#include "core/XMLNameListener.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport EventListener : public BaseObject, public XMLNameListener
+    {
+        public:
+            EventListener(BaseObject* creator);
+            virtual ~EventListener();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            virtual void processEvent(Event& event);
+
+            void setEventName(const std::string& eventname);
+            inline const std::string& getEventName() const
+                { return this->eventName_; }
+
+        private:
+            virtual void loadedNewXMLName(BaseObject* object);
+            void registerAsListener(BaseObject* object);
+
+            std::string eventName_;
+            bool bActive_;
+    };
+}
+
+#endif /* _EventListener_H__ */
Index: code/trunk/src/orxonox/objects/EventTarget.cc
===================================================================
--- code/trunk/src/orxonox/objects/EventTarget.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/EventTarget.cc	(revision 2087)
@@ -0,0 +1,69 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "EventTarget.h"
+
+#include "core/CoreIncludes.h"
+#include "core/EventIncludes.h"
+
+namespace orxonox
+{
+    CreateFactory(EventTarget);
+
+    EventTarget::EventTarget(BaseObject* creator) : BaseObject(creator)
+    {
+        RegisterObject(EventTarget);
+    }
+
+    EventTarget::~EventTarget()
+    {
+    }
+
+    void EventTarget::changedName()
+    {
+        for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)
+            if (it->getName() == this->getName())
+                this->addAsEvent(*it);
+    }
+
+    void EventTarget::loadedNewXMLName(BaseObject* object)
+    {
+        if (this->getName() == "")
+            return;
+
+        if (object->getName() == this->getName())
+            this->addAsEvent(object);
+    }
+
+    void EventTarget::addAsEvent(BaseObject* object)
+    {
+        if (object != (BaseObject*)this)
+            object->addEvent(this, "");
+    }
+}
Index: code/trunk/src/orxonox/objects/EventTarget.h
===================================================================
--- code/trunk/src/orxonox/objects/EventTarget.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/EventTarget.h	(revision 2087)
@@ -0,0 +1,52 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _EventTarget_H__
+#define _EventTarget_H__
+
+#include "OrxonoxPrereqs.h"
+#include "core/BaseObject.h"
+#include "core/XMLNameListener.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport EventTarget : public BaseObject, public XMLNameListener
+    {
+        public:
+            EventTarget(BaseObject* creator);
+            virtual ~EventTarget();
+
+            virtual void changedName();
+
+        private:
+            virtual void loadedNewXMLName(BaseObject* object);
+            void addAsEvent(BaseObject* object);
+    };
+}
+
+#endif /* _EventTarget_H__ */
Index: code/trunk/src/orxonox/objects/Model.cc
===================================================================
--- code/trunk/src/orxonox/objects/Model.cc	(revision 1937)
+++ 	(revision )
@@ -1,107 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "Model.h"
-
-#include "tinyxml/tinyxml.h"
-#include "core/CoreIncludes.h"
-#include "GraphicsEngine.h"
-#include "core/XMLPort.h"
-
-#include <OgreEntity.h>
-#include <OgreMesh.h>
-#include <OgreHardwareVertexBuffer.h>
-#include <OgreMeshManager.h>
-
-
-namespace orxonox
-{
-    CreateFactory(Model);
-
-    /**
-     * @brief Constructor
-     */
-    Model::Model()
-    {
-        RegisterObject(Model);
-        registerAllVariables();
-    }
-
-    /**
-     * @brief Destructor
-     */
-    Model::~Model()
-    {
-        if (this->isInitialized() && (this->meshSrc_ != "") && (this->meshSrc_.size() > 0))
-            this->detachObject(this->mesh_.getEntity());
-    }
-
-    /**
-        @brief XML loading and saving.
-        @param xmlelement The XML-element
-        @param loading Loading (true) or saving (false)
-        @return The XML-element
-    */
-    void Model::XMLPort(Element& xmlelement, XMLPort::Mode mode)
-    {
-        SUPER(Model, XMLPort, xmlelement, mode);
-
-        XMLPortParam(Model, "mesh", setMesh, getMesh, xmlelement, mode);
-
-        Model::create();
-    }
-
-    bool Model::create(){
-      if(!WorldEntity::create())
-        return false;
-      if ((this->meshSrc_ != "") && (this->meshSrc_.size() > 0))
-      {
-        this->mesh_.setMesh(meshSrc_);
-        this->attachObject(this->mesh_.getEntity());
-
-        COUT(4) << "Loader (Model.cc): Created model" << std::endl;
-      }
-      if(this->isExactlyA(Class(Model)))
-        setObjectFrequency(300); //sync all 10 seconds (this only applies to asteroids and other isExactlyA(Model)'s
-      return true;
-    }
-
-    void Model::registerAllVariables(){
-//       WorldEntity::registerAllVariables();
-      COUT(5) << "Model.cc:registering new meshsrc with size: " << meshSrc_.length()+1 << " this: " << this << std::endl;
-      registerVar(&meshSrc_, meshSrc_.length() + 1, network::STRING);
-    }
-
-    void Model::changedVisibility()
-    {
-        SUPER(Model, changedVisibility);
-        if (this->isInitialized())
-            this->mesh_.setVisible(this->isVisible());
-    }
-}
Index: code/trunk/src/orxonox/objects/Model.h
===================================================================
--- code/trunk/src/orxonox/objects/Model.h	(revision 1937)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _Model_H__
-#define _Model_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "WorldEntity.h"
-#include "../tools/Mesh.h"
-
-namespace orxonox
-{
-
-    class _OrxonoxExport Model : public WorldEntity
-    {
-        public:
-            Model();
-            virtual ~Model();
-            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-            virtual void changedVisibility();
-            inline void setMesh(const std::string& meshname)
-                { this->meshSrc_ = meshname; }
-            inline const std::string& getMesh() const
-                { return this->meshSrc_; }
-            virtual bool create();
-
-        protected:
-            void registerAllVariables();
-
-        private:
-            std::string meshSrc_;
-            Mesh mesh_;
-    };
-}
-
-#endif /* _Model_H__ */
Index: code/trunk/src/orxonox/objects/NPC.cc
===================================================================
--- code/trunk/src/orxonox/objects/NPC.cc	(revision 1937)
+++ 	(revision )
@@ -1,176 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Benjamin Knecht, beni_at_orxonox.net
- *   Co-authors:
- *      ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "NPC.h"
-
-#include "core/CoreIncludes.h"
-#include "core/Iterator.h"
-
-namespace orxonox {
-
-  CreateFactory(NPC);
-
-  NPC::NPC() :
-    movable_(true)
-  {
-    RegisterObject(NPC);
-    registerAllVariables();
-  }
-
-  NPC::~NPC()
-  {
-  }
-
-  /**
-   * function to chance values of an element
-   */
-  void NPC::setValues(Vector3 location, Vector3 speed, Vector3 acceleration, bool movable) {
-    this->setAcceleration(acceleration);
-    this->setVelocity(speed);
-    this->translate(location);
-    movable_ = movable;
-  }
-
-  void NPC::registerAllVariables(){
-    Model::registerAllVariables();
-    registerVar(&movable_, sizeof(movable_), network::DATA);
-  }
-
-
-  /**
-   * calculates the distance between the element and an other point given by temp
-   */
-  float NPC::getDistance(WorldEntity* temp)
-  {
-    Vector3 distance = temp->getPosition() - this->getPosition();
-    return distance.length();
-  }
-
-  /**
-   * updates the data of an element
-   */
-  void NPC::update()
-  {
-
-    //if element is movable, calculate acceleration
-    if (this->movable_ == true) calculateAcceleration();
-
-  }
-
-  /**
-   * tick this NPC
-   */
-  void NPC::tick(float dt)
-  {
-    update();
-    this->setVelocity(0.995*this->getVelocity() + this->getAcceleration()*dt);
-    this->translate(this->getVelocity()*dt);
-    this->setAcceleration(Vector3(0,0,0));
-  }
-
-  /**
-   * calculates the new acceleration of an element
-   */
-  void NPC::calculateAcceleration()
-  {
-    //acceleration consisting of flocking-functions
-    this->setAcceleration(separation() + alignment() + cohesion());
-  }
-
-  /**
-   * separation-function (keep elements separated, avoid crashs)
-   */
-  Vector3 NPC::separation()
-  {
-    Vector3 steering = Vector3(0,0,0); //steeringvector
-    Vector3 inverseDistance = Vector3(0,0,0);  //vector pointing away from possible collisions
-    int numberOfNeighbour = 0;  //number of observed neighbours
-    float distance = 0;  // distance to the actual element
-    for(ObjectList<WorldEntity>::iterator it = ObjectList<WorldEntity>::begin(); it; ++it) {  //go through all elements
-      distance = getDistance(*it);  //get distance between this and actual
-      if ((distance > 0) && (distance < SEPERATIONDISTANCE)) {  //do only if actual is inside detectionradius
-        inverseDistance = Vector3(0,0,0);
-        inverseDistance = this->getPosition() - it->getPosition();  //calculate the distancevector heading towards this
-        //adaptation of the inverseDistance to the distance
-        if ((distance < 200) && (distance >= 120)) {inverseDistance = 2*inverseDistance;}
-        if ((distance < 120) && (distance >= 80)) {inverseDistance = 5*inverseDistance;}
-        if ((distance < 80) && (distance >= 40)) {inverseDistance = 10*inverseDistance;}
-        if ((distance < 40) && (distance > 0)) {inverseDistance = 10*inverseDistance;}
-        steering = steering + inverseDistance;  //add up all significant steeringvectors
-        numberOfNeighbour++;  //counts the elements inside the detectionradius
-      }
-    }
-    if(numberOfNeighbour > 0) { steering = steering / (float)numberOfNeighbour; }  //devide the sum of steeringvectors by the number of elements -> separation steeringvector
-    return steering;
-  }
-
-  /**
-   * alignment-function (lead elements to the same heading)
-   */
-  Vector3 NPC::alignment()
-  {
-    Vector3 steering = Vector3(0,0,0); //steeringvector
-    int numberOfNeighbour = 0;  //number of observed neighbours
-    //float distance = 0;
-    //go through all elements
-    for(ObjectList<NPC>::iterator it = ObjectList<NPC>::begin(); it; ++it) {  //just working with 3 elements at the moment
-      float distance = getDistance(*it);  //get distance between this and actual
-      if ((distance > 0) && (distance < ALIGNMENTDISTANCE)) {  //check if actual element is inside detectionradius
-        steering = steering + it->getVelocity();  //add up all speedvectors inside the detectionradius
-        numberOfNeighbour++;  //counts the elements inside the detectionradius
-      }
-    }
-    if(numberOfNeighbour > 0) { steering = steering / (float)numberOfNeighbour; }  //devide the sum of steeringvectors by the number of elements -> alignment steeringvector
-    return steering;
-  }
-
-  /**
-   * cohseion-function (keep elements close to each other)
-   */
-  Vector3 NPC::cohesion()
-  {
-    Vector3 steering = Vector3(0,0,0); //steeringvector
-    int numberOfNeighbour = 0;  //number of observed neighbours
-    //float distance = 0;
-    //go through all elements
-    for(ObjectList<NPC>::iterator it = ObjectList<NPC>::begin(); it; ++it) {  //just working with 3 elements at the moment
-      float distance = getDistance(*it);  //get distance between this and actual
-      if ((distance > 0) && (distance < COHESIONDISTANCE)) {  //check if actual element is inside detectionradius
-        steering = steering + it->getPosition();  //add up all locations of elements inside the detectionradius
-        numberOfNeighbour++;  //counts the elements inside the detectionradius
-      }
-    }
-    if(numberOfNeighbour > 0) {
-      steering = steering  / (float)numberOfNeighbour;  //devide the sum steeringvector by the number of elements -> cohesion steeringvector
-      steering = steering - this->getPosition();  //transform the vector for the ship
-    }
-    return steering;
-  }
-
-} // end of class NPC
Index: code/trunk/src/orxonox/objects/NPC.h
===================================================================
--- code/trunk/src/orxonox/objects/NPC.h	(revision 1937)
+++ 	(revision )
@@ -1,74 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      ...
- *   Co-authors:
- *      ...
- *
- */
-
-/**
-  @file NPC.h
-  @brief AI using WorldEntity
-  @author Benjamin Knecht <beni_at_orxonox.net>
- */
-
-#ifndef _NPC_H__
-#define _NPC_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "Model.h"
-
-namespace orxonox {
-
-  class _OrxonoxExport NPC : public Model
-  {
-    public:
-
-      NPC();
-      virtual ~NPC();
-      virtual void tick(float dt);
-      void update();
-      void setValues(Vector3 location, Vector3 speed, Vector3 acceleration, bool movable);
-      void registerAllVariables();
-      virtual bool create(){return Model::create();}
-
-    private:
-      float getDistance(WorldEntity* temp);
-      void calculateAcceleration();
-      Vector3 separation();
-      Vector3 alignment();
-      Vector3 cohesion();
-
-
-    private:
-      bool movable_;  // movability of the element, (false) gives the possiblity that an object can`t be moved by flocking but still gets into the calculation
-
-      // those values should maybe be controlled by a higher power and should maybe be parameters that can be changed
-      static int const SEPERATIONDISTANCE = 300;  //detectionradius of seperation
-      static int const ALIGNMENTDISTANCE = 300;  //detectionradius of alignment
-      static int const COHESIONDISTANCE = 5000;  //detectionradius of cohesion
-      static int const NUMELEMENTS = 9;  //number of elements
-  };
-}
-#endif /* _NPC_H__ */
Index: code/trunk/src/orxonox/objects/ParticleProjectile.cc
===================================================================
--- code/trunk/src/orxonox/objects/ParticleProjectile.cc	(revision 1937)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "ParticleProjectile.h"
-
-#include "SpaceShip.h"
-#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
-
-namespace orxonox
-{
-    CreateFactory(ParticleProjectile);
-
-    ParticleProjectile::ParticleProjectile(SpaceShip* owner) : BillboardProjectile(owner)
-    {
-        RegisterObject(ParticleProjectile);
-
-        this->particles_ = new ParticleInterface("Orxonox/shot2", LODParticle::normal);
-        this->particles_->addToSceneNode(this->getNode());
-        this->particles_->setKeepParticlesInLocalSpace(true);
-        if (this->owner_)
-        {
-        }
-//        else
-//        {
-//            this->particles_ = 0;
-//        }
-
-        this->setConfigValues();
-    }
-
-    ParticleProjectile::~ParticleProjectile()
-    {
-        if (this->isInitialized() && this->particles_)
-            delete this->particles_;
-    }
-
-    void ParticleProjectile::setConfigValues()
-    {
-        SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second").callback((Projectile*)this, &ParticleProjectile::speedChanged);
-    }
-
-    void ParticleProjectile::changedVisibility()
-    {
-        SUPER(ParticleProjectile, changedVisibility);
-        this->particles_->setEnabled(this->isVisible());
-    }
-    
-    bool ParticleProjectile::create(){
-      if(!Projectile::create())
-        return false;
-      this->particles_->getAllEmitters()->setDirection(-this->getOrientation()*Vector3(1,0,0));
-      return true;
-    }
-}
Index: code/trunk/src/orxonox/objects/ParticleProjectile.h
===================================================================
--- code/trunk/src/orxonox/objects/ParticleProjectile.h	(revision 1937)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _ParticleProjectile_H__
-#define _ParticleProjectile_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "BillboardProjectile.h"
-#include "tools/ParticleInterface.h"
-#include "util/Math.h"
-
-namespace orxonox
-{
-    class _OrxonoxExport ParticleProjectile : public BillboardProjectile
-    {
-        public:
-            ParticleProjectile(SpaceShip* owner = 0);
-            virtual ~ParticleProjectile();
-            virtual void changedVisibility();
-            void setConfigValues();
-            
-            virtual bool create();
-
-        private:
-            ParticleInterface* particles_;
-    };
-}
-
-#endif /* _ParticleProjectile_H__ */
Index: code/trunk/src/orxonox/objects/ParticleSpawner.cc
===================================================================
--- code/trunk/src/orxonox/objects/ParticleSpawner.cc	(revision 1937)
+++ 	(revision )
@@ -1,106 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "ParticleSpawner.h"
-
-#include <OgreSceneManager.h>
-#include "core/CoreIncludes.h"
-#include "core/Executor.h"
-#include "tools/ParticleInterface.h"
-#include "GraphicsEngine.h"
-
-namespace orxonox
-{
-    CreateFactory(ParticleSpawner);
-
-    ParticleSpawner::ParticleSpawner()
-    {
-        RegisterObject(ParticleSpawner);
-        this->particle_ = 0;
-    }
-
-    ParticleSpawner::ParticleSpawner(const std::string& templateName, LODParticle::LOD detaillevel, float lifetime, float startdelay, float destroydelay, const Vector3& direction)
-    {
-        RegisterObject(ParticleSpawner);
-        this->setParticle(templateName, detaillevel, lifetime, startdelay, destroydelay, direction);
-    }
-
-    void ParticleSpawner::setParticle(const std::string& templateName, LODParticle::LOD detaillevel, float lifetime, float startdelay, float destroydelay, const Vector3& direction)
-    {
-        ExecutorMember<ParticleSpawner>* executor = createExecutor(createFunctor(&ParticleSpawner::createParticleSpawner));
-        this->destroydelay_ = destroydelay;
-        executor->setDefaultValues(lifetime);
-        this->timer_.setTimer(startdelay, false, this, executor);
-        this->particle_ = new ParticleInterface(templateName, detaillevel);
-        this->particle_->addToSceneNode(this->getNode());
-        this->particle_->setEnabled(false);
-        if (direction != Vector3::ZERO)
-        {
-            this->particle_->getAllEmitters()->setDirection(direction);
-        }
-    }
-
-    ParticleSpawner::~ParticleSpawner()
-    {
-        if (this->isInitialized() && this->particle_)
-        {
-            this->particle_->detachFromSceneNode();
-            delete this->particle_;
-        }
-    };
-
-    void ParticleSpawner::destroy()
-    {
-        this->setPosition(this->getNode()->getParent()->getPosition());
-        this->getNode()->getParent()->removeChild(this->getNode());
-        GraphicsEngine::getInstance().getLevelSceneManager()->getRootSceneNode()->addChild(this->getNode());
-        if (this->particle_)
-            this->particle_->setEnabled(false);
-        if (!this->timer_.isActive() || this->timer_.getRemainingTime() > this->destroydelay_)
-            this->timer_.setTimer(this->destroydelay_, false, this, createExecutor(createFunctor(&ParticleSpawner::destroyParticleSpawner)));
-    }
-
-    void ParticleSpawner::createParticleSpawner(float lifetime)
-    {
-        this->particle_->setEnabled(true);
-        if (lifetime != 0)
-            this->timer_.setTimer(lifetime, false, this, createExecutor(createFunctor(&ParticleSpawner::destroyParticleSpawner)));
-    }
-
-    void ParticleSpawner::destroyParticleSpawner()
-    {
-        delete this;
-    }
-
-    void ParticleSpawner::setVisible(bool visible)
-    {
-        if (this->particle_)
-            this->particle_->setEnabled(visible);
-    }
-}
Index: code/trunk/src/orxonox/objects/ParticleSpawner.h
===================================================================
--- code/trunk/src/orxonox/objects/ParticleSpawner.h	(revision 1937)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _ParticleSpawner_H__
-#define _ParticleSpawner_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "WorldEntity.h"
-#include "tools/Timer.h"
-
-namespace orxonox
-{
-    class _OrxonoxExport ParticleSpawner : public WorldEntity
-    {
-        public:
-            ParticleSpawner();
-            ParticleSpawner(const std::string& templateName, LODParticle::LOD detaillevel, float lifetime = 0, float startdelay = 0, float destroydelay = 0, const Vector3& direction = Vector3::ZERO);
-            virtual ~ParticleSpawner();
-            void destroy();
-
-            void setParticle(const std::string& templateName, LODParticle::LOD detaillevel, float lifetime = 0, float startdelay = 0, float destroydelay = 0, const Vector3& direction = Vector3::ZERO);
-            inline ParticleInterface* getParticleInterface() const
-                { return this->particle_; }
-
-            void setVisible(bool visible);
-
-        private:
-            void createParticleSpawner(float lifetime);
-            void destroyParticleSpawner();
-
-            Timer<ParticleSpawner> timer_;
-            ParticleInterface* particle_;
-            float destroydelay_;
-    };
-}
-
-#endif /* _ParticleSpawner_H__ */
Index: code/trunk/src/orxonox/objects/Projectile.cc
===================================================================
--- code/trunk/src/orxonox/objects/Projectile.cc	(revision 1937)
+++ 	(revision )
@@ -1,130 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "Projectile.h"
-
-#include <OgreBillboard.h>
-
-#include "core/CoreIncludes.h"
-#include "core/Executor.h"
-#include "core/ConfigValueIncludes.h"
-#include "core/Iterator.h"
-#include "tools/ParticleInterface.h"
-
-#include "SpaceShipAI.h"
-#include "ParticleSpawner.h"
-#include "Model.h"
-#include "Settings.h"
-
-namespace orxonox
-{
-    float Projectile::speed_s = 5000;
-
-    Projectile::Projectile(SpaceShip* owner) : owner_(owner)
-    {
-        RegisterObject(Projectile);
-
-        this->setConfigValues();
-        this->explosionTemplateName_ = "Orxonox/explosion3";
-        this->smokeTemplateName_ = "Orxonox/smoke4";
-
-        this->setStatic(false);
-        this->translate(Vector3(55, 0, 0), Ogre::Node::TS_LOCAL);
-        
-        if (this->owner_)
-        {
-            this->setOrientation(this->owner_->getOrientation());
-            this->setPosition(this->owner_->getPosition());
-            this->setVelocity(this->owner_->getInitialDir() * this->speed_);
-        }
-
-        if(!orxonox::Settings::isClient()) //only if not on client
-          this->destroyTimer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&Projectile::destroyObject)));
-    }
-
-    Projectile::~Projectile()
-    {
-    }
-
-    void Projectile::setConfigValues()
-    {
-        SetConfigValue(damage_, 15.0).description("The damage caused by the projectile");
-        SetConfigValue(lifetime_, 4.0).description("The time in seconds a projectile stays alive");
-        SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second").callback(this, &Projectile::speedChanged);
-    }
-
-    void Projectile::speedChanged()
-    {
-        Projectile::speed_s = this->speed_;
-        if (this->owner_)
-            this->setVelocity(this->owner_->getInitialDir() * this->speed_);
-    }
-
-    void Projectile::tick(float dt)
-    {
-        SUPER(Projectile, tick, dt);
-
-        if (!this->isActive())
-            return;
-
-        float radius;
-        for (ObjectList<Model>::iterator it = ObjectList<Model>::begin(); it; ++it)
-        {
-            if ((*it) != this->owner_)
-            {
-                radius = it->getScale3D().x * 3.0;
-
-                if (this->getPosition().squaredDistance(it->getPosition()) <= (radius*radius))
-                {
-                    // hit
-                    if (it->isA(Class(SpaceShipAI)))
-                        ((SpaceShipAI*)(*it))->damage(this->damage_);
-                    ParticleSpawner* explosion = new ParticleSpawner(this->explosionTemplateName_, LODParticle::low, 2.0);
-                    explosion->setPosition(this->getPosition());
-                    explosion->create();
-                    ParticleSpawner* smoke = new ParticleSpawner(this->smokeTemplateName_, LODParticle::normal, 2.0, 0.0);
-                    smoke->setPosition(this->getPosition());
-//                    smoke->getParticleInterface()->setSpeedFactor(3.0);
-                    smoke->create();
-                    delete this;
-                    return;
-                }
-            }
-        }
-    }
-
-    void Projectile::destroyObject()
-    {
-        delete this;
-    }
-    
-    bool Projectile::create(){
-      return WorldEntity::create();
-    }
-}
Index: code/trunk/src/orxonox/objects/Projectile.h
===================================================================
--- code/trunk/src/orxonox/objects/Projectile.h	(revision 1937)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _Projectile_H__
-#define _Projectile_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "WorldEntity.h"
-#include "tools/Timer.h"
-
-namespace orxonox
-{
-    class _OrxonoxExport Projectile : public WorldEntity
-    {
-        public:
-            virtual ~Projectile();
-            void setConfigValues();
-            void speedChanged();
-            void destroyObject();
-            virtual void tick(float dt);
-            
-            virtual bool create();
-
-            static float getSpeed()
-                { return Projectile::speed_s; }
-
-        protected:
-            Projectile(SpaceShip* owner = 0);
-            SpaceShip* owner_;
-
-        private:
-            std::string explosionTemplateName_;
-            std::string smokeTemplateName_;
-        protected:
-            static float speed_s;
-            float speed_;
-        private:
-            float lifetime_;
-            float damage_;
-            Timer<Projectile> destroyTimer_;
-    };
-}
-
-#endif /* _Projectile_H__ */
Index: code/trunk/src/orxonox/objects/Radar.cc
===================================================================
--- code/trunk/src/orxonox/objects/Radar.cc	(revision 1937)
+++ code/trunk/src/orxonox/objects/Radar.cc	(revision 2087)
@@ -36,6 +36,4 @@
 #include <cfloat>
 #include <cassert>
-#include "objects/WorldEntity.h"
-#include "objects/SpaceShip.h"
 #include "core/CoreIncludes.h"
 #include "core/ConsoleCommand.h"
@@ -114,6 +112,8 @@
             for (ObjectList<RadarViewable>::iterator itElement = ObjectList<RadarViewable>::begin(); itElement; ++itElement)
             {
+/*
                 if ((*itElement) != SpaceShip::getLocalShip() && (*itListener)->getRadarSensitivity() > (*itElement)->getRadarObjectCamouflage())
                     (*itListener)->displayObject(*itElement, *itElement == this->focus_);
+*/
             }
         }
@@ -130,5 +130,5 @@
         else
         {
-            Vector3 localPosition = SpaceShip::getLocalShip()->getPosition();
+            Vector3 localPosition;// = SpaceShip::getLocalShip()->getPosition();
             Vector3 targetPosition = localPosition;
             if (*(this->itFocus_))
@@ -143,7 +143,8 @@
             for (ObjectList<RadarViewable>::iterator it = ObjectList<RadarViewable>::begin(); it; ++it)
             {
+/*
                 if (*it == SpaceShip::getLocalShip())
                     continue;
-
+*/
                 float targetDistance = localPosition.squaredDistance((*it)->getWorldPosition());
                 if (targetDistance > currentDistance && targetDistance < nextDistance)
Index: code/trunk/src/orxonox/objects/RadarViewable.cc
===================================================================
--- code/trunk/src/orxonox/objects/RadarViewable.cc	(revision 1937)
+++ code/trunk/src/orxonox/objects/RadarViewable.cc	(revision 2087)
@@ -31,5 +31,5 @@
 #include "util/Debug.h"
 #include "core/CoreIncludes.h"
-#include "objects/WorldEntity.h"
+//#include "objects/WorldEntity.h"
 #include "Radar.h"
 
@@ -63,5 +63,5 @@
     {
         validate();
-        return this->radarObject_->getWorldPosition();
+        return Vector3::ZERO;//this->radarObject_->getWorldPosition();
     }
 
@@ -69,5 +69,5 @@
     {
         validate();
-        return this->radarObject_->getOrientation() * this->radarObject_->getVelocity();
+        return Vector3::ZERO;//this->radarObject_->getOrientation() * this->radarObject_->getVelocity();
     }
 }
Index: code/trunk/src/orxonox/objects/RadarViewable.h
===================================================================
--- code/trunk/src/orxonox/objects/RadarViewable.h	(revision 1937)
+++ code/trunk/src/orxonox/objects/RadarViewable.h	(revision 2087)
@@ -44,4 +44,6 @@
     class _OrxonoxExport RadarViewable : virtual public OrxonoxClass
     {
+    class WorldEntity;
+
     public:
         enum Shape
Index: code/trunk/src/orxonox/objects/RotatingProjectile.cc
===================================================================
--- code/trunk/src/orxonox/objects/RotatingProjectile.cc	(revision 1937)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "RotatingProjectile.h"
-
-#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
-#include <OgreBillboard.h>
-
-namespace orxonox
-{
-    CreateFactory(RotatingProjectile);
-
-    RotatingProjectile::RotatingProjectile(SpaceShip* owner) : BillboardProjectile(owner)
-    {
-        RegisterObject(RotatingProjectile);
-
-        this->time_ = 0;
-
-        if (/*this->owner_*/true)
-        {
-            this->rotatingBillboard1_.setBillboardSet("Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1);
-            this->rotatingBillboard2_.setBillboardSet("Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1);
-
-            this->rotatingNode1_ = this->getNode()->createChildSceneNode(this->getName() + "rotating1", Vector3(0, 50, 0));
-            this->rotatingNode2_ = this->getNode()->createChildSceneNode(this->getName() + "rotating2", Vector3(0, -50, 0));
-            this->rotatingNode1_->attachObject(this->rotatingBillboard1_.getBillboardSet());
-            this->rotatingNode2_->attachObject(this->rotatingBillboard2_.getBillboardSet());
-            this->rotatingNode1_->scale(0.3, 0.3, 0.3);
-            this->rotatingNode2_->scale(0.3, 0.3, 0.3);
-        }
-
-        this->setConfigValues();
-    }
-
-    RotatingProjectile::~RotatingProjectile()
-    {
-    }
-
-    void RotatingProjectile::setConfigValues()
-    {
-        SetConfigValue(colour_, ColourValue(1.0, 0.0, 0.0)).callback(this, &RotatingProjectile::colourChanged);
-    }
-
-    void RotatingProjectile::colourChanged()
-    {
-        if (this->isInitialized())
-        {
-            this->rotatingBillboard1_.getBillboardSet()->getBillboard(0)->setColour(this->colour_);
-            this->rotatingBillboard2_.getBillboardSet()->getBillboard(0)->setColour(this->colour_);
-        }
-    }
-
-    void RotatingProjectile::tick(float dt)
-    {
-        if (this->isActive())
-        {
-            this->time_ += dt;
-
-            this->rotatingNode1_->setPosition(0, 50 * sin(this->time_ * 20), 50 * cos(this->time_ * 20));
-            this->rotatingNode2_->setPosition(0, -50 * sin(this->time_ * 20), -50 * cos(this->time_ * 20));
-        }
-
-        SUPER(RotatingProjectile, tick, dt);
-    }
-
-    void RotatingProjectile::changedVisibility()
-    {
-        SUPER(RotatingProjectile, changedVisibility);
-        this->rotatingBillboard1_.setVisible(this->isVisible());
-        this->rotatingBillboard2_.setVisible(this->isVisible());
-    }
-}
Index: code/trunk/src/orxonox/objects/RotatingProjectile.h
===================================================================
--- code/trunk/src/orxonox/objects/RotatingProjectile.h	(revision 1937)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#ifndef _RotatingProjectile_H__
-#define _RotatingProjectile_H__
-
-#include "OrxonoxPrereqs.h"
-#include "util/Math.h"
-#include "BillboardProjectile.h"
-
-namespace orxonox
-{
-    class _OrxonoxExport RotatingProjectile : public BillboardProjectile
-    {
-        public:
-            RotatingProjectile(SpaceShip* owner = 0);
-            virtual ~RotatingProjectile();
-            void setConfigValues();
-            void colourChanged();
-            virtual void tick(float dt);
-            virtual void changedVisibility();
-
-        private:
-            ColourValue colour_;
-            BillboardSet rotatingBillboard1_;
-            BillboardSet rotatingBillboard2_;
-            Ogre::SceneNode* rotatingNode1_;
-            Ogre::SceneNode* rotatingNode2_;
-            float time_;
-    };
-}
-
-#endif /* _RotatingProjectile_H__ */
Index: code/trunk/src/orxonox/objects/Scene.cc
===================================================================
--- code/trunk/src/orxonox/objects/Scene.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/Scene.cc	(revision 2087)
@@ -0,0 +1,166 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Scene.h"
+
+#include <OgreRoot.h>
+#include <OgreSceneManagerEnumerator.h>
+#include <OgreSceneNode.h>
+#include <OgreLight.h>
+
+#include "core/CoreIncludes.h"
+#include "core/Core.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+    CreateFactory(Scene);
+
+    Scene::Scene(BaseObject* creator) : BaseObject(creator), network::Synchronisable(creator)
+    {
+        RegisterObject(Scene);
+
+        this->setScene(this);
+        this->bShadows_ = false;
+
+        if (Core::showsGraphics())
+        {
+            if (Ogre::Root::getSingletonPtr())
+            {
+                this->sceneManager_ = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC);
+                this->rootSceneNode_ = this->sceneManager_->getRootSceneNode();
+            }
+            else
+            {
+                this->sceneManager_ = 0;
+                this->rootSceneNode_ = 0;
+            }
+        }
+        else
+        {
+            // create a dummy SceneManager of our own since we don't have Ogre::Root.
+            this->sceneManager_ = new Ogre::DefaultSceneManager("");
+            this->rootSceneNode_ = this->sceneManager_->getRootSceneNode();
+        }
+
+        // test test test
+        if (Core::showsGraphics() && this->sceneManager_)
+        {
+            Ogre::Light* light;
+            light = this->sceneManager_->createLight("Light-1");
+            light->setType(Ogre::Light::LT_DIRECTIONAL);
+            light->setDiffuseColour(ColourValue(1.0, 0.9, 0.6, 1.0));
+            light->setSpecularColour(ColourValue(1.0, 0.9, 0.6, 1.0));
+            light->setDirection(1, -0.3, 0.3);
+        }
+        // test test test
+
+        this->registerVariables();
+    }
+
+    Scene::~Scene()
+    {
+        if (this->isInitialized())
+        {
+            if (Ogre::Root::getSingletonPtr())
+            {
+//                this->sceneManager_->destroySceneNode(this->rootSceneNode_->getName()); // TODO: remove getName() for newer versions of Ogre
+                Ogre::Root::getSingleton().destroySceneManager(this->sceneManager_);
+            }
+            else if (!Core::showsGraphics())
+            {
+                delete this->sceneManager_;
+            }
+        }
+    }
+
+    void Scene::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(Scene, XMLPort, xmlelement, mode);
+
+        XMLPortParam(Scene, "skybox", setSkybox, getSkybox, xmlelement, mode);
+        XMLPortParam(Scene, "ambientlight", setAmbientLight, getAmbientLight, xmlelement, mode).defaultValues(ColourValue(0.2, 0.2, 0.2, 1));
+        XMLPortParam(Scene, "shadow", setShadow, getShadow, xmlelement, mode).defaultValues(true);
+
+        XMLPortObjectExtended(Scene, BaseObject, "", addObject, getObject, xmlelement, mode, true, false);
+    }
+
+    void Scene::registerVariables()
+    {
+        REGISTERSTRING(this->skybox_,     network::direction::toclient, new network::NetworkCallback<Scene>(this, &Scene::networkcallback_applySkybox));
+        REGISTERDATA(this->ambientLight_, network::direction::toclient, new network::NetworkCallback<Scene>(this, &Scene::networkcallback_applyAmbientLight));
+    }
+
+    void Scene::setSkybox(const std::string& skybox)
+    {
+        if (Core::showsGraphics() && this->sceneManager_)
+            this->sceneManager_->setSkyBox(true, skybox);
+
+        this->skybox_ = skybox;
+    }
+
+    void Scene::setAmbientLight(const ColourValue& colour)
+    {
+        if (Core::showsGraphics() && this->sceneManager_)
+            this->sceneManager_->setAmbientLight(colour);
+
+        this->ambientLight_ = colour;
+    }
+
+    void Scene::setShadow(bool bShadow)
+    {
+        if (Core::showsGraphics() && this->sceneManager_)
+        {
+            if (bShadow)
+                this->sceneManager_->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE);
+            else
+                this->sceneManager_->setShadowTechnique(Ogre::SHADOWTYPE_NONE);
+        }
+
+        this->bShadows_ = bShadow;
+    }
+
+    void Scene::addObject(BaseObject* object)
+    {
+        this->objects_.push_back(object);
+        object->setScene(this);
+    }
+
+    BaseObject* Scene::getObject(unsigned int index) const
+    {
+        unsigned int i = 0;
+        for (std::list<BaseObject*>::const_iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
+        {
+            if (i == index)
+                return (*it);
+            ++i;
+        }
+        return 0;
+    }
+}
Index: code/trunk/src/orxonox/objects/Scene.h
===================================================================
--- code/trunk/src/orxonox/objects/Scene.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/Scene.h	(revision 2087)
@@ -0,0 +1,84 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Scene_H__
+#define _Scene_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "network/Synchronisable.h"
+#include "core/BaseObject.h"
+#include "util/Math.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport Scene : public BaseObject, public network::Synchronisable
+    {
+        public:
+            Scene(BaseObject* creator);
+            virtual ~Scene();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            void registerVariables();
+
+            inline Ogre::SceneManager* getSceneManager() const
+                { return this->sceneManager_; }
+            inline Ogre::SceneNode* getRootSceneNode() const
+                { return this->rootSceneNode_; }
+
+            void setSkybox(const std::string& skybox);
+            inline const std::string& getSkybox() const
+                { return this->skybox_; }
+
+            void setAmbientLight(const ColourValue& colour);
+            inline const ColourValue& getAmbientLight() const
+                { return this->ambientLight_; }
+
+            void setShadow(bool bShadow);
+            inline bool getShadow() const
+                { return this->bShadows_; }
+
+        private:
+            void addObject(BaseObject* object);
+            BaseObject* getObject(unsigned int index) const;
+
+            void networkcallback_applySkybox()
+                { this->setSkybox(this->skybox_); }
+            void networkcallback_applyAmbientLight()
+                { this->setAmbientLight(this->ambientLight_); }
+
+            Ogre::SceneManager*    sceneManager_;
+            Ogre::SceneNode*       rootSceneNode_;
+            std::string            skybox_;
+            ColourValue            ambientLight_;
+            std::list<BaseObject*> objects_;
+            bool                   bShadows_;
+    };
+}
+
+#endif /* _Scene_H__ */
Index: code/trunk/src/orxonox/objects/Script.cc
===================================================================
--- code/trunk/src/orxonox/objects/Script.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/Script.cc	(revision 2087)
@@ -0,0 +1,70 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Knecht
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Script.h"
+
+#include "util/Debug.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "core/LuaBind.h"
+
+namespace orxonox
+{
+  CreateFactory(Script);
+
+  Script::Script(BaseObject* creator) : BaseObject(creator)
+  {
+    RegisterObject(Script);
+
+    code_ = "";
+  }
+
+  Script::~Script()
+  {
+  }
+
+  /**
+  @brief XML loading and saving.
+  @param xmlelement The XML-element
+  @param loading Loading (true) or saving (false)
+   */
+  void Script::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+  {
+    BaseObject::XMLPort(xmlelement, mode);
+
+    code_ = xmlelement.GetText(false);
+  }
+
+  void Script::execute()
+  {
+    LuaBind* lua = LuaBind::getInstance();
+    lua->loadString(this->code_);
+    lua->run();
+  }
+}
Index: code/trunk/src/orxonox/objects/Script.h
===================================================================
--- code/trunk/src/orxonox/objects/Script.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/Script.h	(revision 2087)
@@ -0,0 +1,51 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Knecht
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Script_H__
+#define _Script_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "core/BaseObject.h"
+
+namespace orxonox
+{
+  class _OrxonoxExport Script : public BaseObject
+  {
+    public:
+      Script(BaseObject* creator);
+      ~Script();
+      void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+      void execute();
+
+    private:
+      std::string code_;
+  };
+}
+
+#endif /* _Script_H__ */
Index: code/trunk/src/orxonox/objects/Skybox.cc
===================================================================
--- code/trunk/src/orxonox/objects/Skybox.cc	(revision 1937)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      ...
- *   Co-authors:
- *      ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "Skybox.h"
-
-#include <string>
-
-#include <OgreSceneManager.h>
-
-#include "tinyxml/tinyxml.h"
-#include "GraphicsEngine.h"
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "util/Debug.h"
-#include "Settings.h"
-
-namespace orxonox
-{
-    CreateFactory(Skybox);
-
-    Skybox::Skybox()
-    {
-        RegisterObject(Skybox);
-        registerAllVariables();
-    }
-
-    Skybox::~Skybox()
-    {
-    }
-
-    void Skybox::setSkybox(const std::string& skyboxname)
-    {
-        if (Settings::showsGraphics())
-            GraphicsEngine::getInstance().getLevelSceneManager()->setSkyBox(true, skyboxname);
-    }
-
-    /**
-        @brief XML loading and saving.
-        @param xmlelement The XML-element
-        @param loading Loading (true) or saving (false)
-        @return The XML-element
-    */
-    void Skybox::XMLPort(Element& xmlelement, XMLPort::Mode mode)
-    {
-        SUPER(Skybox, XMLPort, xmlelement, mode);
-
-        XMLPortParam(Skybox, "src", setSkyboxSrc, getSkyboxSrc, xmlelement, mode);
-        create();
-    }
-
-    bool Skybox::create()
-    {
-        this->setSkybox(this->skyboxSrc_);
-        return Synchronisable::create();
-    }
-
-    void Skybox::registerAllVariables()
-    {
-        registerVar(&skyboxSrc_, skyboxSrc_.length()+1 ,network::STRING);
-    }
-
-    void Skybox::changedVisibility()
-    {
-        SUPER(Skybox, changedVisibility);
-        if (Settings::showsGraphics())
-            GraphicsEngine::getInstance().getLevelSceneManager()->setSkyBox(this->isVisible(), this->skyboxSrc_);
-    }
-}
Index: code/trunk/src/orxonox/objects/Skybox.h
===================================================================
--- code/trunk/src/orxonox/objects/Skybox.h	(revision 1937)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      ...
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _Skybox_H__
-#define _Skybox_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "core/BaseObject.h"
-#include "network/Synchronisable.h"
-
-namespace orxonox
-{
-    class _OrxonoxExport Skybox : public BaseObject, public network::Synchronisable
-    {
-        public:
-            Skybox();
-            virtual ~Skybox();
-
-            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-            virtual void changedVisibility();
-            void setSkybox(const std::string& skyboxname);
-
-            virtual bool create();
-            void registerAllVariables();
-
-            inline void setSkyboxSrc(const std::string &src)
-                { this->skyboxSrc_ = src; }
-            inline const std::string& getSkyboxSrc() const
-                { return this->skyboxSrc_; }
-
-        private:
-            std::string skyboxSrc_;
-
-
-    };
-}
-
-#endif /* _Skybox_H__ */
Index: code/trunk/src/orxonox/objects/SpaceShip.cc
===================================================================
--- code/trunk/src/orxonox/objects/SpaceShip.cc	(revision 1937)
+++ 	(revision )
@@ -1,637 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      Benjamin Knecht
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "SpaceShip.h"
-
-#include <OgreCamera.h>
-#include <OgreRenderWindow.h>
-#include <OgreParticleSystem.h>
-#include <OgreSceneNode.h>
-
-#include "util/Convert.h"
-#include "util/Math.h"
-#include "util/Debug.h"
-#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
-#include "core/Iterator.h"
-#include "core/input/InputManager.h"
-#include "core/XMLPort.h"
-#include "core/ConsoleCommand.h"
-#include "tools/ParticleInterface.h"
-#include "network/Client.h"
-#include "Backlight.h"
-#include "CameraHandler.h"
-#include "ParticleSpawner.h"
-#include "Settings.h"
-#include "RotatingProjectile.h"
-#include "ParticleProjectile.h"
-#include "GraphicsEngine.h"
-#include "SpaceShipAI.h"
-
-namespace orxonox
-{
-    SetConsoleCommand(SpaceShip, setMaxSpeedTest, false).accessLevel(AccessLevel::Debug);
-    SetConsoleCommand(SpaceShip, whereAmI, true).accessLevel(AccessLevel::User);
-    SetConsoleCommand(SpaceShip, moveLongitudinal, true).accessLevel(AccessLevel::User).defaultValue(0, 1.0f).axisParamIndex(0).keybindMode(KeybindMode::OnHold);
-    SetConsoleCommand(SpaceShip, moveLateral, true).accessLevel(AccessLevel::User).defaultValue(0, 1.0f).axisParamIndex(0).keybindMode(KeybindMode::OnHold);
-    SetConsoleCommand(SpaceShip, moveYaw, true).accessLevel(AccessLevel::User).defaultValue(0, 1.0f).axisParamIndex(0).keybindMode(KeybindMode::OnHold);
-    SetConsoleCommand(SpaceShip, movePitch, true).accessLevel(AccessLevel::User).defaultValue(0, 1.0f).axisParamIndex(0).keybindMode(KeybindMode::OnHold);
-    SetConsoleCommand(SpaceShip, moveRoll, true).accessLevel(AccessLevel::User).defaultValue(0, 1.0f).axisParamIndex(0).keybindMode(KeybindMode::OnHold);
-    SetConsoleCommand(SpaceShip, fire, true).accessLevel(AccessLevel::User).keybindMode(KeybindMode::OnHold);
-    SetConsoleCommandAliasMulti(SpaceShip, setMaxSpeedTest, "setMaxSpeed", 1, false).accessLevel(AccessLevel::Debug);
-    SetConsoleCommandAliasMulti(SpaceShip, setMaxSpeedTest, "setMaxBlubber", 2, false).accessLevel(AccessLevel::Debug);
-    SetConsoleCommandAliasMulti(SpaceShip, setMaxSpeedTest, "setRofl", 3, false).accessLevel(AccessLevel::Debug);
-
-    CreateFactory(SpaceShip);
-
-    SpaceShip* SpaceShip::instance_s;
-
-
-    SpaceShip *SpaceShip::getLocalShip(){
-      ObjectList<SpaceShip>::iterator it;
-      for(it = ObjectList<SpaceShip>::begin(); it; ++it){
-	assert(it->isA(Class(SpaceShip)));
-        if( (it)->myShip_ || (network::Host::running() && network::Host::getShipID()==(it)->getObjectID()) ){
-//	  COUT(1) << "^^^^^^^^^^ myShip_:" << *it << " classname: " << (*it)->getIdentifier()->getName() << " objectid: " << (*it)->objectID << std::endl;
-          return *it;
-	}
-      }
-      return 0;
-    }
-
-    SpaceShip::SpaceShip()
-    {
-        RegisterObject(SpaceShip);
-
-        this->setRotationAxis(1, 0, 0);
-        this->setStatic(false);
-
-        this->zeroRadian_ = 0;
-        this->maxSideAndBackSpeed_ = 0;
-        this->maxSpeed_ = 0;
-        this->maxRotation_ = 0;
-        this->translationAcceleration_ = 0;
-        this->rotationAcceleration_ = 0;
-        this->translationDamping_ = 0;
-        this->rotationDamping_ = 0;
-        this->maxRotationRadian_ = 0;
-        this->rotationAccelerationRadian_ = 0;
-        this->rotationDampingRadian_ = 0;
-
-        this->cam_ = 0;
-        this->tt1_ = 0;
-        this->tt2_ = 0;
-        this->smoke_ = 0;
-        this->fire_ = 0;
-
-        this->backlight_ = 0;
-
-        this->redNode_ = 0;
-        this->greenNode_ = 0;
-        this->blinkTime_ = 0;
-
-        this->timeToReload_ = 0;
-
-        this->bLMousePressed_ = false;
-        this->bRMousePressed_ = false;
-        this->mouseXRotation_ = 0;
-        this->mouseYRotation_ = 0;
-        this->myShip_ = false;
-
-        this->registerAllVariables();
-
-        SpaceShip::instance_s = this;
-
-        this->setConfigValues();
-
-        this->initialDir_ = Vector3(1.0, 0.0, 0.0);
-        this->currentDir_ = initialDir_;
-        this->initialOrth_ = Vector3(0.0, 0.0, 1.0);
-        this->currentOrth_ = initialOrth_;
-
-        this->camName_ = this->getName() + "CamNode";
-
-        this->teamNr_ = 0;
-        this->health_ = 100;
-
-        this->radarObject_ = static_cast<WorldEntity*>(this);
-    }
-
-    SpaceShip::~SpaceShip()
-    {
-        for (ObjectList<SpaceShipAI>::iterator it = ObjectList<SpaceShipAI>::begin(); it; ++it)
-            it->shipDied(this);
-      
-        if (this->isInitialized())
-        {
-            if (this->tt1_)
-                delete this->tt1_;
-            if (this->tt2_)
-                delete this->tt2_;
-
-            if (this->smoke_)
-                this->smoke_->destroy();
-            if (this->fire_)
-                this->fire_->destroy();
-
-            if (this->backlight_)
-                delete this->backlight_;
-
-            if (this->cam_)
-                delete this->cam_;
-        }
-    }
-
-    bool SpaceShip::create()
-    {
-        if (!myShip_)
-        {
-            if (network::Host::running() && getObjectID() == network::Host::getShipID())
-            {
-                if (!network::Host::isServer())
-                    setObjectMode(0x3);
-                myShip_ = true;
-            }
-        }
-        else
-            this->setRadarObjectColour(this->getProjectileColour());
-        Model::create();
-        this->init();
-        return true;
-    }
-
-    void SpaceShip::registerAllVariables()
-    {
-        registerVar( &camName_, camName_.length()+1, network::STRING, 0x1 );
-        registerVar( &maxSpeed_, sizeof(maxSpeed_), network::DATA, 0x1);
-        registerVar( &maxSideAndBackSpeed_, sizeof(maxSideAndBackSpeed_), network::DATA, 0x1);
-        registerVar( &maxRotation_, sizeof(maxRotation_), network::DATA, 0x1);
-        registerVar( &translationAcceleration_, sizeof(translationAcceleration_), network::DATA, 0x1);
-        registerVar( &rotationAcceleration_, sizeof(rotationAcceleration_), network::DATA, 0x1);
-        registerVar( &rotationAccelerationRadian_, sizeof(rotationAccelerationRadian_), network::DATA, 0x1);
-        registerVar( &translationDamping_, sizeof(translationDamping_), network::DATA, 0x1);
-        registerVar( &rotationDamping_, sizeof(rotationDamping_), network::DATA, 0x1);
-        registerVar( &rotationDampingRadian_, sizeof(rotationDampingRadian_), network::DATA, 0x1);
-    }
-
-    void SpaceShip::init()
-    {
-        if (Settings::showsGraphics())
-        {
-            // START CREATING THRUSTERS
-            this->tt1_ = new ParticleInterface("Orxonox/thruster1", LODParticle::low);
-            this->tt1_->createNewEmitter();
-            this->tt1_->getAllEmitters()->setDirection(-this->getInitialDir());
-            this->tt1_->getEmitter(0)->setPosition(Vector3(-15, 20, -1));
-            this->tt1_->getEmitter(1)->setPosition(Vector3(-15, -20, -1));
-            this->tt1_->setSpeedFactor(3.0);
-
-            Ogre::SceneNode* node2a = this->getNode()->createChildSceneNode(this->getName() + "particle2a");
-            node2a->setInheritScale(false);
-            node2a->setScale(1, 1, 1);
-            tt1_->addToSceneNode(node2a);
-
-            this->tt2_ = new ParticleInterface("Orxonox/thruster2", LODParticle::normal);
-            this->tt2_->createNewEmitter();
-            this->tt2_->getAllEmitters()->setDirection(Vector3(-1, 0, 0));
-            this->tt2_->getEmitter(0)->setPosition(Vector3(-30, 40, -2));
-            this->tt2_->getEmitter(1)->setPosition(Vector3(-30, -40, -2));
-
-            Ogre::SceneNode* node2b = this->getNode()->createChildSceneNode(this->getName() + "particle2b");
-            node2b->setInheritScale(false);
-            node2b->setScale(0.5, 0.5, 0.5);
-            tt2_->addToSceneNode(node2b);
-
-            this->leftThrusterFlare_.setBillboardSet("Flares/ThrusterFlare1", Vector3(-7.5, -10, -0.5));
-            this->rightThrusterFlare_.setBillboardSet("Flares/ThrusterFlare1", Vector3(-7.5, 10, -0.5));
-
-            Ogre::SceneNode* node2c = this->getNode()->createChildSceneNode(this->getName() + "particle2c");
-            node2c->setInheritScale(false);
-            node2c->setScale(2, 2, 2);
-            node2c->attachObject(this->leftThrusterFlare_.getBillboardSet());
-            node2c->attachObject(this->rightThrusterFlare_.getBillboardSet());
-            // END CREATING THRUSTERS
-
-            // START CREATING BLINKING LIGHTS
-            this->redBillboard_.setBillboardSet("Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1);
-            this->greenBillboard_.setBillboardSet("Examples/Flare", ColourValue(0.0, 1.0, 0.0), 1);
-
-            this->redNode_ = this->getNode()->createChildSceneNode(this->getName() + "red", Vector3(0.3, 4.0, -0.3));
-            this->redNode_->setInheritScale(false);
-            this->greenNode_ = this->getNode()->createChildSceneNode(this->getName() + "green", Vector3(0.3, -4.0, -0.3));
-            this->greenNode_->setInheritScale(false);
-
-            this->redNode_->attachObject(this->redBillboard_.getBillboardSet());
-            this->redNode_->setScale(0.3, 0.3, 0.3);
-
-            this->greenNode_->attachObject(this->greenBillboard_.getBillboardSet());
-            this->greenNode_->setScale(0.3, 0.3, 0.3);
-            // END CREATING BLINKING LIGHTS
-
-            // START CREATING ADDITIONAL EFFECTS
-            if(!network::Host::running()){
-              this->backlight_ = new Backlight(this->maxSpeed_, 0.8);
-              this->attachObject(this->backlight_);
-              this->backlight_->setPosition(-2.35, 0, 0.2);
-              this->backlight_->create();
-              this->backlight_->setColour(this->getProjectileColour());
-  
-              this->smoke_ = new ParticleSpawner();
-              this->smoke_->setParticle("Orxonox/smoke5", LODParticle::normal, 0, 0, 3);
-              this->attachObject(this->smoke_);
-  
-              this->fire_ = new ParticleSpawner();
-              this->fire_->setParticle("Orxonox/fire3", LODParticle::normal, 0, 0, 1);
-              this->attachObject(this->fire_);
-            }
-            
-            // END CREATING ADDITIONAL EFFECTS
-
-            if (this->isExactlyA(Class(SpaceShip)))
-            {
-                // START of testing crosshair
-                this->crosshairNear_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1);
-                this->crosshairFar_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1);
-
-                this->chNearNode_ = this->getNode()->createChildSceneNode(this->getName() + "near", Vector3(50.0, 0.0, 0.0));
-                this->chNearNode_->setInheritScale(false);
-                this->chFarNode_ = this->getNode()->createChildSceneNode(this->getName() + "far", Vector3(200.0, 0.0, 0.0));
-                this->chFarNode_->setInheritScale(false);
-
-                this->chNearNode_->attachObject(this->crosshairNear_.getBillboardSet());
-                this->chNearNode_->setScale(0.2, 0.2, 0.2);
-
-                this->chFarNode_->attachObject(this->crosshairFar_.getBillboardSet());
-                this->chFarNode_->setScale(0.4, 0.4, 0.4);
-                // END of testing crosshair
-            }
-        }
-        // END of testing crosshair
-
-        createCamera();
-    }
-
-    void SpaceShip::setConfigValues()
-    {
-        SetConfigValue(bInvertYAxis_, false).description("Set this to true for joystick-like mouse behaviour (mouse up = ship down).");
-        SetConfigValue(reloadTime_, 0.125).description("The reload time of the weapon in seconds");
-        SetConfigValue(testvector_, Vector3()).description("asdfblah");
-    }
-
-    void SpaceShip::changedVisibility()
-    {
-        SUPER(SpaceShip, changedVisibility);
-
-        this->tt1_->setEnabled(this->isVisible());
-        this->tt2_->setEnabled(this->isVisible());
-        this->redBillboard_.setVisible(this->isVisible());
-        this->greenBillboard_.setVisible(this->isVisible());
-        this->crosshairNear_.setVisible(this->isVisible());
-        this->crosshairFar_.setVisible(this->isVisible());
-        this->rightThrusterFlare_.setVisible(this->isVisible());
-        this->leftThrusterFlare_.setVisible(this->isVisible());
-        this->smoke_->setVisible(this->isVisible());
-        this->fire_->setVisible(this->isVisible());
-        this->backlight_->setVisible(this->isVisible());
-    }
-
-    void SpaceShip::changedActivity()
-    {
-        SUPER(SpaceShip, changedActivity);
-
-        this->tt1_->setEnabled(this->isVisible());
-        this->tt2_->setEnabled(this->isVisible());
-        this->redBillboard_.setVisible(this->isVisible());
-        this->greenBillboard_.setVisible(this->isVisible());
-        this->crosshairNear_.setVisible(this->isVisible());
-        this->crosshairFar_.setVisible(this->isVisible());
-        this->rightThrusterFlare_.setVisible(this->isVisible());
-        this->leftThrusterFlare_.setVisible(this->isVisible());
-    }
-
-    void SpaceShip::setCamera(const std::string& camera)
-    {
-      camName_=camera;
-      // change camera attributes here, if you want to ;)
-    }
-
-    void SpaceShip::getFocus(){
-      COUT(4) << "requesting focus" << std::endl;
-      //if(!network::Host::running() || network::Host::getShipID()==objectID)
-      if(myShip_)
-        CameraHandler::getInstance()->requestFocus(cam_);
-
-    }
-
-    Camera* SpaceShip::getCamera(){
-        return cam_;
-    }
-
-    void SpaceShip::createCamera(){
-//       COUT(4) << "begin camera creation" << std::endl;
-      this->camNode_ = this->getNode()->createChildSceneNode(camName_);
-      COUT(4) << "position: (this)" << this->getNode()->getPosition() << std::endl;
-      this->camNode_->setPosition(Vector3(-25,0,5));
-//      Quaternion q1 = Quaternion(Radian(Degree(90)),Vector3(0,-1,0));
-//      Quaternion q2 = Quaternion(Radian(Degree(90)),Vector3(0,0,-1));
-//      camNode_->setOrientation(q1*q2);
-      COUT(4) << "position: (cam)" << this->camNode_->getPosition() << std::endl;
-      cam_ = new Camera(this->camNode_);
-
-      cam_->setTargetNode(this->getNode());
-//        cam->setPosition(Vector3(0,-350,0));
-//      Quaternion q1 = Quaternion(Radian(Degree(90)),Vector3(0,0,1));
-//      Quaternion q2 = Quaternion(Radian(Degree(90)),Vector3(0,1,0));
-      Quaternion q1 = Quaternion(Radian(Degree(90)),Vector3(0,-1,0));
-      Quaternion q2 = Quaternion(Radian(Degree(90)),Vector3(1,0,0));
-
-       this->camNode_->setOrientation(q2*q1);
-      if(myShip_){
-        COUT(5) << "requesting focus for camera" << std::endl;
-        //CameraHandler::getInstance()->requestFocus(cam_);
-        if(this->isExactlyA(Class(SpaceShip))){
-          getFocus();
-          COUT(4) << "getting focus for obj id: " << getObjectID() << std::endl;
-        }else
-          COUT(5) << "not getting focus (not exactly spaceship) for obj id: " << getObjectID() << std::endl;
-      }else
-        COUT(5) << "not getting focus (not my ship) for obj id: " << getObjectID() << std::endl;
-    }
-
-    void SpaceShip::setMaxSpeed(float value)
-    { this->maxSpeed_ = value; }
-    void SpaceShip::setMaxSideAndBackSpeed(float value)
-    { this->maxSideAndBackSpeed_ = value; }
-    void SpaceShip::setMaxRotation(float value)
-    { this->maxRotation_ = value; this->maxRotationRadian_ = Radian(value); }
-    void SpaceShip::setTransAcc(float value)
-    { this->translationAcceleration_ = value; }
-    void SpaceShip::setRotAcc(float value)
-    { this->rotationAcceleration_ = value; this->rotationAccelerationRadian_ = Radian(value); }
-    void SpaceShip::setTransDamp(float value)
-    { this->translationDamping_ = value; }
-    void SpaceShip::setRotDamp(float value)
-    { this->rotationDamping_ = value; this->rotationDampingRadian_ = Radian(value); }
-
-    /**
-        @brief XML loading and saving.
-        @param xmlelement The XML-element
-        @param loading Loading (true) or saving (false)
-        @return The XML-element
-    */
-    void SpaceShip::XMLPort(Element& xmlelement, XMLPort::Mode mode)
-    {
-        SUPER(SpaceShip, XMLPort, xmlelement, mode);
-
-        XMLPortParam(SpaceShip, "camera", setCamera, getCamera, xmlelement, mode);
-        XMLPortParam(SpaceShip, "maxSpeed", setMaxSpeed, getMaxSpeed, xmlelement, mode);
-        XMLPortParam(SpaceShip, "maxSideAndBackSpeed", setMaxSideAndBackSpeed, getMaxSideAndBackSpeed, xmlelement, mode);
-        XMLPortParam(SpaceShip, "maxRotation", setMaxRotation, getMaxRotation, xmlelement, mode);
-        XMLPortParam(SpaceShip, "transAcc", setTransAcc, getTransAcc, xmlelement, mode);
-        XMLPortParam(SpaceShip, "rotAcc", setRotAcc, getRotAcc, xmlelement, mode);
-        XMLPortParam(SpaceShip, "transDamp", setTransDamp, getTransDamp, xmlelement, mode);
-        XMLPortParam(SpaceShip, "rotDamp", setRotDamp, getRotDamp, xmlelement, mode);
-
-        myShip_=true; //TODO: this is a hack
-        SpaceShip::create();
-        /*if (this->isExactlyA(Class(SpaceShip)))
-            getFocus();*/
-    }
-
-    std::string SpaceShip::whereAmI() {
-        return getConvertedValue<float, std::string>(SpaceShip::getLocalShip()->getPosition().x)
-        + "  " + getConvertedValue<float, std::string>(SpaceShip::getLocalShip()->getPosition().y)
-        + "  " + getConvertedValue<float, std::string>(SpaceShip::getLocalShip()->getPosition().z);
-    }
-
-    void SpaceShip::tick(float dt)
-    {
-        if (!this->isActive())
-            return;
-
-        currentDir_ = getOrientation()*initialDir_;
-        currentOrth_ = getOrientation()*initialOrth_;
-
-        if (this->cam_)
-            this->cam_->tick(dt);
-
-        if (Settings::showsGraphics())
-        {
-            if (this->smoke_)
-                this->smoke_->setVisible(this->isVisible() && this->health_ < 40);
-            if (this->fire_)
-                this->fire_->setVisible(this->isVisible() && this->health_ < 20);
-
-            if (this->backlight_)
-            {   // (there's already fire ||                 we're to slow                 ||                  we're moving backwards                  )
-                if (this->health_ < 20   || this->getVelocity().squaredLength() < 150*150 || this->getVelocity().dotProduct(this->getInitialDir()) < 0)
-                    this->backlight_->setActive(false);
-                else
-                    this->backlight_->setActive(true);
-            }
-
-            if (this->redNode_ && this->greenNode_)
-            {
-                this->blinkTime_ += dt;
-                float redScale = 0.15 + 0.15 * sin(this->blinkTime_ * 10.0);
-                float greenScale = 0.15 - 0.15 * sin(this->blinkTime_ * 10.0);
-                this->redNode_->setScale(redScale, redScale, redScale);
-                this->greenNode_->setScale(greenScale, greenScale, greenScale);
-            }
-        }
-
-        if (this->timeToReload_ > 0)
-            this->timeToReload_ -= dt;
-        else
-            this->timeToReload_ = 0;
-
-        if (this->bLMousePressed_ && this->timeToReload_ <= 0)
-        {
-
-            BillboardProjectile* projectile = new ParticleProjectile(this);
-            projectile->setColour(this->getProjectileColour());
-            projectile->create();
-            if (projectile->getClassID() == 0)
-            {
-              COUT(3) << "generated projectile with classid 0" <<  std::endl; // TODO: remove this output
-            }
-
-            projectile->setObjectMode(0x3);
-            this->timeToReload_ = this->reloadTime_;
-        }
-
-
-        // #####################################
-        // ############# STEERING ##############
-        // #####################################
-
-        if (this->velocity_.x > this->maxSpeed_)
-            this->velocity_.x = this->maxSpeed_;
-        if (this->velocity_.x < -this->maxSideAndBackSpeed_)
-            this->velocity_.x = -this->maxSideAndBackSpeed_;
-        if (this->velocity_.y > this->maxSideAndBackSpeed_)
-            this->velocity_.y = this->maxSideAndBackSpeed_;
-        if (this->velocity_.y < -this->maxSideAndBackSpeed_)
-            this->velocity_.y = -this->maxSideAndBackSpeed_;
-        if (this->rotationRate_ > this->maxRotationRadian_)
-            this->rotationRate_ = this->maxRotationRadian_;
-        if (this->rotationRate_ < -this->maxRotationRadian_)
-            this->rotationRate_ = -this->maxRotationRadian_;
-
-        if (this->acceleration_.x == 0)
-        {
-            if (this->velocity_.x > 0)
-            {
-                this->velocity_.x -= (this->translationDamping_ * dt);
-                if (this->velocity_.x < 0)
-                    this->velocity_.x = 0;
-            }
-            else if (this->velocity_.x < 0)
-            {
-                this->velocity_.x += (this->translationDamping_ * dt);
-                if (this->velocity_.x > 0)
-                    this->velocity_.x = 0;
-            }
-        }
-
-        if (this->acceleration_.y == 0)
-        {
-            if (this->velocity_.y > 0)
-            {
-                this->velocity_.y -= (this->translationDamping_ * dt);
-                if (this->velocity_.y < 0)
-                    this->velocity_.y = 0;
-            }
-            else if (this->velocity_.y < 0)
-            {
-                this->velocity_.y += (this->translationDamping_ * dt);
-                if (this->velocity_.y > 0)
-                    this->velocity_.y = 0;
-            }
-        }
-
-        if (this->momentum_ == this->zeroRadian_)
-        {
-            if (this->rotationRate_ > this->zeroRadian_)
-            {
-                this->rotationRate_ -= (this->rotationDampingRadian_ * dt);
-                if (this->rotationRate_ < this->zeroRadian_)
-                    this->rotationRate_ = 0;
-            }
-            else if (this->rotationRate_ < this->zeroRadian_)
-            {
-                this->rotationRate_ += (this->rotationDampingRadian_ * dt);
-                if (this->rotationRate_ > this->zeroRadian_)
-                    this->rotationRate_ = 0;
-            }
-        }
-
-
-        SUPER(SpaceShip, tick, dt);
-
-        this->roll(this->mouseXRotation_ * dt);
-        if (this->bInvertYAxis_)
-            this->yaw(Radian(-this->mouseYRotation_ * dt));
-        else
-            this->yaw(Radian(this->mouseYRotation_ * dt));
-
-        if (this->acceleration_.x > 0)
-        {
-            this->tt1_->setEnabled(true);
-            this->tt2_->setEnabled(true);
-        }
-        else
-        {
-            this->tt1_->setEnabled(false);
-            this->tt2_->setEnabled(false);
-        }
-
-        COUT(5) << "steering our ship: " << getObjectID() << std::endl;
-        this->acceleration_.x = 0;
-        this->acceleration_.y = 0;
-        this->momentum_ = 0;
-        this->mouseXRotation_ = Radian(0);
-        this->mouseYRotation_ = Radian(0);
-        this->bLMousePressed_ = false;
-    }
-
-    void SpaceShip::movePitch(float val)
-    {   getLocalShip()->setMovePitch(val);   }
-    void SpaceShip::moveYaw(float val)
-    {   getLocalShip()->setMoveYaw(val);   }
-    void SpaceShip::moveRoll(float val)
-    {   getLocalShip()->setMoveRoll(val);   }
-    void SpaceShip::moveLongitudinal(float val)
-    {   getLocalShip()->setMoveLongitudinal(val);   }
-    void SpaceShip::moveLateral(float val)
-    {   getLocalShip()->setMoveLateral(val);   }
-    void SpaceShip::fire()
-    {   getLocalShip()->doFire();   }
-
-    void SpaceShip::setMovePitch(float val)
-    {
-        val = -val * val * sgn(val) * this->rotationAcceleration_;
-        if (val > this->maxRotation_)
-            val = this->maxRotation_;
-        if (val < -this->maxRotation_)
-            val = -this->maxRotation_;
-        this->mouseYRotation_ = Radian(val);
-    }
-
-    void SpaceShip::setMoveYaw(float val)
-    {
-        val = -val * val * sgn(val) * this->rotationAcceleration_;
-        if (val > this->maxRotation_)
-            val = this->maxRotation_;
-        if (val < -this->maxRotation_)
-            val = -this->maxRotation_;
-        this->mouseXRotation_ = Radian(val);
-    }
-
-    void SpaceShip::setMoveRoll(float val)
-    {
-        this->momentum_ = Radian(-this->rotationAccelerationRadian_ * val);
-        //COUT(3) << "rotating val: " << val << " acceleration: " << this->rotationAccelerationRadian_.valueDegrees() << std::endl;
-    }
-
-    void SpaceShip::setMoveLongitudinal(float val)
-    {
-        this->acceleration_.x = this->translationAcceleration_ * val;
-    }
-
-    void SpaceShip::setMoveLateral(float val)
-    {
-        this->acceleration_.y = -this->translationAcceleration_ * val;
-    }
-
-    void SpaceShip::doFire()
-    {
-        this->bLMousePressed_ = true;
-    }
-}
Index: code/trunk/src/orxonox/objects/SpaceShip.h
===================================================================
--- code/trunk/src/orxonox/objects/SpaceShip.h	(revision 1937)
+++ 	(revision )
@@ -1,193 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      Benjamin Knecht
- *
- */
-
-#ifndef _SpaceShip_H__
-#define _SpaceShip_H__
-#include <string>
-#include "OrxonoxPrereqs.h"
-#include <OgrePrerequisites.h>
-
-#include "util/Math.h"
-#include "Camera.h"
-#include "Model.h"
-#include "RadarViewable.h"
-#include "tools/BillboardSet.h"
-
-namespace orxonox
-{
-    class _OrxonoxExport SpaceShip : public Model, public RadarViewable
-    {
-        public:
-            static SpaceShip *getLocalShip();
-
-            SpaceShip();
-            ~SpaceShip();
-            virtual bool create();
-            void registerAllVariables();
-            void init();
-            void setConfigValues();
-            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-            virtual void tick(float dt);
-            virtual void changedVisibility();
-            virtual void changedActivity();
-
-            void setCamera(const std::string& camera = "");
-            void setMaxSpeed(float value);
-            void setMaxSideAndBackSpeed(float value);
-            void setMaxRotation(float value);
-            void setTransAcc(float value);
-            void setRotAcc(float value);
-            void setTransDamp(float value);
-            void setRotDamp(float value);
-            void getFocus();
-
-            inline float getMaxSpeed() const
-                { return this->maxSpeed_; }
-            inline float getMaxSideAndBackSpeed() const
-                { return this->maxSideAndBackSpeed_; }
-            inline float getMaxRotation() const
-                { return this->maxRotation_; }
-            inline float getTransAcc() const
-                { return this->translationAcceleration_; }
-            inline float getRotAcc() const
-                { return this->rotationAcceleration_; }
-            inline float getTransDamp() const
-                { return this->translationDamping_; }
-            inline float getRotDamp() const
-                { return this->rotationDamping_; }
-
-            static std::string whereAmI();
-            static void setMaxSpeedTest(float value)
-                { SpaceShip::instance_s->setMaxSpeed(value); }
-
-            static void movePitch(float value);
-            static void moveYaw(float value);
-            static void moveRoll(float value);
-            static void moveLongitudinal(float value);
-            static void moveLateral(float value);
-            static void fire();
-            void setMovePitch(float value);
-            void setMoveYaw(float value);
-            void setMoveRoll(float value);
-            void setMoveLongitudinal(float value);
-            void setMoveLateral(float value);
-            void doFire();
-
-            inline const Vector3& getDir() const
-                { return this->currentDir_; }
-            inline const Vector3& getInitialDir() const
-                { return this->initialDir_; }
-            inline const Vector3& getOrth() const
-                { return this->currentOrth_; }
-            inline const Vector3& getInitialOrth() const
-                { return this->initialOrth_; }
-
-            Camera* getCamera();
-
-            int getTeamNr() const
-                { return this->teamNr_; }
-            float getHealth() const
-                { return this->health_; }
-
-            bool getMyShip(){return myShip_;}
-
-        protected:
-            void setTeamNr(int teamNr)
-                { this->teamNr_ = teamNr; }
-
-        private:
-            void createCamera();
-            virtual ColourValue getProjectileColour() const
-                { return ColourValue(1.0, 1.0, 0.5); }
-
-            Vector3 testvector_;
-            Vector3 initialDir_;
-            Vector3 currentDir_;
-            Vector3 initialOrth_;
-            Vector3 currentOrth_;
-            bool bInvertYAxis_;
-            bool bLMousePressed_;
-            bool bRMousePressed_;
-
-            Ogre::SceneNode* camNode_;
-            Camera* cam_;
-            std::string camName_;
-
-            ParticleInterface* tt1_;
-            ParticleInterface* tt2_;
-            BillboardSet leftThrusterFlare_;
-            BillboardSet rightThrusterFlare_;
-
-            Backlight* backlight_;
-
-            BillboardSet redBillboard_;
-            BillboardSet greenBillboard_;
-            Ogre::SceneNode* redNode_;
-            Ogre::SceneNode* greenNode_;
-            float blinkTime_;
-
-            ParticleSpawner* smoke_;
-            ParticleSpawner* fire_;
-
-            BillboardSet crosshairNear_;
-            BillboardSet crosshairFar_;
-            Ogre::SceneNode* chNearNode_;
-            Ogre::SceneNode* chFarNode_;
-
-            float timeToReload_;
-            float reloadTime_;
-
-            float maxSideAndBackSpeed_;
-            float maxSpeed_;
-            float maxRotation_;
-            float translationAcceleration_;
-            float rotationAcceleration_;
-            float translationDamping_;
-            float rotationDamping_;
-
-            Radian maxRotationRadian_;
-            Radian rotationAccelerationRadian_;
-            Radian rotationDampingRadian_;
-            Radian zeroRadian_;
-            Radian mouseXRotation_;
-            Radian mouseYRotation_;
-
-            float mouseX_;
-            float mouseY_;
-
-        protected:
-            bool myShip_;
-
-            int teamNr_;
-            float health_;
-
-            static SpaceShip* instance_s;
-    };
-}
-
-#endif /* _SpaceShip_H__ */
Index: code/trunk/src/orxonox/objects/SpaceShipAI.cc
===================================================================
--- code/trunk/src/orxonox/objects/SpaceShipAI.cc	(revision 1937)
+++ 	(revision )
@@ -1,324 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "SpaceShipAI.h"
-
-#include <OgreMath.h>
-#include "Projectile.h"
-#include "ParticleSpawner.h"
-#include "core/CoreIncludes.h"
-#include "core/Iterator.h"
-#include "core/Executor.h"
-#include "core/ConsoleCommand.h"
-#include "core/XMLPort.h"
-#include "tools/ParticleInterface.h"
-#include "Settings.h"
-
-
-namespace orxonox
-{
-    const float ACTION_INTERVAL = 1.0f;
-
-    SetConsoleCommand(SpaceShipAI, createEnemy, true).defaultValue(0, 1);
-    SetConsoleCommand(SpaceShipAI, killEnemies, true).defaultValue(0, 0);
-
-    CreateFactory(SpaceShipAI);
-
-    SpaceShipAI::SpaceShipAI()
-    {
-        RegisterObject(SpaceShipAI);
-
-        this->target_ = 0;
-        this->bShooting_ = 0;
-        this->bHasTargetPosition_ = false;
-
-        this->setTeamNr((int)rnd(NUM_AI_TEAMS) % NUM_AI_TEAMS + 1);
-
-        if (NUM_AI_TEAMS > 0)
-            this->teamColours_[1] = ColourValue(1, 0, 0, 1);
-        if (NUM_AI_TEAMS > 1)
-            this->teamColours_[2] = ColourValue(0, 1, 0, 1);
-        if (NUM_AI_TEAMS > 2)
-            this->teamColours_[3] = ColourValue(0, 0, 1, 1);
-
-        for (int i = 4; i <= NUM_AI_TEAMS; ++i)
-            this->teamColours_[i] = ColourValue(rnd(), rnd(), rnd(), 1);
-    }
-
-    SpaceShipAI::~SpaceShipAI()
-    {
-    }
-
-    void SpaceShipAI::XMLPort(Element& xmlelement, XMLPort::Mode mode)
-    {
-        SUPER(SpaceShipAI, XMLPort, xmlelement, mode);
-
-        this->actionTimer_.setTimer(ACTION_INTERVAL, true, this, createExecutor(createFunctor(&SpaceShipAI::action)));
-    }
-
-    void SpaceShipAI::createEnemy(int num)
-    {
-        for (int i = 0; i < num; ++i)
-        {
-            SpaceShipAI* newenemy = new SpaceShipAI();
-            newenemy->setMesh("assff.mesh");
-//            newenemy->setPosition(0, 0, 0);
-            newenemy->setPosition(Vector3(rnd(-3000, 3000), rnd(-3000, 3000), rnd(-3000, 3000)));
-            newenemy->setScale(10);
-            newenemy->setMaxSpeed(500);
-            newenemy->setMaxSideAndBackSpeed(50);
-            newenemy->setMaxRotation(1.0);
-            newenemy->setTransAcc(200);
-            newenemy->setRotAcc(3.0);
-            newenemy->setTransDamp(75);
-            newenemy->setRotDamp(1.0);
-            Element xmlelement;
-            newenemy->XMLPort(xmlelement, XMLPort::LoadObject);
-
-            if (Settings::showsGraphics())
-            {
-                ParticleSpawner* spawneffect = new ParticleSpawner("Orxonox/fairytwirl", LODParticle::normal, 2.0, 0, 0, newenemy->getOrth());
-                spawneffect->setPosition(newenemy->getPosition() - newenemy->getOrth() * 50);
-                spawneffect->create();
-            }
-        }
-    }
-
-    void SpaceShipAI::killEnemies(int num)
-    {
-        int i = 0;
-        for (ObjectList<SpaceShipAI>::iterator it = ObjectList<SpaceShipAI>::begin(); it; )
-        {
-            (it++)->kill();
-            if (num && i >= num)
-                break;
-        }
-    }
-
-    ColourValue SpaceShipAI::getProjectileColour() const
-    {
-        return this->teamColours_[this->getTeamNr()];
-    }
-
-    void SpaceShipAI::action()
-    {
-        float random;
-        float maxrand = 100.0f / ACTION_INTERVAL;
-
-        // search enemy
-        random = rnd(maxrand);
-        if (random < 15 && (!this->target_))
-            this->searchNewTarget();
-
-        // forget enemy
-        random = rnd(maxrand);
-        if (random < 5 && (this->target_))
-            this->forgetTarget();
-
-        // next enemy
-        random = rnd(maxrand);
-        if (random < 10 && (this->target_))
-            this->searchNewTarget();
-
-        // fly somewhere
-        random = rnd(maxrand);
-        if (random < 50 && (!this->bHasTargetPosition_ && !this->target_))
-            this->searchNewTargetPosition();
-
-        // stop flying
-        random = rnd(maxrand);
-        if (random < 10 && (this->bHasTargetPosition_ && !this->target_))
-            this->bHasTargetPosition_ = false;
-
-        // fly somewhere else
-        random = rnd(maxrand);
-        if (random < 30 && (this->bHasTargetPosition_ && !this->target_))
-            this->searchNewTargetPosition();
-
-        // shoot
-        random = rnd(maxrand);
-        if (random < 75 && (this->target_ && !this->bShooting_))
-            this->bShooting_ = true;
-
-        // stop shooting
-        random = rnd(maxrand);
-        if (random < 25 && (this->bShooting_))
-            this->bShooting_ = false;
-    }
-
-    void SpaceShipAI::damage(float damage)
-    {
-        this->health_ -= damage;
-        if (this->health_ <= 0)
-        {
-            this->kill();
-            SpaceShipAI::createEnemy(1);
-        }
-    }
-
-    void SpaceShipAI::kill()
-    {
-        if (Settings::showsGraphics())
-        {
-            ParticleSpawner* explosion = new ParticleSpawner("Orxonox/BigExplosion1part1", LODParticle::low, 3.0);
-            explosion->setPosition(this->getPosition());
-            explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true);
-            explosion->setScale(4);
-            explosion->create();
-
-            explosion = new ParticleSpawner("Orxonox/BigExplosion1part2", LODParticle::normal, 3.0);
-            explosion->setPosition(this->getPosition());
-            explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true);
-            explosion->setScale(4);
-            explosion->create();
-            explosion = new ParticleSpawner("Orxonox/BigExplosion1part2", LODParticle::high, 3.0);
-            explosion->setPosition(this->getPosition());
-            explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true);
-            explosion->setScale(4);
-            explosion->create();
-
-            Vector3 ringdirection = Vector3(rnd(), rnd(), rnd());
-            ringdirection.normalise();
-            explosion = new ParticleSpawner("Orxonox/BigExplosion1part3", LODParticle::normal, 3.0, 0.5, 0, ringdirection);
-            explosion->setPosition(this->getPosition());
-            explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true);
-            explosion->setScale(4);
-            explosion->create();
-            explosion = new ParticleSpawner("Orxonox/BigExplosion1part3", LODParticle::high, 3.0, 0.5, 0, ringdirection);
-            explosion->setPosition(this->getPosition());
-            explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true);
-            explosion->setScale(4);
-            explosion->create();
-        }
-
-        delete this;
-    }
-
-    void SpaceShipAI::tick(float dt)
-    {
-        if (!this->isActive())
-            return;
-
-        if (this->target_)
-            this->aimAtTarget();
-
-        if (this->bHasTargetPosition_)
-            this->moveToTargetPosition(dt);
-
-        if (this->bShooting_ && this->isCloseAtTarget(2500) && this->isLookingAtTarget(Ogre::Math::PI / 20.0))
-            this->doFire();
-
-        SUPER(SpaceShipAI, tick, dt);
-    }
-
-    void SpaceShipAI::moveToTargetPosition(float dt)
-    {
-        Vector2 coord = get2DViewdirection(this->getPosition(), this->getDir(), this->getOrth(), this->targetPosition_);
-
-        float distance = (this->targetPosition_ - this->getPosition()).length();
-        if (this->target_ || distance > 50)
-        {
-            // Multiply with 0.8 to make them a bit slower
-            this->setMoveYaw(0.8 * sgn(coord.x) * coord.x*coord.x);
-            this->setMovePitch(0.8 * sgn(coord.y) * coord.y*coord.y);
-        }
-
-        if (this->target_ && distance < 1000 && this->getVelocity().squaredLength() > this->target_->getVelocity().squaredLength())
-            this->setMoveLongitudinal(-0.5); // They don't brake with full power to give the player a chance
-        else if (!this->target_ && distance <= this->getVelocity().length() / (2 * this->getTransAcc()))
-            this->setMoveLongitudinal(-1.0);
-        else
-            this->setMoveLongitudinal(0.8);
-    }
-
-    void SpaceShipAI::searchNewTargetPosition()
-    {
-        this->targetPosition_ = Vector3(rnd(-5000,5000), rnd(-5000,5000), rnd(-5000,5000));
-        this->bHasTargetPosition_ = true;
-    }
-
-    void SpaceShipAI::searchNewTarget()
-    {
-        this->targetPosition_ = this->getPosition();
-        this->forgetTarget();
-
-        for (ObjectList<SpaceShip>::iterator it = ObjectList<SpaceShip>::begin(); it; ++it)
-        {
-            if (it->getTeamNr() != this->getTeamNr())
-            {
-                float speed = this->getVelocity().length();
-                Vector3 distanceCurrent = this->targetPosition_ - this->getPosition();
-                Vector3 distanceNew = it->getPosition() - this->getPosition();
-                if (!this->target_ || it->getPosition().squaredDistance(this->getPosition()) * (1.5f + acos((this->getOrientation() * Ogre::Vector3::UNIT_X).dotProduct(distanceNew) / speed / distanceNew.length()) / (2 * Ogre::Math::PI))
-                        < this->targetPosition_.squaredDistance(this->getPosition()) * (1.5f + acos((this->getOrientation() * Ogre::Vector3::UNIT_X).dotProduct(distanceCurrent) / speed / distanceCurrent.length()) / (2 * Ogre::Math::PI)) + rnd(-250, 250))
-                {
-                    this->target_ = (*it);
-                    this->targetPosition_ = it->getPosition();
-                }
-            }
-        }
-    }
-
-    void SpaceShipAI::forgetTarget()
-    {
-        this->target_ = 0;
-        this->bShooting_ = false;
-    }
-
-    void SpaceShipAI::aimAtTarget()
-    {
-        if (!this->target_)
-            return;
-
-        this->targetPosition_ = getPredictedPosition(this->getPosition(), Projectile::getSpeed(), this->target_->getPosition(), this->target_->getOrientation() * this->target_->getVelocity());
-        this->bHasTargetPosition_ = (this->targetPosition_ != Vector3::ZERO);
-    }
-
-    bool SpaceShipAI::isCloseAtTarget(float distance)
-    {
-        if (!this->target_)
-            return (this->getPosition().squaredDistance(this->targetPosition_) < distance*distance);
-        else
-            return (this->getPosition().squaredDistance(this->target_->getPosition()) < distance*distance);
-    }
-
-    bool SpaceShipAI::isLookingAtTarget(float angle)
-    {
-        return (getAngle(this->getPosition(), this->getDir(), this->targetPosition_) < angle);
-    }
-
-    void SpaceShipAI::shipDied(SpaceShip* ship)
-    {
-        if (ship == this->target_)
-        {
-            this->forgetTarget();
-            this->searchNewTargetPosition();
-        }
-    }
-}
Index: code/trunk/src/orxonox/objects/SpaceShipAI.h
===================================================================
--- code/trunk/src/orxonox/objects/SpaceShipAI.h	(revision 1937)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _SpaceShipAI_H__
-#define _SpaceShipAI_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "SpaceShip.h"
-#include "tools/Timer.h"
-#include "util/Math.h"
-
-
-namespace orxonox
-{
-    const int NUM_AI_TEAMS = 3;
-
-    class SpaceShipAI : public SpaceShip
-    {
-        public:
-            SpaceShipAI();
-            virtual ~SpaceShipAI();
-
-            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-            virtual void tick(float dt);
-            static void createEnemy(int num);
-            static void killEnemies(int num);
-            void shipDied(SpaceShip* ship);
-            void damage(float damage);
-            void kill();
-
-        private:
-            virtual ColourValue getProjectileColour() const;
-
-            void action();
-
-            void moveToTargetPosition(float dt);
-            void searchNewTargetPosition();
-            void forgetTarget();
-            void searchNewTarget();
-            void aimAtTarget();
-            bool isCloseAtTarget(float distance);
-            bool isLookingAtTarget(float angle);
-
-            Timer<SpaceShipAI> actionTimer_;
-
-            bool bHasTargetPosition_;
-            Vector3 targetPosition_;
-            SpaceShip* target_;
-            bool bShooting_;
-
-            ColourValue teamColours_[NUM_AI_TEAMS + 1];
-    };
-}
-
-#endif /* _SpaceShipAI_H__ */
Index: code/trunk/src/orxonox/objects/Test.cc
===================================================================
--- code/trunk/src/orxonox/objects/Test.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/Test.cc	(revision 2087)
@@ -0,0 +1,79 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Oli Scheuss
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
+#include "Test.h"
+
+namespace orxonox
+{
+	CreateFactory ( Test );
+
+	Test::Test(BaseObject* creator) : BaseObject(creator), network::Synchronisable(creator)
+	{
+		RegisterObject ( Test );
+                setConfigValues();
+                registerVariables();
+		setObjectMode(0x3);
+	}
+
+	Test::~Test()
+	{
+
+	}
+
+	void Test::setConfigValues()
+	{
+		SetConfigValue ( v1, 1 ).callback ( this, &Test::checkV1 );
+                SetConfigValue ( v2, 2 ).callback ( this, &Test::checkV2 );
+                SetConfigValue ( v3, 3 ).callback ( this, &Test::checkV3 );
+	}
+
+
+	void Test::registerVariables()
+	{
+		REGISTERDATA ( v1,network::direction::toclient, new network::NetworkCallback<Test> ( this, &Test::checkV1 ) );
+                REGISTERDATA ( v2,network::direction::toserver, new network::NetworkCallback<Test> ( this, &Test::checkV2 ) );
+		REGISTERDATA ( v3,network::direction::bidirectional, new network::NetworkCallback<Test> ( this, &Test::checkV3 ) );
+	}
+
+        void Test::checkV1(){
+                COUT(1) << "V1 changed: " << v1 << std::endl;
+        }
+
+        void Test::checkV2(){
+                COUT(1) << "V2 changed: " << v2 << std::endl;
+        }
+
+        void Test::checkV3(){
+                COUT(1) << "V3 changed: " << v3 << std::endl;
+        }
+
+
+}
Index: code/trunk/src/orxonox/objects/Test.h
===================================================================
--- code/trunk/src/orxonox/objects/Test.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/Test.h	(revision 2087)
@@ -0,0 +1,62 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Oli Scheuss
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Test_H__
+#define _Test_H__
+
+#include "OrxonoxPrereqs.h"
+#include "core/BaseObject.h"
+#include "network/Synchronisable.h"
+
+namespace orxonox
+{
+  class _OrxonoxExport Test: public BaseObject, public network::Synchronisable
+  {
+    public:
+      Test(BaseObject* creator);
+      virtual ~Test();
+
+      void setConfigValues();
+      void registerVariables();
+
+      void setV1(unsigned int value){ v1 = value; }
+      void setV2(unsigned int value){ v2 = value; }
+      void setV3(unsigned int value){ v3 = value; }
+
+      void checkV1();
+      void checkV2();
+      void checkV3();
+
+    private:
+      unsigned int v1;
+      unsigned int v2;
+      unsigned int v3;
+  };
+}
+
+#endif /* _Test_H__ */
Index: code/trunk/src/orxonox/objects/WorldEntity.cc
===================================================================
--- code/trunk/src/orxonox/objects/WorldEntity.cc	(revision 1937)
+++ 	(revision )
@@ -1,189 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "WorldEntity.h"
-
-#include <string>
-#include <sstream>
-#include <OgreSceneManager.h>
-
-#include "tinyxml/tinyxml.h"
-#include "util/SubString.h"
-#include "core/CoreIncludes.h"
-#include "GraphicsEngine.h"
-#include "core/XMLPort.h"
-
-namespace orxonox
-{
-    CreateFactory(WorldEntity);
-
-    unsigned int WorldEntity::worldEntityCounter_s = 0;
-
-    WorldEntity::WorldEntity()
-    {
-        RegisterObject(WorldEntity);
-
-        if (GraphicsEngine::getInstance().getLevelSceneManager())
-        {
-            std::ostringstream name;
-            name << (WorldEntity::worldEntityCounter_s++);
-            this->setName("WorldEntity" + name.str());
-            this->node_ = GraphicsEngine::getInstance().getLevelSceneManager()->getRootSceneNode()->createChildSceneNode(this->getName());
-
-            registerAllVariables();
-        }
-        else
-        {
-            this->node_ = 0;
-        }
-
-        this->bStatic_ = true;
-        this->velocity_ = Vector3(0, 0, 0);
-        this->acceleration_ = Vector3(0, 0, 0);
-        this->rotationAxis_ = Vector3(0, 1, 0);
-        this->rotationRate_ = 0;
-        this->momentum_ = 0;
-    }
-
-
-    WorldEntity::~WorldEntity()
-    {
-        if (this->isInitialized())
-        {
-            this->getNode()->removeAndDestroyAllChildren();
-            GraphicsEngine::getInstance().getLevelSceneManager()->destroySceneNode(this->getName());
-        }
-    }
-
-    void WorldEntity::tick(float dt)
-    {
-        if (!this->bStatic_ && this->isActive())
-        {
-//             COUT(4) << "acceleration: " << this->acceleration_ << " velocity: " << this->velocity_ << std::endl;
-            this->velocity_ += (dt * this->acceleration_);
-            this->translate(dt * this->velocity_, Ogre::Node::TS_LOCAL);
-
-            this->rotationRate_ += (dt * this->momentum_);
-            this->rotate(this->rotationAxis_, dt * this->rotationRate_);
-            //COUT(3) << "rotationrate: " << this->rotationRate_.valueDegrees() << " momentum: " << this->momentum_.valueDegrees() << std::endl;
-        }
-    }
-
-    void WorldEntity::setYawPitchRoll(const Degree& yaw, const Degree& pitch, const Degree& roll)
-    {
-        this->yaw(yaw);
-        this->pitch(pitch);
-        this->roll(roll);
-    }
-
-    /**
-        @brief XML loading and saving.
-        @param xmlelement The XML-element
-        @param loading Loading (true) or saving (false)
-        @return The XML-element
-    */
-    void WorldEntity::XMLPort(Element& xmlelement, XMLPort::Mode mode)
-    {
-        SUPER(WorldEntity, XMLPort, xmlelement, mode);
-
-        XMLPortParamExternTemplate(WorldEntity, Ogre::Node, this->node_, "position", setPosition, getPosition, xmlelement, mode, const Vector3&);
-        XMLPortParamLoadOnly(WorldEntity, "direction", setDirectionSimple, xmlelement, mode);
-        XMLPortParamLoadOnly(WorldEntity, "yawpitchroll", setYawPitchRoll, xmlelement, mode);
-        XMLPortParam(WorldEntity, "scale", setScale, getScale, xmlelement, mode);
-        XMLPortParamTemplate(WorldEntity, "rotationAxis", setRotationAxis, getRotationAxis, xmlelement, mode, const Vector3&);
-        XMLPortParam(WorldEntity, "rotationRate", setRotationRate, getRotationRate, xmlelement, mode);
-
-        XMLPortObject(WorldEntity, WorldEntity, "attached", attachWorldEntity, getAttachedWorldEntity, xmlelement, mode);
-
-        WorldEntity::create();
-    }
-
-
-    void WorldEntity::registerAllVariables()
-    {
-      // register inheritec variables from BaseObject
-      registerVar( (void*) &(this->bActive_), sizeof(this->bActive_), network::DATA, 0x3);
-      registerVar( (void*) &(this->bVisible_), sizeof(this->bVisible_), network::DATA, 0x3);
-      // register coordinates
-      registerVar( (void*) &(this->getPosition().x), sizeof(this->getPosition().x), network::DATA, 0x3);
-      registerVar( (void*) &(this->getPosition().y), sizeof(this->getPosition().y), network::DATA, 0x3);
-      registerVar( (void*) &(this->getPosition().z), sizeof(this->getPosition().z), network::DATA, 0x3);
-      // register orientation
-      registerVar( (void*) &(this->getOrientation().w), sizeof(this->getOrientation().w), network::DATA, 0x3);
-      registerVar( (void*) &(this->getOrientation().x), sizeof(this->getOrientation().x), network::DATA, 0x3);
-      registerVar( (void*) &(this->getOrientation().y), sizeof(this->getOrientation().y), network::DATA, 0x3);
-      registerVar( (void*) &(this->getOrientation().z), sizeof(this->getOrientation().z), network::DATA, 0x3);
-      // register velocity_
-      registerVar( (void*) &(this->getVelocity().x), sizeof(this->getVelocity().x), network::DATA, 0x3);
-      registerVar( (void*) &(this->getVelocity().y), sizeof(this->getVelocity().y), network::DATA, 0x3);
-      registerVar( (void*) &(this->getVelocity().z), sizeof(this->getVelocity().z), network::DATA, 0x3);
-      // register rotationAxis/rate
-      registerVar( (void*) &(this->getRotationRate()), sizeof(this->getRotationRate()), network::DATA, 0x3);
-      registerVar( (void*) &(this->getRotationAxis().x), sizeof(this->getRotationAxis().x), network::DATA, 0x3);
-      registerVar( (void*) &(this->getRotationAxis().y), sizeof(this->getRotationAxis().y), network::DATA, 0x3);
-      registerVar( (void*) &(this->getRotationAxis().z), sizeof(this->getRotationAxis().z), network::DATA, 0x3);
-      // register scale of node
-      registerVar( (void*) &(this->getScale3D().x), sizeof(this->getScale3D().x), network::DATA, 0x3);
-      registerVar( (void*) &(this->getScale3D().y), sizeof(this->getScale3D().y), network::DATA, 0x3);
-      registerVar( (void*) &(this->getScale3D().z), sizeof(this->getScale3D().z), network::DATA, 0x3);
-      //register staticity
-      registerVar( (void*) &(this->bStatic_), sizeof(this->bStatic_), network::DATA, 0x3);
-      //register acceleration & momentum
-//       registerVar( (void*) &(this->getAcceleration().x), sizeof(this->getAcceleration().x), network::DATA, 0x2);
-//       registerVar( (void*) &(this->getAcceleration().y), sizeof(this->getAcceleration().y), network::DATA, 0x2);
-//       registerVar( (void*) &(this->getAcceleration().z), sizeof(this->getAcceleration().z), network::DATA, 0x2);
-//       registerVar( (void*) &(this->getMomentum()), sizeof(this->getMomentum()), network::DATA, 0x2); // only backsync
-    }
-
-    void WorldEntity::attachWorldEntity(WorldEntity* entity)
-    {
-        this->attachedWorldEntities_.push_back(entity);
-        this->attachObject(entity);
-    }
-
-    const WorldEntity* WorldEntity::getAttachedWorldEntity(unsigned int index) const
-    {
-        if (index < this->attachedWorldEntities_.size())
-            return this->attachedWorldEntities_[index];
-        else
-            return 0;
-    }
-
-    void WorldEntity::attachObject(const WorldEntity& obj) const
-    {
-        GraphicsEngine::getInstance().getLevelSceneManager()->getRootSceneNode()->removeChild(obj.getNode());
-        this->getNode()->addChild(obj.getNode());
-    }
-
-    void WorldEntity::attachObject(WorldEntity* obj) const
-    {
-        GraphicsEngine::getInstance().getLevelSceneManager()->getRootSceneNode()->removeChild(obj->getNode());
-        this->getNode()->addChild(obj->getNode());
-    }
-}
Index: code/trunk/src/orxonox/objects/WorldEntity.h
===================================================================
--- code/trunk/src/orxonox/objects/WorldEntity.h	(revision 1937)
+++ 	(revision )
@@ -1,199 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _WorldEntity_H__
-#define _WorldEntity_H__
-
-#include "OrxonoxPrereqs.h"
-#include <OgrePrerequisites.h>
-
-#include <OgreSceneNode.h>
-#include "util/Math.h"
-#include "network/Synchronisable.h"
-#include "core/XMLIncludes.h"
-#include "core/BaseObject.h"
-#include "Tickable.h"
-#include "tools/Mesh.h"
-
-namespace orxonox
-{
-    class _OrxonoxExport WorldEntity : public BaseObject, public Tickable, public network::Synchronisable
-    {
-        public:
-            WorldEntity();
-            virtual ~WorldEntity();
-
-            virtual void tick(float dt);
-            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-            virtual inline bool create(){ return Synchronisable::create(); }
-
-            void attachWorldEntity(WorldEntity* entity);
-            const WorldEntity* getAttachedWorldEntity(unsigned int index) const;
-
-            inline Ogre::SceneNode* getNode() const
-                { return this->node_; }
-
-            inline void setNode(Ogre::SceneNode* node)
-                { this->node_ = node; }
-
-            inline void setPosition(const Vector3& pos)
-                { this->node_->setPosition(pos); }
-            inline void setPosition(Real x, Real y, Real z)
-                { this->node_->setPosition(x, y, z); }
-            inline const Vector3& getPosition() const
-                { return this->node_->getPosition(); }
-            inline const Vector3& getWorldPosition() const
-                { return this->node_->getWorldPosition(); }
-
-            inline void translate(const Vector3& d, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT)
-                { this->node_->translate(d, relativeTo); }
-            inline void translate(Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT)
-                { this->node_->translate(x, y, z, relativeTo); }
-            inline void translate(const Matrix3& axes, const Vector3& move, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT)
-                { this->node_->translate(axes, move, relativeTo); }
-            inline void translate(const Matrix3& axes, Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT)
-                { this->node_->translate(axes, x, y, z, relativeTo); }
-
-            inline void yaw(const Radian& angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL)
-                { this->node_->yaw(angle, relativeTo); }
-            inline void pitch(const Radian& angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL)
-                { this->node_->pitch(angle, relativeTo); }
-            inline void roll(const Radian& angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL)
-                { this->node_->roll(angle, relativeTo); }
-            void setYawPitchRoll(const Degree& yaw, const Degree& pitch, const Degree& roll);
-
-            inline void setYaw(const Degree& angle)
-                { this->node_->yaw(angle, Ogre::Node::TS_LOCAL); }
-            inline void setPitch(const Degree& angle)
-                { this->node_->pitch(angle, Ogre::Node::TS_LOCAL); }
-            inline void setRoll(const Degree& angle)
-                { this->node_->roll(angle, Ogre::Node::TS_LOCAL); }
-
-            inline const Ogre::Quaternion& getOrientation()
-              { return this->node_->getOrientation(); }
-            inline const Ogre::Quaternion& getWorldOrientation()
-              { return this->node_->getWorldOrientation(); }
-            inline void setOrientation(const Ogre::Quaternion& quat)
-              { this->node_->setOrientation(quat); }
-            inline void rotate(const Vector3& axis, const Radian& angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL)
-              { this->node_->rotate(axis, angle, relativeTo); }
-            inline void setDirectionSimple(Real x, Real y, Real z)
-              { this->setDirection(x, y, z); }
-            inline void setDirection(Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
-              { this->node_->setDirection(x, y, z, relativeTo, localDirectionVector); }
-            inline void setDirection(const Vector3& vec, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
-              { this->node_->setDirection(vec, relativeTo, localDirectionVector); }
-            inline void lookAt(const Vector3& targetPoint, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
-              { this->node_->lookAt(targetPoint, relativeTo, localDirectionVector); }
-
-            inline void setScale3D(const Vector3 &scale)
-              { this->node_->setScale(scale); }
-            inline void setScale3D(Real x, Real y, Real z)
-              { this->node_->setScale(x, y, z); }
-            inline const Vector3& getScale3D(void) const
-              { return this->node_->getScale(); }
-            inline void setScale(float scale)
-              { this->node_->setScale(scale, scale, scale); }
-            inline float getScale() const
-              { Vector3 scale = this->getScale3D(); return (scale.x == scale.y && scale.x == scale.z) ? scale.x : 1; }
-            inline void scale3D(const Vector3 &scale)
-              { this->node_->scale(scale); }
-            inline void scale3D(Real x, Real y, Real z)
-              { this->node_->scale(x, y, z); }
-            inline void scale(Real scale)
-              { this->node_->scale(scale, scale, scale); }
-
-            void attachObject(const WorldEntity& obj) const;
-            void attachObject(WorldEntity* obj) const;
-            inline void attachObject(Ogre::MovableObject* obj) const
-              { this->node_->attachObject(obj); }
-            inline void attachObject(Mesh& mesh) const
-              { this->node_->attachObject(mesh.getEntity()); }
-            inline void detachObject(Ogre::MovableObject* obj) const
-              { this->node_->detachObject(obj); }
-            inline void detachAllObjects() const
-              { this->node_->detachAllObjects(); }
-
-            inline void setVelocity(const Vector3& velocity)
-                { this->velocity_ = velocity; }
-            inline void setVelocity(Real x, Real y, Real z)
-                { this->velocity_.x = x; this->velocity_.y = y; this->velocity_.z = z; }
-            inline const Vector3& getVelocity() const
-                { return this->velocity_; }
-
-            inline void setAcceleration(const Vector3& acceleration)
-                { this->acceleration_ = acceleration; }
-            inline void setAcceleration(Real x, Real y, Real z)
-                { this->acceleration_.x = x; this->acceleration_.y = y; this->acceleration_.z = z; }
-            inline const Vector3& getAcceleration() const
-                { return this->acceleration_; }
-
-            inline void setRotationAxis(const Vector3& axis)
-                { this->rotationAxis_ = axis; this->rotationAxis_.normalise(); }
-            inline void setRotationAxis(Real x, Real y, Real z)
-                { this->rotationAxis_.x = x; this->rotationAxis_.y = y; this->rotationAxis_.z = z; rotationAxis_.normalise(); }
-            inline const Vector3& getRotationAxis() const
-                { return this->rotationAxis_; }
-
-//            inline void setRotationRate(const Radian& angle)
-//                { this->rotationRate_ = angle; }
-            inline void setRotationRate(const Degree& angle)
-                { this->rotationRate_ = angle; this->setStatic(angle == Degree(0)); }
-            inline const Radian& getRotationRate() const
-                { return this->rotationRate_; }
-
-            inline void setMomentum(const Radian& angle)
-                { this->momentum_ = angle; }
-            inline void setMomentum(const Degree& angle)
-                { this->momentum_ = angle; }
-            inline const Radian& getMomentum() const
-                { return this->momentum_; }
-
-            inline void setStatic(bool bStatic)
-                { this->bStatic_ = bStatic; }
-            inline bool isStatic() const
-                { return this->bStatic_; }
-
-        protected:
-            void registerAllVariables();
-
-            Vector3 velocity_;
-            Vector3 acceleration_;
-            Vector3 rotationAxis_;
-            Radian rotationRate_;
-            Radian momentum_;
-
-        private:
-            static unsigned int worldEntityCounter_s;
-            Ogre::SceneNode* node_;
-            bool bStatic_;
-            std::vector<WorldEntity*> attachedWorldEntities_;
-    };
-}
-
-#endif /* _WorldEntity_H__ */
Index: code/trunk/src/orxonox/objects/controllers/Controller.cc
===================================================================
--- code/trunk/src/orxonox/objects/controllers/Controller.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/controllers/Controller.cc	(revision 2087)
@@ -0,0 +1,49 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Controller.h"
+
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+    CreateUnloadableFactory(Controller);
+
+    Controller::Controller(BaseObject* creator) : BaseObject(creator)
+    {
+        RegisterObject(Controller);
+
+        this->player_ = 0;
+        this->controllableEntity_ = 0;
+    }
+
+    Controller::~Controller()
+    {
+    }
+}
Index: code/trunk/src/orxonox/objects/controllers/Controller.h
===================================================================
--- code/trunk/src/orxonox/objects/controllers/Controller.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/controllers/Controller.h	(revision 2087)
@@ -0,0 +1,60 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Controller_H__
+#define _Controller_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "core/BaseObject.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport Controller : public BaseObject
+    {
+        public:
+            Controller(BaseObject* creator);
+            virtual ~Controller();
+
+            inline void setPlayer(PlayerInfo* player)
+                { this->player_ = player; }
+            inline PlayerInfo* getPlayer() const
+                { return this->player_; }
+
+            virtual inline void setControllableEntity(ControllableEntity* entity)
+                { this->controllableEntity_ = entity; }
+            virtual inline ControllableEntity* getControllableEntity() const
+                { return this->controllableEntity_; }
+
+        protected:
+            PlayerInfo* player_;
+            ControllableEntity* controllableEntity_;
+    };
+}
+
+#endif /* _Controller_H__ */
Index: code/trunk/src/orxonox/objects/controllers/HumanController.cc
===================================================================
--- code/trunk/src/orxonox/objects/controllers/HumanController.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/controllers/HumanController.cc	(revision 2087)
@@ -0,0 +1,131 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "HumanController.h"
+
+#include "core/CoreIncludes.h"
+#include "core/ConsoleCommand.h"
+#include "objects/worldentities/ControllableEntity.h"
+
+namespace orxonox
+{
+    SetConsoleCommand(HumanController, moveFrontBack, true).setAsInputCommand();
+    SetConsoleCommand(HumanController, moveRightLeft, true).setAsInputCommand();
+    SetConsoleCommand(HumanController, moveUpDown,    true).setAsInputCommand();
+    SetConsoleCommand(HumanController, rotateYaw,     true).setAsInputCommand();
+    SetConsoleCommand(HumanController, rotatePitch,   true).setAsInputCommand();
+    SetConsoleCommand(HumanController, rotateRoll,    true).setAsInputCommand();
+    SetConsoleCommand(HumanController, fire,          true).keybindMode(KeybindMode::OnHold);
+    SetConsoleCommand(HumanController, altFire,       true).keybindMode(KeybindMode::OnHold);
+    SetConsoleCommand(HumanController, greet,         true);
+    SetConsoleCommand(HumanController, use,           true);
+    SetConsoleCommand(HumanController, switchCamera,  true);
+
+    CreateUnloadableFactory(HumanController);
+
+    HumanController* HumanController::localController_s = 0;
+
+    HumanController::HumanController(BaseObject* creator) : Controller(creator)
+    {
+        RegisterObject(HumanController);
+
+        HumanController::localController_s = this;
+    }
+
+    HumanController::~HumanController()
+    {
+        HumanController::localController_s = 0;
+    }
+
+    void HumanController::moveFrontBack(const Vector2& value)
+    {
+        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
+            HumanController::localController_s->controllableEntity_->moveFrontBack(value);
+    }
+
+    void HumanController::moveRightLeft(const Vector2& value)
+    {
+        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
+            HumanController::localController_s->controllableEntity_->moveRightLeft(value);
+    }
+
+    void HumanController::moveUpDown(const Vector2& value)
+    {
+        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
+            HumanController::localController_s->controllableEntity_->moveUpDown(value);
+    }
+
+    void HumanController::rotateYaw(const Vector2& value)
+    {
+        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
+            HumanController::localController_s->controllableEntity_->rotateYaw(value);
+    }
+
+    void HumanController::rotatePitch(const Vector2& value)
+    {
+        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
+            HumanController::localController_s->controllableEntity_->rotatePitch(value);
+    }
+
+    void HumanController::rotateRoll(const Vector2& value)
+    {
+        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
+            HumanController::localController_s->controllableEntity_->rotateRoll(value);
+    }
+
+    void HumanController::fire()
+    {
+        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
+            HumanController::localController_s->controllableEntity_->fire();
+    }
+
+    void HumanController::altFire()
+    {
+        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
+            HumanController::localController_s->controllableEntity_->altFire();
+    }
+
+    void HumanController::greet()
+    {
+        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
+            HumanController::localController_s->controllableEntity_->greet();
+    }
+
+    void HumanController::use()
+    {
+        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
+            HumanController::localController_s->controllableEntity_->use();
+    }
+
+    void HumanController::switchCamera()
+    {
+        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
+            HumanController::localController_s->controllableEntity_->switchCamera();
+    }
+}
Index: code/trunk/src/orxonox/objects/controllers/HumanController.h
===================================================================
--- code/trunk/src/orxonox/objects/controllers/HumanController.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/controllers/HumanController.h	(revision 2087)
@@ -0,0 +1,65 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _HumanController_H__
+#define _HumanController_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "util/Math.h"
+#include "Controller.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport HumanController : public Controller
+    {
+        public:
+            HumanController(BaseObject* creator);
+            virtual ~HumanController();
+
+            static void moveFrontBack(const Vector2& value);
+            static void moveRightLeft(const Vector2& value);
+            static void moveUpDown(const Vector2& value);
+
+            static void rotateYaw(const Vector2& value);
+            static void rotatePitch(const Vector2& value);
+            static void rotateRoll(const Vector2& value);
+
+            static void fire();
+            static void altFire();
+
+            static void greet();
+            static void use();
+            static void switchCamera();
+
+        private:
+            static HumanController* localController_s;
+    };
+}
+
+#endif /* _HumanController_H__ */
Index: code/trunk/src/orxonox/objects/gametypes/Gametype.cc
===================================================================
--- code/trunk/src/orxonox/objects/gametypes/Gametype.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/gametypes/Gametype.cc	(revision 2087)
@@ -0,0 +1,255 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Gametype.h"
+
+#include <cstdlib>
+#include <ctime>
+
+#include "core/CoreIncludes.h"
+#include "objects/infos/PlayerInfo.h"
+#include "objects/worldentities/pawns/Spectator.h"
+#include "objects/worldentities/SpawnPoint.h"
+
+#include "network/Host.h"
+
+namespace orxonox
+{
+    CreateUnloadableFactory(Gametype);
+
+    Gametype::Gametype(BaseObject* creator) : BaseObject(creator)
+    {
+        RegisterObject(Gametype);
+
+        this->defaultControllableEntity_ = Class(Spectator);
+
+        this->bStarted_ = false;
+        this->bEnded_ = false;
+        this->bAutoStart_ = false;
+        this->bForceSpawn_ = false;
+
+        this->initialStartCountdown_ = 3;
+        this->startCountdown_ = 0;
+        this->bStartCountdownRunning_ = false;
+    }
+
+    void Gametype::tick(float dt)
+    {
+        if (this->bStartCountdownRunning_ && !this->bStarted_)
+            this->startCountdown_ -= dt;
+
+        if (!this->bStarted_)
+            this->checkStart();
+
+        this->assignDefaultPawnsIfNeeded();
+        this->spawnDeadPlayersIfRequested();
+    }
+
+    void Gametype::start()
+    {
+        COUT(0) << "game started" << std::endl;
+        this->bStarted_ = true;
+
+        this->spawnPlayersIfRequested();
+    }
+
+    void Gametype::end()
+    {
+        COUT(0) << "game ended" << std::endl;
+        this->bEnded_ = true;
+    }
+
+    void Gametype::playerEntered(PlayerInfo* player)
+    {
+        this->players_.insert(player);
+
+        std::string message = player->getName() + " entered the game";
+        COUT(0) << message << std::endl;
+        network::Host::Broadcast(message);
+    }
+
+    void Gametype::playerLeft(PlayerInfo* player)
+    {
+        std::set<PlayerInfo*>::iterator it = this->players_.find(player);
+        if (it != this->players_.end())
+        {
+            this->players_.erase(it);
+
+            std::string message = player->getName() + " left the game";
+            COUT(0) << message << std::endl;
+            network::Host::Broadcast(message);
+        }
+    }
+
+    void Gametype::playerSwitched(PlayerInfo* player, Gametype* newgametype)
+    {
+    }
+
+    void Gametype::playerSwitchedBack(PlayerInfo* player, Gametype* oldgametype)
+    {
+    }
+
+    void Gametype::playerChangedName(PlayerInfo* player)
+    {
+        if (this->players_.find(player) != this->players_.end())
+        {
+            if (player->getName() != player->getOldName())
+            {
+                std::string message = player->getOldName() + " changed name to " + player->getName();
+                COUT(0) << message << std::endl;
+                network::Host::Broadcast(message);
+            }
+        }
+    }
+
+    void Gametype::pawnPreSpawn(Pawn* pawn)
+    {
+    }
+
+    void Gametype::pawnPostSpawn(Pawn* pawn)
+    {
+    }
+
+    void Gametype::pawnKilled(Pawn* victim, Pawn* killer)
+    {
+    }
+
+    void Gametype::playerScored(PlayerInfo* player)
+    {
+    }
+
+    SpawnPoint* Gametype::getBestSpawnPoint(PlayerInfo* player) const
+    {
+        if (this->spawnpoints_.size() > 0)
+        {
+            srand(time(0));
+            rnd();
+
+            unsigned int randomspawn = (unsigned int)rnd(this->spawnpoints_.size());
+            unsigned int index = 0;
+            for (std::set<SpawnPoint*>::const_iterator it = this->spawnpoints_.begin(); it != this->spawnpoints_.end(); ++it)
+            {
+                if (index == randomspawn)
+                    return (*it);
+
+                ++index;
+            }
+        }
+        return 0;
+    }
+
+    void Gametype::assignDefaultPawnsIfNeeded() const
+    {
+        for (std::set<PlayerInfo*>::const_iterator it = this->players_.begin(); it != this->players_.end(); ++it)
+        {
+            if (!(*it)->getControllableEntity() && (!(*it)->isReadyToSpawn() || !this->bStarted_))
+            {
+                SpawnPoint* spawn = this->getBestSpawnPoint(*it);
+                if (spawn)
+                {
+                    // force spawn at spawnpoint with default pawn
+                    ControllableEntity* entity = this->defaultControllableEntity_.fabricate(spawn);
+                    spawn->spawn(entity);
+                    (*it)->startControl(entity);
+                }
+                else
+                {
+                    COUT(1) << "Error: No SpawnPoints in current Gametype" << std::endl;
+                    abort();
+                }
+            }
+        }
+    }
+
+    void Gametype::checkStart()
+    {
+        if (!this->bStarted_)
+        {
+            if (this->bStartCountdownRunning_)
+            {
+                if (this->startCountdown_ <= 0)
+                {
+                    this->bStartCountdownRunning_ = false;
+                    this->startCountdown_ = 0;
+                    this->start();
+                }
+            }
+            else if (this->players_.size() > 0)
+            {
+                if (this->bAutoStart_)
+                {
+                    this->start();
+                }
+                else
+                {
+                    bool allplayersready = true;
+                    for (std::set<PlayerInfo*>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
+                    {
+                        if (!(*it)->isReadyToSpawn())
+                            allplayersready = false;
+                    }
+                    if (allplayersready)
+                    {
+                        this->startCountdown_ = this->initialStartCountdown_;
+                        this->bStartCountdownRunning_ = true;
+                    }
+                }
+            }
+        }
+    }
+
+    void Gametype::spawnPlayersIfRequested()
+    {
+        for (std::set<PlayerInfo*>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
+            if ((*it)->isReadyToSpawn() || this->bForceSpawn_)
+                this->spawnPlayer(*it);
+    }
+
+    void Gametype::spawnDeadPlayersIfRequested()
+    {
+        for (std::set<PlayerInfo*>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
+            if (!(*it)->getControllableEntity())
+                if ((*it)->isReadyToSpawn() || this->bForceSpawn_)
+                    this->spawnPlayer(*it);
+    }
+
+    void Gametype::spawnPlayer(PlayerInfo* player)
+    {
+        SpawnPoint* spawnpoint = this->getBestSpawnPoint(player);
+        if (spawnpoint)
+        {
+            player->startControl(spawnpoint->spawn());
+        }
+        else
+        {
+            COUT(1) << "Error: No SpawnPoints in current Gametype" << std::endl;
+            abort();
+        }
+    }
+}
Index: code/trunk/src/orxonox/objects/gametypes/Gametype.h
===================================================================
--- code/trunk/src/orxonox/objects/gametypes/Gametype.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/gametypes/Gametype.h	(revision 2087)
@@ -0,0 +1,110 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Gametype_H__
+#define _Gametype_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <map>
+
+#include "core/BaseObject.h"
+#include "core/Identifier.h"
+#include "objects/worldentities/ControllableEntity.h"
+#include "objects/Tickable.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport Gametype : public BaseObject, public Tickable
+    {
+        friend class PlayerInfo;
+
+        public:
+            Gametype(BaseObject* creator);
+            virtual ~Gametype() {}
+
+            virtual void tick(float dt);
+
+            inline bool hasStarted() const
+                { return this->bStarted_; }
+            inline bool hasEnded() const
+                { return this->bEnded_; }
+
+            virtual void start();
+            virtual void end();
+            virtual void playerEntered(PlayerInfo* player);
+            virtual void playerLeft(PlayerInfo* player);
+            virtual void playerSwitched(PlayerInfo* player, Gametype* newgametype);
+            virtual void playerSwitchedBack(PlayerInfo* player, Gametype* oldgametype);
+            virtual void playerChangedName(PlayerInfo* player);
+
+            virtual void playerScored(PlayerInfo* player);
+
+            virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
+            virtual void pawnPreSpawn(Pawn* pawn);
+            virtual void pawnPostSpawn(Pawn* pawn);
+
+            inline const std::set<PlayerInfo*>& getPlayers() const
+                { return this->players_; }
+
+            inline void registerSpawnPoint(SpawnPoint* spawnpoint)
+                { this->spawnpoints_.insert(spawnpoint); }
+
+            inline bool isStartCountdownRunning() const
+                { return this->bStartCountdownRunning_; }
+            inline float getStartCountdown() const
+                { return this->startCountdown_; }
+
+        private:
+            virtual SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const;
+
+            void addPlayer(PlayerInfo* player);
+            void removePlayer(PlayerInfo* player);
+
+            void assignDefaultPawnsIfNeeded() const;
+            void checkStart();
+            void spawnPlayer(PlayerInfo* player);
+            void spawnPlayersIfRequested();
+            void spawnDeadPlayersIfRequested();
+
+            bool bStarted_;
+            bool bEnded_;
+            bool bAutoStart_;
+            bool bForceSpawn_;
+
+            float initialStartCountdown_;
+            float startCountdown_;
+            bool bStartCountdownRunning_;
+
+            std::set<PlayerInfo*> players_;
+            std::set<SpawnPoint*> spawnpoints_;
+            SubclassIdentifier<ControllableEntity> defaultControllableEntity_;
+    };
+}
+
+#endif /* _Gametype_H__ */
Index: code/trunk/src/orxonox/objects/infos/HumanPlayer.cc
===================================================================
--- code/trunk/src/orxonox/objects/infos/HumanPlayer.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/infos/HumanPlayer.cc	(revision 2087)
@@ -0,0 +1,140 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "HumanPlayer.h"
+
+#include "core/Core.h"
+#include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
+#include "network/ClientInformation.h"
+#include "network/Host.h"
+#include "objects/controllers/HumanController.h"
+#include "objects/gametypes/Gametype.h"
+
+namespace orxonox
+{
+    CreateUnloadableFactory(HumanPlayer);
+
+    HumanPlayer::HumanPlayer(BaseObject* creator) : PlayerInfo(creator)
+    {
+        RegisterObject(HumanPlayer);
+
+        this->server_ready_ = Core::isMaster();
+        this->client_ready_ = false;
+
+        this->bHumanPlayer_ = true;
+        this->defaultController_ = Class(HumanController);
+
+        this->setConfigValues();
+        this->registerVariables();
+    }
+
+    HumanPlayer::~HumanPlayer()
+    {
+    }
+
+    void HumanPlayer::setConfigValues()
+    {
+        SetConfigValue(nick_, "Player").callback(this, &HumanPlayer::configvaluecallback_changednick);
+    }
+
+    void HumanPlayer::registerVariables()
+    {
+        REGISTERSTRING(this->synchronize_nick_, network::direction::toserver, new network::NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_changednick));
+
+        REGISTERDATA(this->clientID_,     network::direction::toclient, new network::NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_clientIDchanged));
+        REGISTERDATA(this->server_ready_, network::direction::toclient, new network::NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_server_ready));
+        REGISTERDATA(this->client_ready_, network::direction::toserver, new network::NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_client_ready));
+    }
+
+    void HumanPlayer::configvaluecallback_changednick()
+    {
+        if (this->isLocalPlayer())
+        {
+            this->synchronize_nick_ = this->nick_;
+
+            if (Core::isMaster())
+                this->setName(this->nick_);
+        }
+    }
+
+    void HumanPlayer::networkcallback_changednick()
+    {
+        this->setName(this->synchronize_nick_);
+    }
+
+    void HumanPlayer::networkcallback_clientIDchanged()
+    {
+        if (this->clientID_ == network::Host::getPlayerID())
+        {
+            this->bLocalPlayer_ = true;
+            this->synchronize_nick_ = this->nick_;
+            this->client_ready_ = true;
+
+            if (!Core::isMaster())
+                this->setObjectMode(network::direction::bidirectional);
+            else
+                this->setName(this->nick_);
+
+            this->createController();
+        }
+    }
+
+    void HumanPlayer::networkcallback_server_ready()
+    {
+        this->client_ready_ = true;
+    }
+
+    void HumanPlayer::networkcallback_client_ready()
+    {
+        if (this->getGametype())
+            this->getGametype()->playerEntered(this);
+    }
+
+    bool HumanPlayer::isReady() const
+    {
+        return (this->server_ready_ && this->client_ready_);
+    }
+
+    float HumanPlayer::getPing() const
+    {
+        return network::ClientInformation::findClient(this->getClientID())->getRTT();
+    }
+
+    float HumanPlayer::getPacketLossRatio() const
+    {
+        return network::ClientInformation::findClient(this->getClientID())->getPacketLoss();
+    }
+
+    void HumanPlayer::setClientID(unsigned int clientID)
+    {
+        this->clientID_ = clientID;
+        this->networkcallback_clientIDchanged();
+    }
+}
Index: code/trunk/src/orxonox/objects/infos/HumanPlayer.h
===================================================================
--- code/trunk/src/orxonox/objects/infos/HumanPlayer.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/infos/HumanPlayer.h	(revision 2087)
@@ -0,0 +1,69 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _HumanPlayer_H__
+#define _HumanPlayer_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "PlayerInfo.h"
+#include "core/Identifier.h"
+#include "objects/controllers/Controller.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport HumanPlayer : public PlayerInfo
+    {
+        public:
+            HumanPlayer(BaseObject* creator);
+            virtual ~HumanPlayer();
+
+            void registerVariables();
+            void setConfigValues();
+
+            bool isReady() const;
+            float getPing() const;
+            float getPacketLossRatio() const;
+
+            void setClientID(unsigned int clientID);
+
+        protected:
+            void configvaluecallback_changednick();
+            void networkcallback_changednick();
+            void networkcallback_clientIDchanged();
+            void networkcallback_server_ready();
+            void networkcallback_client_ready();
+
+            std::string nick_;
+            std::string synchronize_nick_;
+            bool server_ready_;
+            bool client_ready_;
+    };
+}
+
+#endif /* _HumanPlayer_H__ */
Index: code/trunk/src/orxonox/objects/infos/Info.cc
===================================================================
--- code/trunk/src/orxonox/objects/infos/Info.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/infos/Info.cc	(revision 2087)
@@ -0,0 +1,40 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Info.h"
+
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+    Info::Info(BaseObject* creator) : BaseObject(creator), network::Synchronisable(creator)
+    {
+        RegisterObject(Info);
+    }
+}
Index: code/trunk/src/orxonox/objects/infos/Info.h
===================================================================
--- code/trunk/src/orxonox/objects/infos/Info.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/infos/Info.h	(revision 2087)
@@ -0,0 +1,47 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Info_H__
+#define _Info_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "network/Synchronisable.h"
+#include "core/BaseObject.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport Info : public BaseObject, public network::Synchronisable
+    {
+        public:
+            Info(BaseObject* creator);
+            virtual ~Info() {}
+    };
+}
+
+#endif /* _Info_H__ */
Index: code/trunk/src/orxonox/objects/infos/Level.cc
===================================================================
--- code/trunk/src/orxonox/objects/infos/Level.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/infos/Level.cc	(revision 2087)
@@ -0,0 +1,148 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Level.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "core/Loader.h"
+#include "core/XMLFile.h"
+#include "core/Template.h"
+
+#include "Settings.h"
+#include "LevelManager.h"
+#include "PlayerInfo.h"
+#include "objects/gametypes/Gametype.h"
+
+#include "util/Math.h"
+
+namespace orxonox
+{
+    CreateFactory(Level);
+
+    Level::Level(BaseObject* creator) : Info(creator)
+    {
+        RegisterObject(Level);
+
+        this->registerVariables();
+        this->xmlfilename_ = this->getFilename();
+
+        if (this->xmlfilename_.length() >= Settings::getDataPath().length())
+            this->xmlfilename_ = this->xmlfilename_.substr(Settings::getDataPath().length());
+    }
+
+    Level::~Level()
+    {
+        if (this->isInitialized())
+        {
+            LevelManager::getInstance().releaseActivity(this);
+
+            if (this->xmlfile_)
+                Loader::unload(this->xmlfile_);
+        }
+    }
+
+    void Level::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(Level, XMLPort, xmlelement, mode);
+
+        XMLPortParam(Level, "description", setDescription, getDescription, xmlelement, mode);
+        XMLPortParam(Level, "gametype", setGametypeString, getGametypeString, xmlelement, mode).defaultValues("Gametype");
+
+        XMLPortObjectExtended(Level, BaseObject, "", addObject, getObject, xmlelement, mode, true, false);
+    }
+
+    void Level::registerVariables()
+    {
+        REGISTERSTRING(this->xmlfilename_, network::direction::toclient, new network::NetworkCallback<Level>(this, &Level::networkcallback_applyXMLFile));
+        REGISTERSTRING(this->name_,        network::direction::toclient, new network::NetworkCallback<Level>(this, &Level::changedName));
+        REGISTERSTRING(this->description_, network::direction::toclient);
+    }
+
+    void Level::networkcallback_applyXMLFile()
+    {
+        COUT(0) << "Loading level \"" << this->xmlfilename_ << "\"..." << std::endl;
+
+        ClassTreeMask mask;
+        mask.exclude(Class(BaseObject));
+        mask.include(Class(Template));
+
+        this->xmlfile_ = new XMLFile(Settings::getDataPath() + this->xmlfilename_, mask);
+
+        Loader::open(this->xmlfile_);
+    }
+
+    void Level::setGametypeString(const std::string& gametype)
+    {
+        Identifier* identifier = ClassByString(gametype);
+        if (identifier && identifier->isA(Class(Gametype)))
+        {
+            this->gametype_ = gametype;
+
+            Gametype* rootgametype = dynamic_cast<Gametype*>(identifier->fabricate(this));
+            this->setGametype(rootgametype);
+
+            for (std::list<BaseObject*>::iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
+                (*it)->setGametype(rootgametype);
+
+            LevelManager::getInstance().requestActivity(this);
+        }
+    }
+
+
+    void Level::addObject(BaseObject* object)
+    {
+        this->objects_.push_back(object);
+        object->setGametype(this->getGametype());
+    }
+
+    BaseObject* Level::getObject(unsigned int index) const
+    {
+        unsigned int i = 0;
+        for (std::list<BaseObject*>::const_iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
+        {
+            if (i == index)
+                return (*it);
+            ++i;
+        }
+        return 0;
+    }
+
+    void Level::playerEntered(PlayerInfo* player)
+    {
+        COUT(3) << "player entered level" << std::endl;
+        player->setGametype(this->getGametype());
+    }
+
+    void Level::playerLeft(PlayerInfo* player)
+    {
+        COUT(3) << "player left level" << std::endl;
+        player->setGametype(0);
+    }
+}
Index: code/trunk/src/orxonox/objects/infos/Level.h
===================================================================
--- code/trunk/src/orxonox/objects/infos/Level.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/infos/Level.h	(revision 2087)
@@ -0,0 +1,73 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Level_H__
+#define _Level_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "Info.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport Level : public Info
+    {
+        public:
+            Level(BaseObject* creator);
+            virtual ~Level();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            void registerVariables();
+
+            inline void setDescription(const std::string& description)
+                { this->description_ = description; }
+            inline const std::string& getDescription() const
+                { return this->description_; }
+
+            void playerEntered(PlayerInfo* player);
+            void playerLeft(PlayerInfo* player);
+
+        private:
+            void addObject(BaseObject* object);
+            BaseObject* getObject(unsigned int index) const;
+
+            void setGametypeString(const std::string& gametype);
+            inline const std::string& getGametypeString() const
+                { return this->gametype_; }
+
+            void networkcallback_applyXMLFile();
+
+            std::string            description_;
+            std::string            gametype_;
+            std::string            xmlfilename_;
+            XMLFile*               xmlfile_;
+            std::list<BaseObject*> objects_;
+    };
+}
+
+#endif /* _Level_H__ */
Index: code/trunk/src/orxonox/objects/infos/PlayerInfo.cc
===================================================================
--- code/trunk/src/orxonox/objects/infos/PlayerInfo.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/infos/PlayerInfo.cc	(revision 2087)
@@ -0,0 +1,164 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include <cassert>
+
+#include "OrxonoxStableHeaders.h"
+#include "PlayerInfo.h"
+
+#include "core/CoreIncludes.h"
+#include "network/ClientInformation.h"
+#include "objects/gametypes/Gametype.h"
+
+namespace orxonox
+{
+    PlayerInfo::PlayerInfo(BaseObject* creator) : Info(creator)
+    {
+        RegisterObject(PlayerInfo);
+
+        this->clientID_ = network::CLIENTID_UNKNOWN;
+        this->bHumanPlayer_ = false;
+        this->bLocalPlayer_ = false;
+        this->bReadyToSpawn_ = false;
+        this->controller_ = 0;
+        this->controllableEntity_ = 0;
+        this->controllableEntityID_ = network::CLIENTID_UNKNOWN;
+
+        this->registerVariables();
+    }
+
+    PlayerInfo::~PlayerInfo()
+    {
+        if (this->isInitialized())
+        {
+            this->stopControl(this->controllableEntity_);
+
+            if (this->controller_)
+            {
+                delete this->controller_;
+                this->controller_ = 0;
+            }
+        }
+    }
+
+    void PlayerInfo::registerVariables()
+    {
+        REGISTERSTRING(this->name_,                 network::direction::toclient, new network::NetworkCallback<PlayerInfo>(this, &PlayerInfo::changedName));
+        REGISTERDATA  (this->controllableEntityID_, network::direction::toclient, new network::NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedcontrollableentityID));
+        REGISTERDATA  (this->bReadyToSpawn_,        network::direction::toserver);
+    }
+
+    void PlayerInfo::changedName()
+    {
+        if (this->isReady() && this->getGametype())
+            this->getGametype()->playerChangedName(this);
+    }
+
+    void PlayerInfo::changedGametype()
+    {
+        if (this->isReady())
+        {
+            if (this->getOldGametype())
+            {
+                if (this->getGametype())
+                    this->getOldGametype()->playerSwitched(this, this->getGametype());
+                else
+                    this->getOldGametype()->playerLeft(this);
+            }
+
+            if (this->getGametype())
+            {
+                if (this->getOldGametype())
+                    this->getGametype()->playerSwitchedBack(this, this->getOldGametype());
+                else
+                    this->getGametype()->playerEntered(this);
+            }
+        }
+    }
+
+    void PlayerInfo::createController()
+    {
+        this->controller_ = this->defaultController_.fabricate(this);
+        assert(this->controller_);
+        this->controller_->setPlayer(this);
+        if (this->controllableEntity_)
+            this->controller_->setControllableEntity(this->controllableEntity_);
+    }
+
+    void PlayerInfo::startControl(ControllableEntity* entity)
+    {
+        if (this->controllableEntity_)
+            this->stopControl(this->controllableEntity_);
+
+        this->controllableEntity_ = entity;
+
+        if (entity)
+        {
+            this->controllableEntityID_ = entity->getObjectID();
+            entity->setPlayer(this);
+            this->bReadyToSpawn_ = false;
+        }
+        else
+        {
+            this->controllableEntityID_ = network::OBJECTID_UNKNOWN;
+        }
+
+        if (this->controller_)
+            this->controller_->setControllableEntity(entity);
+    }
+
+    void PlayerInfo::stopControl(ControllableEntity* entity, bool callback)
+    {
+        if (entity && this->controllableEntity_ == entity)
+        {
+            this->controllableEntity_ = 0;
+            this->controllableEntityID_ = network::OBJECTID_UNKNOWN;
+
+            if (this->controller_)
+                this->controller_->setControllableEntity(0);
+
+            if (callback)
+                entity->removePlayer();
+        }
+    }
+
+    void PlayerInfo::networkcallback_changedcontrollableentityID()
+    {
+        if (this->controllableEntityID_ != network::OBJECTID_UNKNOWN)
+        {
+            Synchronisable* temp = Synchronisable::getSynchronisable(this->controllableEntityID_);
+            ControllableEntity* entity = dynamic_cast<ControllableEntity*>(temp);
+
+            this->startControl(entity);
+        }
+        else
+        {
+            this->stopControl(this->controllableEntity_);
+        }
+    }
+}
Index: code/trunk/src/orxonox/objects/infos/PlayerInfo.h
===================================================================
--- code/trunk/src/orxonox/objects/infos/PlayerInfo.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/infos/PlayerInfo.h	(revision 2087)
@@ -0,0 +1,88 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _PlayerInfo_H__
+#define _PlayerInfo_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "Info.h"
+#include "core/Identifier.h"
+#include "objects/controllers/Controller.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport PlayerInfo : public Info
+    {
+        public:
+            PlayerInfo(BaseObject* creator);
+            virtual ~PlayerInfo();
+
+            void registerVariables();
+
+            virtual void changedName();
+            virtual void changedGametype();
+
+            inline bool isHumanPlayer() const
+                { return this->bHumanPlayer_; }
+            inline bool isLocalPlayer() const
+                { return this->bLocalPlayer_; }
+            inline unsigned int getClientID() const
+                { return this->clientID_; }
+            inline bool isReadyToSpawn() const
+                { return this->bReadyToSpawn_; }
+
+            virtual bool isReady() const = 0;
+            virtual float getPing() const = 0;
+            virtual float getPacketLossRatio() const = 0;
+
+            inline void setReadyToSpawn(bool bReady)
+                { this->bReadyToSpawn_ = bReady; }
+
+            void startControl(ControllableEntity* entity);
+            void stopControl(ControllableEntity* entity, bool callback = true);
+
+            inline ControllableEntity* getControllableEntity() const
+                { return this->controllableEntity_; }
+
+        protected:
+            void createController();
+            void networkcallback_changedcontrollableentityID();
+
+            bool bHumanPlayer_;
+            bool bLocalPlayer_;
+            bool bReadyToSpawn_;
+            SubclassIdentifier<Controller> defaultController_;
+            Controller* controller_;
+            ControllableEntity* controllableEntity_;
+            unsigned int controllableEntityID_;
+            unsigned int clientID_;
+    };
+}
+
+#endif /* _PlayerInfo_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/Backlight.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Backlight.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/Backlight.cc	(revision 2087)
@@ -0,0 +1,170 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Backlight.h"
+
+#include <OgreBillboard.h>
+#include <OgreRibbonTrail.h>
+#include <OgreSceneManager.h>
+
+#include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
+#include "core/Executor.h"
+#include "util/Math.h"
+#include "GraphicsEngine.h"
+
+namespace orxonox
+{
+    CreateFactory(Backlight);
+
+    float Backlight::timeFactor_s = 1.0;
+
+    Backlight::Backlight(float maxspeed, float brakingtime, float scale)
+    {
+        RegisterObject(Backlight);
+
+        this->setConfigValues();
+        this->traillength_ = 1;
+
+        this->configure(maxspeed, brakingtime, scale);
+    }
+    
+    bool Backlight::create(){
+      if(!WorldEntity::create())
+        return false;
+      
+      this->getNode()->setInheritScale(false);
+
+      this->billboard_.setBillboardSet("Flares/backlightflare");
+      this->attachObject(this->billboard_.getBillboardSet());
+
+      this->ribbonTrail_ = GraphicsEngine::getInstance().getLevelSceneManager()->createRibbonTrail(this->getName() + "RibbonTrail");
+      this->ribbonTrailNode_ = GraphicsEngine::getInstance().getLevelSceneManager()->getRootSceneNode()->createChildSceneNode(this->getName() + "RibbonTrailNode");
+      this->ribbonTrailNode_->attachObject(this->ribbonTrail_);
+      this->ribbonTrail_->addNode(this->getNode());
+
+
+      this->ribbonTrail_->setTrailLength(this->maxTraillength_);
+      this->ribbonTrail_->setMaterialName("Trail/backlighttrail");
+
+        //this->setTimeFactor(Orxonox::getInstance().getTimeFactor());
+      this->setTimeFactor(1.0f);
+      
+      this->ribbonTrail_->setMaxChainElements(this->maxTrailsegments_);
+      this->ribbonTrail_->setTrailLength(this->traillength_ = 2 * this->maxTrailsegments_);
+      this->ribbonTrail_->setInitialWidth(0, this->width_ * this->getScale());
+      this->ribbonTrail_->setWidthChange(0, this->width_ * this->getScale() / this->maxLifeTime_ * Backlight::timeFactor_s);
+      return true;
+    }
+
+    Backlight::~Backlight()
+    {
+        if (this->isInitialized())
+        {
+            this->detachObject(this->billboard_.getBillboardSet());
+            GraphicsEngine::getInstance().getLevelSceneManager()->destroySceneNode(this->getName() + "RibbonTrailNode");
+            GraphicsEngine::getInstance().getLevelSceneManager()->destroyRibbonTrail(this->ribbonTrail_);
+        }
+    }
+
+    void Backlight::setConfigValues()
+    {
+        SetConfigValue(maxLifeTime_, 4.0).description("The maximal amount of seconds the trail behind a SpaceShip stays visible");
+        SetConfigValue(trailSegmentLength_, 50).description("The length of one segment of the trail behind a SpaceShip (lower values make it more smooth)");
+        SetConfigValue(width_, 7.0).description("The width of the trail");
+    }
+
+    void Backlight::setTimeFactor(float factor)
+    {
+        Backlight::timeFactor_s = factor;
+        float change = Backlight::timeFactor_s / this->maxLifeTime_;
+        this->ribbonTrail_->setWidthChange(0, this->width_ * change);
+        this->updateColourChange();
+    }
+
+    void Backlight::updateColourChange()
+    {
+        this->ribbonTrail_->setColourChange(0, ColourValue(0, 0, 0, this->maxTraillength_ / this->traillength_ / this->maxLifeTime_ * Backlight::timeFactor_s));
+    }
+    
+    
+    void Backlight::XMLPort(Element& xmlelement, XMLPort::Mode mode){
+      SUPER(Backlight, XMLPort, xmlelement, mode);
+      
+      Backlight::create();
+    }
+
+    void Backlight::tick(float dt)
+    {
+        SUPER(Backlight, tick, dt);
+
+        if (this->isActive())
+        {
+            if (this->traillength_ < this->maxTraillength_)
+            {
+                this->traillength_ = min<float>(this->maxTraillength_, this->traillength_ + dt * this->maxTraillength_ / this->maxLifeTime_);
+                this->updateColourChange();
+            }
+        }
+        else
+        {
+            if (this->traillength_ > 1)
+            {
+                this->traillength_ = max<float>(1, this->traillength_ - this->brakefactor_ * dt * this->maxTraillength_ / this->maxLifeTime_);
+                this->updateColourChange();
+            }
+        }
+
+        this->ribbonTrail_->setTrailLength(this->traillength_);
+    }
+
+    void Backlight::setColour(const ColourValue& colour)
+    {
+        this->billboard_.getBillboardSet()->getBillboard(0)->setColour(colour);
+        this->ribbonTrail_->setInitialColour(0, ColourValue(colour.r / 4 + 0.75, colour.g / 4 + 0.75, colour.b / 4 + 0.75));
+    }
+
+    void Backlight::configure(float maxspeed, float brakingtime, float scale)
+    {
+        this->maxTraillength_ = this->maxLifeTime_ * maxspeed;
+        this->maxTrailsegments_ = (size_t)(this->maxTraillength_ / this->trailSegmentLength_);
+
+        this->brakefactor_ = this->maxLifeTime_ / brakingtime;
+
+        this->scale(scale);
+    }
+
+    void Backlight::changedVisibility()
+    {
+        SUPER(Backlight, changedVisibility);
+
+        this->billboard_.setVisible(this->isVisible());
+        this->ribbonTrail_->setVisible(this->isVisible());
+    }
+}
Index: code/trunk/src/orxonox/objects/worldentities/Backlight.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Backlight.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/Backlight.h	(revision 2087)
@@ -0,0 +1,76 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Backlight_H__
+#define _Backlight_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "PositionableEntity.h"
+#include "tools/BillboardSet.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport Backlight : public PositionableEntity
+    {
+        public:
+            Backlight(float maxspeed = 1.0, float brakingtime = 1.0, float scale = 1.0);
+            virtual ~Backlight();
+
+            void setConfigValues();
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            virtual void tick(float dt);
+            virtual void changedVisibility();
+            virtual bool create();
+
+            void setColour(const ColourValue& colour);
+            void setTimeFactor(float factor);
+
+        private:
+            void configure(float maxspeed, float brakingtime, float scale = 1);
+            void updateColourChange();
+
+            static float timeFactor_s;
+            BillboardSet billboard_;
+            Ogre::SceneNode* ribbonTrailNode_;
+            Ogre::RibbonTrail* ribbonTrail_;
+
+            float maxLifeTime_;
+            float trailSegmentLength_;
+            float width_;
+
+            float brakefactor_;
+
+            float maxTraillength_;
+            float traillength_;
+
+            size_t maxTrailsegments_;
+    };
+}
+
+#endif /* _Backlight_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/Billboard.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Billboard.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/Billboard.cc	(revision 2087)
@@ -0,0 +1,106 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Billboard.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "objects/Scene.h"
+
+namespace orxonox
+{
+    CreateFactory(Billboard);
+
+    Billboard::Billboard(BaseObject* creator) : PositionableEntity(creator)
+    {
+        RegisterObject(Billboard);
+
+        this->registerVariables();
+    }
+
+    Billboard::~Billboard()
+    {
+        if (this->isInitialized())
+        {
+            if (this->isInitialized() && this->billboard_.getBillboardSet())
+                this->getNode()->detachObject(this->billboard_.getName());
+        }
+    }
+
+    void Billboard::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(Billboard, XMLPort, xmlelement, mode);
+
+        XMLPortParam(Billboard, "material", setMaterial, getMaterial, xmlelement, mode);
+        XMLPortParam(Billboard, "colour",   setColour,   getColour,   xmlelement, mode).defaultValues(ColourValue::White);
+    }
+
+    void Billboard::registerVariables()
+    {
+        REGISTERSTRING(this->material_, network::direction::toclient, new network::NetworkCallback<Billboard>(this, &Billboard::changedMaterial));
+        REGISTERDATA  (this->colour_,   network::direction::toclient, new network::NetworkCallback<Billboard>(this, &Billboard::changedColour));
+    }
+
+    void Billboard::changedMaterial()
+    {
+        if (!this->billboard_.getBillboardSet())
+        {
+            if (this->getScene() && this->getScene()->getSceneManager())
+            {
+                this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1);
+                this->getNode()->attachObject(this->billboard_.getBillboardSet());
+                this->billboard_.setVisible(this->isVisible());
+            }
+        }
+        else
+            this->billboard_.setMaterial(this->material_);
+    }
+
+    void Billboard::changedColour()
+    {
+        if (!this->billboard_.getBillboardSet())
+        {
+            if (this->getScene() && this->getScene()->getSceneManager())
+            {
+                this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1);
+                this->getNode()->attachObject(this->billboard_.getBillboardSet());
+                this->billboard_.setVisible(this->isVisible());
+            }
+        }
+        else
+            this->billboard_.setColour(this->colour_);
+    }
+
+    void Billboard::changedVisibility()
+    {
+        SUPER(Billboard, changedVisibility);
+
+        this->billboard_.setVisible(this->isVisible());
+    }
+}
Index: code/trunk/src/orxonox/objects/worldentities/Billboard.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Billboard.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/Billboard.h	(revision 2087)
@@ -0,0 +1,73 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Billboard_H__
+#define _Billboard_H__
+
+#include "OrxonoxPrereqs.h"
+#include "PositionableEntity.h"
+#include "util/Math.h"
+#include "tools/BillboardSet.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport Billboard : public PositionableEntity
+    {
+        public:
+            Billboard(BaseObject* creator);
+            virtual ~Billboard();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            void registerVariables();
+
+            virtual void changedVisibility();
+
+            inline const BillboardSet& getBillboardSet() const
+                { return this->billboard_; }
+
+            inline void setMaterial(const std::string& material)
+                { this->material_ = material; this->changedMaterial(); }
+            inline const std::string& getMaterial() const
+                { return this->material_; }
+
+            inline void setColour(const ColourValue& colour)
+                { this->colour_ = colour; this->changedColour(); }
+            inline const ColourValue& getColour() const
+                { return this->colour_; }
+
+        private:
+            void changedMaterial();
+            void changedColour();
+
+            BillboardSet billboard_;
+            std::string material_;
+            ColourValue colour_;
+    };
+}
+
+#endif /* _Billboard_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/BlinkingBillboard.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/BlinkingBillboard.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/BlinkingBillboard.cc	(revision 2087)
@@ -0,0 +1,86 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "BlinkingBillboard.h"
+
+#include "core/Core.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "util/Math.h"
+
+namespace orxonox
+{
+    CreateFactory(BlinkingBillboard);
+
+    BlinkingBillboard::BlinkingBillboard(BaseObject* creator) : Billboard(creator)
+    {
+        RegisterObject(BlinkingBillboard);
+
+        this->amplitude_ = 1.0f;
+        this->frequency_ = 1.0f;
+        this->phase_ = 0;
+        this->bQuadratic_ = false;
+        this->time_ = 0;
+
+        this->registerVariables();
+    }
+
+    BlinkingBillboard::~BlinkingBillboard()
+    {
+    }
+
+    void BlinkingBillboard::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(BlinkingBillboard, XMLPort, xmlelement, mode);
+
+        XMLPortParam(BlinkingBillboard, "amplitude", setAmplitude, getAmplitude, xmlelement, mode).defaultValues(1.0f);
+        XMLPortParam(BlinkingBillboard, "frequency", setFrequency, getFrequency, xmlelement, mode).defaultValues(1.0f);
+        XMLPortParam(BlinkingBillboard, "phase",     setPhase,     getPhase,     xmlelement, mode).defaultValues(Degree(0));
+        XMLPortParam(BlinkingBillboard, "quadratic", setQuadratic, isQuadratic,  xmlelement, mode).defaultValues(false);
+    }
+
+    void BlinkingBillboard::registerVariables()
+    {
+//        REGISTERDATA(this->amplitude_, network::direction::toclient);
+//        REGISTERDATA(this->frequency_, network::direction::toclient);
+//        REGISTERDATA(this->phase_,     network::direction::toclient);
+    }
+
+    void BlinkingBillboard::tick(float dt)
+    {
+        if (Core::isMaster() && this->isActive())
+        {
+            this->time_ += dt;
+            if (this->bQuadratic_)
+                this->setScale(this->amplitude_ * square(sin((6.2831853 * this->time_ + this->phase_.valueRadians()) * this->frequency_)));
+            else
+                this->setScale(this->amplitude_ * sin((6.2831853 * this->time_ + this->phase_.valueRadians()) * this->frequency_));
+        }
+    }
+}
Index: code/trunk/src/orxonox/objects/worldentities/BlinkingBillboard.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/BlinkingBillboard.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/BlinkingBillboard.h	(revision 2087)
@@ -0,0 +1,78 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _BlinkingBillboard_H__
+#define _BlinkingBillboard_H__
+
+#include "OrxonoxPrereqs.h"
+#include "Billboard.h"
+#include "objects/Tickable.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport BlinkingBillboard : public Billboard, public Tickable
+    {
+        public:
+            BlinkingBillboard(BaseObject* creator);
+            virtual ~BlinkingBillboard();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            void registerVariables();
+
+            virtual void tick(float dt);
+
+            inline void setAmplitude(float amplitude)
+                { this->amplitude_ = amplitude; }
+            inline float getAmplitude() const
+                { return this->amplitude_; }
+
+            inline void setFrequency(float frequency)
+                { this->frequency_ = frequency; }
+            inline float getFrequency() const
+                { return this->frequency_; }
+
+            inline void setPhase(const Degree& phase)
+                { this->phase_ = phase; }
+            inline const Degree& getPhase() const
+                { return this->phase_; }
+
+            inline void setQuadratic(bool bQuadratic)
+                { this->bQuadratic_ = bQuadratic; }
+            inline bool isQuadratic() const
+                { return this->bQuadratic_; }
+
+        private:
+            float amplitude_;
+            float frequency_;
+            Degree phase_;
+            bool bQuadratic_;
+            long double time_;
+    };
+}
+
+#endif /* _BlinkingBillboard_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/Camera.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Camera.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/Camera.cc	(revision 2087)
@@ -0,0 +1,126 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      Benjamin Knecht
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Camera.h"
+
+#include <string>
+#include <cassert>
+
+#include <OgreCamera.h>
+#include <OgreSceneManager.h>
+#include <OgreSceneNode.h>
+#include <OgreViewport.h>
+
+#include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
+#include "objects/Scene.h"
+#include "CameraManager.h"
+
+namespace orxonox
+{
+    CreateFactory(Camera);
+
+    Camera::Camera(BaseObject* creator) : PositionableEntity(creator)
+    {
+        RegisterObject(Camera);
+
+        assert(this->getScene());
+        assert(this->getScene()->getSceneManager());
+
+        this->camera_ = this->getScene()->getSceneManager()->createCamera(getUniqueNumberString());
+        this->getNode()->attachObject(this->camera_);
+
+        this->bHasFocus_ = false;
+        this->bDrag_ = false;
+        this->nearClipDistance_ = 1;
+
+        this->setObjectMode(0x0);
+
+        this->setConfigValues();
+        this->configvaluecallback_changedNearClipDistance();
+
+        this->requestFocus(); // ! HACK ! REMOVE THIS !
+    }
+
+    Camera::~Camera()
+    {
+        if (this->isInitialized())
+        {
+            this->releaseFocus();
+        }
+    }
+
+    void Camera::setConfigValues()
+    {
+        SetConfigValue(nearClipDistance_, 1.0f).callback(this, &Camera::configvaluecallback_changedNearClipDistance);
+    }
+
+    void Camera::configvaluecallback_changedNearClipDistance()
+    {
+        this->camera_->setNearClipDistance(this->nearClipDistance_);
+    }
+
+    void Camera::tick(float dt)
+    {
+/*
+        // this stuff here may need some adjustments
+        float coeff = (this->bDrag_) ? min(1.0f, 15.0f * dt) : (1.0f);
+
+        Vector3 offset = this->getNode()->getWorldPosition() - this->cameraNode_->getWorldPosition();
+        this->cameraNode_->translate(coeff * offset);
+
+        this->cameraNode_->setOrientation(Quaternion::Slerp(coeff, this->cameraNode_->getWorldOrientation(), this->getWorldOrientation(), false));
+*/
+    }
+
+    void Camera::requestFocus()
+    {
+        CameraManager::getInstance().requestFocus(this);
+    }
+
+    void Camera::releaseFocus()
+    {
+        CameraManager::getInstance().releaseFocus(this);
+    }
+
+    /**
+        what to do when camera loses focus (do not request focus in this function!!)
+        this is called by the CameraManager singleton class to notify the camera
+    */
+    void Camera::removeFocus()
+    {
+        this->bHasFocus_ = false;
+    }
+
+    void Camera::setFocus(Ogre::Viewport* viewport)
+    {
+        this->bHasFocus_ = true;
+        viewport->setCamera(this->camera_);
+    }
+}
Index: code/trunk/src/orxonox/objects/worldentities/Camera.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Camera.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/Camera.h	(revision 2087)
@@ -0,0 +1,74 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      Benjamin Knecht
+ *
+ */
+
+#ifndef _Camera_H__
+#define _Camera_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <OgrePrerequisites.h>
+#include "objects/worldentities/PositionableEntity.h"
+#include "objects/Tickable.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport Camera : public PositionableEntity, public Tickable
+    {
+        friend class CameraManager;
+
+        public:
+            Camera(BaseObject* creator);
+            virtual ~Camera();
+
+            void setConfigValues();
+            virtual void tick(float dt);
+
+            void requestFocus();
+            void releaseFocus();
+
+            inline bool hasFocus()
+                { return this->bHasFocus_; }
+
+            inline void setDrag(bool bDrag)
+                { this->bDrag_ = bDrag; }
+            inline bool getDrag() const
+                { return this->bDrag_; }
+
+        private:
+            void removeFocus();
+            void setFocus(Ogre::Viewport* viewport);
+            void configvaluecallback_changedNearClipDistance();
+
+            Ogre::Camera*   camera_;
+            float           nearClipDistance_;
+            bool            bHasFocus_;
+            bool            bDrag_;
+    };
+}
+
+#endif /* _Camera_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/CameraPosition.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/CameraPosition.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/CameraPosition.cc	(revision 2087)
@@ -0,0 +1,65 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "CameraPosition.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "Camera.h"
+
+namespace orxonox
+{
+    CreateFactory(CameraPosition);
+
+    CameraPosition::CameraPosition(BaseObject* creator) : PositionableEntity(creator)
+    {
+        RegisterObject(CameraPosition);
+
+        this->bDrag_ = false;
+
+        this->setObjectMode(0x0);
+    }
+
+    CameraPosition::~CameraPosition()
+    {
+    }
+
+    void CameraPosition::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(CameraPosition, XMLPort, xmlelement, mode);
+
+        XMLPortParam(CameraPosition, "drag", setDrag, getDrag, xmlelement, mode).defaultValues(false);
+    }
+
+    void CameraPosition::attachCamera(Camera* camera)
+    {
+        camera->setDrag(this->bDrag_);
+        this->attach(camera);
+    }
+}
Index: code/trunk/src/orxonox/objects/worldentities/CameraPosition.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/CameraPosition.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/CameraPosition.h	(revision 2087)
@@ -0,0 +1,58 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _CameraPosition_H__
+#define _CameraPosition_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "objects/worldentities/PositionableEntity.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport CameraPosition : public PositionableEntity
+    {
+        public:
+            CameraPosition(BaseObject* creator);
+            virtual ~CameraPosition();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            inline void setDrag(bool bDrag)
+                { this->bDrag_ = bDrag; }
+            inline bool getDrag() const
+                { return this->bDrag_; }
+
+            void attachCamera(Camera* camera);
+
+        private:
+            bool bDrag_;
+    };
+}
+
+#endif /* _CameraPosition_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/ControllableEntity.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/ControllableEntity.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/ControllableEntity.cc	(revision 2087)
@@ -0,0 +1,477 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "ControllableEntity.h"
+
+#include "core/CoreIncludes.h"
+#include "core/Core.h"
+#include "core/XMLPort.h"
+#include "core/Template.h"
+
+#include "objects/infos/PlayerInfo.h"
+#include "objects/worldentities/Camera.h"
+#include "objects/worldentities/CameraPosition.h"
+#include "overlays/OverlayGroup.h"
+
+namespace orxonox
+{
+    CreateFactory(ControllableEntity);
+
+    ControllableEntity::ControllableEntity(BaseObject* creator) : WorldEntity(creator)
+    {
+        RegisterObject(ControllableEntity);
+
+        this->bControlled_ = false;
+        this->server_overwrite_ = 0;
+        this->client_overwrite_ = 0;
+        this->player_ = 0;
+        this->playerID_ = network::OBJECTID_UNKNOWN;
+        this->hud_ = 0;
+        this->camera_ = 0;
+        this->bDestroyWhenPlayerLeft_ = false;
+
+        this->velocity_ = Vector3::ZERO;
+        this->acceleration_ = Vector3::ZERO;
+
+        this->server_position_ = Vector3::ZERO;
+        this->client_position_ = Vector3::ZERO;
+        this->server_velocity_ = Vector3::ZERO;
+        this->client_velocity_ = Vector3::ZERO;
+        this->server_orientation_ = Quaternion::IDENTITY;
+        this->client_orientation_ = Quaternion::IDENTITY;
+
+        this->registerVariables();
+    }
+
+    ControllableEntity::~ControllableEntity()
+    {
+        if (this->isInitialized())
+        {
+            if (this->bControlled_)
+                this->stopLocalControl();
+
+            if (this->hud_)
+                delete this->hud_;
+
+            if (this->camera_)
+                delete this->camera_;
+
+            if (this->getPlayer() && this->getPlayer()->getControllableEntity() == this)
+                this->getPlayer()->stopControl(this, false);
+        }
+    }
+
+    void ControllableEntity::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(ControllableEntity, XMLPort, xmlelement, mode);
+
+        XMLPortParam(ControllableEntity, "hudtemplate", setHudTemplate, getHudTemplate, xmlelement, mode);
+        XMLPortParam(ControllableEntity, "camerapositiontemplate", setCameraPositionTemplate, getCameraPositionTemkplate, xmlelement, mode);
+
+        XMLPortObject(ControllableEntity, CameraPosition, "camerapositions", addCameraPosition, getCameraPosition, xmlelement, mode);
+    }
+
+    void ControllableEntity::addCameraPosition(CameraPosition* position)
+    {
+        this->attach(position);
+        this->cameraPositions_.push_back(position);
+    }
+
+    CameraPosition* ControllableEntity::getCameraPosition(unsigned int index) const
+    {
+        unsigned int i = 0;
+        for (std::list<CameraPosition*>::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
+        {
+            if (i == index)
+                return (*it);
+            ++i;
+        }
+        return 0;
+    }
+
+    void ControllableEntity::switchCamera()
+    {
+        if (this->camera_)
+        {
+            if (this->camera_->getParent() == this && this->cameraPositions_.size() > 0)
+            {
+                this->cameraPositions_.front()->attachCamera(this->camera_);
+            }
+            else if (this->cameraPositions_.size() > 0)
+            {
+                for (std::list<CameraPosition*>::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
+                {
+                    if ((*it) == this->camera_->getParent())
+                    {
+                        ++it;
+                        if (it != this->cameraPositions_.end())
+                            (*it)->attachCamera(this->camera_);
+                        else
+                            (*this->cameraPositions_.begin())->attachCamera(this->camera_);
+                        break;
+                    }
+                }
+            }
+            else
+            {
+                this->attach(this->camera_);
+            }
+        }
+    }
+
+    void ControllableEntity::setPlayer(PlayerInfo* player)
+    {
+        if (!player)
+        {
+            this->removePlayer();
+            return;
+        }
+
+        this->player_ = player;
+        this->playerID_ = player->getObjectID();
+        this->bControlled_ = (player->isLocalPlayer() && player->isHumanPlayer());
+        if (this->bControlled_)
+        {
+            this->startLocalControl();
+
+            if (!Core::isMaster())
+            {
+                this->client_overwrite_ = this->server_overwrite_;
+COUT(0) << "CE: bidirectional synchronization" << std::endl;
+                this->setObjectMode(network::direction::bidirectional);
+            }
+        }
+    }
+
+    void ControllableEntity::removePlayer()
+    {
+        if (this->bControlled_)
+            this->stopLocalControl();
+
+        this->player_ = 0;
+        this->playerID_ = network::OBJECTID_UNKNOWN;
+        this->bControlled_ = false;
+        this->setObjectMode(network::direction::toclient);
+
+        if (this->bDestroyWhenPlayerLeft_)
+            delete this;
+    }
+
+    void ControllableEntity::networkcallback_changedplayerID()
+    {
+        // just do this in case the entity wasn't yet synchronized when the corresponding PlayerInfo got our objectID
+        if (this->playerID_ != network::OBJECTID_UNKNOWN)
+        {
+            this->player_ = dynamic_cast<PlayerInfo*>(network::Synchronisable::getSynchronisable(this->playerID_));
+            if (this->player_ && (this->player_->getControllableEntity() != this))
+                this->player_->startControl(this);
+        }
+    }
+
+    void ControllableEntity::startLocalControl()
+    {
+//        std::cout << this->getObjectID() << " ###### start local control" << std::endl;
+        this->camera_ = new Camera(this);
+        this->camera_->requestFocus();
+        if (this->cameraPositionTemplate_ != "")
+            this->addTemplate(this->cameraPositionTemplate_);
+        if (this->cameraPositions_.size() > 0)
+            this->cameraPositions_.front()->attachCamera(this->camera_);
+        else
+            this->attach(this->camera_);
+
+        if (this->hudtemplate_ != "")
+        {
+            this->hud_ = new OverlayGroup(this);
+            this->hud_->addTemplate(this->hudtemplate_);
+        }
+    }
+
+    void ControllableEntity::stopLocalControl()
+    {
+//        std::cout << "###### stop local control" << std::endl;
+        this->camera_->detachFromParent();
+        delete this->camera_;
+        this->camera_ = 0;
+
+        delete this->hud_;
+        this->hud_ = 0;
+    }
+
+    void ControllableEntity::tick(float dt)
+    {
+        if (this->isActive())
+        {
+            this->velocity_ += (dt * this->acceleration_);
+            this->node_->translate(dt * this->velocity_, Ogre::Node::TS_LOCAL);
+
+            if (Core::isMaster())
+            {
+                this->server_velocity_ = this->velocity_;
+                this->server_position_ = this->node_->getPosition();
+            }
+            else if (this->bControlled_)
+            {
+//                COUT(2) << "setting client position" << endl;
+                this->client_velocity_ = this->velocity_;
+                this->client_position_ = this->node_->getPosition();
+            }
+        }
+    }
+
+    void ControllableEntity::registerVariables()
+    {
+        REGISTERSTRING(this->cameraPositionTemplate_, network::direction::toclient);
+
+        REGISTERDATA(this->server_position_,    network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerPosition));
+        REGISTERDATA(this->server_velocity_,    network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerVelocity));
+        REGISTERDATA(this->server_orientation_, network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerOrientation));
+
+        REGISTERDATA(this->server_overwrite_,   network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processOverwrite));
+        REGISTERDATA(this->client_overwrite_,   network::direction::toserver);
+
+        REGISTERDATA(this->client_position_,    network::direction::toserver, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientPosition));
+        REGISTERDATA(this->client_velocity_,    network::direction::toserver, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientVelocity));
+        REGISTERDATA(this->client_orientation_, network::direction::toserver, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientOrientation));
+
+
+        REGISTERDATA(this->playerID_, network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::networkcallback_changedplayerID));
+    }
+
+    void ControllableEntity::processServerPosition()
+    {
+        if (!this->bControlled_)
+            this->node_->setPosition(this->server_position_);
+    }
+
+    void ControllableEntity::processServerVelocity()
+    {
+        if (!this->bControlled_)
+            this->velocity_ = this->server_velocity_;
+    }
+
+    void ControllableEntity::processServerOrientation()
+    {
+        if (!this->bControlled_)
+            this->node_->setOrientation(this->server_orientation_);
+    }
+
+    void ControllableEntity::processOverwrite()
+    {
+        if (this->bControlled_)
+        {
+            this->setPosition(this->server_position_);
+            this->setVelocity(this->server_velocity_);
+            this->setOrientation(this->server_orientation_);
+
+            this->client_overwrite_ = this->server_overwrite_;
+        }
+    }
+
+    void ControllableEntity::processClientPosition()
+    {
+        if (this->server_overwrite_ == this->client_overwrite_)
+        {
+//            COUT(2) << "callback: setting client position" << endl;
+            this->node_->setPosition(this->client_position_);
+            this->server_position_ = this->client_position_;
+        }
+//        else
+//          COUT(2) << "callback: not setting client position" << endl;
+    }
+
+    void ControllableEntity::processClientVelocity()
+    {
+        if (this->server_overwrite_ == this->client_overwrite_)
+        {
+            this->velocity_ = this->client_velocity_;
+            this->server_velocity_ = this->client_velocity_;
+        }
+    }
+
+    void ControllableEntity::processClientOrientation()
+    {
+        if (this->server_overwrite_ == this->client_overwrite_)
+        {
+            this->node_->setOrientation(this->client_orientation_);
+            this->server_orientation_ = this->client_orientation_;
+        }
+    }
+
+
+    void ControllableEntity::setPosition(const Vector3& position)
+    {
+        if (Core::isMaster())
+        {
+            this->node_->setPosition(position);
+            this->server_position_ = position;
+            ++this->server_overwrite_;
+        }
+        else if (this->bControlled_)
+        {
+            this->node_->setPosition(position);
+            this->client_position_ = position;
+        }
+    }
+
+    void ControllableEntity::setVelocity(const Vector3& velocity)
+    {
+        if (Core::isMaster())
+        {
+            this->velocity_ = velocity;
+            this->server_velocity_ = velocity;
+            ++this->server_overwrite_;
+        }
+        else if (this->bControlled_)
+        {
+            this->velocity_ = velocity;
+            this->client_velocity_ = velocity;
+        }
+    }
+
+    void ControllableEntity::translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo)
+    {
+        if (Core::isMaster())
+        {
+            this->node_->translate(distance, relativeTo);
+            this->server_position_ = this->node_->getPosition();
+            ++this->server_overwrite_;
+        }
+        else if (this->bControlled_)
+        {
+            this->node_->translate(distance, relativeTo);
+            this->client_position_ = this->node_->getPosition();
+        }
+    }
+
+    void ControllableEntity::setOrientation(const Quaternion& orientation)
+    {
+        if (Core::isMaster())
+        {
+            this->node_->setOrientation(orientation);
+            this->server_orientation_ = orientation;
+            ++this->server_overwrite_;
+        }
+        else if (this->bControlled_)
+        {
+            this->node_->setOrientation(orientation);
+            this->client_orientation_ = orientation;
+        }
+    }
+
+    void ControllableEntity::rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo)
+    {
+        if (Core::isMaster())
+        {
+            this->node_->rotate(rotation, relativeTo);
+            this->server_orientation_ = this->node_->getOrientation();
+            ++this->server_overwrite_;
+        }
+        else if (this->bControlled_)
+        {
+            this->node_->rotate(rotation, relativeTo);
+            this->client_orientation_ = this->node_->getOrientation();
+        }
+    }
+
+    void ControllableEntity::yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
+    {
+        if (Core::isMaster())
+        {
+            this->node_->yaw(angle, relativeTo);
+            this->server_orientation_ = this->node_->getOrientation();
+            ++this->server_overwrite_;
+        }
+        else if (this->bControlled_)
+        {
+            this->node_->yaw(angle, relativeTo);
+            this->client_orientation_ = this->node_->getOrientation();
+        }
+    }
+
+    void ControllableEntity::pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
+    {
+        if (Core::isMaster())
+        {
+            this->node_->pitch(angle, relativeTo);
+            this->server_orientation_ = this->node_->getOrientation();
+            ++this->server_overwrite_;
+        }
+        else if (this->bControlled_)
+        {
+            this->node_->pitch(angle, relativeTo);
+            this->client_orientation_ = this->node_->getOrientation();
+        }
+    }
+
+    void ControllableEntity::roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
+    {
+        if (Core::isMaster())
+        {
+            this->node_->roll(angle, relativeTo);
+            this->server_orientation_ = this->node_->getOrientation();
+            ++this->server_overwrite_;
+        }
+        else if (this->bControlled_)
+        {
+            this->node_->roll(angle, relativeTo);
+            this->client_orientation_ = this->node_->getOrientation();
+        }
+    }
+
+    void ControllableEntity::lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector)
+    {
+        if (Core::isMaster())
+        {
+            this->node_->lookAt(target, relativeTo, localDirectionVector);
+            this->server_orientation_ = this->node_->getOrientation();
+            ++this->server_overwrite_;
+        }
+        else if (this->bControlled_)
+        {
+            this->node_->lookAt(target, relativeTo, localDirectionVector);
+            this->client_orientation_ = this->node_->getOrientation();
+        }
+    }
+
+    void ControllableEntity::setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector)
+    {
+        if (Core::isMaster())
+        {
+            this->node_->setDirection(direction, relativeTo, localDirectionVector);
+            this->server_orientation_ = this->node_->getOrientation();
+            ++this->server_overwrite_;
+        }
+        else if (this->bControlled_)
+        {
+            this->node_->setDirection(direction, relativeTo, localDirectionVector);
+            this->client_orientation_ = this->node_->getOrientation();
+        }
+    }
+}
Index: code/trunk/src/orxonox/objects/worldentities/ControllableEntity.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/ControllableEntity.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/ControllableEntity.h	(revision 2087)
@@ -0,0 +1,176 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _ControllableEntity_H__
+#define _ControllableEntity_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "WorldEntity.h"
+#include "objects/Tickable.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport ControllableEntity : public WorldEntity, public Tickable
+    {
+        public:
+            ControllableEntity(BaseObject* creator);
+            virtual ~ControllableEntity();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            virtual void tick(float dt);
+            void registerVariables();
+
+            virtual void setPlayer(PlayerInfo* player);
+            virtual void removePlayer();
+            inline PlayerInfo* getPlayer() const
+                { return this->player_; }
+
+            inline void setDestroyWhenPlayerLeft(bool bDestroy)
+                { this->bDestroyWhenPlayerLeft_ = bDestroy; }
+            inline bool getDestroyWhenPlayerLeft() const
+                { return this->bDestroyWhenPlayerLeft_; }
+
+            virtual void moveFrontBack(const Vector2& value) {}
+            virtual void moveRightLeft(const Vector2& value) {}
+            virtual void moveUpDown(const Vector2& value) {}
+
+            virtual void rotateYaw(const Vector2& value) {}
+            virtual void rotatePitch(const Vector2& value) {}
+            virtual void rotateRoll(const Vector2& value) {}
+
+            virtual void fire() {}
+            virtual void altFire() {}
+
+            virtual void greet() {}
+            virtual void use() {}
+            virtual void switchCamera();
+
+            inline const Vector3& getVelocity() const
+                { return this->velocity_; }
+            inline const Vector3& getAcceleration() const
+                { return this->acceleration_; }
+            inline const std::string& getHudTemplate() const
+                { return this->hudtemplate_; }
+
+            using WorldEntity::setPosition;
+            using WorldEntity::translate;
+            using WorldEntity::setOrientation;
+            using WorldEntity::rotate;
+            using WorldEntity::yaw;
+            using WorldEntity::pitch;
+            using WorldEntity::roll;
+            using WorldEntity::lookAt;
+            using WorldEntity::setDirection;
+
+            void setPosition(const Vector3& position);
+            void translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
+            void setOrientation(const Quaternion& orientation);
+            void rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
+            void yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
+            void pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
+            void roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
+            void lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
+            void setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
+
+            void setVelocity(const Vector3& velocity);
+            inline void setVelocity(float x, float y, float z)
+                { this->velocity_.x = x; this->velocity_.y = y; this->velocity_.z = z; }
+
+            inline void setAcceleration(const Vector3& acceleration)
+                { this->acceleration_ = acceleration; }
+            inline void setAcceleration(float x, float y, float z)
+                { this->acceleration_.x = x; this->acceleration_.y = y; this->acceleration_.z = z; }
+
+            inline Camera* getCamera() const
+                { return this->camera_; }
+            inline OverlayGroup* getHUD() const
+                { return this->hud_; }
+
+            void addCameraPosition(CameraPosition* position);
+            CameraPosition* getCameraPosition(unsigned int index) const;
+            inline const std::list<CameraPosition*>& getCameraPositions() const
+                { return this->cameraPositions_; }
+
+            inline void setCameraPositionTemplate(const std::string& name)
+                { this->cameraPositionTemplate_ = name; }
+            inline const std::string& getCameraPositionTemkplate() const
+                { return this->cameraPositionTemplate_; }
+
+        protected:
+            virtual void startLocalControl();
+            virtual void stopLocalControl();
+
+            inline void setHudTemplate(const std::string& name)
+                { this->hudtemplate_ = name; }
+
+            inline bool isLocallyControlled() const
+                { return this->bControlled_; }
+
+            Vector3 acceleration_;
+
+        private:
+            void overwrite();
+            void processOverwrite();
+
+            void processServerPosition();
+            void processServerVelocity();
+            void processServerOrientation();
+
+            void processClientPosition();
+            void processClientVelocity();
+            void processClientOrientation();
+
+            void networkcallback_changedplayerID();
+
+            unsigned int server_overwrite_;
+            unsigned int client_overwrite_;
+
+            Vector3 velocity_;
+
+            bool bControlled_;
+            Vector3 server_position_;
+            Vector3 client_position_;
+            Vector3 server_velocity_;
+            Vector3 client_velocity_;
+            Quaternion server_orientation_;
+            Quaternion client_orientation_;
+
+            PlayerInfo* player_;
+            unsigned int playerID_;
+            std::string hudtemplate_;
+            OverlayGroup* hud_;
+            Camera* camera_;
+            bool bDestroyWhenPlayerLeft_;
+
+            std::list<CameraPosition*> cameraPositions_;
+            std::string cameraPositionTemplate_;
+    };
+}
+
+#endif /* _ControllableEntity_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/Light.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Light.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/Light.cc	(revision 2087)
@@ -0,0 +1,174 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Light.h"
+
+#include <sstream>
+#include <cassert>
+
+#include <OgreSceneManager.h>
+
+#include "util/String.h"
+#include "util/Convert.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "objects/Scene.h"
+
+namespace orxonox
+{
+    unsigned int Light::lightCounter_s = 0;
+
+    CreateFactory(Light);
+
+    Light::Light(BaseObject* creator) : PositionableEntity(creator)
+    {
+        RegisterObject(Light);
+
+        if (this->getScene() && this->getScene()->getSceneManager())
+        this->light_ = this->getScene()->getSceneManager()->createLight("Light" + convertToString(Light::lightCounter_s++));
+        this->getNode()->attachObject(this->light_);
+
+        this->registerVariables();
+    }
+
+    Light::~Light()
+    {
+        if (this->isInitialized())
+        {
+            if (this->light_ && this->getScene() && this->getScene()->getSceneManager())
+                this->getScene()->getSceneManager()->destroyLight(this->light_);
+        }
+    }
+
+    void Light::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(Light, XMLPort, xmlelement, mode);
+
+        XMLPortParam(Light, "type", setTypeString, getTypeString, xmlelement, mode).defaultValues("point");
+        XMLPortParamExternTemplate(Light, Ogre::Light, this->light_, "diffuse",   setDiffuseColour,  getDiffuseColour,  xmlelement, mode, const ColourValue&);
+        XMLPortParamExternTemplate(Light, Ogre::Light, this->light_, "specular",  setSpecularColour, getSpecularColour, xmlelement, mode, const ColourValue&);
+        XMLPortParamExternTemplate(Light, Ogre::Light, this->light_, "direction", setDirection,      getDirection,      xmlelement, mode, const Vector3&);
+    }
+
+    void Light::registerVariables()
+    {
+        REGISTERDATA(this->type_, network::direction::toclient, new network::NetworkCallback<Light>(this, &Light::changedType));
+        REGISTERDATA(this->light_->getDiffuseColour(), network::direction::toclient);
+        REGISTERDATA(this->light_->getSpecularColour(), network::direction::toclient);
+        REGISTERDATA(this->light_->getDirection(), network::direction::toclient);
+    }
+
+    const std::string& Light::getName() const
+    {
+        if (this->light_)
+            return this->light_->getName();
+        else
+            return BLANKSTRING;
+    }
+
+    void Light::setDiffuseColour(const ColourValue& colour)
+    {
+        if (this->light_)
+            this->light_->setDiffuseColour(colour);
+    }
+
+    const ColourValue& Light::getDiffuseColour() const
+    {
+        if (this->light_)
+            return this->light_->getDiffuseColour();
+        else
+            return ColourValue::White;
+    }
+
+    void Light::setSpecularColour(const ColourValue& colour)
+    {
+        if (this->light_)
+            this->light_->setSpecularColour(colour);
+    }
+
+    const ColourValue& Light::getSpecularColour() const
+    {
+        if (this->light_)
+            return this->light_->getSpecularColour();
+        else
+            return ColourValue::White;
+    }
+
+    void Light::setDirection(const Vector3& direction)
+    {
+        if (this->light_)
+            this->light_->setDirection(direction);
+    }
+
+    const Vector3& Light::getDirection() const
+    {
+        if (this->light_)
+            return this->light_->getDirection();
+        else
+            return Vector3::ZERO;
+    }
+
+    void Light::setTypeString(const std::string& type)
+    {
+        if (type == "point")
+            this->setType(Ogre::Light::LT_POINT);
+        else if (type == "directional")
+            this->setType(Ogre::Light::LT_DIRECTIONAL);
+        else if (type == "spotlight")
+            this->setType(Ogre::Light::LT_SPOTLIGHT);
+        else
+            this->setType(Ogre::Light::LT_POINT);
+    }
+
+    std::string Light::getTypeString() const
+    {
+        switch (this->type_)
+        {
+            case Ogre::Light::LT_DIRECTIONAL:
+                return "directional";
+            case Ogre::Light::LT_SPOTLIGHT:
+                return "spotlight";
+            case Ogre::Light::LT_POINT:
+            default:
+                return "poinT";
+        }
+    }
+
+    void Light::changedType()
+    {
+        this->light_->setType(this->type_);
+    }
+
+    void Light::changedVisibility()
+    {
+        SUPER(Light, changedVisibility);
+
+        this->light_->setVisible(this->isVisible());
+    }
+}
Index: code/trunk/src/orxonox/objects/worldentities/Light.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Light.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/Light.h	(revision 2087)
@@ -0,0 +1,85 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Light_H__
+#define _Light_H__
+
+#include "OrxonoxPrereqs.h"
+#include "PositionableEntity.h"
+
+#include <string>
+#include <OgreLight.h>
+
+#include "util/Math.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport Light : public PositionableEntity
+    {
+        public:
+            Light(BaseObject* creator);
+            virtual ~Light();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            void registerVariables();
+
+            virtual void changedVisibility();
+
+            inline Ogre::Light* getLight()
+                { return this->light_; }
+
+            const std::string& getName() const;
+
+            inline void setType(Ogre::Light::LightTypes type)
+                { this->type_ = type; this->changedType(); }
+            Ogre::Light::LightTypes getType() const
+                { return this->type_; }
+
+            void setDiffuseColour(const ColourValue& colour);
+            const ColourValue& getDiffuseColour() const;
+
+            void setSpecularColour(const ColourValue& colour);
+            const ColourValue& getSpecularColour() const;
+
+            void setDirection(const Vector3& direction);
+            const Vector3& getDirection() const;
+
+        private:
+            void setTypeString(const std::string& type);
+            std::string getTypeString() const;
+
+            void changedType();
+
+            static unsigned int lightCounter_s;
+            Ogre::Light* light_;
+            Ogre::Light::LightTypes type_;
+
+    };
+}
+
+#endif /* _Light_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/Model.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Model.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/Model.cc	(revision 2087)
@@ -0,0 +1,93 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+
+#include "Model.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "objects/Scene.h"
+
+namespace orxonox
+{
+    CreateFactory(Model);
+
+    Model::Model(BaseObject* creator) : PositionableEntity(creator)
+    {
+        RegisterObject(Model);
+
+        this->registerVariables();
+    }
+
+    Model::~Model()
+    {
+        if (this->isInitialized() && this->mesh_.getEntity())
+            this->getNode()->detachObject(this->mesh_.getEntity());
+    }
+
+    void Model::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(Model, XMLPort, xmlelement, mode);
+
+        XMLPortParam(Model, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
+        XMLPortParam(Model, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true);
+    }
+
+    void Model::registerVariables()
+    {
+        REGISTERSTRING(this->meshSrc_,    network::direction::toclient, new network::NetworkCallback<Model>(this, &Model::changedMesh));
+        REGISTERDATA(this->bCastShadows_, network::direction::toclient, new network::NetworkCallback<Model>(this, &Model::changedShadows));
+    }
+
+    void Model::changedMesh()
+    {
+        if (this->mesh_.getEntity())
+            this->getNode()->detachObject(this->mesh_.getEntity());
+
+        this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_);
+
+        if (this->mesh_.getEntity())
+        {
+            this->getNode()->attachObject(this->mesh_.getEntity());
+            this->mesh_.getEntity()->setCastShadows(this->bCastShadows_);
+            this->mesh_.setVisible(this->isVisible());
+        }
+    }
+
+    void Model::changedShadows()
+    {
+        this->mesh_.setCastShadows(this->bCastShadows_);
+    }
+
+    void Model::changedVisibility()
+    {
+        SUPER(Model, changedVisibility);
+
+        this->mesh_.setVisible(this->isVisible());
+    }
+}
Index: code/trunk/src/orxonox/objects/worldentities/Model.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Model.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/Model.h	(revision 2087)
@@ -0,0 +1,72 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Model_H__
+#define _Model_H__
+
+#include "OrxonoxPrereqs.h"
+#include "PositionableEntity.h"
+#include "tools/Mesh.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport Model : public PositionableEntity
+    {
+        public:
+            Model(BaseObject* creator);
+            virtual ~Model();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            void registerVariables();
+
+            virtual void changedVisibility();
+
+            inline const Mesh& getMesh() const
+                { return this->mesh_; }
+
+            inline void setMeshSource(const std::string& meshname)
+                { this->meshSrc_ = meshname; this->changedMesh(); }
+            inline const std::string& getMeshSource() const
+                { return this->meshSrc_; }
+
+            inline void setCastShadows(bool bCastShadows)
+                { this->bCastShadows_ = bCastShadows; this->changedShadows(); }
+            inline bool getCastShadows() const
+                { return this->bCastShadows_; }
+
+        private:
+            void changedMesh();
+            void changedShadows();
+
+            std::string meshSrc_;
+            Mesh mesh_;
+            bool bCastShadows_;
+    };
+}
+
+#endif /* _PositionableEntity_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/MovableEntity.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/MovableEntity.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/MovableEntity.cc	(revision 2087)
@@ -0,0 +1,178 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "MovableEntity.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "core/Executor.h"
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+    static const float MAX_RESYNCHRONIZE_TIME = 3.0f;
+
+    CreateFactory(MovableEntity);
+
+    MovableEntity::MovableEntity(BaseObject* creator) : WorldEntity(creator)
+    {
+        RegisterObject(MovableEntity);
+
+        this->velocity_ = Vector3::ZERO;
+        this->acceleration_ = Vector3::ZERO;
+        this->rotationAxis_ = Vector3::ZERO;
+        this->rotationRate_ = 0;
+        this->momentum_ = 0;
+
+        this->overwrite_position_ = Vector3::ZERO;
+        this->overwrite_orientation_ = Quaternion::IDENTITY;
+
+        this->registerVariables();
+    }
+
+    MovableEntity::~MovableEntity()
+    {
+    }
+
+    void MovableEntity::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(MovableEntity, XMLPort, xmlelement, mode);
+
+        XMLPortParamTemplate(MovableEntity, "velocity", setVelocity, getVelocity, xmlelement, mode, const Vector3&);
+        XMLPortParamTemplate(MovableEntity, "rotationaxis", setRotationAxis, getRotationAxis, xmlelement, mode, const Vector3&);
+        XMLPortParamTemplate(MovableEntity, "rotationrate", setRotationRate, getRotationRate, xmlelement, mode, const Degree&);
+    }
+
+    void MovableEntity::tick(float dt)
+    {
+        if (this->isActive())
+        {
+            this->velocity_ += (dt * this->acceleration_);
+            this->node_->translate(dt * this->velocity_);
+
+            this->rotationRate_ += (dt * this->momentum_);
+            this->node_->rotate(this->rotationAxis_, this->rotationRate_  * dt);
+        }
+    }
+
+    void MovableEntity::registerVariables()
+    {
+        REGISTERDATA(this->velocity_.x, network::direction::toclient);
+        REGISTERDATA(this->velocity_.y, network::direction::toclient);
+        REGISTERDATA(this->velocity_.z, network::direction::toclient);
+
+        REGISTERDATA(this->rotationAxis_.x, network::direction::toclient);
+        REGISTERDATA(this->rotationAxis_.y, network::direction::toclient);
+        REGISTERDATA(this->rotationAxis_.z, network::direction::toclient);
+
+        REGISTERDATA(this->rotationRate_, network::direction::toclient);
+
+        REGISTERDATA(this->overwrite_position_,    network::direction::toclient, new network::NetworkCallback<MovableEntity>(this, &MovableEntity::overwritePosition));
+        REGISTERDATA(this->overwrite_orientation_, network::direction::toclient, new network::NetworkCallback<MovableEntity>(this, &MovableEntity::overwriteOrientation));
+    }
+
+    void MovableEntity::overwritePosition()
+    {
+        this->node_->setPosition(this->overwrite_position_);
+    }
+
+    void MovableEntity::overwriteOrientation()
+    {
+        this->node_->setOrientation(this->overwrite_orientation_);
+    }
+
+    void MovableEntity::clientConnected(unsigned int clientID)
+    {
+        new Timer<MovableEntity>(rnd() * MAX_RESYNCHRONIZE_TIME, false, this, createExecutor(createFunctor(&MovableEntity::resynchronize)), true);
+    }
+
+    void MovableEntity::clientDisconnected(unsigned int clientID)
+    {
+    }
+
+    void MovableEntity::resynchronize()
+    {
+        this->overwrite_position_ = this->getPosition();
+        this->overwrite_orientation_ = this->getOrientation();
+    }
+
+    void MovableEntity::setPosition(const Vector3& position)
+    {
+        this->node_->setPosition(position);
+        this->overwrite_position_ = this->node_->getPosition();
+    }
+
+    void MovableEntity::translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo)
+    {
+        this->node_->translate(distance, relativeTo);
+        this->overwrite_position_ = this->node_->getPosition();
+    }
+
+    void MovableEntity::setOrientation(const Quaternion& orientation)
+    {
+        this->node_->setOrientation(orientation);
+        this->overwrite_orientation_ = this->node_->getOrientation();
+    }
+
+    void MovableEntity::rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo)
+    {
+        this->node_->rotate(rotation, relativeTo);
+        this->overwrite_orientation_ = this->node_->getOrientation();
+    }
+
+    void MovableEntity::yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
+    {
+        this->node_->yaw(angle, relativeTo);
+        this->overwrite_orientation_ = this->node_->getOrientation();
+    }
+
+    void MovableEntity::pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
+    {
+        this->node_->pitch(angle, relativeTo);
+        this->overwrite_orientation_ = this->node_->getOrientation();
+    }
+
+    void MovableEntity::roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
+    {
+        this->node_->roll(angle, relativeTo);
+        this->overwrite_orientation_ = this->node_->getOrientation();
+    }
+
+    void MovableEntity::lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector)
+    {
+        this->node_->lookAt(target, relativeTo, localDirectionVector);
+        this->overwrite_orientation_ = this->node_->getOrientation();
+    }
+
+    void MovableEntity::setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector)
+    {
+        this->node_->setDirection(direction, relativeTo, localDirectionVector);
+        this->overwrite_orientation_ = this->node_->getOrientation();
+    }
+}
Index: code/trunk/src/orxonox/objects/worldentities/MovableEntity.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/MovableEntity.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/MovableEntity.h	(revision 2087)
@@ -0,0 +1,124 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _MovableEntity_H__
+#define _MovableEntity_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "WorldEntity.h"
+#include "objects/Tickable.h"
+#include "network/ClientConnectionListener.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport MovableEntity : public WorldEntity, public Tickable, public network::ClientConnectionListener
+    {
+        public:
+            MovableEntity(BaseObject* creator);
+            virtual ~MovableEntity();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            virtual void tick(float dt);
+            void registerVariables();
+
+            using WorldEntity::setPosition;
+            using WorldEntity::translate;
+            using WorldEntity::setOrientation;
+            using WorldEntity::rotate;
+            using WorldEntity::yaw;
+            using WorldEntity::pitch;
+            using WorldEntity::roll;
+            using WorldEntity::lookAt;
+            using WorldEntity::setDirection;
+
+            void setPosition(const Vector3& position);
+            void translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
+            void setOrientation(const Quaternion& orientation);
+            void rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
+            void yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
+            void pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
+            void roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
+            void lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
+            void setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
+
+            inline void setVelocity(const Vector3& velocity)
+                { this->velocity_ = velocity; }
+            inline void setVelocity(float x, float y, float z)
+                { this->velocity_.x = x; this->velocity_.y = y; this->velocity_.z = z; }
+            inline const Vector3& getVelocity() const
+                { return this->velocity_; }
+
+            inline void setAcceleration(const Vector3& acceleration)
+                { this->acceleration_ = acceleration; }
+            inline void setAcceleration(float x, float y, float z)
+                { this->acceleration_.x = x; this->acceleration_.y = y; this->acceleration_.z = z; }
+            inline const Vector3& getAcceleration() const
+                { return this->acceleration_; }
+
+            inline void setRotationAxis(const Vector3& axis)
+                { this->rotationAxis_ = axis; this->rotationAxis_.normalise(); }
+            inline void setRotationAxis(float x, float y, float z)
+                { this->rotationAxis_.x = x; this->rotationAxis_.y = y; this->rotationAxis_.z = z; rotationAxis_.normalise(); }
+            inline const Vector3& getRotationAxis() const
+                { return this->rotationAxis_; }
+
+            inline void setRotationRate(const Degree& angle)
+                { this->rotationRate_ = angle; }
+            inline void setRotationRate(const Radian& angle)
+                { this->rotationRate_ = angle; }
+            inline const Degree& getRotationRate() const
+                { return this->rotationRate_; }
+
+            inline void setMomentum(const Degree& angle)
+                { this->momentum_ = angle; }
+            inline void setMomentum(const Radian& angle)
+                { this->momentum_ = angle; }
+            inline const Degree& getMomentum() const
+                { return this->momentum_; }
+
+        private:
+            void clientConnected(unsigned int clientID);
+            void clientDisconnected(unsigned int clientID);
+            void resynchronize();
+
+            void overwritePosition();
+            void overwriteOrientation();
+
+            Vector3 velocity_;
+            Vector3 acceleration_;
+            Vector3 rotationAxis_;
+            Degree rotationRate_;
+            Degree momentum_;
+
+            Vector3 overwrite_position_;
+            Quaternion overwrite_orientation_;
+    };
+}
+
+#endif /* _MovableEntity_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/ParticleEmitter.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/ParticleEmitter.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/ParticleEmitter.cc	(revision 2087)
@@ -0,0 +1,125 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+* @file ParticleInterface.cc
+* @brief class to control praticle effects
+*/
+
+#include "OrxonoxStableHeaders.h"
+
+#include "ParticleEmitter.h"
+
+#include "tools/ParticleInterface.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "objects/Scene.h"
+
+namespace orxonox
+{
+    CreateFactory(ParticleEmitter);
+
+    ParticleEmitter::ParticleEmitter(BaseObject* creator) : PositionableEntity(creator)
+    {
+        RegisterObject(ParticleEmitter);
+
+        assert(this->getScene());
+        assert(this->getScene()->getSceneManager());
+
+        this->particles_ = 0;
+        this->LOD_ = LODParticle::normal;
+
+        this->registerVariables();
+    }
+
+    ParticleEmitter::~ParticleEmitter()
+    {
+        if (this->isInitialized() && this->particles_)
+            delete this->particles_;
+    }
+
+    void ParticleEmitter::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(ParticleEmitter, XMLPort, xmlelement, mode);
+
+        XMLPortParam(ParticleEmitter, "lod",    setLODxml, getLODxml, xmlelement, mode).defaultValues(LODParticle::normal);
+        XMLPortParam(ParticleEmitter, "source", setSource, getSource, xmlelement, mode);
+    }
+
+    void ParticleEmitter::registerVariables()
+    {
+        REGISTERSTRING(this->source_, network::direction::toclient, new network::NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::sourceChanged));
+        REGISTERDATA  (this->LOD_,    network::direction::toclient, new network::NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::LODchanged));
+    }
+
+    void ParticleEmitter::changedVisibility()
+    {
+        SUPER(ParticleEmitter, changedVisibility);
+
+        if (this->particles_)
+            this->particles_->setVisible(this->isVisible());
+    }
+
+    void ParticleEmitter::changedActivity()
+    {
+        SUPER(ParticleEmitter, changedActivity);
+
+        if (this->particles_)
+            this->particles_->setEnabled(this->isActive());
+    }
+
+    void ParticleEmitter::sourceChanged()
+    {
+        if (this->particles_)
+            delete this->particles_;
+
+        if (this->getScene() && this->getScene()->getSceneManager())
+        {
+            try
+            {
+                this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), this->source_, this->LOD_);
+                this->particles_->addToSceneNode(this->getNode());
+                this->particles_->setVisible(this->isVisible());
+                this->particles_->setEnabled(this->isActive());
+            }
+            catch (...)
+            {
+                COUT(1) << "Error: Couln't load particle effect \"" << this->source_ << "\"" << std::endl;
+                this->particles_ = 0;
+            }
+        }
+        else
+            this->particles_ = 0;
+    }
+
+    void ParticleEmitter::LODchanged()
+    {
+        if (this->particles_)
+            this->particles_->setDetailLevel(this->LOD_);
+    }
+}
Index: code/trunk/src/orxonox/objects/worldentities/ParticleEmitter.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/ParticleEmitter.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/ParticleEmitter.h	(revision 2087)
@@ -0,0 +1,77 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _ParticleEmitter_H__
+#define _ParticleEmitter_H__
+
+#include "OrxonoxPrereqs.h"
+#include "PositionableEntity.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport ParticleEmitter : public PositionableEntity
+    {
+        public:
+            ParticleEmitter(BaseObject* creator);
+            ~ParticleEmitter();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            void registerVariables();
+
+            virtual void changedVisibility();
+            virtual void changedActivity();
+
+            inline ParticleInterface* getParticleInterface() const
+                { return this->particles_; }
+
+            inline void setSource(const std::string& source)
+                { this->source_ = source; this->sourceChanged(); }
+            inline const std::string& getSource() const
+                { return this->source_; }
+
+            inline void setLOD(LODParticle::LOD level)
+                { this->LOD_ = level; this->LODchanged(); }
+            inline LODParticle::LOD getLOD() const
+                { return this->LOD_; }
+
+        protected:
+            inline void setLODxml(unsigned int level)
+                { this->LOD_ = (LODParticle::LOD)level; this->LODchanged(); }
+            inline unsigned int getLODxml() const
+                { return (unsigned int)this->LOD_; }
+
+            void sourceChanged();
+            void LODchanged();
+
+            ParticleInterface* particles_;
+            std::string        source_;
+            LODParticle::LOD   LOD_;
+    };
+}
+
+#endif /* _ParticleEmitter_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/ParticleSpawner.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/ParticleSpawner.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/ParticleSpawner.cc	(revision 2087)
@@ -0,0 +1,131 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "ParticleSpawner.h"
+
+#include "core/CoreIncludes.h"
+#include "core/EventIncludes.h"
+#include "core/Executor.h"
+#include "core/XMLPort.h"
+#include "tools/ParticleInterface.h"
+
+namespace orxonox
+{
+    CreateFactory(ParticleSpawner);
+
+    ParticleSpawner::ParticleSpawner(BaseObject* creator) : ParticleEmitter(creator)
+    {
+        RegisterObject(ParticleSpawner);
+
+        this->bAutostart_ = true;
+        this->bSuppressStart_ = false;
+        this->bAutoDestroy_ = true;
+        this->bForceDestroy_ = false;
+        this->bLoop_ = false;
+        this->startdelay_ = 0;
+        this->lifetime_ = 0;
+        this->destroydelay_ = 0;
+
+        this->startParticleSpawner();
+    }
+
+    ParticleSpawner::~ParticleSpawner()
+    {
+    }
+
+    void ParticleSpawner::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(ParticleSpawner, XMLPort, xmlelement, mode);
+
+        XMLPortParam(ParticleSpawner, "autostart",    setAutoStart,        getAutoStart,        xmlelement, mode).defaultValues(true);
+        XMLPortParam(ParticleSpawner, "autodestroy",  setDestroyAfterLife, getDestroyAfterLife, xmlelement, mode).defaultValues(false);
+        XMLPortParam(ParticleSpawner, "loop",         setLoop,             getLoop,             xmlelement, mode).defaultValues(false);
+        XMLPortParam(ParticleSpawner, "lifetime",     setLifetime,         getLifetime,         xmlelement, mode).defaultValues(0.0f);
+        XMLPortParam(ParticleSpawner, "startdelay",   setStartdelay,       getStartdelay,       xmlelement, mode).defaultValues(0.0f);
+        XMLPortParam(ParticleSpawner, "destroydelay", setDestroydelay,     getDestroydelay,     xmlelement, mode).defaultValues(0.0f);
+    }
+
+    void ParticleSpawner::processEvent(Event& event)
+    {
+        SUPER(ParticleSpawner, processEvent, event);
+
+        SetEvent(ParticleSpawner, "spawn", spawn, event);
+    }
+
+    void ParticleSpawner::configure(float lifetime, float startdelay, float destroydelay, bool autodestroy)
+    {
+        this->bAutoDestroy_ = autodestroy;
+        this->startdelay_ = startdelay;
+        this->lifetime_ = lifetime;
+        this->destroydelay_ = destroydelay;
+    }
+
+    void ParticleSpawner::startParticleSpawner()
+    {
+        if (!this->particles_)
+            return;
+
+        this->setActive(false);
+
+        if (this->bForceDestroy_ || this->bSuppressStart_)
+            return;
+
+        this->timer_.setTimer(this->startdelay_, false, this, createExecutor(createFunctor(&ParticleSpawner::fireParticleSpawner)));
+    }
+
+    void ParticleSpawner::fireParticleSpawner()
+    {
+        this->setActive(true);
+        if (this->lifetime_ != 0)
+            this->timer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&ParticleSpawner::stopParticleSpawner)));
+    }
+
+    void ParticleSpawner::stopParticleSpawner()
+    {
+        this->setActive(false);
+
+        if (this->bAutoDestroy_ || this->bForceDestroy_)
+        {
+            this->setPosition(this->getWorldPosition());
+            this->detachFromParent();
+
+            if (!this->timer_.isActive() || this->timer_.getRemainingTime() > this->destroydelay_)
+                this->timer_.setTimer(this->destroydelay_, false, this, createExecutor(createFunctor(&ParticleSpawner::destroyParticleSpawner)));
+        }
+        else if (this->bLoop_)
+        {
+            this->timer_.setTimer(this->destroydelay_, false, this, createExecutor(createFunctor(&ParticleSpawner::startParticleSpawner)));
+        }
+    }
+
+    void ParticleSpawner::destroyParticleSpawner()
+    {
+        delete this;
+    }
+}
Index: code/trunk/src/orxonox/objects/worldentities/ParticleSpawner.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/ParticleSpawner.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/ParticleSpawner.h	(revision 2087)
@@ -0,0 +1,104 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _ParticleSpawner_H__
+#define _ParticleSpawner_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "ParticleEmitter.h"
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport ParticleSpawner : public ParticleEmitter
+    {
+        public:
+            ParticleSpawner(BaseObject* creator);
+            virtual ~ParticleSpawner();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            virtual void processEvent(Event& event);
+
+            inline void destroy()
+                { this->bForceDestroy_ = true; this->stopParticleSpawner(); }
+            inline void spawn()
+                { this->bSuppressStart_ = false; this->startParticleSpawner(); }
+
+            void configure(float lifetime = 0, float startdelay = 0, float destroydelay = 0, bool autodestroy = true);
+
+            inline void setAutoStart(bool autostart)
+                { this->bAutostart_ = autostart; this->bSuppressStart_ = !autostart; }
+            inline bool getAutoStart() const
+                { return this->bAutostart_; }
+
+            inline void setDestroyAfterLife(bool destroy)
+                { this->bAutoDestroy_ = destroy; }
+            inline bool getDestroyAfterLife() const
+                { return this->bAutoDestroy_; }
+
+            inline void setLoop(bool loop)
+                { this->bLoop_ = loop; }
+            inline bool getLoop() const
+                { return this->bLoop_; }
+
+            inline void setLifetime(float lifetime)
+                { this->lifetime_ = lifetime; this->startParticleSpawner(); }
+            inline float getLifetime() const
+                { return this->lifetime_; }
+
+            inline void setStartdelay(float startdelay)
+                { this->startdelay_ = startdelay; this->startParticleSpawner(); }
+            inline float getStartdelay() const
+                { return this->startdelay_; }
+
+            inline void setDestroydelay(float destroydelay)
+                { this->destroydelay_ = destroydelay; this->startParticleSpawner(); }
+            inline float getDestroydelay() const
+                { return this->destroydelay_; }
+
+        private:
+            void startParticleSpawner();
+            void fireParticleSpawner();
+            void stopParticleSpawner();
+            void destroyParticleSpawner();
+
+            Timer<ParticleSpawner> timer_;
+
+            bool  bSuppressStart_;
+            bool  bAutostart_;
+            bool  bForceDestroy_;
+            bool  bAutoDestroy_;
+            bool  bLoop_;
+            float startdelay_;
+            float lifetime_;
+            float destroydelay_;
+    };
+}
+
+#endif /* _ParticleSpawner_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/PositionableEntity.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/PositionableEntity.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/PositionableEntity.cc	(revision 2087)
@@ -0,0 +1,59 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "PositionableEntity.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+    CreateFactory(PositionableEntity);
+
+    PositionableEntity::PositionableEntity(BaseObject* creator) : WorldEntity(creator)
+    {
+        RegisterObject(PositionableEntity);
+
+        this->registerVariables();
+    }
+
+    PositionableEntity::~PositionableEntity()
+    {
+    }
+
+    void PositionableEntity::registerVariables()
+    {
+        REGISTERDATA(this->getPosition().x, network::direction::toclient);
+        REGISTERDATA(this->getPosition().y, network::direction::toclient);
+        REGISTERDATA(this->getPosition().z, network::direction::toclient);
+
+        REGISTERDATA(this->getOrientation().w, network::direction::toclient);
+        REGISTERDATA(this->getOrientation().x, network::direction::toclient);
+        REGISTERDATA(this->getOrientation().y, network::direction::toclient);
+        REGISTERDATA(this->getOrientation().z, network::direction::toclient);
+    }
+}
Index: code/trunk/src/orxonox/objects/worldentities/PositionableEntity.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/PositionableEntity.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/PositionableEntity.h	(revision 2087)
@@ -0,0 +1,76 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _PositionableEntity_H__
+#define _PositionableEntity_H__
+
+#include "OrxonoxPrereqs.h"
+#include "WorldEntity.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport PositionableEntity : public WorldEntity
+    {
+        public:
+            PositionableEntity(BaseObject* creator);
+            virtual ~PositionableEntity();
+
+            void registerVariables();
+
+            using WorldEntity::setPosition;
+            using WorldEntity::translate;
+            using WorldEntity::setOrientation;
+            using WorldEntity::rotate;
+            using WorldEntity::yaw;
+            using WorldEntity::pitch;
+            using WorldEntity::roll;
+            using WorldEntity::lookAt;
+            using WorldEntity::setDirection;
+
+            inline void setPosition(const Vector3& position)
+                { this->node_->setPosition(position); }
+            inline void translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
+                { this->node_->translate(distance, relativeTo); }
+            inline void setOrientation(const Quaternion& orientation)
+                { this->node_->setOrientation(orientation); }
+            inline void rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
+                { this->node_->rotate(rotation, relativeTo); }
+            inline void yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
+                { this->node_->yaw(angle, relativeTo); }
+            inline void pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
+                { this->node_->pitch(angle, relativeTo); }
+            inline void roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
+                { this->node_->roll(angle, relativeTo); }
+            inline void lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z)
+                { this->node_->lookAt(target, relativeTo, localDirectionVector); }
+            inline void setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z)
+                { this->node_->setDirection(direction, relativeTo, localDirectionVector); }
+    };
+}
+
+#endif /* _PositionableEntity_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/SpawnPoint.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/SpawnPoint.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/SpawnPoint.cc	(revision 2087)
@@ -0,0 +1,100 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "SpawnPoint.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "objects/gametypes/Gametype.h"
+
+namespace orxonox
+{
+    CreateFactory(SpawnPoint);
+
+    SpawnPoint::SpawnPoint(BaseObject* creator) : PositionableEntity(creator)
+    {
+        RegisterObject(SpawnPoint);
+
+        this->template_ = 0;
+
+        if (this->getGametype())
+            this->getGametype()->registerSpawnPoint(this);
+        else
+            COUT(1) << "Error: SpawnPoint has no Gametype" << std::endl;
+
+        this->setObjectMode(0x0);
+    }
+
+    void SpawnPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(SpawnPoint, XMLPort, xmlelement, mode);
+
+        XMLPortParam(SpawnPoint, "spawnclass", setSpawnClassName, getSpawnClassName, xmlelement, mode);
+        XMLPortParam(SpawnPoint, "pawndesign", setTemplateName, getTemplateName, xmlelement, mode);
+    }
+
+    void SpawnPoint::setSpawnClassName(const std::string& name)
+    {
+        this->spawnclassname_ = name;
+        this->spawnclass_ = ClassByString(name);
+    }
+
+    void SpawnPoint::setTemplateName(const std::string& name)
+    {
+        this->templatename_ = name;
+        this->template_ = Template::getTemplate(name);
+    }
+
+    Pawn* SpawnPoint::spawn()
+    {
+        Pawn* entity = this->spawnclass_.fabricate(this);
+        if (entity)
+        {
+            this->getGametype()->pawnPreSpawn(entity);
+
+            this->spawn(entity);
+
+            if (this->template_)
+                entity->addTemplate(this->template_);
+
+            entity->postSpawn();
+
+            this->getGametype()->pawnPostSpawn(entity);
+
+            this->fireEvent();
+        }
+        return entity;
+    }
+
+    void SpawnPoint::spawn(ControllableEntity* entity)
+    {
+        entity->setPosition(this->getPosition());
+        entity->setOrientation(this->getOrientation());
+    }
+}
Index: code/trunk/src/orxonox/objects/worldentities/SpawnPoint.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/SpawnPoint.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/SpawnPoint.h	(revision 2087)
@@ -0,0 +1,78 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _SpawnPoint_H__
+#define _SpawnPoint_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "core/Identifier.h"
+#include "core/Template.h"
+#include "PositionableEntity.h"
+#include "objects/worldentities/pawns/Pawn.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport SpawnPoint : public PositionableEntity
+    {
+        public:
+            SpawnPoint(BaseObject* creator);
+            virtual ~SpawnPoint() {}
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            inline void setSpawnClass(Identifier* identifier)
+                { this->spawnclass_ = identifier; this->spawnclassname_ = identifier->getName(); }
+            inline Identifier* getSpawnClass() const
+                { return this->spawnclass_; }
+
+            inline void setTemplate(Template* temp)
+                { this->template_ = temp; this->templatename_ = temp->getName(); }
+            inline Template* getTemplate() const
+                { return this->template_; }
+
+            Pawn* spawn();
+            void spawn(ControllableEntity* entity);
+
+        private:
+            void setSpawnClassName(const std::string& name);
+            inline const std::string& getSpawnClassName() const
+                { return this->spawnclassname_; }
+
+            void setTemplateName(const std::string& name);
+            inline const std::string& getTemplateName() const
+                { return this->templatename_; }
+
+            SubclassIdentifier<Pawn> spawnclass_;
+            std::string spawnclassname_;
+            Template* template_;
+            std::string templatename_;
+    };
+}
+
+#endif /* _SpawnPoint_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/WorldEntity.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/WorldEntity.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/WorldEntity.cc	(revision 2087)
@@ -0,0 +1,152 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "WorldEntity.h"
+
+#include <cassert>
+#include <OgreSceneManager.h>
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "util/Convert.h"
+
+#include "objects/Scene.h"
+
+namespace orxonox
+{
+    const Vector3 WorldEntity::FRONT = Vector3::NEGATIVE_UNIT_Z;
+    const Vector3 WorldEntity::BACK  = Vector3::UNIT_Z;
+    const Vector3 WorldEntity::LEFT  = Vector3::NEGATIVE_UNIT_X;
+    const Vector3 WorldEntity::RIGHT = Vector3::UNIT_X;
+    const Vector3 WorldEntity::DOWN  = Vector3::NEGATIVE_UNIT_Y;
+    const Vector3 WorldEntity::UP    = Vector3::UNIT_Y;
+
+    WorldEntity::WorldEntity(BaseObject* creator) : BaseObject(creator), network::Synchronisable(creator)
+    {
+        RegisterObject(WorldEntity);
+
+        assert(this->getScene());
+        assert(this->getScene()->getRootSceneNode());
+
+        this->node_ = this->getScene()->getRootSceneNode()->createChildSceneNode();
+
+        this->parent_ = 0;
+        this->parentID_ = (unsigned int)-1;
+
+        this->node_->setPosition(Vector3::ZERO);
+        this->node_->setOrientation(Quaternion::IDENTITY);
+
+        this->registerVariables();
+    }
+
+    WorldEntity::~WorldEntity()
+    {
+        if (this->isInitialized())
+        {
+            this->node_->detachAllObjects();
+            if (this->getScene()->getSceneManager())
+                this->getScene()->getSceneManager()->destroySceneNode(this->node_->getName());
+        }
+    }
+
+    void WorldEntity::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(WorldEntity, XMLPort, xmlelement, mode);
+
+        XMLPortParamTemplate(WorldEntity, "position", setPosition, getPosition, xmlelement, mode, const Vector3&);
+        XMLPortParamTemplate(WorldEntity, "orientation", setOrientation, getOrientation, xmlelement, mode, const Quaternion&);
+        XMLPortParamLoadOnly(WorldEntity, "lookat", lookAt_xmlport, xmlelement, mode);
+        XMLPortParamLoadOnly(WorldEntity, "direction", setDirection_xmlport, xmlelement, mode);
+        XMLPortParamLoadOnly(WorldEntity, "yaw", yaw_xmlport, xmlelement, mode);
+        XMLPortParamLoadOnly(WorldEntity, "pitch", pitch_xmlport, xmlelement, mode);
+        XMLPortParamLoadOnly(WorldEntity, "roll", roll_xmlport, xmlelement, mode);
+        XMLPortParamTemplate(WorldEntity, "scale3D", setScale3D, getScale3D, xmlelement, mode, const Vector3&);
+        XMLPortParam(WorldEntity, "scale", setScale, getScale, xmlelement, mode);
+
+        XMLPortObject(WorldEntity, WorldEntity, "attached", attach, getAttachedObject, xmlelement, mode);
+    }
+
+    void WorldEntity::registerVariables()
+    {
+        REGISTERDATA(this->bActive_,  network::direction::toclient, new network::NetworkCallback<WorldEntity>(this, &WorldEntity::changedActivity));
+        REGISTERDATA(this->bVisible_, network::direction::toclient, new network::NetworkCallback<WorldEntity>(this, &WorldEntity::changedVisibility));
+
+        REGISTERDATA(this->getScale3D().x, network::direction::toclient);
+        REGISTERDATA(this->getScale3D().y, network::direction::toclient);
+        REGISTERDATA(this->getScale3D().z, network::direction::toclient);
+
+        REGISTERDATA(this->parentID_, network::direction::toclient, new network::NetworkCallback<WorldEntity>(this, &WorldEntity::updateParent));
+    }
+
+    void WorldEntity::updateParent()
+    {
+        WorldEntity* parent = dynamic_cast<WorldEntity*>(Synchronisable::getSynchronisable(this->parentID_));
+        if (parent)
+            this->attachToParent(parent);
+    }
+
+    void WorldEntity::attach(WorldEntity* object)
+    {
+        if (object->getParent())
+            object->detachFromParent();
+        else
+        {
+            Ogre::Node* parent = object->node_->getParent();
+            if (parent)
+                parent->removeChild(object->node_);
+        }
+
+        this->node_->addChild(object->node_);
+        this->children_.insert(object);
+        object->parent_ = this;
+        object->parentID_ = this->getObjectID();
+    }
+
+    void WorldEntity::detach(WorldEntity* object)
+    {
+        this->node_->removeChild(object->node_);
+        this->children_.erase(object);
+        object->parent_ = 0;
+        object->parentID_ = (unsigned int)-1;
+
+//        this->getScene()->getRootSceneNode()->addChild(object->node_);
+    }
+
+    WorldEntity* WorldEntity::getAttachedObject(unsigned int index) const
+    {
+        unsigned int i = 0;
+        for (std::set<WorldEntity*>::const_iterator it = this->children_.begin(); it != this->children_.end(); ++it)
+        {
+            if (i == index)
+                return (*it);
+            ++i;
+        }
+        return 0;
+    }
+}
Index: code/trunk/src/orxonox/objects/worldentities/WorldEntity.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/WorldEntity.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/WorldEntity.h	(revision 2087)
@@ -0,0 +1,163 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _WorldEntity_H__
+#define _WorldEntity_H__
+
+#include "OrxonoxPrereqs.h"
+
+#define OGRE_FORCE_ANGLE_TYPES
+
+#include <OgreSceneNode.h>
+
+#include "network/Synchronisable.h"
+#include "core/BaseObject.h"
+#include "util/Math.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport WorldEntity : public BaseObject, public network::Synchronisable
+    {
+        public:
+            WorldEntity(BaseObject* creator);
+            virtual ~WorldEntity();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            void registerVariables();
+
+            inline Ogre::SceneNode* getNode() const
+                { return this->node_; }
+
+            static const Vector3 FRONT;
+            static const Vector3 BACK;
+            static const Vector3 LEFT;
+            static const Vector3 RIGHT;
+            static const Vector3 DOWN;
+            static const Vector3 UP;
+
+            virtual void setPosition(const Vector3& position) = 0;
+            inline void setPosition(float x, float y, float z)
+                { this->setPosition(Vector3(x, y, z)); }
+            inline const Vector3& getPosition() const
+                { return this->node_->getPosition(); }
+            inline const Vector3& getWorldPosition() const
+                { return this->node_->getWorldPosition(); }
+
+            virtual void translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0;
+            inline void translate(float x, float y, float z, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
+                { this->translate(Vector3(x, y, z), relativeTo); }
+
+            virtual void setOrientation(const Quaternion& orientation) = 0;
+            inline void setOrientation(float w, float x, float y, float z)
+                { this->setOrientation(Quaternion(w, x, y, z)); }
+            inline void setOrientation(const Vector3& axis, const Radian& angle)
+                { this->setOrientation(Quaternion(angle, axis)); }
+            inline void setOrientation(const Vector3& axis, const Degree& angle)
+                { this->setOrientation(Quaternion(angle, axis)); }
+            inline const Quaternion& getOrientation() const
+                { return this->node_->getOrientation(); }
+            inline const Quaternion& getWorldOrientation() const
+                { return this->node_->getWorldOrientation(); }
+
+            virtual void rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0;
+            inline void rotate(const Vector3& axis, const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
+                { this->rotate(Quaternion(angle, axis), relativeTo); }
+            inline void rotate(const Vector3& axis, const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
+                { this->rotate(Quaternion(angle, axis), relativeTo); }
+
+            virtual void yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0;
+            inline void yaw(const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
+                { this->yaw(Degree(angle), relativeTo); }
+            virtual void pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0;
+            inline void pitch(const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
+                { this->pitch(Degree(angle), relativeTo); }
+            virtual void roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0;
+            inline void roll(const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
+                { this->roll(Degree(angle), relativeTo); }
+
+            virtual void lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z) = 0;
+            virtual void setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z) = 0;
+            inline void setDirection(float x, float y, float z, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z)
+                { this->setDirection(Vector3(x, y, z), relativeTo, localDirectionVector); }
+
+            inline void setScale3D(const Vector3& scale)
+                { this->node_->setScale(scale); }
+            inline void setScale3D(float x, float y, float z)
+                { this->node_->setScale(x, y, z); }
+            inline const Vector3& getScale3D(void) const
+                { return this->node_->getScale(); }
+
+            inline void setScale(float scale)
+                { this->node_->setScale(scale, scale, scale); }
+            inline float getScale() const
+                { Vector3 scale = this->getScale3D(); return (scale.x == scale.y && scale.x == scale.z) ? scale.x : 1; }
+
+            inline void scale3D(const Vector3& scale)
+                { this->node_->scale(scale); }
+            inline void scale3D(float x, float y, float z)
+                { this->node_->scale(x, y, z); }
+            inline void scale(float scale)
+                { this->node_->scale(scale, scale, scale); }
+
+            void attach(WorldEntity* object);
+            void detach(WorldEntity* object);
+            WorldEntity* getAttachedObject(unsigned int index) const;
+            inline const std::set<WorldEntity*>& getAttachedObjects() const
+                { return this->children_; }
+
+            inline void attachToParent(WorldEntity* parent)
+                { parent->attach(this); }
+            inline void detachFromParent()
+                { if (this->parent_) { this->parent_->detach(this); } }
+            inline WorldEntity* getParent() const
+                { return this->parent_; }
+
+        protected:
+            Ogre::SceneNode* node_;
+
+        private:
+            void updateParent();
+
+            inline void lookAt_xmlport(const Vector3& target)
+                { this->lookAt(target); }
+            inline void setDirection_xmlport(const Vector3& direction)
+                { this->setDirection(direction); }
+            inline void yaw_xmlport(const Degree& angle)
+                { this->yaw(angle); }
+            inline void pitch_xmlport(const Degree& angle)
+                { this->pitch(angle); }
+            inline void roll_xmlport(const Degree& angle)
+                { this->roll(angle); }
+
+            WorldEntity* parent_;
+            unsigned int parentID_;
+            std::set<WorldEntity*> children_;
+    };
+}
+
+#endif /* _WorldEntity_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc	(revision 2087)
@@ -0,0 +1,134 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Pawn.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "util/Math.h"
+#include "objects/infos/PlayerInfo.h"
+#include "objects/gametypes/Gametype.h"
+
+namespace orxonox
+{
+    CreateFactory(Pawn);
+
+    Pawn::Pawn(BaseObject* creator) : ControllableEntity(creator)
+    {
+        RegisterObject(Pawn);
+
+        this->bAlive_ = false;
+
+        this->health_ = 0;
+        this->maxHealth_ = 0;
+        this->initialHealth_ = 0;
+
+        this->lastHitOriginator_ = 0;
+
+        this->registerVariables();
+    }
+
+    Pawn::~Pawn()
+    {
+    }
+
+    void Pawn::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(Pawn, XMLPort, xmlelement, mode);
+
+        XMLPortParam(Pawn, "health", setHealth, getHealht, xmlelement, mode).defaultValues(100);
+        XMLPortParam(Pawn, "maxhealth", setMaxHealth, getMaxHealth, xmlelement, mode).defaultValues(200);
+        XMLPortParam(Pawn, "initialhealth", setInitialHealth, getInitialHealth, xmlelement, mode).defaultValues(100);
+    }
+
+    void Pawn::registerVariables()
+    {
+        REGISTERDATA(this->bAlive_, network::direction::toclient);
+        REGISTERDATA(this->health_, network::direction::toclient);
+    }
+
+    void Pawn::tick(float dt)
+    {
+        SUPER(Pawn, tick, dt);
+
+        if (this->health_ <= 0)
+            this->death();
+    }
+
+    void Pawn::setHealth(float health)
+    {
+        this->health_ = min(health, this->maxHealth_);
+    }
+
+    void Pawn::damage(float damage, Pawn* originator)
+    {
+        this->setHealth(this->health_ - damage);
+        this->lastHitOriginator_ = originator;
+
+        // play damage effect
+    }
+
+    void Pawn::hit(Pawn* originator, const Vector3& force, float damage)
+    {
+        this->damage(damage, originator);
+        this->setVelocity(this->getVelocity() + force);
+
+        // play hit effect
+    }
+
+    void Pawn::kill()
+    {
+        this->damage(this->health_);
+        this->death();
+    }
+
+    void Pawn::spawn()
+    {
+        // play spawn effect
+    }
+
+    void Pawn::death()
+    {
+        this->bAlive_ = false;
+        if (this->getGametype())
+            this->getGametype()->pawnKilled(this, this->lastHitOriginator_);
+        if (this->getPlayer())
+            this->getPlayer()->stopControl(this);
+
+        delete this;
+
+        // play death effect
+    }
+
+    void Pawn::postSpawn()
+    {
+        this->setHealth(this->initialHealth_);
+        this->spawn();
+    }
+}
Index: code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.h	(revision 2087)
@@ -0,0 +1,92 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Pawn_H__
+#define _Pawn_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "objects/worldentities/ControllableEntity.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport Pawn : public ControllableEntity
+    {
+        public:
+            Pawn(BaseObject* creator);
+            virtual ~Pawn();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            virtual void tick(float dt);
+            void registerVariables();
+
+            inline bool isAlive() const
+                { return this->bAlive_; }
+
+            virtual void setHealth(float health);
+            inline void addHealth(float health)
+                { this->setHealth(this->health_ + health); }
+            inline void removeHealth(float health)
+                { this->setHealth(this->health_ - health); }
+            inline float getHealht() const
+                { return this->health_; }
+
+            inline void setMaxHealth(float maxhealth)
+                { this->maxHealth_ = maxhealth; this->setHealth(this->health_); }
+            inline float getMaxHealth() const
+                { return this->maxHealth_; }
+
+            inline void setInitialHealth(float initialhealth)
+                { this->initialHealth_ = initialhealth; this->setHealth(initialhealth); }
+            inline float getInitialHealth() const
+                { return this->initialHealth_; }
+
+            inline ControllableEntity* getLastHitOriginator() const
+                { return this->lastHitOriginator_; }
+
+            virtual void damage(float damage, Pawn* originator = 0);
+            virtual void hit(Pawn* originator, const Vector3& force, float damage);
+            virtual void kill();
+
+            virtual void postSpawn();
+
+        protected:
+            virtual void spawn();
+            virtual void death();
+
+            bool bAlive_;
+
+            float health_;
+            float maxHealth_;
+            float initialHealth_;
+
+            Pawn* lastHitOriginator_;
+    };
+}
+
+#endif /* _Pawn_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/pawns/SpaceShip.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/pawns/SpaceShip.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/pawns/SpaceShip.cc	(revision 2087)
@@ -0,0 +1,213 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "SpaceShip.h"
+
+#include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
+#include "core/XMLPort.h"
+#include "util/Math.h"
+
+namespace orxonox
+{
+    CreateFactory(SpaceShip);
+
+    SpaceShip::SpaceShip(BaseObject* creator) : Pawn(creator)
+    {
+        RegisterObject(SpaceShip);
+
+        this->zeroDegree_ = 0;
+
+        this->maxSpeed_ = 0;
+        this->maxSecondarySpeed_ = 0;
+        this->maxRotation_ = 0;
+        this->translationAcceleration_ = 0;
+        this->rotationAcceleration_ = 0;
+        this->translationDamping_ = 0;
+
+        this->yawRotation_ = 0;
+        this->pitchRotation_ = 0;
+        this->rollRotation_ = 0;
+
+        this->bInvertYAxis_ = false;
+
+        this->setDestroyWhenPlayerLeft(true);
+
+        this->setConfigValues();
+        this->registerVariables();
+    }
+
+    SpaceShip::~SpaceShip()
+    {
+    }
+
+    void SpaceShip::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(SpaceShip, XMLPort, xmlelement, mode);
+
+        XMLPortParam(SpaceShip, "maxspeed",          setMaxSpeed,          getMaxSpeed,          xmlelement, mode);
+        XMLPortParam(SpaceShip, "maxsecondaryspeed", setMaxSecondarySpeed, getMaxSecondarySpeed, xmlelement, mode);
+        XMLPortParam(SpaceShip, "maxrotation",       setMaxRotation,       getMaxRotation,       xmlelement, mode);
+        XMLPortParam(SpaceShip, "transacc",          setTransAcc,          getTransAcc,          xmlelement, mode);
+        XMLPortParam(SpaceShip, "rotacc",            setRotAcc,            getRotAcc,            xmlelement, mode);
+        XMLPortParam(SpaceShip, "transdamp",         setTransDamp,         getTransDamp,         xmlelement, mode);
+    }
+
+    void SpaceShip::registerVariables()
+    {
+        REGISTERDATA(this->maxSpeed_,                network::direction::toclient);
+        REGISTERDATA(this->maxSecondarySpeed_,       network::direction::toclient);
+        REGISTERDATA(this->maxRotation_,             network::direction::toclient);
+        REGISTERDATA(this->translationAcceleration_, network::direction::toclient);
+        REGISTERDATA(this->rotationAcceleration_,    network::direction::toclient);
+        REGISTERDATA(this->translationDamping_,      network::direction::toclient);
+    }
+
+    void SpaceShip::setConfigValues()
+    {
+        SetConfigValue(bInvertYAxis_, false).description("Set this to true for joystick-like mouse behaviour (mouse up = ship down).");
+    }
+
+    void SpaceShip::tick(float dt)
+    {
+        if (this->isLocallyControlled())
+        {
+            // #####################################
+            // ############# STEERING ##############
+            // #####################################
+
+            Vector3 velocity = this->getVelocity();
+            if (velocity.x > this->maxSecondarySpeed_)
+                velocity.x = this->maxSecondarySpeed_;
+            if (velocity.x < -this->maxSecondarySpeed_)
+                velocity.x = -this->maxSecondarySpeed_;
+            if (velocity.y > this->maxSecondarySpeed_)
+                velocity.y = this->maxSecondarySpeed_;
+            if (velocity.y < -this->maxSecondarySpeed_)
+                velocity.y = -this->maxSecondarySpeed_;
+            if (velocity.z > this->maxSecondarySpeed_)
+                velocity.z = this->maxSecondarySpeed_;
+            if (velocity.z < -this->maxSpeed_)
+                velocity.z = -this->maxSpeed_;
+
+            // normalize velocity and acceleration
+            for (size_t dimension = 0; dimension < 3; ++dimension)
+            {
+                if (this->acceleration_[dimension] == 0)
+                {
+                    if (velocity[dimension] > 0)
+                    {
+                        velocity[dimension] -= (this->translationDamping_ * dt);
+                        if (velocity[dimension] < 0)
+                            velocity[dimension] = 0;
+                    }
+                    else if (velocity[dimension] < 0)
+                    {
+                        velocity[dimension] += (this->translationDamping_ * dt);
+                        if (velocity[dimension] > 0)
+                            velocity[dimension] = 0;
+                    }
+                }
+            }
+
+            this->setVelocity(velocity);
+        }
+
+
+        SUPER(SpaceShip, tick, dt);
+
+
+        if (this->isLocallyControlled())
+        {
+            this->yaw(this->yawRotation_ * dt);
+            if (this->bInvertYAxis_)
+                this->pitch(Degree(-this->pitchRotation_ * dt));
+            else
+                this->pitch(Degree( this->pitchRotation_ * dt));
+            this->roll(this->rollRotation_ * dt);
+
+            this->acceleration_.x = 0;
+            this->acceleration_.y = 0;
+            this->acceleration_.z = 0;
+
+            this->yawRotation_   = this->zeroDegree_;
+            this->pitchRotation_ = this->zeroDegree_;
+            this->rollRotation_  = this->zeroDegree_;
+        }
+    }
+
+    void SpaceShip::moveFrontBack(const Vector2& value)
+    {
+        this->acceleration_.z = -this->translationAcceleration_ * value.x;
+    }
+
+    void SpaceShip::moveRightLeft(const Vector2& value)
+    {
+        this->acceleration_.x = this->translationAcceleration_ * value.x;
+    }
+
+    void SpaceShip::moveUpDown(const Vector2& value)
+    {
+        this->acceleration_.y = this->translationAcceleration_ * value.x;
+    }
+
+    void SpaceShip::rotateYaw(const Vector2& value)
+    {
+        Degree temp = value.x * value.x * sgn(value.x) * this->rotationAcceleration_;
+        if (temp > this->maxRotation_)
+            temp = this->maxRotation_;
+        if (temp < -this->maxRotation_)
+            temp = -this->maxRotation_;
+        this->yawRotation_ = Degree(temp);
+    }
+
+    void SpaceShip::rotatePitch(const Vector2& value)
+    {
+        Degree temp = value.x * value.x * sgn(value.x) * this->rotationAcceleration_;
+        if (temp > this->maxRotation_)
+            temp = this->maxRotation_;
+        if (temp < -this->maxRotation_)
+            temp = -this->maxRotation_;
+        this->pitchRotation_ = Degree(temp);
+    }
+
+    void SpaceShip::rotateRoll(const Vector2& value)
+    {
+        Degree temp = value.x * value.x * sgn(value.x) * this->rotationAcceleration_;
+        if (temp > this->maxRotation_)
+            temp = this->maxRotation_;
+        if (temp < -this->maxRotation_)
+            temp = -this->maxRotation_;
+        this->rollRotation_ = Degree(temp);
+    }
+
+    void SpaceShip::fire()
+    {
+    }
+}
Index: code/trunk/src/orxonox/objects/worldentities/pawns/SpaceShip.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/pawns/SpaceShip.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/pawns/SpaceShip.h	(revision 2087)
@@ -0,0 +1,103 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _SpaceShip_H__
+#define _SpaceShip_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "Pawn.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport SpaceShip : public Pawn
+    {
+        public:
+            SpaceShip(BaseObject* creator);
+            virtual ~SpaceShip();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            virtual void tick(float dt);
+            void registerVariables();
+            void setConfigValues();
+
+            virtual void moveFrontBack(const Vector2& value);
+            virtual void moveRightLeft(const Vector2& value);
+            virtual void moveUpDown(const Vector2& value);
+
+            virtual void rotateYaw(const Vector2& value);
+            virtual void rotatePitch(const Vector2& value);
+            virtual void rotateRoll(const Vector2& value);
+
+            virtual void fire();
+
+            void setMaxSpeed(float value)
+                { this->maxSpeed_ = value; }
+            void setMaxSecondarySpeed(float value)
+                { this->maxSecondarySpeed_ = value; }
+            void setMaxRotation(const Degree& value)
+                { this->maxRotation_ = value; }
+            void setTransAcc(float value)
+                { this->translationAcceleration_ = value; }
+            void setRotAcc(const Degree& value)
+                { this->rotationAcceleration_ = value; }
+            void setTransDamp(float value)
+                { this->translationDamping_ = value; }
+
+            inline float getMaxSpeed() const
+                { return this->maxSpeed_; }
+            inline float getMaxSecondarySpeed() const
+                { return this->maxSecondarySpeed_; }
+            inline float getMaxRotation() const
+                { return this->maxRotation_.valueDegrees(); }
+            inline float getTransAcc() const
+                { return this->translationAcceleration_; }
+            inline float getRotAcc() const
+                { return this->rotationAcceleration_.valueDegrees(); }
+            inline float getTransDamp() const
+                { return this->translationDamping_; }
+
+        protected:
+            bool bInvertYAxis_;
+
+            float maxSpeed_;
+            float maxSecondarySpeed_;
+            float translationAcceleration_;
+            float translationDamping_;
+
+            Degree maxRotation_;
+            Degree rotationAcceleration_;
+
+            Degree zeroDegree_;
+            Degree pitchRotation_;
+            Degree yawRotation_;
+            Degree rollRotation_;
+    };
+}
+
+#endif /* _SpaceShip_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/pawns/Spectator.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/pawns/Spectator.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/pawns/Spectator.cc	(revision 2087)
@@ -0,0 +1,255 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Spectator.h"
+
+#include "core/CoreIncludes.h"
+#include "core/Core.h"
+#include "objects/worldentities/Model.h"
+#include "objects/Scene.h"
+#include "objects/infos/PlayerInfo.h"
+#include "objects/gametypes/Gametype.h"
+#include "tools/BillboardSet.h"
+#include "overlays/OverlayText.h"
+#include "overlays/OverlayGroup.h"
+#include "util/Convert.h"
+
+namespace orxonox
+{
+    CreateFactory(Spectator);
+
+    Spectator::Spectator(BaseObject* creator) : ControllableEntity(creator)
+    {
+        RegisterObject(Spectator);
+
+        this->speed_ = 100;
+        this->rotationSpeed_ = 3;
+
+        this->yaw_ = 0;
+        this->pitch_ = 0;
+        this->roll_ = 0;
+        this->setHudTemplate("spectatorhud");
+        this->hudmode_ = 0;
+
+        this->setDestroyWhenPlayerLeft(true);
+
+        this->greetingFlare_ = new BillboardSet();
+        this->greetingFlare_->setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(1.0, 1.0, 0.8), Vector3(0, 20, 0), 1);
+        this->getNode()->attachObject(this->greetingFlare_->getBillboardSet());
+        this->greetingFlare_->setVisible(false);
+        this->bGreetingFlareVisible_ = false;
+        this->bGreeting_ = false;
+
+        this->registerVariables();
+    }
+
+    Spectator::~Spectator()
+    {
+        if (this->isInitialized())
+        {
+            if (this->greetingFlare_)
+            {
+                this->getNode()->detachObject(this->greetingFlare_->getBillboardSet());
+                delete this->greetingFlare_;
+            }
+        }
+    }
+
+    void Spectator::registerVariables()
+    {
+        REGISTERDATA(this->bGreetingFlareVisible_, network::direction::toclient, new network::NetworkCallback<Spectator>(this, &Spectator::changedFlareVisibility));
+        REGISTERDATA(this->bGreeting_,             network::direction::toserver, new network::NetworkCallback<Spectator>(this, &Spectator::changedGreeting));
+        REGISTERDATA(this->hudmode_,               network::direction::toclient);
+    }
+
+    void Spectator::changedGreeting()
+    {
+        this->bGreetingFlareVisible_ = this->bGreeting_;
+        this->changedFlareVisibility();
+    }
+
+    void Spectator::changedFlareVisibility()
+    {
+        this->greetingFlare_->setVisible(this->bGreetingFlareVisible_);
+    }
+
+    void Spectator::tick(float dt)
+    {
+        this->updateHUD();
+
+        if (this->isLocallyControlled())
+        {
+            Vector3 velocity = this->getVelocity();
+            velocity.normalise();
+            this->setVelocity(velocity * this->speed_);
+
+            this->yaw(Radian(this->yaw_ * this->rotationSpeed_));
+            this->pitch(Radian(this->pitch_ * this->rotationSpeed_));
+            this->roll(Radian(this->roll_ * this->rotationSpeed_));
+
+            this->yaw_ = this->pitch_ = this->roll_ = 0;
+        }
+
+        SUPER(Spectator, tick, dt);
+
+        if (this->isLocallyControlled())
+        {
+            this->setVelocity(Vector3::ZERO);
+        }
+    }
+
+    void Spectator::setPlayer(PlayerInfo* player)
+    {
+        ControllableEntity::setPlayer(player);
+
+//        this->setObjectMode(network::direction::toclient);
+    }
+
+    void Spectator::startLocalControl()
+    {
+        ControllableEntity::startLocalControl();
+//        if (this->isLocallyControlled())
+//            this->testmesh_->setVisible(false);
+    }
+
+    void Spectator::moveFrontBack(const Vector2& value)
+    {
+        this->setVelocity(this->getVelocity() + value.y * this->speed_ * WorldEntity::FRONT);
+    }
+
+    void Spectator::moveRightLeft(const Vector2& value)
+    {
+        this->setVelocity(this->getVelocity() + value.y * this->speed_ * WorldEntity::RIGHT);
+    }
+
+    void Spectator::moveUpDown(const Vector2& value)
+    {
+        this->setVelocity(this->getVelocity() + value.y * this->speed_ * WorldEntity::UP);
+    }
+
+    void Spectator::rotateYaw(const Vector2& value)
+    {
+        this->yaw_ = value.y;
+    }
+
+    void Spectator::rotatePitch(const Vector2& value)
+    {
+        this->pitch_ = value.y;
+    }
+
+    void Spectator::rotateRoll(const Vector2& value)
+    {
+        this->roll_ = value.y;
+    }
+
+    void Spectator::fire()
+    {
+        if (this->getPlayer())
+            this->getPlayer()->setReadyToSpawn(true);
+    }
+
+    void Spectator::greet()
+    {
+        this->bGreeting_ = !this->bGreeting_;
+
+        if (Core::isMaster())
+        {
+            this->bGreetingFlareVisible_ = this->bGreeting_;
+            this->changedFlareVisibility();
+        }
+    }
+
+    void Spectator::updateHUD()
+    {
+        // <hack>
+        if (Core::isMaster())
+        {
+            if (this->getPlayer() && this->getGametype())
+            {
+                if (!this->getGametype()->hasStarted() && !this->getGametype()->isStartCountdownRunning())
+                {
+                    if (!this->getPlayer()->isReadyToSpawn())
+                        this->hudmode_ = 0;
+                    else
+                        this->hudmode_ = 1;
+                }
+                else if (!this->getGametype()->hasEnded())
+                {
+                    if (this->getGametype()->isStartCountdownRunning())
+                        this->hudmode_ = 2 + 10*ceil(this->getGametype()->getStartCountdown());
+                    else
+                        this->hudmode_ = 3;
+                }
+                else
+                    this->hudmode_ = 4;
+            }
+            else
+                return;
+        }
+
+        if (this->getHUD())
+        {
+            std::string text;
+            int hudmode = this->hudmode_ % 10;
+
+            switch (hudmode)
+            {
+                case 0:
+                    text = "Press [Fire] to start the match";
+                    break;
+                case 1:
+                    text = "Waiting for other players";
+                    break;
+                case 2:
+                    text = convertToString((this->hudmode_ - 2) / 10);
+                    break;
+                case 3:
+                    text = "Press [Fire] to respawn";
+                    break;
+                case 4:
+                    text = "Game has ended";
+                    break;
+                default:;
+            }
+
+            std::map<std::string, OrxonoxOverlay*>::const_iterator it = this->getHUD()->getOverlays().begin();
+            for (; it != this->getHUD()->getOverlays().end(); ++it)
+            {
+                if (it->second->isA(Class(OverlayText)) && it->second->getName() == "state")
+                {
+                    OverlayText* overlay = dynamic_cast<OverlayText*>(it->second);
+                    if (overlay)
+                        overlay->setCaption(text);
+                    break;
+                }
+            }
+        }
+        // </hack>
+    }
+}
Index: code/trunk/src/orxonox/objects/worldentities/pawns/Spectator.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/pawns/Spectator.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/pawns/Spectator.h	(revision 2087)
@@ -0,0 +1,81 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Spectator_H__
+#define _Spectator_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "objects/worldentities/ControllableEntity.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport Spectator : public ControllableEntity
+    {
+        public:
+            Spectator(BaseObject* creator);
+            virtual ~Spectator();
+
+            void registerVariables();
+            virtual void tick(float dt);
+
+            virtual void setPlayer(PlayerInfo* player);
+            virtual void startLocalControl();
+
+            virtual void moveFrontBack(const Vector2& value);
+            virtual void moveRightLeft(const Vector2& value);
+            virtual void moveUpDown(const Vector2& value);
+
+            virtual void rotateYaw(const Vector2& value);
+            virtual void rotatePitch(const Vector2& value);
+            virtual void rotateRoll(const Vector2& value);
+
+            virtual void fire();
+            virtual void greet();
+
+        private:
+            void changedGreeting();
+            void changedFlareVisibility();
+            void updateHUD();
+
+            BillboardSet* greetingFlare_;
+            bool bGreetingFlareVisible_;
+            bool bGreeting_;
+
+            float speed_;
+            float rotationSpeed_;
+
+            float yaw_;
+            float pitch_;
+            float roll_;
+
+            int hudmode_;
+    };
+}
+
+#endif /* _Spectator_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc	(revision 2087)
@@ -0,0 +1,132 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Knecht
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "DistanceTrigger.h"
+
+#include <OgreNode.h>
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+  CreateFactory(DistanceTrigger);
+
+  DistanceTrigger::DistanceTrigger(BaseObject* creator) : Trigger(creator)
+  {
+    RegisterObject(DistanceTrigger);
+
+    this->distance_ = 100;
+    this->targetMask_.exclude(Class(BaseObject));
+  }
+
+  DistanceTrigger::~DistanceTrigger()
+  {
+  }
+
+  void DistanceTrigger::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+  {
+    SUPER(DistanceTrigger, XMLPort, xmlelement, mode);
+
+    XMLPortParam(DistanceTrigger, "distance", setDistance, getDistance, xmlelement, mode).defaultValues(100.0f);
+    XMLPortParamLoadOnly(DistanceTrigger, "target", addTargets, xmlelement, mode).defaultValues("ControllableEntity");
+  }
+
+  void DistanceTrigger::addTarget(Ogre::Node* targetNode)
+  {
+    this->targetSet_.insert(targetNode);
+  }
+
+  void DistanceTrigger::removeTarget(Ogre::Node* targetNode)
+  {
+    int returnval = this->targetSet_.erase(targetNode);
+    if (returnval == 0)
+    {
+      COUT(2) << "Warning: Node " << targetNode << " did not exist in targetSet of trigger " << this << " !" << std::endl;
+      COUT(4) << "Content of targetSet of trigger " << this << " :" << std::endl;
+      std::set<Ogre::Node*>::iterator it;
+      for (it = this->targetSet_.begin(); it != this->targetSet_.end(); ++it)
+      {
+        COUT(4) << *it << std::endl;
+      }
+      COUT(4) << "End of targetSet of trigger " << this << std::endl;
+    }
+  }
+
+  void DistanceTrigger::addTargets(const std::string& targets)
+  {
+    Identifier* targetId = ClassByString(targets);
+    if (!targetId)
+    {
+        COUT(1) << "Error: \"" << targets << "\" is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ")" << std::endl;
+        return;
+    }
+
+    this->targetMask_.include(targetId);
+
+    // trigger shouldn't react on itself or other triggers
+    this->targetMask_.exclude(Class(Trigger), true);
+
+    // we only want WorldEntities
+    ClassTreeMask WEMask;
+    WEMask.include(Class(WorldEntity));
+    this->targetMask_ *= WEMask;
+  }
+
+  void DistanceTrigger::removeTargets(const std::string& targets)
+  {
+    Identifier* targetId = ClassByString(targets);
+    this->targetMask_.exclude(targetId);
+  }
+
+  bool DistanceTrigger::checkDistance()
+  {
+    // Iterate through all objects
+    for (ClassTreeMaskObjectIterator it = this->targetMask_.begin(); it != this->targetMask_.end(); ++it)
+    {
+      WorldEntity* entity = dynamic_cast<WorldEntity*>(*it);
+      if (!entity)
+        continue;
+
+      Vector3 distanceVec = entity->getWorldPosition() - this->getWorldPosition();
+      if (distanceVec.length() < this->distance_)
+        return true;
+    }
+    return false;
+
+  }
+
+  bool DistanceTrigger::isTriggered(TriggerMode mode)
+  {
+    if (Trigger::isTriggered(mode))
+      return checkDistance();
+    else
+      return false;
+  }
+}
Index: code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.h	(revision 2087)
@@ -0,0 +1,71 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Knecht
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _DistanceTrigger_H__
+#define _DistanceTrigger_H__
+
+#include "Trigger.h"
+
+#include <set>
+
+#include "core/ClassTreeMask.h"
+#include "core/BaseObject.h"
+
+namespace orxonox
+{
+  class _OrxonoxExport DistanceTrigger : public Trigger
+  {
+    public:
+      DistanceTrigger(BaseObject* creator);
+      virtual ~DistanceTrigger();
+
+      virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+      void addTarget(Ogre::Node* targetNode);
+      void addTargets(const std::string& targets);
+      void removeTarget(Ogre::Node* targetNode);
+      void removeTargets(const std::string& targets);
+
+      inline void setDistance(float distance)
+        { this->distance_ = distance; }
+      inline float getDistance() const
+        { return this->distance_; }
+
+      bool checkDistance();
+
+    protected:
+      virtual bool isTriggered(TriggerMode mode);
+
+    private:
+      ClassTreeMask targetMask_;
+      std::set<Ogre::Node*> targetSet_;
+      float distance_;
+  };
+}
+
+#endif /* _DistanceTrigger_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/triggers/EventTrigger.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/EventTrigger.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/EventTrigger.cc	(revision 2087)
@@ -0,0 +1,64 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "EventTrigger.h"
+
+#include "core/CoreIncludes.h"
+#include "core/EventIncludes.h"
+
+namespace orxonox
+{
+    CreateFactory(EventTrigger);
+
+    EventTrigger::EventTrigger(BaseObject* creator) : Trigger(creator)
+    {
+        RegisterObject(EventTrigger);
+
+        this->bEventTriggered_ = false;
+    }
+
+    EventTrigger::~EventTrigger()
+    {
+    }
+
+    void EventTrigger::processEvent(Event& event)
+    {
+        SUPER(EventTrigger, processEvent, event);
+
+        SetEvent(EventTrigger, "trigger", trigger, event);
+    }
+
+    bool EventTrigger::isTriggered(TriggerMode mode)
+    {
+        if (Trigger::isTriggered(mode))
+            return this->bEventTriggered_;
+        else
+            return false;
+    }
+}
Index: code/trunk/src/orxonox/objects/worldentities/triggers/EventTrigger.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/EventTrigger.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/EventTrigger.h	(revision 2087)
@@ -0,0 +1,58 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _EventTrigger_H__
+#define _EventTrigger_H__
+
+#include "Trigger.h"
+
+#include "core/ClassTreeMask.h"
+#include "core/BaseObject.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport EventTrigger : public Trigger
+    {
+        public:
+            EventTrigger(BaseObject* creator);
+            virtual ~EventTrigger();
+
+            virtual void processEvent(Event& event);
+
+            inline void trigger(bool bTriggered)
+                { this->bEventTriggered_ = bTriggered; this->tick(0); }
+
+        protected:
+            virtual bool isTriggered(TriggerMode mode);
+
+        private:
+            bool bEventTriggered_;
+    };
+}
+
+#endif /* _EventTrigger_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.cc	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.cc	(revision 2087)
@@ -0,0 +1,321 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Knecht
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Trigger.h"
+
+#include <OgreBillboard.h>
+#include "util/Debug.h"
+#include "core/CoreIncludes.h"
+#include "core/ConsoleCommand.h"
+#include "core/XMLPort.h"
+#include "objects/Scene.h"
+
+namespace orxonox
+{
+
+  SetConsoleCommand(Trigger, debugFlares, false).defaultValues(false);
+
+  CreateFactory(Trigger);
+
+  Trigger::Trigger(BaseObject* creator) : PositionableEntity(creator)
+  {
+    RegisterObject(Trigger);
+
+    this->mode_ = TM_EventTriggerAND;
+
+    this->bFirstTick_ = true;
+    this->bActive_ = false;
+    this->bTriggered_ = false;
+    this->latestState_ = 0x0;
+
+    this->bInvertMode_ = false;
+    this->bSwitch_ = false;
+    this->bStayActive_ = false;
+    this->delay_ = 0.0f;
+    this->remainingTime_ = 0.0f;
+    this->timeSinceLastEvent_ = 0.0f;
+    this->remainingActivations_ = -1;
+
+//    this->bUpdating_ = false;
+
+    if (this->getScene() && this->getScene()->getSceneManager())
+    {
+      this->debugBillboard_.setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1);
+      this->debugBillboard_.setVisible(false);
+    }
+
+    this->getNode()->attachObject(this->debugBillboard_.getBillboardSet());
+    this->setObjectMode(0x0);
+  }
+
+  Trigger::~Trigger()
+  {
+  }
+
+  void Trigger::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+  {
+    SUPER(Trigger, XMLPort, xmlelement, mode);
+
+    XMLPortParam(Trigger, "delay",       setDelay,       getDelay,       xmlelement, mode).defaultValues(0.0f);
+    XMLPortParam(Trigger, "switch",      setSwitch,      getSwitch,      xmlelement, mode).defaultValues(false);
+    XMLPortParam(Trigger, "stayactive",  setStayActive,  getStayActive,  xmlelement, mode).defaultValues(false);
+    XMLPortParam(Trigger, "activations", setActivations, getActivations, xmlelement, mode).defaultValues(-1);
+    XMLPortParam(Trigger, "invert",      setInvert,      getInvert,      xmlelement, mode).defaultValues(false);
+    XMLPortParamTemplate(Trigger, "mode", setMode, getModeString, xmlelement, mode, const std::string&).defaultValues("or");
+
+    XMLPortObject(Trigger, Trigger, "", addTrigger, getTrigger, xmlelement, mode);
+  }
+
+  void Trigger::tick(float dt)
+  {
+    if (this->bFirstTick_)
+    {
+      this->bFirstTick_ = false;
+      this->fireEvent(false);
+    }
+
+    // Check if the object is active (this is NOT Trigger::isActive()!)
+    if (!this->BaseObject::isActive())
+        return;
+
+    bool newTriggered = this->isTriggered() ^ this->bInvertMode_;
+
+    // check if new triggering event is really new
+    if ((this->latestState_ & 0x1) != newTriggered)
+    {
+      // create new state
+      if (newTriggered)
+      {
+        this->latestState_ |= 1; // set trigger bit to 1
+        this->switchState();
+      }
+      else
+      {
+        this->latestState_ &= 0xFE; // set trigger bit to 0
+        if (!this->bSwitch_)
+          this->switchState();
+      }
+    }
+
+    if (this->remainingTime_ > 0.0)
+    {
+      this->remainingTime_ -= dt;
+      // only increase when acctually waiting for a state in the queue
+      if (this->timeSinceLastEvent_ >= 0.0)
+        this->timeSinceLastEvent_ += dt;
+    }
+
+    while (this->remainingTime_ <= 0.0 && this->stateChanges_.size() > 0)
+    {
+      // time ran out, change state to new one
+      char newState = this->stateChanges_.front().second;
+      this->bTriggered_ = (newState & 0x1);
+      this->bActive_ = newState & 2;
+      this->fireEvent(this->bActive_);
+      this->stateChanges_.pop();
+      if (this->stateChanges_.size() != 0)
+        this->remainingTime_ = this->stateChanges_.front().first;
+      else
+        this->timeSinceLastEvent_ = this->delay_;
+    }
+
+    if (this->bTriggered_ && this->bActive_)
+      this->setBillboardColour(ColourValue(0.5, 1.0, 0.0));
+    else if (!this->bTriggered_ && this->bActive_)
+      this->setBillboardColour(ColourValue(0.0, 1.0, 0.0));
+    else if (this->bTriggered_ && !this->bActive_)
+      this->setBillboardColour(ColourValue(1.0, 0.5, 0.0));
+    else
+      this->setBillboardColour(ColourValue(1.0, 0.0, 0.0));
+  }
+
+  bool Trigger::isTriggered(TriggerMode mode)
+  {
+//    if (this->bUpdating_)
+//      return this->bTriggered_;
+
+//    this->bUpdating_ = true;
+    if (this->children_.size() != 0)
+    {
+      bool returnval = false;
+
+      switch (mode)
+      {
+        case TM_EventTriggerAND:
+          returnval = checkAnd();
+          break;
+        case TM_EventTriggerOR:
+          returnval = checkOr();
+          break;
+        case TM_EventTriggerXOR:
+          returnval = checkXor();
+          break;
+        default:
+          returnval = false;
+          break;
+      }
+//      this->bUpdating_ = false;
+
+      return returnval;
+    }
+    return true;
+  }
+
+  bool Trigger::checkAnd()
+  {
+    std::set<Trigger*>::iterator it;
+    for(it = this->children_.begin(); it != this->children_.end(); ++it)
+    {
+      if (!(*it)->isActive())
+        return false;
+    }
+    return true;
+  }
+
+  bool Trigger::checkOr()
+  {
+    std::set<Trigger*>::iterator it;
+    for(it = this->children_.begin(); it != this->children_.end(); ++it)
+    {
+      if ((*it)->isActive())
+        return true;
+    }
+    return false;
+  }
+
+  bool Trigger::checkXor()
+  {
+    std::set<Trigger*>::iterator it;
+    bool test = false;
+    for(it = this->children_.begin(); it != this->children_.end(); ++it)
+    {
+      if (test && (*it)->isActive())
+        return false;
+      if ((*it)->isActive())
+        test = true;
+    }
+    return test;
+  }
+
+  bool Trigger::switchState()
+  {
+    if (( (this->latestState_ & 2) && this->bStayActive_ && (this->remainingActivations_ <= 0))
+     || (!(this->latestState_ & 2))                      && (this->remainingActivations_ == 0))
+      return false;
+    else
+    {
+      this->latestState_ ^= 2; // toggle state bit
+
+      // increase activation count
+      if (this->latestState_ & 2 && this->remainingActivations_ > 0)
+        this->remainingActivations_--;
+
+      this->storeState();
+
+      return true;
+    }
+  }
+
+  void Trigger::storeState()
+  {
+    // put state change into queue
+    this->stateChanges_.push(std::pair<float, char>(this->timeSinceLastEvent_, this->latestState_));
+    // reset time since last event
+    this->timeSinceLastEvent_ = 0.0;
+
+    if (this->stateChanges_.size() == 1)
+      this->remainingTime_ = this->stateChanges_.front().first;
+  }
+
+  void Trigger::setDelay(float delay)
+  {
+    this->delay_ = delay;
+    this->timeSinceLastEvent_ = delay;
+  }
+
+  void Trigger::setMode(const std::string& modeName)
+  {
+    if (modeName == "and")
+      this->setMode(TM_EventTriggerAND);
+    else if (modeName == "or")
+      this->setMode(TM_EventTriggerOR);
+    else if (modeName == "xor")
+      this->setMode(TM_EventTriggerXOR);
+  }
+
+  std::string Trigger::getModeString() const
+  {
+    if (this->mode_ == TM_EventTriggerAND)
+      return std::string("and");
+    else if (this->mode_ == TM_EventTriggerOR)
+      return std::string("or");
+    else if (this->mode_ == TM_EventTriggerXOR)
+      return std::string("xor");
+    else
+      return std::string("and");
+  }
+
+  void Trigger::addTrigger(Trigger* trigger)
+  {
+    if (this != trigger)
+      this->children_.insert(trigger);
+  }
+
+  const Trigger* Trigger::getTrigger(unsigned int index) const
+  {
+    if (this->children_.size() <= index)
+      return NULL;
+
+    std::set<Trigger*>::const_iterator it;
+    it = this->children_.begin();
+
+    for (unsigned int i = 0; i != index; ++i)
+      ++it;
+
+    return (*it);
+  }
+
+  void Trigger::debugFlares(bool bVisible)
+  {
+    for (ObjectList<Trigger>::iterator it = ObjectList<Trigger>::begin(); it != ObjectList<Trigger>::end(); ++it)
+      it->setVisible(bVisible);
+  }
+
+  void Trigger::setBillboardColour(const ColourValue& colour)
+  {
+    this->debugBillboard_.getBillboardSet()->getBillboard(0)->setColour(colour);
+  }
+
+  void Trigger::changedVisibility()
+  {
+    SUPER(Trigger, changedVisibility);
+
+    this->debugBillboard_.setVisible(this->isVisible());
+  }
+}
Index: code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.h	(revision 2087)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.h	(revision 2087)
@@ -0,0 +1,136 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Knecht
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Trigger_H__
+#define _Trigger_H__
+
+#include <set>
+#include <queue>
+
+#include "OrxonoxPrereqs.h"
+
+#include "objects/Tickable.h"
+#include "objects/worldentities/PositionableEntity.h"
+#include "tools/BillboardSet.h"
+
+namespace orxonox
+{
+  enum TriggerMode
+  {
+    TM_EventTriggerAND,
+    TM_EventTriggerOR,
+    TM_EventTriggerXOR,
+  };
+
+  class _OrxonoxExport Trigger : public PositionableEntity, public Tickable
+  {
+    public:
+      Trigger(BaseObject* creator);
+      virtual ~Trigger();
+
+      virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+      virtual void tick(float dt);
+
+      inline bool isActive() const
+        { return bActive_; }
+
+      void addTrigger(Trigger* trigger);
+      const Trigger* getTrigger(unsigned int index) const;
+
+      void setMode(const std::string& modeName);
+      inline void setMode(TriggerMode mode)
+        { this->mode_ = mode; }
+      inline TriggerMode getMode() const
+        { return mode_; }
+
+      inline void setInvert(bool bInvert)
+        { this->bInvertMode_ = bInvert; }
+      inline bool getInvert() const
+        { return this->bInvertMode_; }
+
+      inline void setSwitch(bool bSwitch)
+        { this->bSwitch_ = bSwitch; }
+      inline bool getSwitch() const
+        { return this->bSwitch_; }
+
+      inline void setStayActive(bool bStayActive)
+        { this->bStayActive_ = bStayActive; }
+      inline bool getStayActive() const
+        { return this->bStayActive_; }
+
+      inline void setActivations(int activations)
+        { this->remainingActivations_ = activations; }
+      inline int getActivations() const
+        { return this->remainingActivations_; }
+
+      void setDelay(float delay);
+      inline float getDelay() const
+        { return this->delay_; }
+
+      bool switchState();
+
+      static void debugFlares(bool bVisible);
+      virtual void changedVisibility();
+
+    protected:
+      inline bool isTriggered() { return this->isTriggered(this->mode_); }
+      virtual bool isTriggered(TriggerMode mode);
+
+    private:
+      bool checkAnd();
+      bool checkOr();
+      bool checkXor();
+      void setBillboardColour(const ColourValue& colour);
+      void storeState();
+      std::string getModeString() const;
+
+      bool bActive_;
+      bool bTriggered_;
+      bool bFirstTick_;
+
+      TriggerMode mode_;
+      bool bInvertMode_;
+      bool bSwitch_;
+      bool bStayActive_;
+      float delay_;
+      int remainingActivations_;
+
+      char latestState_;
+      float remainingTime_;
+      float timeSinceLastEvent_;
+
+//      bool bUpdating_;
+      BillboardSet debugBillboard_;
+
+      std::set<Trigger*> children_;
+      std::queue<std::pair<float, char> > stateChanges_;
+  };
+
+}
+
+#endif /* _Trigger_H__ */
Index: code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc
===================================================================
--- code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc	(revision 1937)
+++ code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc	(revision 2087)
@@ -44,5 +44,4 @@
 #include "core/XMLPort.h"
 #include "core/ConsoleCommand.h"
-#include "GraphicsEngine.h"
 
 namespace orxonox
@@ -55,9 +54,39 @@
     SetConsoleCommand(OrxonoxOverlay, rotateOverlay, false).accessLevel(AccessLevel::User);
 
-    OrxonoxOverlay::OrxonoxOverlay()
-        : overlay_(0)
-        , background_(0)
+    OrxonoxOverlay::OrxonoxOverlay(BaseObject* creator)
+        : BaseObject(creator)
     {
         RegisterObject(OrxonoxOverlay);
+
+        // add this overlay to the static map of OrxonoxOverlays
+        if (overlays_s.find(this->getName()) != overlays_s.end())
+        {
+            COUT(1) << "Overlay names should be unique or you cannnot access them via console. Name: \"" << this->getName() << "\"" << std::endl;
+        }
+        overlays_s[this->getName()] = this;
+
+        // create the Ogre::Overlay
+        overlay_ = Ogre::OverlayManager::getSingleton().create("OrxonoxOverlay_overlay_"
+            + convertToString(hudOverlayCounter_s++));
+
+        // create background panel (can be used to show any picture)
+        this->background_ = static_cast<Ogre::PanelOverlayElement*>(
+            Ogre::OverlayManager::getSingleton().createOverlayElement("Panel",
+            "OrxonoxOverlay_background_" + convertToString(hudOverlayCounter_s++)));
+        this->overlay_->add2D(this->background_);
+
+        // We'll have to set the aspect ratio to a default value first.
+        // GSGraphics gets informed about our construction here and can update us in the next tick.
+        this->windowAspectRatio_ = 1.0;
+        this->sizeCorrectionChanged();
+
+        this->changedVisibility();
+
+        setSize(Vector2(1.0f, 1.0f));
+        setPickPoint(Vector2(0.0f, 0.0f));
+        setPosition(Vector2(0.0f, 0.0f));
+        setRotation(Degree(0.0));
+        setAspectCorrection(true);
+        setBackgroundMaterial("");
     }
 
@@ -70,13 +99,14 @@
     OrxonoxOverlay::~OrxonoxOverlay()
     {
-        // erase ourself from the map with all overlays
-        std::map<std::string, OrxonoxOverlay*>::iterator it = overlays_s.find(this->getName());
-        if (it != overlays_s.end())
-            overlays_s.erase(it);
-
-        if (this->background_)
+        if (this->isInitialized())
+        {
+            // erase ourself from the map with all overlays
+            std::map<std::string, OrxonoxOverlay*>::iterator it = overlays_s.find(this->getName());
+            if (it != overlays_s.end())
+                overlays_s.erase(it);
+
             Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->background_);
-        if (this->overlay_)
             Ogre::OverlayManager::getSingleton().destroy(this->overlay_);
+        }
     }
 
@@ -94,43 +124,20 @@
         SUPER(OrxonoxOverlay, XMLPort, xmlElement, mode);
 
-        if (mode == XMLPort::LoadObject)
-        {
-            // add this overlay to the static map of OrxonoxOverlays
-            if (overlays_s.find(this->getName()) != overlays_s.end())
-            {
-                COUT(1) << "Overlay names should be unique or you cannnot access them via console." << std::endl;
-            }
-            overlays_s[this->getName()] = this;
-
-            // create the Ogre::Overlay
-            overlay_ = Ogre::OverlayManager::getSingleton().create("OrxonoxOverlay_overlay_"
-                + convertToString(hudOverlayCounter_s++));
-
-            // create background panel (can be used to show any picture)
-            this->background_ = static_cast<Ogre::PanelOverlayElement*>(
-                Ogre::OverlayManager::getSingleton().createOverlayElement("Panel",
-                "OrxonoxOverlay_background_" + convertToString(hudOverlayCounter_s++)));
-            this->overlay_->add2D(this->background_);
-
-            // We'll have to get the aspect ratio manually for the first time. Afterwards windowResized() gets
-            // called automatically by the GraphicsEngine.
-            this->windowResized(GraphicsEngine::getInstance().getWindowWidth(),
-                GraphicsEngine::getInstance().getWindowHeight());
-
-            this->changedVisibility();
-        }
-
-        XMLPortParam(OrxonoxOverlay, "size",      setSize,      getSize,      xmlElement, mode)
-            .defaultValues(Vector2(1.0f, 1.0f));
-        XMLPortParam(OrxonoxOverlay, "pickPoint", setPickPoint, getPickPoint, xmlElement, mode)
-            .defaultValues(Vector2(0.0f, 0.0f));
-        XMLPortParam(OrxonoxOverlay, "position",  setPosition,  getPosition,  xmlElement, mode)
-            .defaultValues(Vector2(0.0f, 0.0f));
-        XMLPortParam(OrxonoxOverlay, "rotation",  setRotation,  getRotation,  xmlElement, mode)
-            .defaultValues(0.0f);
-        XMLPortParam(OrxonoxOverlay, "correctAspect", setAspectCorrection,   getAspectCorrection,   xmlElement, mode)
-            .defaultValues(true);
-        XMLPortParam(OrxonoxOverlay, "background",    setBackgroundMaterial, getBackgroundMaterial, xmlElement, mode)
-            .defaultValues("");
+        XMLPortParam(OrxonoxOverlay, "size",      setSize,      getSize,      xmlElement, mode);
+        XMLPortParam(OrxonoxOverlay, "pickPoint", setPickPoint, getPickPoint, xmlElement, mode);
+        XMLPortParam(OrxonoxOverlay, "position",  setPosition,  getPosition,  xmlElement, mode);
+        XMLPortParam(OrxonoxOverlay, "rotation",  setRotation,  getRotation,  xmlElement, mode);
+        XMLPortParam(OrxonoxOverlay, "correctAspect", setAspectCorrection,   getAspectCorrection,   xmlElement, mode);
+        XMLPortParam(OrxonoxOverlay, "background",    setBackgroundMaterial, getBackgroundMaterial, xmlElement, mode);
+    }
+
+    void OrxonoxOverlay::changedName()
+    {
+        OrxonoxOverlay::overlays_s.erase(this->getOldName());
+
+        if (OrxonoxOverlay::overlays_s.find(this->getName()) != OrxonoxOverlay::overlays_s.end())
+            COUT(1) << "Overlay names should be unique or you cannnot access them via console. Name: \"" << this->getName() << "\"" << std::endl;
+
+        OrxonoxOverlay::overlays_s[this->getName()] = this;
     }
 
@@ -148,5 +155,5 @@
             return this->background_->getMaterialName();
         else
-            return blankString;
+            return BLANKSTRING;
     }
 
Index: code/trunk/src/orxonox/overlays/OrxonoxOverlay.h
===================================================================
--- code/trunk/src/orxonox/overlays/OrxonoxOverlay.h	(revision 1937)
+++ code/trunk/src/orxonox/overlays/OrxonoxOverlay.h	(revision 2087)
@@ -84,8 +84,10 @@
 
     public:
-        OrxonoxOverlay();
+        OrxonoxOverlay(BaseObject* creator);
         virtual ~OrxonoxOverlay();
 
         virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
+
+        virtual void changedName();
 
         //! Shows the overlay with an detour to BaseObject::visibility_
Index: code/trunk/src/orxonox/overlays/OverlayGroup.cc
===================================================================
--- code/trunk/src/orxonox/overlays/OverlayGroup.cc	(revision 1937)
+++ code/trunk/src/orxonox/overlays/OverlayGroup.cc	(revision 2087)
@@ -50,7 +50,17 @@
     SetConsoleCommand(OverlayGroup, scrollGroup, false).accessLevel(AccessLevel::User);
 
-    OverlayGroup::OverlayGroup()
+    OverlayGroup::OverlayGroup(BaseObject* creator)
+        : BaseObject(creator)
     {
         RegisterObject(OverlayGroup);
+
+        setScale(Vector2(1.0, 1.0));
+        setScroll(Vector2(0.0, 0.0));
+    }
+
+    OverlayGroup::~OverlayGroup()
+    {
+        for (std::map<std::string, OrxonoxOverlay*>::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
+            delete it->second;
     }
 
@@ -65,6 +75,6 @@
         SUPER(OverlayGroup, XMLPort, xmlElement, mode);
 
-        XMLPortParam(OverlayGroup, "scale",  setScale,  getScale,  xmlElement, mode).defaultValues(Vector2(1.0, 1.0));
-        XMLPortParam(OverlayGroup, "scroll", setScroll, getScroll, xmlElement, mode).defaultValues(Vector2(0.0, 0.0));
+        XMLPortParam(OverlayGroup, "scale",  setScale,  getScale,  xmlElement, mode);
+        XMLPortParam(OverlayGroup, "scroll", setScroll, getScroll, xmlElement, mode);
         // loads all the child elements
         XMLPortObject(OverlayGroup, OrxonoxOverlay, "", addElement, getElement, xmlElement, mode);
@@ -100,5 +110,8 @@
         }
         else
+        {
             hudElements_[element->getName()] = element;
+            element->setVisible(this->isVisible());
+        }
     }
 
Index: code/trunk/src/orxonox/overlays/OverlayGroup.h
===================================================================
--- code/trunk/src/orxonox/overlays/OverlayGroup.h	(revision 1937)
+++ code/trunk/src/orxonox/overlays/OverlayGroup.h	(revision 2087)
@@ -54,7 +54,7 @@
     {
     public:
-        OverlayGroup();
+        OverlayGroup(BaseObject* creator);
         //! Empty destructor.
-        ~OverlayGroup() { }
+        ~OverlayGroup();
 
         virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
@@ -63,4 +63,7 @@
         static void scaleGroup(const std::string& name, float scale);
         static void scrollGroup(const std::string& name, const Vector2& scroll);
+
+        inline const std::map<std::string, OrxonoxOverlay*>& getOverlays() const
+            { return this->hudElements_; }
 
         void changedVisibility();
Index: code/trunk/src/orxonox/overlays/OverlayText.cc
===================================================================
--- code/trunk/src/orxonox/overlays/OverlayText.cc	(revision 1937)
+++ code/trunk/src/orxonox/overlays/OverlayText.cc	(revision 2087)
@@ -31,5 +31,4 @@
 
 #include <OgreOverlayManager.h>
-#include <OgreTextAreaOverlayElement.h>
 #include <OgrePanelOverlayElement.h>
 
@@ -42,13 +41,25 @@
     CreateFactory(OverlayText);
 
-    OverlayText::OverlayText()
-        : text_(0)
+    OverlayText::OverlayText(BaseObject* creator)
+        : OrxonoxOverlay(creator)
     {
         RegisterObject(OverlayText);
+
+        this->text_ = static_cast<Ogre::TextAreaOverlayElement*>(Ogre::OverlayManager::getSingleton()
+            .createOverlayElement("TextArea", "OverlayText_text_" + getUniqueNumberString()));
+        this->text_->setCharHeight(1.0);
+
+        setFont("Monofur");
+        setColour(ColourValue(1.0, 1.0, 1.0, 1.0));
+        setCaption("");
+        setTextSize(1.0f);
+        setAlignmentString("left");
+
+        this->background_->addChild(this->text_);
     }
 
     OverlayText::~OverlayText()
     {
-        if (this->text_)
+        if (this->isInitialized())
             Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->text_);
     }
@@ -58,37 +69,46 @@
         SUPER(OverlayText, XMLPort, xmlElement, mode);
 
-        if (mode == XMLPort::LoadObject)
-        {
-            this->text_ = static_cast<Ogre::TextAreaOverlayElement*>(Ogre::OverlayManager::getSingleton()
-                .createOverlayElement("TextArea", "OverlayText_text_" + getUniqueNumberStr()));
-            this->text_->setCharHeight(1.0);
-
-            this->background_->addChild(this->text_);
-        }
-
-        XMLPortParam(OverlayText, "font",     setFont,     getFont,     xmlElement, mode).defaultValues("Monofur");
-        XMLPortParam(OverlayText, "caption",  setCaption,  getCaption,  xmlElement, mode).defaultValues("");
-        XMLPortParam(OverlayText, "textSize", setTextSize, getTextSize, xmlElement, mode).defaultValues(1.0f);
+        XMLPortParam(OverlayText, "font",     setFont,            getFont,            xmlElement, mode);
+        XMLPortParam(OverlayText, "colour",   setColour,          getColour,          xmlElement, mode);
+        XMLPortParam(OverlayText, "caption",  setCaption,         getCaption,         xmlElement, mode);
+        XMLPortParam(OverlayText, "textSize", setTextSize,        getTextSize,        xmlElement, mode);
+        XMLPortParam(OverlayText, "align",    setAlignmentString, getAlignmentString, xmlElement, mode);
     }
 
     void OverlayText::setFont(const std::string& font)
     {
-        if (this->text_ && font != "")
+        if (font != "")
             this->text_->setFontName(font);
     }
 
-    const std::string& OverlayText::getFont() const
+    void OverlayText::setAlignmentString(const std::string& alignment)
     {
-        if (this->text_)
-            return this->text_->getFontName();
-        else
-            return blankString;
+        if (alignment == "right")
+            this->setAlignment(Ogre::TextAreaOverlayElement::Right);
+        else if (alignment == "center")
+            this->setAlignment(Ogre::TextAreaOverlayElement::Center);
+        else // "left" and default
+            this->setAlignment(Ogre::TextAreaOverlayElement::Left);
+    }
+
+    std::string OverlayText::getAlignmentString() const
+    {
+        Ogre::TextAreaOverlayElement::Alignment alignment = this->text_->getAlignment();
+
+        switch (alignment)
+        {
+            case Ogre::TextAreaOverlayElement::Right:
+                return "right";
+            case Ogre::TextAreaOverlayElement::Center:
+                return "center";
+            case Ogre::TextAreaOverlayElement::Left:
+                return "left";
+            default:
+                assert(false); return "";
+        }
     }
 
     void OverlayText::sizeChanged()
     {
-        if (!this->overlay_)
-            return;
-
         if (this->rotState_ == Horizontal)
             this->overlay_->setScale(size_.y * sizeCorrection_.y, size_.y * sizeCorrection_.y);
Index: code/trunk/src/orxonox/overlays/OverlayText.h
===================================================================
--- code/trunk/src/orxonox/overlays/OverlayText.h	(revision 1937)
+++ code/trunk/src/orxonox/overlays/OverlayText.h	(revision 2087)
@@ -34,4 +34,5 @@
 #include <string>
 #include <OgrePrerequisites.h>
+#include <OgreTextAreaOverlayElement.h>
 #include "OrxonoxOverlay.h"
 
@@ -41,17 +42,26 @@
     {
     public:
-        OverlayText();
+        OverlayText(BaseObject* creator);
         virtual ~OverlayText();
 
         virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
 
+        void setCaption(const std::string& caption) { this->text_->setCaption(caption); }
+        std::string getCaption() const              { return this->text_->getCaption(); }
+
+        void setFont(const std::string& font);
+        const std::string& getFont() const { return this->text_->getFontName(); }
+
+        void setColour(const ColourValue& colour) { this->text_->setColour(colour); }
+        const ColourValue& getColour() const      { return this->text_->getColour(); }
+
+        void setAlignment(Ogre::TextAreaOverlayElement::Alignment alignment) { this->text_->setAlignment(alignment); }
+        Ogre::TextAreaOverlayElement::Alignment getAlignment() const         { return this->text_->getAlignment(); }
+
     protected:
         virtual void sizeChanged();
 
-        void setCaption(const std::string& caption) { this->caption_ = caption; }
-        const std::string& getCaption() const       { return this->caption_; }
-
-        void setFont(const std::string& font);
-        const std::string& getFont() const;
+        void setAlignmentString(const std::string& alignment);
+        std::string getAlignmentString() const;
 
         void setTextSize(float size) { this->setSize(Vector2(size, size)); }
@@ -59,7 +69,4 @@
 
         Ogre::TextAreaOverlayElement* text_;
-
-    private:
-        std::string caption_;
     };
 }
Index: code/trunk/src/orxonox/overlays/console/InGameConsole.cc
===================================================================
--- code/trunk/src/orxonox/overlays/console/InGameConsole.cc	(revision 1937)
+++ code/trunk/src/orxonox/overlays/console/InGameConsole.cc	(revision 2087)
@@ -48,5 +48,4 @@
 #include "core/input/SimpleInputState.h"
 #include "core/input/InputBuffer.h"
-#include "GraphicsEngine.h"
 
 namespace orxonox
@@ -170,5 +169,5 @@
         @brief Initializes the InGameConsole.
     */
-    void InGameConsole::initialise()
+    void InGameConsole::initialise(int windowWidth, int windowHeight)
     {
         // create the corresponding input state
@@ -246,5 +245,5 @@
         this->consoleOverlayContainer_->addChild(this->consoleOverlayNoise_);
 
-        this->windowResized(GraphicsEngine::getInstance().getWindowWidth(), GraphicsEngine::getInstance().getWindowHeight());
+        this->windowResized(windowWidth, windowHeight);
 
         // move overlay "above" the top edge of the screen
@@ -613,11 +612,11 @@
         @return The converted string
     */
-    /*static*/ Ogre::UTFString InGameConsole::convert2UTF(std::string s)
+    /*static*/ Ogre::UTFString InGameConsole::convert2UTF(const std::string& text)
     {
         Ogre::UTFString utf;
         Ogre::UTFString::code_point cp;
-        for (unsigned int i = 0; i < s.size(); ++i)
-        {
-          cp = s[i];
+        for (unsigned int i = 0; i < text.size(); ++i)
+        {
+          cp = text[i];
           cp &= 0xFF;
           utf.append(1, cp);
Index: code/trunk/src/orxonox/overlays/console/InGameConsole.h
===================================================================
--- code/trunk/src/orxonox/overlays/console/InGameConsole.h	(revision 1937)
+++ code/trunk/src/orxonox/overlays/console/InGameConsole.h	(revision 2087)
@@ -49,5 +49,5 @@
         ~InGameConsole();
 
-        void initialise();
+        void initialise(int windowWidth, int windowHeight);
         void destroy();
         void setConfigValues();
@@ -60,4 +60,6 @@
         static void openConsole();
         static void closeConsole();
+
+        static Ogre::UTFString convert2UTF(const std::string& text);
 
     private: // functions
@@ -83,6 +85,4 @@
         // config value related
         void bHidesAllInputChanged();
-
-        static Ogre::UTFString convert2UTF(std::string s);
 
     private: // variables
Index: code/trunk/src/orxonox/overlays/debug/DebugFPSText.cc
===================================================================
--- code/trunk/src/orxonox/overlays/debug/DebugFPSText.cc	(revision 1937)
+++ code/trunk/src/orxonox/overlays/debug/DebugFPSText.cc	(revision 2087)
@@ -38,5 +38,5 @@
     CreateFactory(DebugFPSText);
 
-    DebugFPSText::DebugFPSText()
+    DebugFPSText::DebugFPSText(BaseObject* creator) : OverlayText(creator)
     {
         RegisterObject(DebugFPSText);
@@ -50,5 +50,5 @@
     {
         float fps = GraphicsEngine::getInstance().getAverageFramesPerSecond();
-        this->text_->setCaption(this->getCaption() + convertToString(fps));
+        this->setCaption(convertToString(fps));
     }
 }
Index: code/trunk/src/orxonox/overlays/debug/DebugFPSText.h
===================================================================
--- code/trunk/src/orxonox/overlays/debug/DebugFPSText.h	(revision 1937)
+++ code/trunk/src/orxonox/overlays/debug/DebugFPSText.h	(revision 2087)
@@ -40,5 +40,5 @@
     {
     public:
-        DebugFPSText();
+        DebugFPSText(BaseObject* creator);
         ~DebugFPSText();
 
Index: code/trunk/src/orxonox/overlays/debug/DebugRTRText.cc
===================================================================
--- code/trunk/src/orxonox/overlays/debug/DebugRTRText.cc	(revision 1937)
+++ code/trunk/src/orxonox/overlays/debug/DebugRTRText.cc	(revision 2087)
@@ -38,5 +38,5 @@
     CreateFactory(DebugRTRText);
 
-    DebugRTRText::DebugRTRText()
+    DebugRTRText::DebugRTRText(BaseObject* creator) : OverlayText(creator)
     {
         RegisterObject(DebugRTRText);
@@ -50,5 +50,5 @@
     {
         float rtr = GraphicsEngine::getInstance().getAverageTickTime();
-        this->text_->setCaption(this->getCaption() + convertToString(rtr));
+        this->setCaption(convertToString(rtr));
     }
 }
Index: code/trunk/src/orxonox/overlays/debug/DebugRTRText.h
===================================================================
--- code/trunk/src/orxonox/overlays/debug/DebugRTRText.h	(revision 1937)
+++ code/trunk/src/orxonox/overlays/debug/DebugRTRText.h	(revision 2087)
@@ -40,5 +40,5 @@
     {
     public:
-        DebugRTRText();
+        DebugRTRText(BaseObject* creator);
         ~DebugRTRText();
 
Index: code/trunk/src/orxonox/overlays/hud/ChatOverlay.cc
===================================================================
--- code/trunk/src/orxonox/overlays/hud/ChatOverlay.cc	(revision 2087)
+++ code/trunk/src/orxonox/overlays/hud/ChatOverlay.cc	(revision 2087)
@@ -0,0 +1,113 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "ChatOverlay.h"
+
+#include <OgreTextAreaOverlayElement.h>
+
+#include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
+#include "core/Executor.h"
+
+#include "network/ClientInformation.h"
+
+#include "LevelManager.h"
+#include "objects/infos/PlayerInfo.h"
+#include "overlays/console/InGameConsole.h"
+#include "tools/Timer.h"
+
+#include "util/Convert.h"
+
+namespace orxonox
+{
+    CreateFactory(ChatOverlay);
+
+    ChatOverlay::ChatOverlay(BaseObject* creator)
+        : OverlayText(creator)
+    {
+        RegisterObject(ChatOverlay);
+
+        this->displayTime_ = 0.0;
+
+        this->setConfigValues();
+    }
+
+    ChatOverlay::~ChatOverlay()
+    {
+    }
+
+    void ChatOverlay::setConfigValues()
+    {
+        SetConfigValue(displayTime_, 6.0f);
+    }
+
+    void ChatOverlay::incomingChat(const std::string& message, unsigned int senderID)
+    {
+        std::string text;
+
+        if (senderID != network::CLIENTID_UNKNOWN)
+        {
+            std::string name = "unknown";
+
+            PlayerInfo* player = LevelManager::getInstance().getClient(senderID);
+            if (player)
+                name = player->getName();
+
+            text = name + ": " + message;
+        }
+        else
+        {
+            text = message;
+        }
+
+        this->messages_.push_back(InGameConsole::convert2UTF(text));
+        COUT(0) << "Chat: " << text << std::endl;
+
+        new Timer<ChatOverlay>(this->displayTime_, false, this, createExecutor(createFunctor(&ChatOverlay::dropMessage)), true);
+
+        this->updateOverlayText();
+    }
+
+    void ChatOverlay::dropMessage()
+    {
+        if (this->messages_.size() > 0)
+            this->messages_.pop_front();
+        this->updateOverlayText();
+    }
+
+    void ChatOverlay::updateOverlayText()
+    {
+        this->text_->setCaption("");
+
+        for (std::list<Ogre::UTFString>::reverse_iterator it = this->messages_.rbegin(); it != this->messages_.rend(); ++it)
+        {
+            this->text_->setCaption(this->text_->getCaption() + "\n" + (*it));
+        }
+    }
+}
Index: code/trunk/src/orxonox/overlays/hud/ChatOverlay.h
===================================================================
--- code/trunk/src/orxonox/overlays/hud/ChatOverlay.h	(revision 2087)
+++ code/trunk/src/orxonox/overlays/hud/ChatOverlay.h	(revision 2087)
@@ -0,0 +1,61 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _ChatOverlay_H__
+#define _ChatOverlay_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <OgreTextAreaOverlayElement.h>
+
+#include "network/ChatListener.h"
+#include "overlays/OverlayText.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport ChatOverlay : public OverlayText, public network::ChatListener
+    {
+        public:
+            ChatOverlay(BaseObject* creator);
+            ~ChatOverlay();
+
+            void setConfigValues();
+
+        protected:
+            virtual void incomingChat(const std::string& message, unsigned int senderID);
+
+            std::list<Ogre::UTFString> messages_;
+
+        private:
+            void updateOverlayText();
+            void dropMessage();
+
+            float displayTime_;
+    };
+}
+#endif /* _DebugFPSText_H__ */
Index: code/trunk/src/orxonox/overlays/hud/HUDBar.cc
===================================================================
--- code/trunk/src/orxonox/overlays/hud/HUDBar.cc	(revision 1937)
+++ code/trunk/src/orxonox/overlays/hud/HUDBar.cc	(revision 2087)
@@ -38,4 +38,5 @@
 
 #include "util/Convert.h"
+#include "util/String.h"
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
@@ -45,8 +46,11 @@
     CreateFactory(BarColour);
 
-    BarColour::BarColour()
-        : position_(0.0)
+    BarColour::BarColour(BaseObject* creator)
+        : BaseObject(creator)
     {
         RegisterObject(BarColour);
+
+        setColour(ColourValue(1.0, 1.0, 1.0, 1.0));
+        setPosition(0.0);
     }
 
@@ -55,7 +59,6 @@
         SUPER(BarColour, XMLPort, xmlElement, mode);
 
-        XMLPortParam(BarColour, "colour", setColour, getColour, xmlElement, mode)
-            .defaultValues(ColourValue(1.0, 1.0, 1.0, 1.0));
-        XMLPortParam(BarColour, "position", setPosition, getPosition, xmlElement, mode).defaultValues(0.0f);
+        XMLPortParam(BarColour, "colour", setColour, getColour, xmlElement, mode);
+        XMLPortParam(BarColour, "position", setPosition, getPosition, xmlElement, mode);
     }
 
@@ -63,14 +66,32 @@
     unsigned int HUDBar::materialcount_s = 0;
 
-    HUDBar::HUDBar()
-        : bar_(0)
-        , textureUnitState_(0)
+    HUDBar::HUDBar(BaseObject* creator)
+        : OrxonoxOverlay(creator)
     {
         RegisterObject(HUDBar);
+
+        // create new material
+        std::string materialname = "barmaterial" + getConvertedValue<unsigned int, std::string>(materialcount_s++);
+        Ogre::MaterialPtr material = (Ogre::MaterialPtr)Ogre::MaterialManager::getSingleton().create(materialname, "General");
+        material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
+        this->textureUnitState_ = material->getTechnique(0)->getPass(0)->createTextureUnitState();
+        this->textureUnitState_->setTextureName("bar2.tga");
+        // use the default colour
+        this->textureUnitState_->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, ColourValue(0.2, 0.7, 0.2));
+
+        this->bar_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
+            .createOverlayElement("Panel", "HUDBar_bar_" + getUniqueNumberString()));
+        this->bar_->setMaterialName(materialname);
+
+        setValue(0.4567654f);
+        setRightToLeft(false);
+        setAutoColour(true);
+
+        this->background_->addChild(bar_);
     }
 
     HUDBar::~HUDBar()
     {
-        if (this->bar_)
+        if (this->isInitialized())
             Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->bar_);
     }
@@ -80,24 +101,7 @@
         SUPER(HUDBar, XMLPort, xmlElement, mode);
 
-        if (mode == XMLPort::LoadObject)
-        {
-            // create new material
-            std::string materialname = "barmaterial" + getConvertedValue<unsigned int, std::string>(materialcount_s++);
-            Ogre::MaterialPtr material = (Ogre::MaterialPtr)Ogre::MaterialManager::getSingleton().create(materialname, "General");
-            material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
-            this->textureUnitState_ = material->getTechnique(0)->getPass(0)->createTextureUnitState();
-            this->textureUnitState_->setTextureName("bar2.tga");
-            // use the default colour
-            this->textureUnitState_->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, ColourValue(0.2, 0.7, 0.2));
-
-            this->bar_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
-                .createOverlayElement("Panel", "HUDBar_bar_" + getUniqueNumberStr()));
-            this->bar_->setMaterialName(materialname);
-            this->background_->addChild(bar_);
-        }
-
-        XMLPortParam(HUDBar, "initialValue", setValue,       getValue,       xmlElement, mode).defaultValues(0.4567654f);
-        XMLPortParam(HUDBar, "rightToLeft",  setRightToLeft, getRightToLeft, xmlElement, mode).defaultValues(false);
-        XMLPortParam(HUDBar, "autoColour",   setAutoColour,  getAutoColour,  xmlElement, mode).defaultValues(true);
+        XMLPortParam(HUDBar, "initialValue", setValue,       getValue,       xmlElement, mode);
+        XMLPortParam(HUDBar, "rightToLeft",  setRightToLeft, getRightToLeft, xmlElement, mode);
+        XMLPortParam(HUDBar, "autoColour",   setAutoColour,  getAutoColour,  xmlElement, mode);
         XMLPortObject(HUDBar, BarColour, "", addColour, getColour, xmlElement, mode);
     }
Index: code/trunk/src/orxonox/overlays/hud/HUDBar.h
===================================================================
--- code/trunk/src/orxonox/overlays/hud/HUDBar.h	(revision 1937)
+++ code/trunk/src/orxonox/overlays/hud/HUDBar.h	(revision 2087)
@@ -44,5 +44,5 @@
     {
     public:
-        BarColour();
+        BarColour(BaseObject* creator);
         ~BarColour() { }
 
@@ -64,5 +64,5 @@
     {
     public:
-        HUDBar();
+        HUDBar(BaseObject* creator);
         virtual ~HUDBar();
 
Index: code/trunk/src/orxonox/overlays/hud/HUDNavigation.cc
===================================================================
--- code/trunk/src/orxonox/overlays/hud/HUDNavigation.cc	(revision 1937)
+++ code/trunk/src/orxonox/overlays/hud/HUDNavigation.cc	(revision 2087)
@@ -41,7 +41,4 @@
 #include "core/XMLPort.h"
 #include "objects/Radar.h"
-#include "objects/SpaceShip.h"
-#include "objects/Projectile.h"
-#include "objects/CameraHandler.h"
 
 namespace orxonox
@@ -49,20 +46,45 @@
     CreateFactory(HUDNavigation);
 
-    HUDNavigation::HUDNavigation()
-        : navMarker_(0)
-        , aimMarker_(0)
-        , navText_(0)
+    HUDNavigation::HUDNavigation(BaseObject* creator)
+        : OrxonoxOverlay(creator)
     {
         RegisterObject(HUDNavigation);
+
+        // create nav text
+        navText_ = static_cast<Ogre::TextAreaOverlayElement*>(Ogre::OverlayManager::getSingleton()
+            .createOverlayElement("TextArea", "HUDNavigation_navText_" + getUniqueNumberString()));
+
+        // create nav marker
+        navMarker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
+            .createOverlayElement("Panel", "HUDNavigation_navMarker_" + getUniqueNumberString()));
+        navMarker_->setMaterialName("Orxonox/NavArrows");
+
+        // create aim marker
+        aimMarker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
+            .createOverlayElement("Panel", "HUDNavigation_aimMarker_" + getUniqueNumberString()));
+        aimMarker_->setMaterialName("Orxonox/NavCrosshair");
+        this->wasOutOfView_ = true; // Ensure the material is changed right the first time..
+
+        setFont("Monofur");
+        setTextSize(0.05f);
+        setNavMarkerSize(0.05f);
+        setAimMarkerSize(0.04f);
+
+        background_->addChild(navMarker_);
+        background_->addChild(aimMarker_);
+        background_->addChild(navText_);
+
+        // hide at first
+        this->setVisible(false);
     }
 
     HUDNavigation::~HUDNavigation()
     {
-        if (this->navMarker_)
+        if (this->isInitialized())
+        {
             Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->navMarker_);
-        if (this->navText_)
             Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->navText_);
-        if (this->aimMarker_)
             Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->aimMarker_);
+        }
     }
 
@@ -71,35 +93,8 @@
         SUPER(HUDNavigation, XMLPort, xmlElement, mode);
 
-        if (mode == XMLPort::LoadObject)
-        {
-            // create nav text
-            navText_ = static_cast<Ogre::TextAreaOverlayElement*>(Ogre::OverlayManager::getSingleton()
-                .createOverlayElement("TextArea", "HUDNavigation_navText_" + getUniqueNumberStr()));
-
-            // create nav marker
-            navMarker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
-                .createOverlayElement("Panel", "HUDNavigation_navMarker_" + getUniqueNumberStr()));
-            navMarker_->setMaterialName("Orxonox/NavArrows");
-            wasOutOfView_ = true; // just to ensure the material is changed right the first time..
-
-            // create aim marker
-            aimMarker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
-                .createOverlayElement("Panel", "HUDNavigation_aimMarker_" + getUniqueNumberStr()));
-            aimMarker_->setMaterialName("Orxonox/NavCrosshair");
-
-            background_->addChild(navMarker_);
-            background_->addChild(aimMarker_);
-            background_->addChild(navText_);
-
-            // hide at first
-            this->setVisible(false);
-        }
-
-        XMLPortParam(HUDNavigation, "font",     setFont,     getFont,     xmlElement, mode).defaultValues("Monofur");
-        XMLPortParam(HUDNavigation, "textSize", setTextSize, getTextSize, xmlElement, mode).defaultValues(0.05f);
-        XMLPortParam(HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlElement, mode)
-            .defaultValues(0.05f);
-        XMLPortParam(HUDNavigation, "aimMarkerSize", setAimMarkerSize, getAimMarkerSize, xmlElement, mode)
-            .defaultValues(0.04f);
+        XMLPortParam(HUDNavigation, "font",     setFont,     getFont,     xmlElement, mode);
+        XMLPortParam(HUDNavigation, "textSize", setTextSize, getTextSize, xmlElement, mode);
+        XMLPortParam(HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlElement, mode);
+        XMLPortParam(HUDNavigation, "aimMarkerSize", setAimMarkerSize, getAimMarkerSize, xmlElement, mode);
     }
 
@@ -115,5 +110,5 @@
             return this->navText_->getFontName();
         else
-            return blankString;
+            return BLANKSTRING;
     }
 
@@ -149,8 +144,10 @@
         float textLength = convertToString(dist).size() * navText_->getCharHeight() * 0.3;
 
+/*
         Ogre::Camera* navCam = SpaceShip::getLocalShip()->getCamera()->cam_;
         Matrix4 transformationMatrix = navCam->getProjectionMatrix() * navCam->getViewMatrix();
+*/
         // transform to screen coordinates
-        Vector3 pos = transformationMatrix * Radar::getInstance().getFocus()->getWorldPosition();
+        Vector3 pos = /*transformationMatrix * */Radar::getInstance().getFocus()->getWorldPosition();
 
         bool outOfView;
@@ -224,8 +221,8 @@
         {
             // object is in view
-
+/*
             Vector3 aimpos = transformationMatrix * getPredictedPosition(SpaceShip::getLocalShip()->getPosition(),
                     Projectile::getSpeed(), Radar::getInstance().getFocus()->getWorldPosition(), Radar::getInstance().getFocus()->getOrientedVelocity());
-
+*/
             if (wasOutOfView_)
             {
@@ -240,7 +237,8 @@
 
             aimMarker_->show();
+/*
             aimMarker_->setLeft((aimpos.x + 1.0 - aimMarker_->getWidth()) * 0.5);
             aimMarker_->setTop((-aimpos.y + 1.0 - aimMarker_->getHeight()) * 0.5);
-
+*/
             navText_->setLeft((pos.x + 1.0 + navMarker_->getWidth()) * 0.5);
             navText_->setTop((-pos.y + 1.0 + navMarker_->getHeight()) * 0.5);
@@ -250,7 +248,9 @@
     float HUDNavigation::getDist2Focus() const
     {
+/*
         if (Radar::getInstance().getFocus())
             return (Radar::getInstance().getFocus()->getWorldPosition() - SpaceShip::getLocalShip()->getPosition()).length();
         else
+*/
             return 0;
     }
Index: code/trunk/src/orxonox/overlays/hud/HUDNavigation.h
===================================================================
--- code/trunk/src/orxonox/overlays/hud/HUDNavigation.h	(revision 1937)
+++ code/trunk/src/orxonox/overlays/hud/HUDNavigation.h	(revision 2087)
@@ -41,5 +41,5 @@
     {
     public:
-        HUDNavigation();
+        HUDNavigation(BaseObject* creator);
         ~HUDNavigation();
 
Index: code/trunk/src/orxonox/overlays/hud/HUDRadar.cc
===================================================================
--- code/trunk/src/orxonox/overlays/hud/HUDRadar.cc	(revision 1937)
+++ code/trunk/src/orxonox/overlays/hud/HUDRadar.cc	(revision 2087)
@@ -35,9 +35,8 @@
 
 #include "util/Math.h"
+#include "util/String.h"
 #include "core/ConsoleCommand.h"
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
-#include "objects/SpaceShip.h"
-#include "objects/WorldEntity.h"
 #include "objects/Radar.h"
 #include "tools/TextureGenerator.h"
@@ -47,18 +46,34 @@
     CreateFactory(HUDRadar);
 
-    HUDRadar::HUDRadar()
-        : marker_(0)
+    HUDRadar::HUDRadar(BaseObject* creator)
+        : OrxonoxOverlay(creator)
     {
         RegisterObject(HUDRadar);
+
+        marker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
+            .createOverlayElement("Panel", "HUDRadar_marker_" + getUniqueNumberString()));
+        marker_->setMaterialName("Orxonox/RadarMarker");
+        overlay_->add2D(marker_);
+        marker_->hide();
+
+        setRadarSensitivity(1.0f);
+        setHalfDotSizeDistance(3000.0f);
+        setMaximumDotSize(0.1f);
+
+        shapeMaterials_[RadarViewable::Dot]      = "RadarSquare.tga";
+        shapeMaterials_[RadarViewable::Triangle] = "RadarSquare.tga";
+        shapeMaterials_[RadarViewable::Square]   = "RadarSquare.tga";
     }
 
     HUDRadar::~HUDRadar()
     {
-        if (this->marker_)
+        if (this->isInitialized())
+        {
             Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->marker_);
-        for (std::vector<Ogre::PanelOverlayElement*>::iterator it = this->radarDots_.begin();
-            it != this->radarDots_.end(); ++it)
-        {
-            Ogre::OverlayManager::getSingleton().destroyOverlayElement(*it);
+            for (std::vector<Ogre::PanelOverlayElement*>::iterator it = this->radarDots_.begin();
+                it != this->radarDots_.end(); ++it)
+            {
+                Ogre::OverlayManager::getSingleton().destroyOverlayElement(*it);
+            }
         }
     }
@@ -68,27 +83,12 @@
         SUPER(HUDRadar, XMLPort, xmlElement, mode);
 
-        if (mode == XMLPort::LoadObject)
-        {
-            marker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
-                .createOverlayElement("Panel", "HUDRadar_marker_" + getUniqueNumberStr()));
-            marker_->setMaterialName("Orxonox/RadarMarker");
-            overlay_->add2D(marker_);
-            marker_->hide();
-        }
-
-        XMLPortParam(HUDRadar, "sensitivity", setRadarSensitivity, getRadarSensitivity, xmlElement, mode)
-            .defaultValues(1.0f);
-        XMLPortParam(HUDRadar, "halfDotSizeDistance", setHalfDotSizeDistance, getHalfDotSizeDistance,
-            xmlElement, mode).defaultValues(3000.0f);
-        XMLPortParam(HUDRadar, "maximumDotSize", setMaximumDotSize, getMaximumDotSize, xmlElement, mode)
-            .defaultValues(0.1f);
-
-        shapeMaterials_[RadarViewable::Dot]      = "RadarSquare.tga";
-        shapeMaterials_[RadarViewable::Triangle] = "RadarSquare.tga";
-        shapeMaterials_[RadarViewable::Square]   = "RadarSquare.tga";
+        XMLPortParam(HUDRadar, "sensitivity", setRadarSensitivity, getRadarSensitivity, xmlElement, mode);
+        XMLPortParam(HUDRadar, "halfDotSizeDistance", setHalfDotSizeDistance, getHalfDotSizeDistance, xmlElement, mode);
+        XMLPortParam(HUDRadar, "maximumDotSize", setMaximumDotSize, getMaximumDotSize, xmlElement, mode);
     }
 
     void HUDRadar::displayObject(RadarViewable* object, bool bIsMarked)
     {
+/*
         const WorldEntity* wePointer = object->getWorldEntity();
 
@@ -100,5 +100,5 @@
             return;
         }
-
+*/
         // try to find a panel already created
         Ogre::PanelOverlayElement* panel;
@@ -108,5 +108,5 @@
             // we have to create a new entry
             panel = static_cast<Ogre::PanelOverlayElement*>(
-                Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "RadarDot" + getUniqueNumberStr()));
+                Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "RadarDot" + getUniqueNumberString()));
             radarDots_.push_back(panel);
             // get right material
@@ -126,5 +126,5 @@
         }
         panel->show();
-
+/*
         // set size to fit distance...
         float distance = (wePointer->getWorldPosition() - SpaceShip::getLocalShip()->getPosition()).length();
@@ -144,4 +144,5 @@
             this->marker_->setPosition((1.0 + coord.x - size * 1.5) * 0.5, (1.0 - coord.y - size * 1.5) * 0.5);
         }
+*/
     }
 
Index: code/trunk/src/orxonox/overlays/hud/HUDRadar.h
===================================================================
--- code/trunk/src/orxonox/overlays/hud/HUDRadar.h	(revision 1937)
+++ code/trunk/src/orxonox/overlays/hud/HUDRadar.h	(revision 2087)
@@ -45,5 +45,5 @@
     {
     public:
-        HUDRadar();
+        HUDRadar(BaseObject* creator);
         ~HUDRadar();
 
Index: code/trunk/src/orxonox/overlays/hud/HUDSpeedBar.cc
===================================================================
--- code/trunk/src/orxonox/overlays/hud/HUDSpeedBar.cc	(revision 1937)
+++ code/trunk/src/orxonox/overlays/hud/HUDSpeedBar.cc	(revision 2087)
@@ -31,5 +31,4 @@
 #include "HUDSpeedBar.h"
 #include "core/CoreIncludes.h"
-#include "objects/SpaceShip.h"
 
 namespace orxonox
@@ -37,5 +36,6 @@
     CreateFactory(HUDSpeedBar);
 
-    HUDSpeedBar::HUDSpeedBar()
+    HUDSpeedBar::HUDSpeedBar(BaseObject* creator)
+        : HUDBar(creator)
     {
         RegisterObject(HUDSpeedBar);
@@ -49,4 +49,5 @@
     void HUDSpeedBar::tick(float dt)
     {
+/*
         SpaceShip* ship = SpaceShip::getLocalShip();
         if (ship)
@@ -57,4 +58,5 @@
                 this->setValue(value);
         }
+*/
     }
 }
Index: code/trunk/src/orxonox/overlays/hud/HUDSpeedBar.h
===================================================================
--- code/trunk/src/orxonox/overlays/hud/HUDSpeedBar.h	(revision 1937)
+++ code/trunk/src/orxonox/overlays/hud/HUDSpeedBar.h	(revision 2087)
@@ -41,5 +41,5 @@
     {
     public:
-        HUDSpeedBar();
+        HUDSpeedBar(BaseObject* creator);
         ~HUDSpeedBar();
 
Index: code/trunk/src/orxonox/tools/BillboardSet.cc
===================================================================
--- code/trunk/src/orxonox/tools/BillboardSet.cc	(revision 1937)
+++ code/trunk/src/orxonox/tools/BillboardSet.cc	(revision 2087)
@@ -31,9 +31,11 @@
 
 #include <sstream>
+#include <cassert>
 
 #include <OgreSceneManager.h>
+#include <OgreBillboard.h>
 
-#include "GraphicsEngine.h"
-#include "util/Math.h"
+#include "util/Convert.h"
+#include "util/String.h"
 
 namespace orxonox
@@ -46,44 +48,116 @@
     }
 
-    void BillboardSet::setBillboardSet(const std::string& file, int count)
+    BillboardSet::~BillboardSet()
     {
-        std::ostringstream name;
-        name << (BillboardSet::billboardSetCounter_s++);
-        this->billboardSet_ = GraphicsEngine::getInstance().getLevelSceneManager()->createBillboardSet("Billboard" + name.str(), count);
-        this->billboardSet_->createBillboard(Vector3::ZERO);
-        this->billboardSet_->setMaterialName(file);
+        this->destroyBillboardSet();
     }
 
-    void BillboardSet::setBillboardSet(const std::string& file, const ColourValue& colour, int count)
+    void BillboardSet::setBillboardSet(Ogre::SceneManager* scenemanager, const std::string& file, int count)
     {
-        std::ostringstream name;
-        name << (BillboardSet::billboardSetCounter_s++);
-        this->billboardSet_ = GraphicsEngine::getInstance().getLevelSceneManager()->createBillboardSet("Billboard" + name.str(), count);
-        this->billboardSet_->createBillboard(Vector3::ZERO, colour);
-        this->billboardSet_->setMaterialName(file);
+        this->setBillboardSet(scenemanager, file, Vector3::ZERO, count);
     }
 
-    void BillboardSet::setBillboardSet(const std::string& file, const Vector3& position, int count)
+    void BillboardSet::setBillboardSet(Ogre::SceneManager* scenemanager, const std::string& file, const ColourValue& colour, int count)
     {
-        std::ostringstream name;
-        name << (BillboardSet::billboardSetCounter_s++);
-        this->billboardSet_ = GraphicsEngine::getInstance().getLevelSceneManager()->createBillboardSet("Billboard" + name.str(), count);
-        this->billboardSet_->createBillboard(position);
-        this->billboardSet_->setMaterialName(file);
+        this->setBillboardSet(scenemanager, file, colour, Vector3::ZERO, count);
     }
 
-    void BillboardSet::setBillboardSet(const std::string& file, const ColourValue& colour, const Vector3& position, int count)
+    void BillboardSet::setBillboardSet(Ogre::SceneManager* scenemanager, const std::string& file, const Vector3& position, int count)
     {
-        std::ostringstream name;
-        name << (BillboardSet::billboardSetCounter_s++);
-        this->billboardSet_ = GraphicsEngine::getInstance().getLevelSceneManager()->createBillboardSet("Billboard" + name.str(), count);
-        this->billboardSet_->createBillboard(position, colour);
-        this->billboardSet_->setMaterialName(file);
+        assert(scenemanager);
+        this->destroyBillboardSet();
+
+        try
+        {
+            this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + convertToString(BillboardSet::billboardSetCounter_s++), count);
+            this->billboardSet_->createBillboard(position);
+            this->billboardSet_->setMaterialName(file);
+        }
+        catch (...)
+        {
+            COUT(1) << "Error: Couln't load billboard \"" << file << "\"" << std::endl;
+        }
+
+        this->scenemanager_ = scenemanager;
     }
 
-    BillboardSet::~BillboardSet()
+    void BillboardSet::setBillboardSet(Ogre::SceneManager* scenemanager, const std::string& file, const ColourValue& colour, const Vector3& position, int count)
+    {
+        assert(scenemanager);
+        this->destroyBillboardSet();
+
+        try
+        {
+            this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + convertToString(BillboardSet::billboardSetCounter_s++), count);
+            this->billboardSet_->createBillboard(position, colour);
+            this->billboardSet_->setMaterialName(file);
+        }
+        catch (...)
+        {
+            COUT(1) << "Error: Couln't load billboard \"" << file << "\"" << std::endl;
+        }
+
+        this->scenemanager_ = scenemanager;
+    }
+
+    void BillboardSet::destroyBillboardSet()
+    {
+        if (this->billboardSet_ && this->scenemanager_)
+            this->scenemanager_->destroyBillboardSet(this->billboardSet_);
+    }
+
+    const std::string& BillboardSet::getName() const
     {
         if (this->billboardSet_)
-            GraphicsEngine::getInstance().getLevelSceneManager()->destroyBillboardSet(this->billboardSet_);
+            return this->billboardSet_->getName();
+        else
+            return BLANKSTRING;
+    }
+
+    void BillboardSet::setVisible(bool visible)
+    {
+        if (this->billboardSet_)
+            this->billboardSet_->setVisible(visible);
+    }
+
+    bool BillboardSet::getVisible() const
+    {
+        if (this->billboardSet_)
+            return this->billboardSet_->getVisible();
+        else
+            return false;
+    }
+
+    void BillboardSet::setColour(const ColourValue& colour)
+    {
+        if (this->billboardSet_)
+        {
+            for (int i = 0; i < this->billboardSet_->getNumBillboards(); ++i)
+                this->billboardSet_->getBillboard(i)->setColour(colour);
+        }
+    }
+
+    const ColourValue& BillboardSet::getColour() const
+    {
+        if (this->billboardSet_ && this->billboardSet_->getNumBillboards() > 0)
+        {
+            return this->billboardSet_->getBillboard(0)->getColour();
+        }
+        else
+            return ColourValue::White;
+    }
+
+    void BillboardSet::setMaterial(const std::string& material)
+    {
+        if (this->billboardSet_)
+            this->billboardSet_->setMaterialName(material);
+    }
+
+    const std::string& BillboardSet::getMaterial() const
+    {
+        if (this->billboardSet_)
+            return this->billboardSet_->getMaterialName();
+        else
+            return BLANKSTRING;
     }
 }
Index: code/trunk/src/orxonox/tools/BillboardSet.h
===================================================================
--- code/trunk/src/orxonox/tools/BillboardSet.h	(revision 1937)
+++ code/trunk/src/orxonox/tools/BillboardSet.h	(revision 2087)
@@ -44,23 +44,30 @@
             BillboardSet();
             ~BillboardSet();
-            void setBillboardSet(const std::string& file, int count = 1);
-            void setBillboardSet(const std::string& file, const ColourValue& colour, int count = 1);
-            void setBillboardSet(const std::string& file, const Vector3& position, int count = 1);
-            void setBillboardSet(const std::string& file, const ColourValue& colour, const Vector3& position, int count = 1);
+
+            void setBillboardSet(Ogre::SceneManager* scenemanager, const std::string& file, int count = 1);
+            void setBillboardSet(Ogre::SceneManager* scenemanager, const std::string& file, const ColourValue& colour, int count = 1);
+            void setBillboardSet(Ogre::SceneManager* scenemanager, const std::string& file, const Vector3& position, int count = 1);
+            void setBillboardSet(Ogre::SceneManager* scenemanager, const std::string& file, const ColourValue& colour, const Vector3& position, int count = 1);
 
             inline Ogre::BillboardSet* getBillboardSet()
                 { return this->billboardSet_; }
 
-            inline const std::string& getName() const
-                { return this->billboardSet_->getName(); }
+            const std::string& getName() const;
 
-            inline void setVisible(bool visible)
-                { this->billboardSet_->setVisible(visible); }
-            inline bool getVisible() const
-                { return this->billboardSet_->getVisible(); }
+            void setVisible(bool visible);
+            bool getVisible() const;
+
+            void setColour(const ColourValue& colour);
+            const ColourValue& getColour() const;
+
+            void setMaterial(const std::string& material);
+            const std::string& getMaterial() const;
 
         private:
+            void destroyBillboardSet();
+
             static unsigned int billboardSetCounter_s;
             Ogre::BillboardSet* billboardSet_;
+            Ogre::SceneManager* scenemanager_;
     };
 }
Index: code/trunk/src/orxonox/tools/Light.cc
===================================================================
--- code/trunk/src/orxonox/tools/Light.cc	(revision 1937)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      ...
- *   Co-authors:
- *      ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "Light.h"
-
-#include <sstream>
-
-#include <OgreSceneManager.h>
-
-#include "GraphicsEngine.h"
-
-namespace orxonox
-{
-    unsigned int Light::lightCounter_s = 0;
-
-    Light::Light()
-    {
-        this->light_ = 0;
-    }
-
-    void Light::setLight(Ogre::Light::LightTypes type, const ColourValue& diffuse, const ColourValue& specular)
-    {
-        std::ostringstream name;
-        name << (Light::lightCounter_s++);
-        this->light_ = GraphicsEngine::getInstance().getLevelSceneManager()->createLight("Light" + name.str());
-        this->light_->setType(type);
-        this->light_->setDiffuseColour(diffuse);
-        this->light_->setSpecularColour(specular);
-    }
-
-    Light::~Light()
-    {
-        if (this->light_)
-            GraphicsEngine::getInstance().getLevelSceneManager()->destroyLight(this->light_);
-    }
-}
Index: code/trunk/src/orxonox/tools/Light.h
===================================================================
--- code/trunk/src/orxonox/tools/Light.h	(revision 1937)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      ...
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _Light_H__
-#define _Light_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <string>
-
-#include <OgreLight.h>
-
-#include "util/Math.h"
-
-namespace orxonox
-{
-    class _OrxonoxExport Light
-    {
-        public:
-            Light();
-            ~Light();
-            void setLight(Ogre::Light::LightTypes type = Ogre::Light::LT_POINT, const ColourValue& diffuse = ColourValue(1.0, 1.0, 1.0), const ColourValue& specular = ColourValue(1.0, 1.0, 1.0));
-
-            inline Ogre::Light* getLight()
-                { return this->light_; }
-
-            inline const std::string& getName() const
-                { return this->light_->getName(); }
-
-        private:
-            static unsigned int lightCounter_s;
-            Ogre::Light* light_;
-    };
-}
-
-#endif /* _Light_H__ */
Index: code/trunk/src/orxonox/tools/Mesh.cc
===================================================================
--- code/trunk/src/orxonox/tools/Mesh.cc	(revision 1937)
+++ code/trunk/src/orxonox/tools/Mesh.cc	(revision 2087)
@@ -32,6 +32,9 @@
 #include <sstream>
 #include <OgreSceneManager.h>
-#include "GraphicsEngine.h"
-#include "Settings.h"
+#include <cassert>
+
+#include "core/Core.h"
+#include "util/Convert.h"
+#include "util/String.h"
 
 namespace orxonox
@@ -39,21 +42,66 @@
     unsigned int Mesh::meshCounter_s = 0;
 
-    Mesh::Mesh() :
-      entity_(0)
+    Mesh::Mesh()
     {
-    }
-
-    void Mesh::setMesh(const std::string& file)
-    {
-        std::ostringstream name;
-        name << (Mesh::meshCounter_s++);
-        if (Settings::showsGraphics())
-            this->entity_ = GraphicsEngine::getInstance().getLevelSceneManager()->createEntity("Mesh" + name.str(), file);
+        this->entity_ = 0;
+        this->bCastShadows_ = true;
     }
 
     Mesh::~Mesh()
     {
-        if (this->entity_ && Settings::showsGraphics())
-            GraphicsEngine::getInstance().getLevelSceneManager()->destroyEntity(this->entity_);
+        if (this->entity_ && this->scenemanager_)
+            this->scenemanager_->destroyEntity(this->entity_);
+    }
+
+    void Mesh::setMeshSource(Ogre::SceneManager* scenemanager, const std::string& meshsource)
+    {
+        assert(scenemanager);
+
+        this->scenemanager_ = scenemanager;
+
+        if (this->entity_)
+            this->scenemanager_->destroyEntity(this->entity_);
+
+        if (Core::showsGraphics())
+        {
+            try
+            {
+                this->entity_ = this->scenemanager_->createEntity("Mesh" + convertToString(Mesh::meshCounter_s++), meshsource);
+                this->entity_->setCastShadows(this->bCastShadows_);
+            }
+            catch (...)
+            {
+                COUT(1) << "Error: Couln't load mesh \"" << meshsource << "\"" << std::endl;
+            }
+        }
+    }
+
+    void Mesh::setCastShadows(bool bCastShadows)
+    {
+        this->bCastShadows_ = bCastShadows;
+        if (this->entity_)
+            this->entity_->setCastShadows(this->bCastShadows_);
+    }
+
+    const std::string& Mesh::getName() const
+    {
+        if (this->entity_)
+            return this->entity_->getName();
+        else
+            return BLANKSTRING;
+    }
+
+    void Mesh::setVisible(bool bVisible)
+    {
+        if (this->entity_)
+            this->entity_->setVisible(bVisible);
+    }
+
+    bool Mesh::isVisible() const
+    {
+        if (this->entity_)
+            return this->entity_->getVisible();
+        else
+            return false;
     }
 }
Index: code/trunk/src/orxonox/tools/Mesh.h
===================================================================
--- code/trunk/src/orxonox/tools/Mesh.h	(revision 1937)
+++ code/trunk/src/orxonox/tools/Mesh.h	(revision 2087)
@@ -21,5 +21,5 @@
  *
  *   Author:
- *      ...
+ *      Fabian 'x3n' Landau
  *   Co-authors:
  *      ...
@@ -33,5 +33,4 @@
 
 #include <string>
-
 #include <OgreEntity.h>
 
@@ -43,20 +42,24 @@
             Mesh();
             ~Mesh();
-            void setMesh(const std::string& file);
+
+            void setMeshSource(Ogre::SceneManager* scenemanager, const std::string& file);
 
             inline Ogre::Entity* getEntity()
                 { return this->entity_; }
 
-            inline const std::string& getName() const
-                { return this->entity_->getName(); }
+            const std::string& getName() const;
 
-            inline void setVisible(bool visible)
-                { if (this->entity_) this->entity_->setVisible(visible); }
-            inline bool getVisible() const
-                { if (this->entity_) return this->entity_->getVisible(); else return false; }
+            void setVisible(bool bVisible);
+            bool isVisible() const;
+
+            void setCastShadows(bool bCastShadows);
+            inline bool getCastShadows() const
+                { return this->bCastShadows_; }
 
         private:
             static unsigned int meshCounter_s;
             Ogre::Entity* entity_;
+            bool bCastShadows_;
+            Ogre::SceneManager* scenemanager_;
     };
 }
Index: code/trunk/src/orxonox/tools/ParticleInterface.cc
===================================================================
--- code/trunk/src/orxonox/tools/ParticleInterface.cc	(revision 1937)
+++ code/trunk/src/orxonox/tools/ParticleInterface.cc	(revision 2087)
@@ -1,28 +1,29 @@
 /*
-*   ORXONOX - the hottest 3D action shooter ever to exist
-*
-*
-*   License notice:
-*
-*   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
-*   of the License, or (at your option) any later version.
-*
-*   This program is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with this program; if not, write to the Free Software
-*   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-*
-*   Author:
-*      ...
-*   Co-authors:
-*      ...
-*
-*/
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
 
 /**
@@ -37,4 +38,5 @@
 #include <OgreParticleEmitter.h>
 #include <OgreSceneManager.h>
+#include <cassert>
 
 #include "GraphicsEngine.h"
@@ -44,147 +46,164 @@
 namespace orxonox
 {
-  unsigned int ParticleInterface::counter_s = 0;
-  ParticleInterface* ParticleInterface::currentParticleInterface_s = 0;
-
-  ParticleInterface::ParticleInterface(const std::string& templateName, LODParticle::LOD detaillevel)
-  {
-    RegisterRootObject(ParticleInterface);
-
-    this->sceneNode_ = 0;
-    this->bEnabled_ = true;
-    this->detaillevel_ = (unsigned int)detaillevel;
-    this->particleSystem_ = GraphicsEngine::getInstance().getLevelSceneManager()->createParticleSystem("particles" + getConvertedValue<unsigned int, std::string>(ParticleInterface::counter_s++), templateName);
-    //this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor());
-    this->particleSystem_->setSpeedFactor(1.0f);
-
-    if (GraphicsEngine::getInstance().getDetailLevelParticle() < (unsigned int)this->detaillevel_)
-    {
-      this->bVisible_ = false;
-      this->updateVisibility();
-    }
-    else
-    {
-      this->bVisible_ = true;
-    }
-  }
-
-  ParticleInterface::~ParticleInterface()
-  {
-    this->particleSystem_->removeAllEmitters();
-    GraphicsEngine::getInstance().getLevelSceneManager()->destroyParticleSystem(particleSystem_);
-  }
-
-  void ParticleInterface::addToSceneNode(Ogre::SceneNode* sceneNode)
-  {
-    this->sceneNode_ = sceneNode;
-    this->sceneNode_->attachObject(this->particleSystem_);
-  }
-
-  void ParticleInterface::detachFromSceneNode()
-  {
-    if (this->sceneNode_)
-    {
-      this->sceneNode_->detachObject(this->particleSystem_);
-      this->sceneNode_ = 0;
-    }
-  }
-
-  Ogre::ParticleEmitter* ParticleInterface::createNewEmitter()
-  {
-    if (this->particleSystem_->getNumEmitters() > 0)
-    {
-      Ogre::ParticleEmitter* newemitter = this->particleSystem_->addEmitter(this->particleSystem_->getEmitter(0)->getType());
-      this->particleSystem_->getEmitter(0)->copyParametersTo(newemitter);
-      return newemitter;
-    }
-    else
-      return 0;
-  }
-  Ogre::ParticleEmitter* ParticleInterface::getEmitter(unsigned int emitterNr) const
-  {
-    if (emitterNr < this->particleSystem_->getNumEmitters())
-      return this->particleSystem_->getEmitter(emitterNr);
-    else
-      return 0;
-  }
-  void ParticleInterface::removeEmitter(unsigned int emitterNr)
-  {
-    if (emitterNr < this->particleSystem_->getNumEmitters())
-      this->particleSystem_->removeEmitter(emitterNr);
-  }
-  void ParticleInterface::removeAllEmitters()
-  {
-    this->particleSystem_->removeAllEmitters();
-  }
-  unsigned int ParticleInterface::getNumEmitters() const
-  {
-    return this->particleSystem_->getNumEmitters();
-  }
-
-  Ogre::ParticleAffector* ParticleInterface::addAffector(const std::string& name)
-  {
-    return this->particleSystem_->addAffector(name);
-  }
-  Ogre::ParticleAffector* ParticleInterface::getAffector(unsigned int affectorNr) const
-  {
-    if (affectorNr < this->particleSystem_->getNumAffectors())
-      return this->particleSystem_->getAffector(affectorNr);
-    else
-      return 0;
-  }
-  void ParticleInterface::removeAffector(unsigned int affectorNr)
-  {
-    if (affectorNr < this->particleSystem_->getNumAffectors())
-      this->particleSystem_->removeAffector(affectorNr);
-  }
-  void ParticleInterface::removeAllAffectors()
-  {
-    this->particleSystem_->removeAllAffectors();
-  }
-  unsigned int ParticleInterface::getNumAffectors() const
-  {
-    return this->particleSystem_->getNumAffectors();
-  }
-
-  void ParticleInterface::setEnabled(bool enable)
-  {
-    this->bEnabled_ = enable;
-    this->updateVisibility();
-  }
-
-  void ParticleInterface::detailLevelChanged(unsigned int newlevel)
-  {
-    if (newlevel >= (unsigned int)this->detaillevel_)
-      this->bVisible_ = true;
-    else
-      this->bVisible_ = false;
-
-    this->updateVisibility();
-  }
-
-  void ParticleInterface::updateVisibility()
-  {
-    for (unsigned int i = 0; i < this->particleSystem_->getNumEmitters(); i++)
-      this->particleSystem_->getEmitter(i)->setEnabled(this->bEnabled_ && this->bVisible_);
-  }
-
-  void ParticleInterface::setSpeedFactor(float factor)
-  {
-    //this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor() * factor);
-    this->particleSystem_->setSpeedFactor(1.0f * factor);
-  }
-  float ParticleInterface::getSpeedFactor() const
-  {
-    //return (this->particleSystem_->getSpeedFactor() / Orxonox::getInstance().getTimeFactor());
-    return (this->particleSystem_->getSpeedFactor() / 1.0f);
-  }
-
-  bool ParticleInterface::getKeepParticlesInLocalSpace() const
-  {
-    return this->particleSystem_->getKeepParticlesInLocalSpace();
-  }
-  void ParticleInterface::setKeepParticlesInLocalSpace(bool keep)
-  {
-    this->particleSystem_->setKeepParticlesInLocalSpace(keep);
-  }
+    unsigned int ParticleInterface::counter_s = 0;
+    ParticleInterface* ParticleInterface::currentParticleInterface_s = 0;
+
+    ParticleInterface::ParticleInterface(Ogre::SceneManager* scenemanager, const std::string& templateName, LODParticle::LOD detaillevel)
+    {
+        RegisterRootObject(ParticleInterface);
+
+        assert(scenemanager);
+
+        this->scenemanager_ = scenemanager;
+        this->sceneNode_ = 0;
+
+        this->bEnabled_ = true;
+        this->bVisible_ = true;
+        this->bAllowedByLOD_ = true;
+
+        this->particleSystem_ = this->scenemanager_->createParticleSystem("particles" + getConvertedValue<unsigned int, std::string>(ParticleInterface::counter_s++), templateName);
+        this->particleSystem_->setSpeedFactor(1.0f);
+        //this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor());
+
+        this->setDetailLevel((unsigned int)detaillevel);
+    }
+
+    ParticleInterface::~ParticleInterface()
+    {
+        this->particleSystem_->removeAllEmitters();
+        this->detachFromSceneNode();
+        this->scenemanager_->destroyParticleSystem(particleSystem_);
+    }
+
+    void ParticleInterface::addToSceneNode(Ogre::SceneNode* sceneNode)
+    {
+        if (this->sceneNode_)
+            this->detachFromSceneNode();
+
+        this->sceneNode_ = sceneNode;
+        this->sceneNode_->attachObject(this->particleSystem_);
+    }
+
+    void ParticleInterface::detachFromSceneNode()
+    {
+        if (this->sceneNode_)
+        {
+            this->sceneNode_->detachObject(this->particleSystem_);
+            this->sceneNode_ = 0;
+        }
+    }
+
+    Ogre::ParticleEmitter* ParticleInterface::createNewEmitter()
+    {
+        if (this->particleSystem_->getNumEmitters() > 0)
+        {
+            Ogre::ParticleEmitter* newemitter = this->particleSystem_->addEmitter(this->particleSystem_->getEmitter(0)->getType());
+            this->particleSystem_->getEmitter(0)->copyParametersTo(newemitter);
+            return newemitter;
+        }
+        else
+            return 0;
+    }
+    Ogre::ParticleEmitter* ParticleInterface::getEmitter(unsigned int emitterNr) const
+    {
+        if (emitterNr < this->particleSystem_->getNumEmitters())
+            return this->particleSystem_->getEmitter(emitterNr);
+        else
+            return 0;
+    }
+    void ParticleInterface::removeEmitter(unsigned int emitterNr)
+    {
+        if (emitterNr < this->particleSystem_->getNumEmitters())
+            this->particleSystem_->removeEmitter(emitterNr);
+    }
+    void ParticleInterface::removeAllEmitters()
+    {
+        this->particleSystem_->removeAllEmitters();
+    }
+    unsigned int ParticleInterface::getNumEmitters() const
+    {
+        return this->particleSystem_->getNumEmitters();
+    }
+
+    Ogre::ParticleAffector* ParticleInterface::addAffector(const std::string& name)
+    {
+        return this->particleSystem_->addAffector(name);
+    }
+    Ogre::ParticleAffector* ParticleInterface::getAffector(unsigned int affectorNr) const
+    {
+        if (affectorNr < this->particleSystem_->getNumAffectors())
+            return this->particleSystem_->getAffector(affectorNr);
+        else
+            return 0;
+    }
+    void ParticleInterface::removeAffector(unsigned int affectorNr)
+    {
+        if (affectorNr < this->particleSystem_->getNumAffectors())
+            this->particleSystem_->removeAffector(affectorNr);
+    }
+    void ParticleInterface::removeAllAffectors()
+    {
+        this->particleSystem_->removeAllAffectors();
+    }
+    unsigned int ParticleInterface::getNumAffectors() const
+    {
+        return this->particleSystem_->getNumAffectors();
+    }
+
+    void ParticleInterface::setEnabled(bool enable)
+    {
+        this->bEnabled_ = enable;
+
+        for (unsigned int i = 0; i < this->particleSystem_->getNumEmitters(); i++)
+            this->particleSystem_->getEmitter(i)->setEnabled(this->bEnabled_ && this->bAllowedByLOD_);
+    }
+
+    void ParticleInterface::setVisible(bool visible)
+    {
+        this->bVisible_ = visible;
+
+        this->particleSystem_->setVisible(this->bVisible_ && this->bAllowedByLOD_);
+    }
+
+    void ParticleInterface::setDetailLevel(unsigned int level)
+    {
+        this->detaillevel_ = level;
+        this->detailLevelChanged(GraphicsEngine::getInstance().getDetailLevelParticle());
+    }
+
+    void ParticleInterface::detailLevelChanged(unsigned int newlevel)
+    {
+        if (newlevel >= (unsigned int)this->detaillevel_)
+            this->bAllowedByLOD_ = true;
+        else
+            this->bAllowedByLOD_ = false;
+
+        this->updateVisibility();
+    }
+
+    void ParticleInterface::updateVisibility()
+    {
+        this->setEnabled(this->isEnabled());
+        this->setVisible(this->isVisible());
+    }
+
+    void ParticleInterface::setSpeedFactor(float factor)
+    {
+        //this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor() * factor);
+        this->particleSystem_->setSpeedFactor(1.0f * factor);
+    }
+    float ParticleInterface::getSpeedFactor() const
+    {
+        //return (this->particleSystem_->getSpeedFactor() / Orxonox::getInstance().getTimeFactor());
+        return (this->particleSystem_->getSpeedFactor() / 1.0f);
+    }
+
+    bool ParticleInterface::getKeepParticlesInLocalSpace() const
+    {
+        return this->particleSystem_->getKeepParticlesInLocalSpace();
+    }
+    void ParticleInterface::setKeepParticlesInLocalSpace(bool keep)
+    {
+        this->particleSystem_->setKeepParticlesInLocalSpace(keep);
+    }
 }
Index: code/trunk/src/orxonox/tools/ParticleInterface.h
===================================================================
--- code/trunk/src/orxonox/tools/ParticleInterface.h	(revision 1937)
+++ code/trunk/src/orxonox/tools/ParticleInterface.h	(revision 2087)
@@ -21,5 +21,5 @@
  *
  *   Author:
- *      ...
+ *      Fabian 'x3n' Landau
  *   Co-authors:
  *      ...
@@ -45,52 +45,63 @@
 namespace orxonox
 {
-  class _OrxonoxExport ParticleInterface : public OrxonoxClass
-  {
-    public:
-      ParticleInterface(const std::string& templateName, LODParticle::LOD detaillevel);
-      ~ParticleInterface();
+    class _OrxonoxExport ParticleInterface : public OrxonoxClass
+    {
+        public:
+            ParticleInterface(Ogre::SceneManager* scenemanager, const std::string& templateName, LODParticle::LOD detaillevel);
+            virtual ~ParticleInterface();
 
-      inline Ogre::ParticleSystem* getParticleSystem() const
-        { return this->particleSystem_; }
+            inline Ogre::ParticleSystem* getParticleSystem() const
+                { return this->particleSystem_; }
 
-      void addToSceneNode(Ogre::SceneNode* sceneNode);
-      void detachFromSceneNode();
+            void addToSceneNode(Ogre::SceneNode* sceneNode);
+            void detachFromSceneNode();
 
-      Ogre::ParticleEmitter* createNewEmitter();
-      Ogre::ParticleEmitter* getEmitter(unsigned int emitterNr) const;
-      void removeEmitter(unsigned int emitterNr);
-      void removeAllEmitters();
-      unsigned int getNumEmitters() const;
+            Ogre::ParticleEmitter* createNewEmitter();
+            Ogre::ParticleEmitter* getEmitter(unsigned int emitterNr) const;
+            void removeEmitter(unsigned int emitterNr);
+            void removeAllEmitters();
+            unsigned int getNumEmitters() const;
 
-      Ogre::ParticleAffector* addAffector(const std::string& name);
-      Ogre::ParticleAffector* getAffector(unsigned int affectorNr) const;
-      void removeAffector(unsigned int affectorNr);
-      void removeAllAffectors();
-      unsigned int getNumAffectors() const;
+            Ogre::ParticleAffector* addAffector(const std::string& name);
+            Ogre::ParticleAffector* getAffector(unsigned int affectorNr) const;
+            void removeAffector(unsigned int affectorNr);
+            void removeAllAffectors();
+            unsigned int getNumAffectors() const;
 
-      float getSpeedFactor() const;
-      void setSpeedFactor(float factor);
-      bool getKeepParticlesInLocalSpace() const;
-      void setKeepParticlesInLocalSpace(bool keep);
+            float getSpeedFactor() const;
+            void setSpeedFactor(float factor);
+            bool getKeepParticlesInLocalSpace() const;
+            void setKeepParticlesInLocalSpace(bool keep);
 
-      void setEnabled(bool enable);
-      void detailLevelChanged(unsigned int newlevel);
+            void setEnabled(bool enable);
+            inline bool isEnabled() const
+                { return this->bEnabled_; }
 
-      inline void storeThisAsCurrentParticleInterface()
-        { ParticleInterface::currentParticleInterface_s = this; }
-      inline static ParticleInterface* getCurrentParticleInterface()
-        { return ParticleInterface::currentParticleInterface_s; }
+            void setVisible(bool visible);
+            inline bool isVisible() const
+                { return this->bVisible_; }
 
-    private:
-      void updateVisibility();
+            void detailLevelChanged(unsigned int newlevel);
+            void setDetailLevel(unsigned int level);
 
-      static ParticleInterface* currentParticleInterface_s;
-      static unsigned int counter_s;
-      Ogre::SceneNode* sceneNode_;
-      Ogre::ParticleSystem* particleSystem_;
-      bool bVisible_;
-      bool bEnabled_;
-      unsigned int detaillevel_;                            //!< Detail level of this particle effect (0: off, 1: low, 2: normal, 3: high)
-  };
+            inline void storeThisAsCurrentParticleInterface()
+                { ParticleInterface::currentParticleInterface_s = this; }
+            inline static ParticleInterface* getCurrentParticleInterface()
+                { return ParticleInterface::currentParticleInterface_s; }
+
+        private:
+            void updateVisibility();
+
+            static ParticleInterface* currentParticleInterface_s;
+            static unsigned int       counter_s;
+
+            Ogre::SceneNode*          sceneNode_;
+            Ogre::ParticleSystem*     particleSystem_;
+            bool                      bVisible_;
+            bool                      bEnabled_;
+            bool                      bAllowedByLOD_;
+            unsigned int              detaillevel_;     //!< Detail level of this particle effect (0: off, 1: low, 2: normal, 3: high)
+            Ogre::SceneManager*       scenemanager_;
+    };
 }
 
Index: code/trunk/src/orxonox/tools/Timer.cc
===================================================================
--- code/trunk/src/orxonox/tools/Timer.cc	(revision 1937)
+++ code/trunk/src/orxonox/tools/Timer.cc	(revision 2087)
@@ -92,4 +92,5 @@
         this->bLoop_ = false;
         this->bActive_ = false;
+        this->bKillAfterCall_ = false;
 
         this->time_ = 0;
@@ -111,5 +112,10 @@
     void TimerBase::run() const
     {
+        bool temp = this->bKillAfterCall_; // to avoid errors with bKillAfterCall_=false and an exutors which destroy the timer
+
         (*this->executor_)();
+
+        if (temp)
+            delete this;
     }
 
@@ -136,5 +142,5 @@
             {
                 // It's time to call the function
-                if (this->bLoop_)
+                if (this->bLoop_ && !this->bKillAfterCall_)
                 {
                     this->time_ += this->interval_; // Q: Why '+=' and not '='? A: Think about it. It's more accurate like that. Seriously.
Index: code/trunk/src/orxonox/tools/Timer.h
===================================================================
--- code/trunk/src/orxonox/tools/Timer.h	(revision 1937)
+++ code/trunk/src/orxonox/tools/Timer.h	(revision 2087)
@@ -116,11 +116,12 @@
             TimerBase();
 
-            Executor* executor_; //!< The executor of the function that should be called when the time expires
-
-            long long interval_; //!< The time-interval in micro seconds
-            bool bLoop_;         //!< If true, the function gets called every 'interval' seconds
-            bool bActive_;       //!< If true, the Timer ticks and calls the function if the time's up
-
-            long long time_;     //!< Internal variable, counting the time till the next function-call
+            Executor* executor_;  //!< The executor of the function that should be called when the time expires
+
+            long long interval_;  //!< The time-interval in micro seconds
+            bool bLoop_;          //!< If true, the function gets called every 'interval' seconds
+            bool bActive_;        //!< If true, the Timer ticks and calls the function if the time's up
+            bool bKillAfterCall_; //!< If true the timer gets deleted after it called the function
+
+            long long time_;      //!< Internal variable, counting the time till the next function-call
     };
 
@@ -139,7 +140,7 @@
                 @param exeuctor A executor of the function to call
             */
-            Timer(float interval, bool bLoop, T* object, ExecutorMember<T>* exeuctor)
-            {
-                this->setTimer(interval, bLoop, object, exeuctor);
+            Timer(float interval, bool bLoop, T* object, ExecutorMember<T>* exeuctor, bool bKillAfterCall = false)
+            {
+                this->setTimer(interval, bLoop, object, exeuctor, bKillAfterCall);
             }
 
@@ -151,5 +152,5 @@
                 @param exeuctor A executor of the function to call
             */
-            void setTimer(float interval, bool bLoop, T* object, ExecutorMember<T>* executor)
+            void setTimer(float interval, bool bLoop, T* object, ExecutorMember<T>* executor, bool bKillAfterCall = false)
             {
                 this->deleteExecutor();
@@ -162,4 +163,5 @@
 
                 this->time_ = this->interval_;
+                this->bKillAfterCall_ = bKillAfterCall;
             }
     };
@@ -177,7 +179,7 @@
                 @param exeuctor A executor of the function to call
             */
-            StaticTimer(float interval, bool bLoop, ExecutorStatic* executor)
-            {
-                this->setTimer(interval, bLoop, executor);
+            StaticTimer(float interval, bool bLoop, ExecutorStatic* executor, bool bKillAfterCall = false)
+            {
+                this->setTimer(interval, bLoop, executor, bKillAfterCall);
             }
 
@@ -189,5 +191,5 @@
                 @param executor A executor of the function to call
             */
-            void setTimer(float interval, bool bLoop, ExecutorStatic* executor)
+            void setTimer(float interval, bool bLoop, ExecutorStatic* executor, bool bKillAfterCall = false)
             {
                 this->deleteExecutor();
@@ -199,4 +201,5 @@
 
                 this->time_ = this->interval_;
+                this->bKillAfterCall_ = bKillAfterCall;
             }
     };
Index: code/trunk/src/tinyxml/ticpp.h
===================================================================
--- code/trunk/src/tinyxml/ticpp.h	(revision 1937)
+++ code/trunk/src/tinyxml/ticpp.h	(revision 2087)
@@ -1184,4 +1184,5 @@
 		T* m_tiXmlPointer;		/**< Internal pointer to the TiXml Class which is being wrapped */
 
+    public:
 		/**
 		@internal
@@ -1195,4 +1196,5 @@
 			return m_tiXmlPointer;
 		}
+    protected:
 
 		/**
Index: code/trunk/src/tolua/lua/compat-5.1.lua
===================================================================
--- code/trunk/src/tolua/lua/compat-5.1.lua	(revision 1937)
+++ code/trunk/src/tolua/lua/compat-5.1.lua	(revision 2087)
Index: code/trunk/src/tolua/lua/custom.lua
===================================================================
--- code/trunk/src/tolua/lua/custom.lua	(revision 1937)
+++ code/trunk/src/tolua/lua/custom.lua	(revision 2087)
Index: code/trunk/src/tolua/lua/custom_hide.lua
===================================================================
--- code/trunk/src/tolua/lua/custom_hide.lua	(revision 1937)
+++ code/trunk/src/tolua/lua/custom_hide.lua	(revision 2087)
Index: code/trunk/src/tolua/lua/function.lua
===================================================================
--- code/trunk/src/tolua/lua/function.lua	(revision 1937)
+++ code/trunk/src/tolua/lua/function.lua	(revision 2087)
Index: code/trunk/src/util/CMakeLists.txt
===================================================================
--- code/trunk/src/util/CMakeLists.txt	(revision 1937)
+++ code/trunk/src/util/CMakeLists.txt	(revision 2087)
@@ -8,4 +8,5 @@
   OutputBuffer.cc
   OutputHandler.cc
+  SignalHandler.cc
   String.cc
   SubString.cc
Index: code/trunk/src/util/Convert.h
===================================================================
--- code/trunk/src/util/Convert.h	(revision 1937)
+++ code/trunk/src/util/Convert.h	(revision 2087)
@@ -21,4 +21,5 @@
  *
  *   Author:
+ *      Reto Grieder
  *      Fabian 'x3n' Landau
  *      Benjamin Grauer
@@ -28,10 +29,10 @@
 
 /*!
-    @file Convert.h
+    @file
     @brief Definition and Implementation of the Convert class.
 */
 
-#ifndef _Convert_H__
-#define _Convert_H__
+#ifndef _Converter_H__
+#define _Converter_H__
 
 #include "UtilPrereqs.h"
@@ -39,261 +40,167 @@
 #include <string>
 #include <sstream>
+#include <istream>
+#include <ostream>
 #include <typeinfo>
 
-#include "Math.h"
 #include "Debug.h"
-#include "SubString.h"
 #include "String.h"
 
-// disable annoying warning about forcing value to boolean
+// GCC generates warnings when implicitely casting from float to int for instance.
+// This is however exactly what convertValue does, so we need to suppress these warnings.
+// They only occur when using the ImplicitConversion template.
+#if ORXONOX_COMPILER == ORXONOX_COMPILER_GNUC
+#  pragma GCC system_header
+#endif
+
+
+///////////////////////////////////////////////
+// Static detection for conversion functions //
+///////////////////////////////////////////////
+
+/* The idea to use the sizeof() operator on return functions to determine function existance
+   is described in 'Modern C++ design' by Alexandrescu (2001). */
+
+// disable warnings about possible loss of data
 #if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
-#pragma warning(push)
-#pragma warning(disable:4100 4800)
+#  pragma warning(push)
+#  pragma warning(disable:4244)
 #endif
 
-
-//////////
-// MAIN //
-//////////
-
-// Enum to declare the wanted conversion preference in case of equal type-levels
-enum ConversionPreference
-{
-    CP_PreferToType,
-    CP_PreferFromType,
-};
-
-// Helper classes to determine the preferred partial template specialization
-class _ToType_   {};
-class _FromType_ {};
-class _Explicit_ {};
-
-
-// The default convert functions
-template <class FromType, class ToType, class Type>
-struct ConverterSpecialized
-{
-    enum { specialized = false };
+template <class FromType, class ToType>
+class ImplicitConversion
+{
+private:
+    ImplicitConversion(); ImplicitConversion(const ImplicitConversion&); ~ImplicitConversion();
+    // Gets chosen only if there is an implicit conversion from FromType to ToType.
+    static char test(ToType);
+    // Accepts any argument. Why do we not use a template? The reason is that with templates,
+    // the function above is only taken iff it is an exact type match. But since we want to
+    // check for implicit conversion, we have to use the ellipsis.
+    static long long test(...);
+    static FromType object; // helper object to handle private c'tor and d'tor
+public:
+    // test(object) only has 'long long' return type iff the compiler doesn't choose test(...)
+    enum { exists = (sizeof(test(object)) == sizeof(char)) };
+};
+
+#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
+#  pragma warning(pop)
+#endif
+
+
+////////////////////////////////////
+//// ACTUAL CONVERSION SEQUENCE ////
+////////////////////////////////////
+/*
+    There is a distinct priority when choosing the right conversion function:
+    Overwrite:
+    1. (Partial) template specialisation of ConverterExplicit::convert()
+    Fallbacks:
+    2. Any possible implicit conversion. This includes 'FooBar' --> 'int' if FooBar defines operator float().
+    3. Global or member operators for stringstream when converting from or to std::string (or FROM const char*)
+    4. (Partial) template specialisation of ConverterFallback::convert()
+    5. Function that simply displays "Could not convert value" with type information obtained from typeid().
+
+    Notes:
+    There has to be an exact type match when using template specialisations.
+    Template specialisations can be defined after including this file. Any implicit cast function or iostream
+    operator has to be declared BEFORE this file gets parsed.
+
+    Defining your own functions:
+    There are obviously 4 ways to specifiy a user defined conversion. What should I use?
+
+    Usually, ConverterFallback fits quite well. You won't have to deal with the conversion from
+    'MyClass' to 'MyClass' by using another explicit template specialisation to avoid ambiguities.
+
+    However if you want to overwrite an implicit conversion or an iostream operator, you really need to
+    make use of ConverterExplicit.
+*/
+
+namespace
+{
+    //! Little template that maps integers to entire types (Alexandrescu 2001)
+    template <int I>
+    struct Int2Type { };
+}
+
+
+///////////////////
+// No Conversion //
+///////////////////
+
+// Default template. No conversion available at all.
+template <class FromType, class ToType>
+struct ConverterFallback
+{
     static bool convert(ToType* output, const FromType& input)
     {
-        COUT(2) << "Warning: Couldn't convert a value: From \"" << typeid(FromType).name() << "\" to \"" << typeid(ToType).name() << "\"" << std::endl;
+        COUT(2) << "Could not convert value of type " << typeid(FromType).name()
+                << " to type " << typeid(ToType).name() << std::endl;
         return false;
     }
 };
 
-
-// The default convert function if both types are the same
-template <class BothTypes>
-struct ConverterSpecialized<BothTypes, BothTypes, _Explicit_>
-{
-    enum { specialized = true };
-    static bool convert(BothTypes* output, const BothTypes& input)
-    { (*output) = input; return true; }
-};
-
-
-// The possible levels
-#define __low__  0 // Everything that is or behaves like a primitive type (an can be converted with a typecast to every other low-level type)
-#define __mid__  1 // Everything that has overloaded << and >> operators to operate on a std::stream
-#define __high__ 2 // Everything that doesn't fullfill the lowerlevel-requirements and therefore needs specialized conversions
-
-// Defines the levels of all types: Default is __high__ so you don't have to define every high-level type
-template <class T> struct ConverterLevel              { enum { level = __high__ }; };
-template <> struct ConverterLevel<std::string>        { enum { level = __mid__ }; };
-template <> struct ConverterLevel<orxonox::Radian>    { enum { level = __mid__ }; };
-template <> struct ConverterLevel<orxonox::Degree>    { enum { level = __mid__ }; };
-template <> struct ConverterLevel<int>                { enum { level = __low__ }; };
-template <> struct ConverterLevel<unsigned int>       { enum { level = __low__ }; };
-template <> struct ConverterLevel<char>               { enum { level = __low__ }; };
-template <> struct ConverterLevel<unsigned char>      { enum { level = __low__ }; };
-template <> struct ConverterLevel<short>              { enum { level = __low__ }; };
-template <> struct ConverterLevel<unsigned short>     { enum { level = __low__ }; };
-template <> struct ConverterLevel<long>               { enum { level = __low__ }; };
-template <> struct ConverterLevel<unsigned long>      { enum { level = __low__ }; };
-template <> struct ConverterLevel<long long>          { enum { level = __low__ }; };
-template <> struct ConverterLevel<unsigned long long> { enum { level = __low__ }; };
-template <> struct ConverterLevel<float>              { enum { level = __low__ }; };
-template <> struct ConverterLevel<double>             { enum { level = __low__ }; };
-template <> struct ConverterLevel<long double>        { enum { level = __low__ }; };
-template <> struct ConverterLevel<bool>               { enum { level = __low__ }; };
-
-
-// Calculates the preference based on the levels of FromType and ToType
-template <int from, int to>
-struct ConverterPreference
-{
-    enum
-    {
-        // The maximum of both levels: element of {0, 1, 2}
-        // max 0: Both types are primitives or have a similar behaviour
-        // max 1: At least one type is not a primitive, but both can be put on a std::stream
-        // max 2: There is at least one generic type that needs specialized conversions
-        max = (from > to) ? from : to,
-
-        // The difference between both levels limited to +-1: element of {-1, 0, 1}
-        // diff -1: The FromType has higher level than the ToType
-        // diff  0: Both types have the same level
-        // diff  1: The ToType has higher level than the FromType
-        diff = ((to - from) > 1) ? 1 : (((to - from) < -1) ? -1 : to - from)
-    };
-};
-
-
-// The default conversion: This usually does nothing
-template <int max, class FromType, class ToType>
-struct ConverterDefault
+// If all else fails, try a dynamic_cast for pointer types.
+template <class FromType, class ToType>
+struct ConverterFallback<FromType*, ToType*>
+{
+    static bool convert(ToType** output, FromType* const input)
+    {
+        ToType* temp = dynamic_cast<ToType*>(input);
+        if (temp)
+        {
+            *output = temp;
+            return true;
+        }
+        else
+            return false;
+    }
+};
+
+
+///////////////////////
+// ConverterFallback //
+///////////////////////
+
+// Default template for stringstream
+template <class FromType, class ToType>
+struct ConverterStringStream
 {
     static bool convert(ToType* output, const FromType& input)
     {
-        COUT(2) << "Warning: Couldn't convert a value: From \"" << typeid(FromType).name() << "\" to \"" << typeid(ToType).name() << "\"" << std::endl;
-        return false;
-    }
-};
-// The default conversion for primitives: A typecast (defined over two partial specialized templates to exclude all non-primitive types and classes)    template <int max, class FromType, class ToType>
-template <class FromType, class ToType>
-struct ConverterDefault<0, FromType, ToType>
-{
-    static bool convert(ToType* output, const FromType& input)
-    {
-        (*output) = (ToType)input;
-        return true;
-    }
-};
-
-
-// Converter: Converts input of FromType into output of ToType
-template <int diff, int max, class FromType, class ToType, ConversionPreference pref>
-struct Converter
-{
-    static bool convert(ToType* output, const FromType& input)
-    {
-        return false;
-    }
-};
-// Converter: level{FromType} > level{ToType}
-template <int max, class FromType, class ToType, ConversionPreference pref>
-struct Converter<-1, max, FromType, ToType, pref>
-{   static bool convert(ToType* output, const FromType& input)
-    { return (ConverterSpecialized<FromType, ToType, _Explicit_>::specialized) ? (ConverterSpecialized<FromType, ToType, _Explicit_>::convert(output, input)) : (ConverterSpecialized<FromType, ToType, _FromType_>::specialized) ? (ConverterSpecialized<FromType, ToType, _FromType_>::convert(output, input)) : (ConverterDefault<max, FromType, ToType>::convert(output, input)); } };
-// Converter: level{FromType} < level{ToType}
-template <int max, class FromType, class ToType, ConversionPreference pref>
-struct Converter<1, max, FromType, ToType, pref>
-{   static bool convert(ToType* output, const FromType& input)
-    { return (ConverterSpecialized<FromType, ToType, _Explicit_>::specialized) ? (ConverterSpecialized<FromType, ToType, _Explicit_>::convert(output, input)) : (ConverterSpecialized<FromType, ToType, _ToType_>::specialized) ? (ConverterSpecialized<FromType, ToType, _ToType_>::convert(output, input)) : (ConverterDefault<max, FromType, ToType>::convert(output, input)); } };
-// Converter: level{FromType} = level{ToType}
-// CP_PreferToType
-template <int max, class FromType, class ToType>
-struct Converter<0, max, FromType, ToType, CP_PreferToType>
-{   static bool convert(ToType* output, const FromType& input)
-    { return (ConverterSpecialized<FromType, ToType, _Explicit_>::specialized) ? (ConverterSpecialized<FromType, ToType, _Explicit_>::convert(output, input)) : (ConverterSpecialized<FromType, ToType, _ToType_>::specialized) ? (ConverterSpecialized<FromType, ToType, _ToType_>::convert(output, input)) : (ConverterSpecialized<FromType, ToType, _FromType_>::specialized) ? (ConverterSpecialized<FromType, ToType, _FromType_>::convert(output, input)) : (ConverterDefault<max, FromType, ToType>::convert(output, input)); } };
-// CP_PreferFromType
-template <int max, class FromType, class ToType>
-struct Converter<0, max, FromType, ToType, CP_PreferFromType>
-{   static bool convert(ToType* output, const FromType& input)
-    { return (ConverterSpecialized<FromType, ToType, _Explicit_>::specialized) ? (ConverterSpecialized<FromType, ToType, _Explicit_>::convert(output, input)) : (ConverterSpecialized<FromType, ToType, _FromType_>::specialized) ? (ConverterSpecialized<FromType, ToType, _FromType_>::convert(output, input)) : (ConverterSpecialized<FromType, ToType, _ToType_>::specialized) ? (ConverterSpecialized<FromType, ToType, _ToType_>::convert(output, input)) : (ConverterDefault<max, FromType, ToType>::convert(output, input)); } };
-
-
-// Calls the Converter::convertValue function with the correct template type parameters calculated by ConverterPreference
-template <class FromType, class ToType>
-static bool convertValue(ToType* output, const FromType& input, ConversionPreference preference = CP_PreferToType)
-{
-    return (preference == CP_PreferToType) ?
-           Converter<ConverterPreference<ConverterLevel<FromType>::level, ConverterLevel<ToType>::level>::diff,
-                     ConverterPreference<ConverterLevel<FromType>::level, ConverterLevel<ToType>::level>::max,
-                     FromType,
-                     ToType,
-                     CP_PreferToType>::convert(output, input)
-         : Converter<ConverterPreference<ConverterLevel<FromType>::level, ConverterLevel<ToType>::level>::diff,
-                     ConverterPreference<ConverterLevel<FromType>::level, ConverterLevel<ToType>::level>::max,
-                     FromType,
-                     ToType,
-                     CP_PreferFromType>::convert(output, input);
-}
-
-
-//////////////////////
-// HELPER FUNCTIONS //
-//////////////////////
-
-// Helper function: Calls convertValue with and without default value and returns true if the conversion was successful
-template<class FromType, class ToType>
-static bool ConvertValue(ToType* output, const FromType& input, ConversionPreference preference = CP_PreferToType)
-{
-    return convertValue(output, input, preference);
-}
-template<class FromType, class ToType>
-static bool ConvertValue(ToType* output, const FromType& input, const ToType& fallback, ConversionPreference preference = CP_PreferToType)
-{
-    if (convertValue(output, input, preference))
-        return true;
-
-    (*output) = fallback;
-    return false;
-}
-
-// Helper function: Calls convertValue with and without default value and returns the converted value
-template<class FromType, class ToType>
-static ToType getConvertedValue(const FromType& input, ConversionPreference preference = CP_PreferToType)
-{
-    ToType output = ToType();
-    ConvertValue(&output, input, preference);
-    return output;
-}
-template<class FromType, class ToType>
-static ToType getConvertedValue(const FromType& input, const ToType& fallback, ConversionPreference preference = CP_PreferToType)
-{
-    ToType output = fallback;
-    ConvertValue(&output, input, fallback, preference);
-    return output;
-}
-
-
-/////////////////////
-// SPECIALIZATIONS //
-/////////////////////
+        return ConverterFallback<FromType, ToType>::convert(output, input);
+    }
+};
+
 
 /////////////
-// SAMPLES //
+// OStream //
 /////////////
-/*
-// convert everything to xyz
+
+namespace fallbackTemplates
+{
+    template <class FromType>
+    inline bool operator <<(std::ostream& outstream,  const FromType& input)
+    {
+        std::string temp;
+        if (ConverterFallback<FromType, std::string>::convert(&temp, input))
+        {
+            std::operator <<(outstream, temp);
+            return true;
+        }
+        else
+            return false;
+    }
+}
+
+// template that evaluates whether we can convert to std::string via ostringstream
 template <class FromType>
-struct ConverterSpecialized<FromType, xyz, _ToType_>
-{
-    enum { specialized = true };
-    static bool convert(xyz* output, const FromType& input)
-    { return ...; }
-};
-
-// convert xyz to everything
-template <class ToType>
-struct ConverterSpecialized<xyz, ToType, _FromType_>
-{
-    enum { specialized = true };
-    static bool convert(ToType* output, const xyz& input)
-    { return ...; }
-};
-
-// convert abc to xyz
-template <>
-struct ConverterSpecialized<abc, xyz, _Explicit_>
-{
-    enum { specialized = true };
-    static bool convert(xyz* output, const abc& input)
-    { return ...; }
-};
-*/
-
-////////////
-// STRING //
-////////////
-
-// convert to string
-template <class FromType>
-struct ConverterSpecialized<FromType, std::string, _ToType_>
-{
-    enum { specialized = true };
+struct ConverterStringStream<FromType, std::string>
+{
     static bool convert(std::string* output, const FromType& input)
     {
+        using namespace fallbackTemplates;
+        // this operator call only chooses fallbackTemplates::operator<< if there's no other fitting function
         std::ostringstream oss;
         if (oss << input)
@@ -307,18 +214,264 @@
 };
 
+
+/////////////
+// IStream //
+/////////////
+
+namespace fallbackTemplates
+{
+    template <class ToType>
+    inline bool operator >>(std::istream& instream, ToType& output)
+    {
+        return ConverterFallback<std::string, ToType>
+            ::convert(&output, static_cast<std::istringstream&>(instream).str());
+    }
+}
+
+// template that evaluates whether we can convert from std::string via ostringstream
+template <class ToType>
+struct ConverterStringStream<std::string, ToType>
+{
+    static bool convert(ToType* output, const std::string& input)
+    {
+        using namespace fallbackTemplates;
+        std::istringstream iss(input);
+        // this operator call only chooses fallbackTemplates::operator>> if there's no other fitting function
+        if (iss >> (*output))
+        {
+            return true;
+        }
+        else
+            return false;
+    }
+};
+
+
+///////////////////
+// Implicit Cast //
+///////////////////
+
+// implicit cast not possible, try stringstream conversion next
+template <class FromType, class ToType>
+inline bool convertImplicitely(ToType* output, const FromType& input, ::Int2Type<false>)
+{
+    return ConverterStringStream<FromType, ToType>::convert(output, input);
+}
+
+// We can cast implicitely
+template <class FromType, class ToType>
+inline bool convertImplicitely(ToType* output, const FromType& input, ::Int2Type<true>)
+{
+    (*output) = static_cast<ToType>(input);
+    return true;
+}
+
+
+////////////////////////////////
+// ConverterExplicit Fallback //
+////////////////////////////////
+
+// Default template if no specialisation is available
+template <class FromType, class ToType>
+struct ConverterExplicit
+{
+    static bool convert(ToType* output, const FromType& input)
+    {
+        // Try implict cast and probe first. If a simple cast is not possible, it will not compile
+        // We therefore have to out source it into another template function
+        const bool probe = ImplicitConversion<FromType, ToType>::exists;
+        return convertImplicitely(output, input, ::Int2Type<probe>());
+    }
+};
+
+
+//////////////////////
+// Public Functions //
+//////////////////////
+
+/**
+@brief
+    Converts any value to any other as long as there exists a conversion.
+    Otherwise, the conversion will generate a runtime warning and return false.
+    For information about the different conversion methods (user defined too), see the section
+    'Actual conversion sequence' in this file above.
+*/
+template <class FromType, class ToType>
+inline bool convertValue(ToType* output, const FromType& input)
+{
+    return ConverterExplicit<FromType, ToType>::convert(output, input);
+}
+
+// For compatibility reasons. The same, but with capital ConvertValue
+template<class FromType, class ToType>
+inline bool ConvertValue(ToType* output, const FromType& input)
+{
+    return convertValue(output, input);
+}
+
+// Calls convertValue and returns true if the conversion was successful.
+// Otherwise the fallback is used.
+/**
+@brief
+    Converts any value to any other as long as there exists a conversion.
+    Otherwise, the conversion will generate a runtime warning and return false.
+    For information about the different conversion methods (user defined too), see the section
+    'Actual conversion sequence' in this file above.
+    If the conversion doesn't succeed, 'fallback' is written to '*output'.
+@param fallback
+    A default value that gets written to '*output' if there is no conversion.
+*/
+template<class FromType, class ToType>
+inline bool convertValue(ToType* output, const FromType& input, const ToType& fallback)
+{
+    if (convertValue(output, input))
+        return true;
+    else
+    {
+        (*output) = fallback;
+        return false;
+    }
+}
+
+// for compatibility reason. (capital 'c' in ConvertValue)
+template<class FromType, class ToType>
+inline bool ConvertValue(ToType* output, const FromType& input, const ToType& fallback)
+{
+    return convertValue(output, input, fallback);
+}
+
+// Directly returns the converted value, even if the conversion was not successful.
+template<class FromType, class ToType>
+inline ToType getConvertedValue(const FromType& input)
+{
+    ToType output;
+    convertValue(&output, input);
+    return output;
+}
+
+// Directly returns the converted value, but uses the fallback on failure.
+template<class FromType, class ToType>
+inline ToType getConvertedValue(const FromType& input, const ToType& fallback)
+{
+    ToType output;
+    convertValue(&output, input, fallback);
+    return output;
+}
+
+// Like getConvertedValue, but the template argument order is in reverse.
+// That means you can call it exactly like static_cast<ToType>(fromTypeValue).
+template<class ToType, class FromType>
+inline ToType omni_cast(const FromType& input)
+{
+    ToType output;
+    convertValue(&output, input);
+    return output;
+}
+
 // convert to string Shortcut
 template <class FromType>
-std::string convertToString(FromType value)
+inline std::string convertToString(FromType value)
 {
   return getConvertedValue<FromType, std::string>(value);
 }
 
-// convert from string
+// convert from string Shortcut
 template <class ToType>
-struct ConverterSpecialized<std::string, ToType, _FromType_>
-{
-    enum { specialized = true };
-    static bool convert(ToType* output, const std::string& input)
-    {
+inline ToType convertFromString(std::string str)
+{
+  return getConvertedValue<std::string, ToType>(str);
+}
+
+////////////////////////////////
+// Special string conversions //
+////////////////////////////////
+
+// Delegate conversion from const char* to std::string
+template <class ToType>
+struct ConverterExplicit<const char*, ToType>
+{
+    static bool convert(ToType* output, const char* input)
+    {
+        return convertValue<std::string, ToType>(output, input);
+    }
+};
+
+// These conversions would exhibit ambiguous << or >> operators when using stringstream
+template <>
+struct ConverterExplicit<char, std::string>
+{
+    static bool convert(std::string* output, const char input)
+    {
+        *output = std::string(1, input);
+        return true;
+    }
+};
+template <>
+struct ConverterExplicit<unsigned char, std::string>
+{
+    static bool convert(std::string* output, const unsigned char input)
+    {
+        *output = std::string(1, input);
+        return true;
+    }
+};
+template <>
+struct ConverterExplicit<std::string, char>
+{
+    static bool convert(char* output, const std::string input)
+    {
+        if (input != "")
+            *output = input[0];
+        else
+            *output = '\0';
+        return true;
+    }
+};
+template <>
+struct ConverterExplicit<std::string, unsigned char>
+{
+    static bool convert(unsigned char* output, const std::string input)
+    {
+        if (input != "")
+            *output = input[0];
+        else
+            *output = '\0';
+        return true;
+    }
+};
+
+
+// bool to std::string
+template <>
+struct ConverterExplicit<bool, std::string>
+{
+    static bool convert(std::string* output, const bool& input)
+    {
+        if (input)
+          *output = "true";
+        else
+          *output = "false";
+        return false;
+    }
+};
+
+// std::string to bool
+template <>
+struct ConverterExplicit<std::string, bool>
+{
+    static bool convert(bool* output, const std::string& input)
+    {
+        std::string stripped = getLowercase(removeTrailingWhitespaces(input));
+        if (stripped == "true" || stripped == "on" || stripped == "yes")
+        {
+          *output = true;
+          return true;
+        }
+        else if (stripped == "false" || stripped == "off" || stripped == "no")
+        {
+          *output = false;
+          return true;
+        }
+
         std::istringstream iss(input);
         if (iss >> (*output))
@@ -329,345 +482,3 @@
 };
 
-// convert from string Shortcut
-template <class ToType>
-ToType convertFromString(std::string str)
-{
-  return getConvertedValue<std::string, ToType>(str);
-}
-
-
-//////////
-// MATH //
-//////////
-// convert everything to Degree
-template <class FromType>
-struct ConverterSpecialized<FromType, Ogre::Degree, _ToType_>
-{
-    enum { specialized = true };
-    static bool convert(Ogre::Degree* output, const FromType& input)
-    {
-        float angle = 0;
-        bool success = ConvertValue<FromType, float>(&angle, input);
-        (*output) = angle;
-        return success;
-    }
-};
-
-// convert everything to Radian
-template <class FromType>
-struct ConverterSpecialized<FromType, Ogre::Radian, _ToType_>
-{
-    enum { specialized = true };
-    static bool convert(Ogre::Radian* output, const FromType& input)
-    {
-        float angle = 0;
-        bool success = ConvertValue<FromType, float>(&angle, input);
-        (*output) = angle;
-        return success;
-    }
-};
-
-
-////////////////////
-// MATH TO STRING //
-////////////////////
-
-// bool to std::string
-template <>
-struct ConverterSpecialized<bool, std::string, _Explicit_>
-{
-    enum { specialized = true };
-    static bool convert(std::string* output, const bool& input)
-    {
-        if (input)
-          *output = "true";
-        else
-          *output = "false";
-        return false;
-    }
-};
-
-// Vector2 to std::string
-template <>
-struct ConverterSpecialized<orxonox::Vector2, std::string, _Explicit_>
-{
-    enum { specialized = true };
-    static bool convert(std::string* output, const orxonox::Vector2& input)
-    {
-        std::ostringstream ostream;
-        if (ostream << input.x << "," << input.y)
-        {
-            (*output) = ostream.str();
-            return true;
-        }
-        return false;
-    }
-};
-
-// Vector3 to std::string
-template <>
-struct ConverterSpecialized<orxonox::Vector3, std::string, _Explicit_>
-{
-    enum { specialized = true };
-    static bool convert(std::string* output, const orxonox::Vector3& input)
-    {
-        std::ostringstream ostream;
-        if (ostream << input.x << "," << input.y << "," << input.z)
-        {
-            (*output) = ostream.str();
-            return true;
-        }
-        return false;
-    }
-};
-
-// Vector4 to std::string
-template <>
-struct ConverterSpecialized<orxonox::Vector4, std::string, _Explicit_>
-{
-    enum { specialized = true };
-    static bool convert(std::string* output, const orxonox::Vector4& input)
-    {
-        std::ostringstream ostream;
-        if (ostream << input.x << "," << input.y << "," << input.z << "," << input.w)
-        {
-            (*output) = ostream.str();
-            return true;
-        }
-        return false;
-    }
-};
-
-// Quaternion to std::string
-template <>
-struct ConverterSpecialized<orxonox::Quaternion, std::string, _Explicit_>
-{
-    enum { specialized = true };
-    static bool convert(std::string* output, const orxonox::Quaternion& input)
-    {
-        std::ostringstream ostream;
-        if (ostream << input.w << "," << input.x << "," << input.y << "," << input.z)
-        {
-            (*output) = ostream.str();
-            return true;
-        }
-        return false;
-    }
-};
-
-// ColourValue to std::string
-template <>
-struct ConverterSpecialized<orxonox::ColourValue, std::string, _Explicit_>
-{
-    enum { specialized = true };
-    static bool convert(std::string* output, const orxonox::ColourValue& input)
-    {
-        std::ostringstream ostream;
-        if (ostream << input.r << "," << input.g << "," << input.b << "," << input.a)
-        {
-            (*output) = ostream.str();
-            return true;
-        }
-        return false;
-    }
-};
-
-
-////////////////////
-// STRING TO MATH //
-////////////////////
-
-// std::string to bool
-template <>
-struct ConverterSpecialized<std::string, bool, _Explicit_>
-{
-    enum { specialized = true };
-    static bool convert(bool* output, const std::string& input)
-    {
-        std::string stripped = getLowercase(removeTrailingWhitespaces(input));
-        if (stripped == "true" || stripped == "on" || stripped == "yes")
-        {
-          *output = true;
-          return true;
-        }
-        else if (stripped == "false" || stripped == "off" || stripped == "no")
-        {
-          *output = false;
-          return true;
-        }
-
-        std::istringstream iss(input);
-        if (iss >> (*output))
-            return true;
-        else
-            return false;
-    }
-};
-
-// std::string to Vector2
-template <>
-struct ConverterSpecialized<std::string, orxonox::Vector2, _Explicit_>
-{
-    enum { specialized = true };
-    static bool convert(orxonox::Vector2* output, const std::string& input)
-    {
-        size_t opening_parenthesis, closing_parenthesis = input.find(')');
-        if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; }
-
-        SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
-        if (tokens.size() >= 2)
-        {
-            if (!ConvertValue(&(output->x), tokens[0]))
-                return false;
-            if (!ConvertValue(&(output->y), tokens[1]))
-                return false;
-
-            return true;
-        }
-        return false;
-    }
-};
-
-// std::string to Vector3
-template <>
-struct ConverterSpecialized<std::string, orxonox::Vector3, _Explicit_>
-{
-    enum { specialized = true };
-    static bool convert(orxonox::Vector3* output, const std::string& input)
-    {
-        size_t opening_parenthesis, closing_parenthesis = input.find(')');
-        if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; }
-
-        SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
-        if (tokens.size() >= 3)
-        {
-            if (!ConvertValue(&(output->x), tokens[0]))
-                return false;
-            if (!ConvertValue(&(output->y), tokens[1]))
-                return false;
-            if (!ConvertValue(&(output->z), tokens[2]))
-                return false;
-
-            return true;
-        }
-        return false;
-    }
-};
-
-// std::string to Vector4
-template <>
-struct ConverterSpecialized<std::string, orxonox::Vector4, _Explicit_>
-{
-    enum { specialized = true };
-    static bool convert(orxonox::Vector4* output, const std::string& input)
-    {
-        size_t opening_parenthesis, closing_parenthesis = input.find(')');
-        if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; }
-
-        SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
-        if (tokens.size() >= 4)
-        {
-            if (!ConvertValue(&(output->x), tokens[0]))
-                return false;
-            if (!ConvertValue(&(output->y), tokens[1]))
-                return false;
-            if (!ConvertValue(&(output->z), tokens[2]))
-                return false;
-            if (!ConvertValue(&(output->w), tokens[3]))
-                return false;
-
-            return true;
-        }
-        return false;
-    }
-};
-
-// std::string to Quaternion
-template <>
-struct ConverterSpecialized<std::string, orxonox::Quaternion, _Explicit_>
-{
-    enum { specialized = true };
-    static bool convert(orxonox::Quaternion* output, const std::string& input)
-    {
-        size_t opening_parenthesis, closing_parenthesis = input.find(')');
-        if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; }
-
-        SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
-        if (tokens.size() >= 4)
-        {
-            if (!ConvertValue(&(output->w), tokens[0]))
-                return false;
-            if (!ConvertValue(&(output->x), tokens[1]))
-                return false;
-            if (!ConvertValue(&(output->y), tokens[2]))
-                return false;
-            if (!ConvertValue(&(output->z), tokens[3]))
-                return false;
-
-            return true;
-        }
-        return false;
-    }
-};
-
-// std::string to ColourValue
-template <>
-struct ConverterSpecialized<std::string, orxonox::ColourValue, _Explicit_>
-{
-    enum { specialized = true };
-    static bool convert(orxonox::ColourValue* output, const std::string& input)
-    {
-        size_t opening_parenthesis, closing_parenthesis = input.find(')');
-        if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; }
-
-        SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
-        if (tokens.size() >= 3)
-        {
-            if (!ConvertValue(&(output->r), tokens[0]))
-                return false;
-            if (!ConvertValue(&(output->g), tokens[1]))
-                return false;
-            if (!ConvertValue(&(output->b), tokens[2]))
-                return false;
-            if (tokens.size() >= 4)
-            {
-                if (!ConvertValue(&(output->a), tokens[3]))
-                    return false;
-            }
-            else
-                output->a = 1.0;
-
-            return true;
-        }
-        return false;
-    }
-};
-
-
-///////////////////////////
-// Static type detection //
-///////////////////////////
-
-/**
-    Template class that determines whether type T converts implicitly to type U.
-@note
-    This allows to detect type conversion at compile time.
-    From 'Modern C++ Design' (Alexandrescu 2001).
-*/
-template <class T, class U>
-class StaticConversion
-{
-    class Small { char dummy[1]; };
-    class Big   { char dummy[1024]; };
-    static Small Test(U);
-    static Big   Test(...);
-    static T MakeT();
-public:
-    enum { exists = sizeof(Test(MakeT())) == sizeof(Small) };
-};
-
-#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
-#pragma warning(pop)
-#endif
-
 #endif /* _Convert_H__ */
Index: code/trunk/src/util/Debug.h
===================================================================
--- code/trunk/src/util/Debug.h	(revision 1937)
+++ code/trunk/src/util/Debug.h	(revision 2087)
@@ -77,4 +77,8 @@
 }
 
+namespace orxonox
+{
+    using std::endl;
+}
 
 // DEFINE ERROR MODES
Index: code/trunk/src/util/Math.cc
===================================================================
--- code/trunk/src/util/Math.cc	(revision 1937)
+++ code/trunk/src/util/Math.cc	(revision 2087)
@@ -28,12 +28,13 @@
 
 /**
-    @file Math.cc
+    @file
     @brief Implementation of several math-functions.
 */
 
+#include "Math.h"
+
 #include <OgrePlane.h>
-
-#include "Math.h"
-#include "Convert.h"
+#include "MathConvert.h"
+#include "SubString.h"
 
 /**
@@ -201,6 +202,132 @@
 }
 
-std::string getUniqueNumberStr()
-{
-    return convertToString(getUniqueNumber());
-}
+
+//////////////////////////
+// Conversion functions //
+//////////////////////////
+
+// std::string to Vector2
+bool ConverterFallback<std::string, orxonox::Vector2>::convert(orxonox::Vector2* output, const std::string& input)
+{
+    size_t opening_parenthesis, closing_parenthesis = input.find(')');
+    if ((opening_parenthesis = input.find('(')) == std::string::npos)
+        opening_parenthesis = 0;
+    else
+        opening_parenthesis++;
+
+    SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis),
+                     ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
+    if (tokens.size() >= 2)
+    {
+        if (!ConvertValue(&(output->x), tokens[0]))
+            return false;
+        if (!ConvertValue(&(output->y), tokens[1]))
+            return false;
+
+        return true;
+    }
+    return false;
+}
+
+// std::string to Vector3
+bool ConverterFallback<std::string, orxonox::Vector3>::convert(orxonox::Vector3* output, const std::string& input)
+{
+    size_t opening_parenthesis, closing_parenthesis = input.find(')');
+    if ((opening_parenthesis = input.find('(')) == std::string::npos)
+        opening_parenthesis = 0;
+    else
+        opening_parenthesis++;
+
+    SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis),
+                     ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
+    if (tokens.size() >= 3)
+    {
+        if (!ConvertValue(&(output->x), tokens[0]))
+            return false;
+        if (!ConvertValue(&(output->y), tokens[1]))
+            return false;
+        if (!ConvertValue(&(output->z), tokens[2]))
+            return false;
+
+        return true;
+    }
+    return false;
+}
+
+// std::string to Vector4
+bool ConverterFallback<std::string, orxonox::Vector4>::convert(orxonox::Vector4* output, const std::string& input)
+{
+    size_t opening_parenthesis, closing_parenthesis = input.find(')');
+    if ((opening_parenthesis = input.find('(')) == std::string::npos)
+        opening_parenthesis = 0;
+    else
+        opening_parenthesis++;
+
+    SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis),
+                     ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
+    if (tokens.size() >= 4)
+    {
+        if (!ConvertValue(&(output->x), tokens[0]))
+            return false;
+        if (!ConvertValue(&(output->y), tokens[1]))
+            return false;
+        if (!ConvertValue(&(output->z), tokens[2]))
+            return false;
+        if (!ConvertValue(&(output->w), tokens[3]))
+            return false;
+
+        return true;
+    }
+    return false;
+}
+
+// std::string to Quaternion
+bool ConverterFallback<std::string, orxonox::Quaternion>::convert(orxonox::Quaternion* output, const std::string& input)
+{
+    size_t opening_parenthesis, closing_parenthesis = input.find(')');
+    if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; }
+
+    SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
+    if (tokens.size() >= 4)
+    {
+        if (!ConvertValue(&(output->w), tokens[0]))
+            return false;
+        if (!ConvertValue(&(output->x), tokens[1]))
+            return false;
+        if (!ConvertValue(&(output->y), tokens[2]))
+            return false;
+        if (!ConvertValue(&(output->z), tokens[3]))
+            return false;
+
+        return true;
+    }
+    return false;
+}
+
+// std::string to ColourValue
+bool ConverterFallback<std::string, orxonox::ColourValue>::convert(orxonox::ColourValue* output, const std::string& input)
+{
+    size_t opening_parenthesis, closing_parenthesis = input.find(')');
+    if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; }
+
+    SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
+    if (tokens.size() >= 3)
+    {
+        if (!ConvertValue(&(output->r), tokens[0]))
+            return false;
+        if (!ConvertValue(&(output->g), tokens[1]))
+            return false;
+        if (!ConvertValue(&(output->b), tokens[2]))
+            return false;
+        if (tokens.size() >= 4)
+        {
+            if (!ConvertValue(&(output->a), tokens[3]))
+                return false;
+        }
+        else
+            output->a = 1.0;
+
+        return true;
+    }
+    return false;
+}
Index: code/trunk/src/util/Math.h
===================================================================
--- code/trunk/src/util/Math.h	(revision 1937)
+++ code/trunk/src/util/Math.h	(revision 2087)
@@ -39,4 +39,5 @@
 #include <ostream>
 #include <string>
+#include <boost/static_assert.hpp>
 
 #include <OgreMath.h>
@@ -189,4 +190,35 @@
 }
 
+template <typename T>
+inline T zeroise()
+{
+    BOOST_STATIC_ASSERT(sizeof(T) == 0);
+    return T();
+}
+
+template <> inline char                 zeroise<char>()                 { return 0; }
+template <> inline unsigned char        zeroise<unsigned char>()        { return 0; }
+template <> inline short                zeroise<short>()                { return 0; }
+template <> inline unsigned short       zeroise<unsigned short>()       { return 0; }
+template <> inline int                  zeroise<int>()                  { return 0; }
+template <> inline unsigned int         zeroise<unsigned int>()         { return 0; }
+template <> inline long                 zeroise<long>()                 { return 0; }
+template <> inline unsigned long        zeroise<unsigned long>()        { return 0; }
+template <> inline long long            zeroise<long long>()            { return 0; }
+template <> inline unsigned long long   zeroise<unsigned long long>()   { return 0; }
+template <> inline float                zeroise<float>()                { return 0; }
+template <> inline double               zeroise<double>()               { return 0; }
+template <> inline long double          zeroise<long double>()          { return 0; }
+template <> inline bool                 zeroise<bool>()                 { return 0; }
+template <> inline void*                zeroise<void*>()                { return 0; }
+template <> inline std::string          zeroise<std::string>()          { return ""; }
+template <> inline orxonox::Radian      zeroise<orxonox::Radian>()      { return orxonox::Radian(0.0f); }
+template <> inline orxonox::Degree      zeroise<orxonox::Degree>()      { return orxonox::Degree(0.0f); }
+template <> inline orxonox::Vector2     zeroise<orxonox::Vector2>()     { return orxonox::Vector2    (0, 0)      ; }
+template <> inline orxonox::Vector3     zeroise<orxonox::Vector3>()     { return orxonox::Vector3    (0, 0, 0)   ; }
+template <> inline orxonox::Vector4     zeroise<orxonox::Vector4>()     { return orxonox::Vector4    (0, 0, 0, 0); }
+template <> inline orxonox::ColourValue zeroise<orxonox::ColourValue>() { return orxonox::ColourValue(0, 0, 0, 0); }
+template <> inline orxonox::Quaternion  zeroise<orxonox::Quaternion>()  { return orxonox::Quaternion (0, 0, 0, 0); }
+
 /**
     @brief Interpolates between two values for a time between 0 and 1.
@@ -243,5 +275,4 @@
 
 _UtilExport unsigned long getUniqueNumber();
-_UtilExport std::string getUniqueNumberStr();
 
 class _UtilExport IntVector2
Index: code/trunk/src/util/MathConvert.h
===================================================================
--- code/trunk/src/util/MathConvert.h	(revision 2087)
+++ code/trunk/src/util/MathConvert.h	(revision 2087)
@@ -0,0 +1,207 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ */
+
+/**
+    @file
+    @brief
+        Math conversion functions. Definitions are in Math.cc
+*/
+
+#ifndef _MathConvert_H__
+#define _MathConvert_H__
+
+#include "UtilPrereqs.h"
+#include "Math.h"
+#include "Convert.h"
+
+
+////////////////////
+// Math to string //
+////////////////////
+
+// Vector2 to std::string
+template <>
+struct ConverterExplicit<orxonox::Vector2, std::string>
+{
+    static bool convert(std::string* output, const orxonox::Vector2& input)
+    {
+        std::ostringstream ostream;
+        if (ostream << input.x << "," << input.y)
+        {
+            (*output) = ostream.str();
+            return true;
+        }
+        return false;
+    }
+};
+
+// Vector3 to std::string
+template <>
+struct ConverterExplicit<orxonox::Vector3, std::string>
+{
+    static bool convert(std::string* output, const orxonox::Vector3& input)
+    {
+        std::ostringstream ostream;
+        if (ostream << input.x << "," << input.y << "," << input.z)
+        {
+            (*output) = ostream.str();
+            return true;
+        }
+        return false;
+    }
+};
+
+// Vector4 to std::string
+template <>
+struct ConverterExplicit<orxonox::Vector4, std::string>
+{
+    static bool convert(std::string* output, const orxonox::Vector4& input)
+    {
+        std::ostringstream ostream;
+        if (ostream << input.x << "," << input.y << "," << input.z << "," << input.w)
+        {
+            (*output) = ostream.str();
+            return true;
+        }
+        return false;
+    }
+};
+
+// Quaternion to std::string
+template <>
+struct ConverterExplicit<orxonox::Quaternion, std::string>
+{
+    static bool convert(std::string* output, const orxonox::Quaternion& input)
+    {
+        std::ostringstream ostream;
+        if (ostream << input.w << "," << input.x << "," << input.y << "," << input.z)
+        {
+            (*output) = ostream.str();
+            return true;
+        }
+        return false;
+    }
+};
+
+// ColourValue to std::string
+template <>
+struct ConverterExplicit<orxonox::ColourValue, std::string>
+{
+    static bool convert(std::string* output, const orxonox::ColourValue& input)
+    {
+        std::ostringstream ostream;
+        if (ostream << input.r << "," << input.g << "," << input.b << "," << input.a)
+        {
+            (*output) = ostream.str();
+            return true;
+        }
+        return false;
+    }
+};
+
+
+////////////////////
+// string to Math //
+////////////////////
+
+// std::string to Vector2
+template <> struct _UtilExport ConverterFallback<std::string, orxonox::Vector2>
+{ static bool convert(orxonox::Vector2*     output, const std::string& input); };
+// std::string to Vector3
+template <> struct _UtilExport ConverterFallback<std::string, orxonox::Vector3>
+{ static bool convert(orxonox::Vector3*     output, const std::string& input); };
+// std::string to Vector4
+template <> struct _UtilExport ConverterFallback<std::string, orxonox::Vector4>
+{ static bool convert(orxonox::Vector4*     output, const std::string& input); };
+// std::string to Quaternion
+template <> struct _UtilExport ConverterFallback<std::string, orxonox::Quaternion>
+{ static bool convert(orxonox::Quaternion*  output, const std::string& input); };
+// std::string to ColourValue
+template <> struct _UtilExport ConverterFallback<std::string, orxonox::ColourValue>
+{ static bool convert(orxonox::ColourValue* output, const std::string& input); };
+
+
+///////////////////////////////
+// From and to Radian/Degree //
+///////////////////////////////
+
+// From Radian
+template <class ToType>
+struct ConverterFallback<orxonox::Radian, ToType>
+{
+    static bool convert(ToType* output, const orxonox::Radian& input)
+    {
+        return convertValue<Ogre::Real, ToType>(output, input.valueRadians());
+    }
+};
+
+// From Degree
+template <class ToType>
+struct ConverterFallback<orxonox::Degree, ToType>
+{
+    static bool convert(ToType* output, const orxonox::Degree& input)
+    {
+        return convertValue<Ogre::Real, ToType>(output, input.valueDegrees());
+    }
+};
+
+// To Radian
+template <class FromType>
+struct ConverterFallback<FromType, orxonox::Radian>
+{
+    static bool convert(orxonox::Radian* output, const FromType& input)
+    {
+        float temp;
+        if (convertValue(&temp, input))
+        {
+            *output = temp;
+            return true;
+        }
+        else
+            return false;
+    }
+};
+
+// To Degree
+template <class FromType>
+struct ConverterFallback<FromType, orxonox::Degree>
+{
+    static bool convert(orxonox::Degree* output, const FromType& input)
+    {
+        float temp;
+        if (convertValue(&temp, input))
+        {
+            *output = temp;
+            return true;
+        }
+        else
+            return false;
+    }
+};
+
+#endif /* _MathConvert_H__ */
Index: code/trunk/src/util/MultiType.cc
===================================================================
--- code/trunk/src/util/MultiType.cc	(revision 1937)
+++ code/trunk/src/util/MultiType.cc	(revision 2087)
@@ -39,56 +39,56 @@
     @param type The type
 */
-void MultiType::convert(MT_Type type)
+bool MultiType::convert(MT_Type type)
 {
     switch (type)
     {
         case MT_char:
-            this->convert<char>(); break;
+            return this->convert<char>(); break;
         case MT_uchar:
-            this->convert<unsigned char>(); break;
+            return this->convert<unsigned char>(); break;
         case MT_short:
-            this->convert<short>(); break;
+            return this->convert<short>(); break;
         case MT_ushort:
-            this->convert<unsigned short>(); break;
+            return this->convert<unsigned short>(); break;
         case MT_int:
-            this->convert<int>(); break;
+            return this->convert<int>(); break;
         case MT_uint:
-            this->convert<unsigned int>(); break;
+            return this->convert<unsigned int>(); break;
         case MT_long:
-            this->convert<long>(); break;
+            return this->convert<long>(); break;
         case MT_ulong:
-            this->convert<unsigned long>(); break;
+            return this->convert<unsigned long>(); break;
         case MT_longlong:
-            this->convert<long long>(); break;
+            return this->convert<long long>(); break;
         case MT_ulonglong:
-            this->convert<unsigned long long>(); break;
+            return this->convert<unsigned long long>(); break;
         case MT_float:
-            this->convert<float>(); break;
+            return this->convert<float>(); break;
         case MT_double:
-            this->convert<double>(); break;
+            return this->convert<double>(); break;
         case MT_longdouble:
-            this->convert<long double>(); break;
+            return this->convert<long double>(); break;
         case MT_bool:
-            this->convert<bool>(); break;
+            return this->convert<bool>(); break;
         case MT_void:
-            this->convert<void*>(); break;
+            return this->convert<void*>(); break;
         case MT_string:
-            this->convert<std::string>(); break;
+            return this->convert<std::string>(); break;
         case MT_vector2:
-            this->convert<orxonox::Vector2>(); break;
+            return this->convert<orxonox::Vector2>(); break;
         case MT_vector3:
-            this->convert<orxonox::Vector3>(); break;
+            return this->convert<orxonox::Vector3>(); break;
         case MT_vector4:
-            this->convert<orxonox::Vector4>(); break;
+            return this->convert<orxonox::Vector4>(); break;
         case MT_colourvalue:
-            this->convert<orxonox::ColourValue>(); break;
+            return this->convert<orxonox::ColourValue>(); break;
         case MT_quaternion:
-            this->convert<orxonox::Quaternion>(); break;
+            return this->convert<orxonox::Quaternion>(); break;
         case MT_radian:
-            this->convert<orxonox::Radian>(); break;
+            return this->convert<orxonox::Radian>(); break;
         case MT_degree:
-            this->convert<orxonox::Degree>(); break;
+            return this->convert<orxonox::Degree>(); break;
         default:
-            this->reset(); break;
+            this->reset(); return false; break;
     };
 }
@@ -168,14 +168,14 @@
 MultiType::operator double()               const { return (this->value_) ? ((this->value_->type_ == MT_double     ) ? ((MT_Value<double>              *)this->value_)->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
 MultiType::operator long double()          const { return (this->value_) ? ((this->value_->type_ == MT_longdouble ) ? ((MT_Value<long double>         *)this->value_)->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
-MultiType::operator bool()                 const { return (this->value_) ? ((this->value_->type_ == MT_bool       ) ? ((MT_Value<bool>                *)this->value_)->value_ : (*this->value_)) : false;                  } /** @brief Returns the current value, converted to the requested type. */
-MultiType::operator void*()                const { return (this->value_) ? ((this->value_->type_ == MT_void       ) ? ((MT_Value<void*>               *)this->value_)->value_ : (*this->value_)) : (void*)0;               } /** @brief Returns the current value, converted to the requested type. */
-MultiType::operator std::string()          const { return (this->value_) ? ((this->value_->type_ == MT_string     ) ? ((MT_Value<std::string>         *)this->value_)->value_ : (*this->value_)) : std::string();          } /** @brief Returns the current value, converted to the requested type. */
-MultiType::operator orxonox::Vector2()     const { return (this->value_) ? ((this->value_->type_ == MT_vector2    ) ? ((MT_Value<orxonox::Vector2>    *)this->value_)->value_ : (*this->value_)) : orxonox::Vector2();     } /** @brief Returns the current value, converted to the requested type. */
-MultiType::operator orxonox::Vector3()     const { return (this->value_) ? ((this->value_->type_ == MT_vector3    ) ? ((MT_Value<orxonox::Vector3>    *)this->value_)->value_ : (*this->value_)) : orxonox::Vector3();     } /** @brief Returns the current value, converted to the requested type. */
-MultiType::operator orxonox::Vector4()     const { return (this->value_) ? ((this->value_->type_ == MT_vector4    ) ? ((MT_Value<orxonox::Vector4>    *)this->value_)->value_ : (*this->value_)) : orxonox::Vector4();     } /** @brief Returns the current value, converted to the requested type. */
-MultiType::operator orxonox::ColourValue() const { return (this->value_) ? ((this->value_->type_ == MT_colourvalue) ? ((MT_Value<orxonox::ColourValue>*)this->value_)->value_ : (*this->value_)) : orxonox::ColourValue(); } /** @brief Returns the current value, converted to the requested type. */
-MultiType::operator orxonox::Quaternion()  const { return (this->value_) ? ((this->value_->type_ == MT_quaternion ) ? ((MT_Value<orxonox::Quaternion> *)this->value_)->value_ : (*this->value_)) : orxonox::Quaternion();  } /** @brief Returns the current value, converted to the requested type. */
-MultiType::operator orxonox::Radian()      const { return (this->value_) ? ((this->value_->type_ == MT_radian     ) ? ((MT_Value<orxonox::Radian>     *)this->value_)->value_ : (*this->value_)) : orxonox::Radian();      } /** @brief Returns the current value, converted to the requested type. */
-MultiType::operator orxonox::Degree()      const { return (this->value_) ? ((this->value_->type_ == MT_degree     ) ? ((MT_Value<orxonox::Degree>     *)this->value_)->value_ : (*this->value_)) : orxonox::Degree();      } /** @brief Returns the current value, converted to the requested type. */
+MultiType::operator bool()                 const { return (this->value_) ? ((this->value_->type_ == MT_bool       ) ? ((MT_Value<bool>                *)this->value_)->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+MultiType::operator void*()                const { return (this->value_) ? ((this->value_->type_ == MT_void       ) ? ((MT_Value<void*>               *)this->value_)->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+MultiType::operator std::string()          const { return (this->value_) ? ((this->value_->type_ == MT_string     ) ? ((MT_Value<std::string>         *)this->value_)->value_ : (*this->value_)) : zeroise<std::string>();          } /** @brief Returns the current value, converted to the requested type. */
+MultiType::operator orxonox::Vector2()     const { return (this->value_) ? ((this->value_->type_ == MT_vector2    ) ? ((MT_Value<orxonox::Vector2>    *)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::Vector2>();     } /** @brief Returns the current value, converted to the requested type. */
+MultiType::operator orxonox::Vector3()     const { return (this->value_) ? ((this->value_->type_ == MT_vector3    ) ? ((MT_Value<orxonox::Vector3>    *)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::Vector3>();     } /** @brief Returns the current value, converted to the requested type. */
+MultiType::operator orxonox::Vector4()     const { return (this->value_) ? ((this->value_->type_ == MT_vector4    ) ? ((MT_Value<orxonox::Vector4>    *)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::Vector4>();     } /** @brief Returns the current value, converted to the requested type. */
+MultiType::operator orxonox::ColourValue() const { return (this->value_) ? ((this->value_->type_ == MT_colourvalue) ? ((MT_Value<orxonox::ColourValue>*)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::ColourValue>(); } /** @brief Returns the current value, converted to the requested type. */
+MultiType::operator orxonox::Quaternion()  const { return (this->value_) ? ((this->value_->type_ == MT_quaternion ) ? ((MT_Value<orxonox::Quaternion> *)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::Quaternion>();  } /** @brief Returns the current value, converted to the requested type. */
+MultiType::operator orxonox::Radian()      const { return (this->value_) ? ((this->value_->type_ == MT_radian     ) ? ((MT_Value<orxonox::Radian>     *)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::Radian>();      } /** @brief Returns the current value, converted to the requested type. */
+MultiType::operator orxonox::Degree()      const { return (this->value_) ? ((this->value_->type_ == MT_degree     ) ? ((MT_Value<orxonox::Degree>     *)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::Degree>();      } /** @brief Returns the current value, converted to the requested type. */
 
 template <> void MultiType::createNewValueContainer(const char& value)                 { this->value_ = new MT_Value<char>                (value, MT_char       ); } /** @brief Creates a new value container for the given type. */
Index: code/trunk/src/util/MultiType.h
===================================================================
--- code/trunk/src/util/MultiType.h	(revision 1937)
+++ code/trunk/src/util/MultiType.h	(revision 2087)
@@ -58,4 +58,8 @@
     a.convert<bool>();         // converts 3.14 to bool, which is true
     a = false;                 // assigns false, this is equivalent to a.setValue(false)
+
+    @note
+    Whenever a value gets converted, there is a boolean return value telling you whether it was
+    successful or not. If it wasn't a zero value is assigned with the help of zeroise<T>().
 */
 
@@ -128,5 +132,5 @@
     struct _UtilExport MT_ValueBase
     {
-        MT_ValueBase(MT_Type type) : type_(type) {}
+        MT_ValueBase(MT_Type type) : type_(type), bHasDefaultValue_(false) {}
         virtual ~MT_ValueBase() {}
 
@@ -134,32 +138,59 @@
 
         virtual void reset() = 0;
-        virtual void assimilate(const MultiType& other) = 0;
+        virtual bool assimilate(const MultiType& other) = 0;
 
         /** @brief Returns the type of the current value. */
         const MT_Type& getType() const { return this->type_; }
 
-        virtual void setValue(const char& value)                 = 0;
-        virtual void setValue(const unsigned char& value)        = 0;
-        virtual void setValue(const short& value)                = 0;
-        virtual void setValue(const unsigned short& value)       = 0;
-        virtual void setValue(const int& value)                  = 0;
-        virtual void setValue(const unsigned int& value)         = 0;
-        virtual void setValue(const long& value)                 = 0;
-        virtual void setValue(const unsigned long& value)        = 0;
-        virtual void setValue(const long long& value)            = 0;
-        virtual void setValue(const unsigned long long& value)   = 0;
-        virtual void setValue(const float& value)                = 0;
-        virtual void setValue(const double& value)               = 0;
-        virtual void setValue(const long double& value)          = 0;
-        virtual void setValue(const bool& value)                 = 0;
-        virtual void setValue(      void* const& value)          = 0;
-        virtual void setValue(const std::string& value)          = 0;
-        virtual void setValue(const orxonox::Vector2& value)     = 0;
-        virtual void setValue(const orxonox::Vector3& value)     = 0;
-        virtual void setValue(const orxonox::Vector4& value)     = 0;
-        virtual void setValue(const orxonox::ColourValue& value) = 0;
-        virtual void setValue(const orxonox::Quaternion& value)  = 0;
-        virtual void setValue(const orxonox::Radian& value)      = 0;
-        virtual void setValue(const orxonox::Degree& value)      = 0;
+        /** @brief Checks whether the value is a default one. */
+        bool hasDefaultValue()   const { return this->bHasDefaultValue_; }
+
+        virtual bool setValue(const char& value)                 = 0;
+        virtual bool setValue(const unsigned char& value)        = 0;
+        virtual bool setValue(const short& value)                = 0;
+        virtual bool setValue(const unsigned short& value)       = 0;
+        virtual bool setValue(const int& value)                  = 0;
+        virtual bool setValue(const unsigned int& value)         = 0;
+        virtual bool setValue(const long& value)                 = 0;
+        virtual bool setValue(const unsigned long& value)        = 0;
+        virtual bool setValue(const long long& value)            = 0;
+        virtual bool setValue(const unsigned long long& value)   = 0;
+        virtual bool setValue(const float& value)                = 0;
+        virtual bool setValue(const double& value)               = 0;
+        virtual bool setValue(const long double& value)          = 0;
+        virtual bool setValue(const bool& value)                 = 0;
+        virtual bool setValue(      void* const& value)          = 0;
+        virtual bool setValue(const std::string& value)          = 0;
+        virtual bool setValue(const orxonox::Vector2& value)     = 0;
+        virtual bool setValue(const orxonox::Vector3& value)     = 0;
+        virtual bool setValue(const orxonox::Vector4& value)     = 0;
+        virtual bool setValue(const orxonox::ColourValue& value) = 0;
+        virtual bool setValue(const orxonox::Quaternion& value)  = 0;
+        virtual bool setValue(const orxonox::Radian& value)      = 0;
+        virtual bool setValue(const orxonox::Degree& value)      = 0;
+
+        virtual bool getValue(char*                 value) const = 0;
+        virtual bool getValue(unsigned char*        value) const = 0;
+        virtual bool getValue(short*                value) const = 0;
+        virtual bool getValue(unsigned short*       value) const = 0;
+        virtual bool getValue(int*                  value) const = 0;
+        virtual bool getValue(unsigned int*         value) const = 0;
+        virtual bool getValue(long*                 value) const = 0;
+        virtual bool getValue(unsigned long*        value) const = 0;
+        virtual bool getValue(long long*            value) const = 0;
+        virtual bool getValue(unsigned long long*   value) const = 0;
+        virtual bool getValue(float*                value) const = 0;
+        virtual bool getValue(double*               value) const = 0;
+        virtual bool getValue(long double*          value) const = 0;
+        virtual bool getValue(bool*                 value) const = 0;
+        virtual bool getValue(void**                value) const = 0;
+        virtual bool getValue(std::string*          value) const = 0;
+        virtual bool getValue(orxonox::Vector2*     value) const = 0;
+        virtual bool getValue(orxonox::Vector3*     value) const = 0;
+        virtual bool getValue(orxonox::Vector4*     value) const = 0;
+        virtual bool getValue(orxonox::ColourValue* value) const = 0;
+        virtual bool getValue(orxonox::Quaternion*  value) const = 0;
+        virtual bool getValue(orxonox::Radian*      value) const = 0;
+        virtual bool getValue(orxonox::Degree*      value) const = 0;
 
         virtual operator char()                 const = 0;
@@ -189,5 +220,6 @@
         virtual void toString(std::ostream& outstream) const = 0;
 
-        MT_Type type_; //!< The type of the current value
+        MT_Type type_;          //!< The type of the current value
+        bool bHasDefaultValue_; //!< True if the last conversion wasn't successful
     };
 
@@ -229,34 +261,34 @@
         inline                       const MultiType& operator=(MT_Type type)           { this->setType(type);   return (*this); } /** @brief Resets the value and changes the type. */
 
-        inline void                                   setValue(const char& value);
-        inline void                                   setValue(const unsigned char& value);
-        inline void                                   setValue(const short& value);
-        inline void                                   setValue(const unsigned short& value);
-        inline void                                   setValue(const int& value);
-        inline void                                   setValue(const unsigned int& value);
-        inline void                                   setValue(const long& value);
-        inline void                                   setValue(const unsigned long& value);
-        inline void                                   setValue(const long long& value);
-        inline void                                   setValue(const unsigned long long& value);
-        inline void                                   setValue(const float& value);
-        inline void                                   setValue(const double& value);
-        inline void                                   setValue(const long double& value);
-        inline void                                   setValue(const bool& value);
-        inline void                                   setValue(      void* const& value);
-        inline void                                   setValue(const std::string& value);
-        inline void                                   setValue(const orxonox::Vector2& value);
-        inline void                                   setValue(const orxonox::Vector3& value);
-        inline void                                   setValue(const orxonox::Vector4& value);
-        inline void                                   setValue(const orxonox::ColourValue& value);
-        inline void                                   setValue(const orxonox::Quaternion& value);
-        inline void                                   setValue(const orxonox::Radian& value);
-        inline void                                   setValue(const orxonox::Degree& value);
-        inline void                                   setValue(const char* value);
+        inline bool                                   setValue(const char& value);
+        inline bool                                   setValue(const unsigned char& value);
+        inline bool                                   setValue(const short& value);
+        inline bool                                   setValue(const unsigned short& value);
+        inline bool                                   setValue(const int& value);
+        inline bool                                   setValue(const unsigned int& value);
+        inline bool                                   setValue(const long& value);
+        inline bool                                   setValue(const unsigned long& value);
+        inline bool                                   setValue(const long long& value);
+        inline bool                                   setValue(const unsigned long long& value);
+        inline bool                                   setValue(const float& value);
+        inline bool                                   setValue(const double& value);
+        inline bool                                   setValue(const long double& value);
+        inline bool                                   setValue(const bool& value);
+        inline bool                                   setValue(      void* const& value);
+        inline bool                                   setValue(const std::string& value);
+        inline bool                                   setValue(const orxonox::Vector2& value);
+        inline bool                                   setValue(const orxonox::Vector3& value);
+        inline bool                                   setValue(const orxonox::Vector4& value);
+        inline bool                                   setValue(const orxonox::ColourValue& value);
+        inline bool                                   setValue(const orxonox::Quaternion& value);
+        inline bool                                   setValue(const orxonox::Radian& value);
+        inline bool                                   setValue(const orxonox::Degree& value);
+        inline bool                                   setValue(const char* value);
         /** @brief Assigns a pointer. */
-        template <typename V> inline void             setValue(V* value)               { if (this->value_) { this->value_->setValue((void*)value); } else { this->assignValue((void*)value); } }
+        template <typename V> inline bool             setValue(V* value)               { if (this->value_) { return this->value_->setValue((void*)value); } else { return this->assignValue((void*)value); } }
         /** @brief Assigns the value of the other MultiType and converts it to the current type. */
-        void                                          setValue(const MultiType& other) { if (this->value_) { this->value_->assimilate(other); } else { if (other.value_) { this->value_ = other.value_->clone(); } } }
+        bool                                          setValue(const MultiType& other) { if (this->value_) { return this->value_->assimilate(other); } else { if (other.value_) { this->value_ = other.value_->clone(); } return true; } }
         /** @brief Changes the type to T and assigns the new value (which might be of another type than T - it gets converted). */
-        template <typename T, typename V> inline void setValue(const V& value)         { this->setType<T>(); this->setValue(value); }
+        template <typename T, typename V> inline bool setValue(const V& value) { this->setType<T>(); return this->setValue(value); }
 
 
@@ -264,10 +296,10 @@
         inline void                       copy(const MultiType& other)    { if (this == &other) { return; } if (this->value_) { delete this->value_; } this->value_ = (other.value_) ? other.value_->clone() : 0; }
 
-        template <typename T> inline void convert()                       { this->setValue<T>((T)(*this));  } /** @brief Converts the current value to type T. */
-        inline void                       convert(const MultiType& other) { this->convert(other.getType()); } /** @brief Converts the current value to the type of the other MultiType. */
-        void                              convert(MT_Type type);
-
-        /** @brief Resets the value to the defaultvalue of the current type. */
-        inline void                       reset()                         { if (this->value_) { delete this->value_; this->value_ = 0; } }
+        template <typename T> inline bool convert()                       { return this->setValue<T>((T)(*this));  } /** @brief Converts the current value to type T. */
+        inline bool                       convert(const MultiType& other) { return this->convert(other.getType()); } /** @brief Converts the current value to the type of the other MultiType. */
+        bool                              convert(MT_Type type);
+
+        /** @brief Current content gets deleted. New type is MT_null */
+        inline void                       reset()                         { if (this->value_) this->value_->reset(); }
 
         template <typename T> inline void setType()                       { this->assignValue(T());                            } /** @brief Resets the value and changes the internal type to T. */
@@ -282,4 +314,7 @@
         template <typename T> inline bool isType()                  const { return false; } // Only works for specialized values - see below
         std::string                       getTypename()             const;
+
+        /** @brief Checks whether the value is a default one. */
+        bool                              hasDefaultValue()         const { return this->value_->hasDefaultValue(); }
 
         operator char()                  const;
@@ -309,27 +344,27 @@
         template <class T> operator T*() const { return ((T*)this->operator void*()); }
 
-        inline void getValue(char*                 value) const { if (this->value_) { (*value) = (*this->value_); } } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
-        inline void getValue(unsigned char*        value) const { if (this->value_) { (*value) = (*this->value_); } } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
-        inline void getValue(short*                value) const { if (this->value_) { (*value) = (*this->value_); } } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
-        inline void getValue(unsigned short*       value) const { if (this->value_) { (*value) = (*this->value_); } } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
-        inline void getValue(int*                  value) const { if (this->value_) { (*value) = (*this->value_); } } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
-        inline void getValue(unsigned int*         value) const { if (this->value_) { (*value) = (*this->value_); } } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
-        inline void getValue(long*                 value) const { if (this->value_) { (*value) = (*this->value_); } } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
-        inline void getValue(unsigned long*        value) const { if (this->value_) { (*value) = (*this->value_); } } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
-        inline void getValue(long long*            value) const { if (this->value_) { (*value) = (*this->value_); } } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
-        inline void getValue(unsigned long long*   value) const { if (this->value_) { (*value) = (*this->value_); } } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
-        inline void getValue(float*                value) const { if (this->value_) { (*value) = (*this->value_); } } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
-        inline void getValue(double*               value) const { if (this->value_) { (*value) = (*this->value_); } } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
-        inline void getValue(long double*          value) const { if (this->value_) { (*value) = (*this->value_); } } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
-        inline void getValue(bool*                 value) const { if (this->value_) { (*value) = (*this->value_); } } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
-        inline void getValue(void*                 value) const { if (this->value_) {   value  = (*this->value_); } } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
-        inline void getValue(std::string*          value) const { if (this->value_) { (*value) = this->value_->operator std::string();          } } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
-        inline void getValue(orxonox::Vector2*     value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Vector2();     } } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
-        inline void getValue(orxonox::Vector3*     value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Vector3();     } } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
-        inline void getValue(orxonox::Vector4*     value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Vector4();     } } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
-        inline void getValue(orxonox::ColourValue* value) const { if (this->value_) { (*value) = this->value_->operator orxonox::ColourValue(); } } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
-        inline void getValue(orxonox::Quaternion*  value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Quaternion();  } } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
-        inline void getValue(orxonox::Radian*      value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Radian();      } } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
-        inline void getValue(orxonox::Degree*      value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Degree();      } } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(char*                 value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(unsigned char*        value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(short*                value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(unsigned short*       value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(int*                  value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(unsigned int*         value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(long*                 value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(unsigned long*        value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(long long*            value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(unsigned long long*   value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(float*                value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(double*               value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(long double*          value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(bool*                 value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(void**                value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(std::string*          value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(orxonox::Vector2*     value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(orxonox::Vector3*     value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(orxonox::Vector4*     value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(orxonox::ColourValue* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(orxonox::Quaternion*  value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(orxonox::Radian*      value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(orxonox::Degree*      value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
 
         inline char                     getChar()             const { return this->operator char();                 } /** @brief Returns the current value, converted to the requested type. */
@@ -359,32 +394,32 @@
 
     private:
-        inline void assignValue(const char& value)                 { if (this->value_ && this->value_->type_ == MT_char)        { this->value_->setValue(value); } else { this->changeValueContainer<char>(value);                 } } /** @brief Assigns a new value by changing type and creating a new container. */
-        inline void assignValue(const unsigned char& value)        { if (this->value_ && this->value_->type_ == MT_uchar)       { this->value_->setValue(value); } else { this->changeValueContainer<unsigned char>(value);        } } /** @brief Assigns a new value by changing type and creating a new container. */
-        inline void assignValue(const short& value)                { if (this->value_ && this->value_->type_ == MT_short)       { this->value_->setValue(value); } else { this->changeValueContainer<short>(value);                } } /** @brief Assigns a new value by changing type and creating a new container. */
-        inline void assignValue(const unsigned short& value)       { if (this->value_ && this->value_->type_ == MT_ushort)      { this->value_->setValue(value); } else { this->changeValueContainer<unsigned short>(value);       } } /** @brief Assigns a new value by changing type and creating a new container. */
-        inline void assignValue(const int& value)                  { if (this->value_ && this->value_->type_ == MT_int)         { this->value_->setValue(value); } else { this->changeValueContainer<int>(value);                  } } /** @brief Assigns a new value by changing type and creating a new container. */
-        inline void assignValue(const unsigned int& value)         { if (this->value_ && this->value_->type_ == MT_uint)        { this->value_->setValue(value); } else { this->changeValueContainer<unsigned int>(value);         } } /** @brief Assigns a new value by changing type and creating a new container. */
-        inline void assignValue(const long& value)                 { if (this->value_ && this->value_->type_ == MT_long)        { this->value_->setValue(value); } else { this->changeValueContainer<long>(value);                 } } /** @brief Assigns a new value by changing type and creating a new container. */
-        inline void assignValue(const unsigned long& value)        { if (this->value_ && this->value_->type_ == MT_ulong)       { this->value_->setValue(value); } else { this->changeValueContainer<unsigned long>(value);        } } /** @brief Assigns a new value by changing type and creating a new container. */
-        inline void assignValue(const long long& value)            { if (this->value_ && this->value_->type_ == MT_longlong)    { this->value_->setValue(value); } else { this->changeValueContainer<long long>(value);            } } /** @brief Assigns a new value by changing type and creating a new container. */
-        inline void assignValue(const unsigned long long& value)   { if (this->value_ && this->value_->type_ == MT_ulonglong)   { this->value_->setValue(value); } else { this->changeValueContainer<unsigned long long>(value);   } } /** @brief Assigns a new value by changing type and creating a new container. */
-        inline void assignValue(const float& value)                { if (this->value_ && this->value_->type_ == MT_float)       { this->value_->setValue(value); } else { this->changeValueContainer<float>(value);                } } /** @brief Assigns a new value by changing type and creating a new container. */
-        inline void assignValue(const double& value)               { if (this->value_ && this->value_->type_ == MT_double)      { this->value_->setValue(value); } else { this->changeValueContainer<double>(value);               } } /** @brief Assigns a new value by changing type and creating a new container. */
-        inline void assignValue(const long double& value)          { if (this->value_ && this->value_->type_ == MT_longdouble)  { this->value_->setValue(value); } else { this->changeValueContainer<long double>(value);          } } /** @brief Assigns a new value by changing type and creating a new container. */
-        inline void assignValue(const bool& value)                 { if (this->value_ && this->value_->type_ == MT_bool)        { this->value_->setValue(value); } else { this->changeValueContainer<bool>(value);                 } } /** @brief Assigns a new value by changing type and creating a new container. */
-        inline void assignValue(      void* const& value)          { if (this->value_ && this->value_->type_ == MT_void)        { this->value_->setValue(value); } else { this->changeValueContainer<void*>(value);                } } /** @brief Assigns a new value by changing type and creating a new container. */
-        inline void assignValue(const std::string& value)          { if (this->value_ && this->value_->type_ == MT_string)      { this->value_->setValue(value); } else { this->changeValueContainer<std::string>(value);          } } /** @brief Assigns a new value by changing type and creating a new container. */
-        inline void assignValue(const orxonox::Vector2& value)     { if (this->value_ && this->value_->type_ == MT_vector2)     { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector2>(value);     } } /** @brief Assigns a new value by changing type and creating a new container. */
-        inline void assignValue(const orxonox::Vector3& value)     { if (this->value_ && this->value_->type_ == MT_vector3)     { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector3>(value);     } } /** @brief Assigns a new value by changing type and creating a new container. */
-        inline void assignValue(const orxonox::Vector4& value)     { if (this->value_ && this->value_->type_ == MT_vector4)     { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector4>(value);     } } /** @brief Assigns a new value by changing type and creating a new container. */
-        inline void assignValue(const orxonox::ColourValue& value) { if (this->value_ && this->value_->type_ == MT_colourvalue) { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::ColourValue>(value); } } /** @brief Assigns a new value by changing type and creating a new container. */
-        inline void assignValue(const orxonox::Quaternion& value)  { if (this->value_ && this->value_->type_ == MT_quaternion)  { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Quaternion>(value);  } } /** @brief Assigns a new value by changing type and creating a new container. */
-        inline void assignValue(const orxonox::Radian& value)      { if (this->value_ && this->value_->type_ == MT_radian)      { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Radian>(value);      } } /** @brief Assigns a new value by changing type and creating a new container. */
-        inline void assignValue(const orxonox::Degree& value)      { if (this->value_ && this->value_->type_ == MT_degree)      { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Degree>(value);      } } /** @brief Assigns a new value by changing type and creating a new container. */
+        inline bool assignValue(const char& value)                 { if (this->value_ && this->value_->type_ == MT_char)        { return this->value_->setValue(value); } else { this->changeValueContainer<char>(value);                 return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+        inline bool assignValue(const unsigned char& value)        { if (this->value_ && this->value_->type_ == MT_uchar)       { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned char>(value);        return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+        inline bool assignValue(const short& value)                { if (this->value_ && this->value_->type_ == MT_short)       { return this->value_->setValue(value); } else { this->changeValueContainer<short>(value);                return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+        inline bool assignValue(const unsigned short& value)       { if (this->value_ && this->value_->type_ == MT_ushort)      { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned short>(value);       return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+        inline bool assignValue(const int& value)                  { if (this->value_ && this->value_->type_ == MT_int)         { return this->value_->setValue(value); } else { this->changeValueContainer<int>(value);                  return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+        inline bool assignValue(const unsigned int& value)         { if (this->value_ && this->value_->type_ == MT_uint)        { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned int>(value);         return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+        inline bool assignValue(const long& value)                 { if (this->value_ && this->value_->type_ == MT_long)        { return this->value_->setValue(value); } else { this->changeValueContainer<long>(value);                 return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+        inline bool assignValue(const unsigned long& value)        { if (this->value_ && this->value_->type_ == MT_ulong)       { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned long>(value);        return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+        inline bool assignValue(const long long& value)            { if (this->value_ && this->value_->type_ == MT_longlong)    { return this->value_->setValue(value); } else { this->changeValueContainer<long long>(value);            return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+        inline bool assignValue(const unsigned long long& value)   { if (this->value_ && this->value_->type_ == MT_ulonglong)   { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned long long>(value);   return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+        inline bool assignValue(const float& value)                { if (this->value_ && this->value_->type_ == MT_float)       { return this->value_->setValue(value); } else { this->changeValueContainer<float>(value);                return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+        inline bool assignValue(const double& value)               { if (this->value_ && this->value_->type_ == MT_double)      { return this->value_->setValue(value); } else { this->changeValueContainer<double>(value);               return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+        inline bool assignValue(const long double& value)          { if (this->value_ && this->value_->type_ == MT_longdouble)  { return this->value_->setValue(value); } else { this->changeValueContainer<long double>(value);          return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+        inline bool assignValue(const bool& value)                 { if (this->value_ && this->value_->type_ == MT_bool)        { return this->value_->setValue(value); } else { this->changeValueContainer<bool>(value);                 return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+        inline bool assignValue(      void* const& value)          { if (this->value_ && this->value_->type_ == MT_void)        { return this->value_->setValue(value); } else { this->changeValueContainer<void*>(value);                return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+        inline bool assignValue(const std::string& value)          { if (this->value_ && this->value_->type_ == MT_string)      { return this->value_->setValue(value); } else { this->changeValueContainer<std::string>(value);          return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+        inline bool assignValue(const orxonox::Vector2& value)     { if (this->value_ && this->value_->type_ == MT_vector2)     { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector2>(value);     return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+        inline bool assignValue(const orxonox::Vector3& value)     { if (this->value_ && this->value_->type_ == MT_vector3)     { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector3>(value);     return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+        inline bool assignValue(const orxonox::Vector4& value)     { if (this->value_ && this->value_->type_ == MT_vector4)     { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector4>(value);     return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+        inline bool assignValue(const orxonox::ColourValue& value) { if (this->value_ && this->value_->type_ == MT_colourvalue) { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::ColourValue>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+        inline bool assignValue(const orxonox::Quaternion& value)  { if (this->value_ && this->value_->type_ == MT_quaternion)  { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Quaternion>(value);  return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+        inline bool assignValue(const orxonox::Radian& value)      { if (this->value_ && this->value_->type_ == MT_radian)      { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Radian>(value);      return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+        inline bool assignValue(const orxonox::Degree& value)      { if (this->value_ && this->value_->type_ == MT_degree)      { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Degree>(value);      return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
 
         /** @brief Changes the value container. */
         template <typename T> inline void changeValueContainer(const T& value) { if (this->value_) { delete this->value_; } this->createNewValueContainer<T>(value); }
         /** @brief Creates a new value container (works only with specialized types). */
-        template <typename T>        void createNewValueContainer(const T& value) { BOOST_STATIC_ASSERT(sizeof(T) == 0); }
+        template <typename T>        void createNewValueContainer(const T& value) { BOOST_STATIC_ASSERT(sizeof(T) == 0); return false; }
 
         MT_ValueBase* value_; //!< A pointer to the value container
@@ -419,22 +454,22 @@
 
 // Specialization to avoid ambiguities with the conversion operator
-template <> inline void MultiType::convert<std::string>()          { this->setValue<std::string>         (this->operator std::string());          } /** @brief Converts the current value to the given type. */
-template <> inline void MultiType::convert<orxonox::Vector2>()     { this->setValue<orxonox::Vector2>    (this->operator orxonox::Vector2());     } /** @brief Converts the current value to the given type. */
-template <> inline void MultiType::convert<orxonox::Vector3>()     { this->setValue<orxonox::Vector3>    (this->operator orxonox::Vector3());     } /** @brief Converts the current value to the given type. */
-template <> inline void MultiType::convert<orxonox::Vector4>()     { this->setValue<orxonox::Vector4>    (this->operator orxonox::Vector4());     } /** @brief Converts the current value to the given type. */
-template <> inline void MultiType::convert<orxonox::ColourValue>() { this->setValue<orxonox::ColourValue>(this->operator orxonox::ColourValue()); } /** @brief Converts the current value to the given type. */
-template <> inline void MultiType::convert<orxonox::Quaternion>()  { this->setValue<orxonox::Quaternion> (this->operator orxonox::Quaternion());  } /** @brief Converts the current value to the given type. */
-template <> inline void MultiType::convert<orxonox::Radian>()      { this->setValue<orxonox::Radian>     (this->operator orxonox::Radian());      } /** @brief Converts the current value to the given type. */
-template <> inline void MultiType::convert<orxonox::Degree>()      { this->setValue<orxonox::Degree>     (this->operator orxonox::Degree());      } /** @brief Converts the current value to the given type. */
+template <> inline bool MultiType::convert<std::string>()          { return this->setValue<std::string>         (this->operator std::string());          } /** @brief Converts the current value to the given type. */
+template <> inline bool MultiType::convert<orxonox::Vector2>()     { return this->setValue<orxonox::Vector2>    (this->operator orxonox::Vector2());     } /** @brief Converts the current value to the given type. */
+template <> inline bool MultiType::convert<orxonox::Vector3>()     { return this->setValue<orxonox::Vector3>    (this->operator orxonox::Vector3());     } /** @brief Converts the current value to the given type. */
+template <> inline bool MultiType::convert<orxonox::Vector4>()     { return this->setValue<orxonox::Vector4>    (this->operator orxonox::Vector4());     } /** @brief Converts the current value to the given type. */
+template <> inline bool MultiType::convert<orxonox::ColourValue>() { return this->setValue<orxonox::ColourValue>(this->operator orxonox::ColourValue()); } /** @brief Converts the current value to the given type. */
+template <> inline bool MultiType::convert<orxonox::Quaternion>()  { return this->setValue<orxonox::Quaternion> (this->operator orxonox::Quaternion());  } /** @brief Converts the current value to the given type. */
+template <> inline bool MultiType::convert<orxonox::Radian>()      { return this->setValue<orxonox::Radian>     (this->operator orxonox::Radian());      } /** @brief Converts the current value to the given type. */
+template <> inline bool MultiType::convert<orxonox::Degree>()      { return this->setValue<orxonox::Degree>     (this->operator orxonox::Degree());      } /** @brief Converts the current value to the given type. */
 
 // Specialization to avoid ambiguities with the conversion operator
-template <> inline void MultiType::convert<const std::string&>()          { this->convert<std::string>();          } /** @brief Converts the current value to the given type. */
-template <> inline void MultiType::convert<const orxonox::Vector2&>()     { this->convert<orxonox::Vector2>();     } /** @brief Converts the current value to the given type. */
-template <> inline void MultiType::convert<const orxonox::Vector3&>()     { this->convert<orxonox::Vector3>();     } /** @brief Converts the current value to the given type. */
-template <> inline void MultiType::convert<const orxonox::Vector4&>()     { this->convert<orxonox::Vector4>();     } /** @brief Converts the current value to the given type. */
-template <> inline void MultiType::convert<const orxonox::ColourValue&>() { this->convert<orxonox::ColourValue>(); } /** @brief Converts the current value to the given type. */
-template <> inline void MultiType::convert<const orxonox::Quaternion&>()  { this->convert<orxonox::Quaternion>();  } /** @brief Converts the current value to the given type. */
-template <> inline void MultiType::convert<const orxonox::Radian&>()      { this->convert<orxonox::Radian>();      } /** @brief Converts the current value to the given type. */
-template <> inline void MultiType::convert<const orxonox::Degree&>()      { this->convert<orxonox::Degree>();      } /** @brief Converts the current value to the given type. */
+template <> inline bool MultiType::convert<const std::string&>()          { return this->convert<std::string>();          } /** @brief Converts the current value to the given type. */
+template <> inline bool MultiType::convert<const orxonox::Vector2&>()     { return this->convert<orxonox::Vector2>();     } /** @brief Converts the current value to the given type. */
+template <> inline bool MultiType::convert<const orxonox::Vector3&>()     { return this->convert<orxonox::Vector3>();     } /** @brief Converts the current value to the given type. */
+template <> inline bool MultiType::convert<const orxonox::Vector4&>()     { return this->convert<orxonox::Vector4>();     } /** @brief Converts the current value to the given type. */
+template <> inline bool MultiType::convert<const orxonox::ColourValue&>() { return this->convert<orxonox::ColourValue>(); } /** @brief Converts the current value to the given type. */
+template <> inline bool MultiType::convert<const orxonox::Quaternion&>()  { return this->convert<orxonox::Quaternion>();  } /** @brief Converts the current value to the given type. */
+template <> inline bool MultiType::convert<const orxonox::Radian&>()      { return this->convert<orxonox::Radian>();      } /** @brief Converts the current value to the given type. */
+template <> inline bool MultiType::convert<const orxonox::Degree&>()      { return this->convert<orxonox::Degree>();      } /** @brief Converts the current value to the given type. */
 
 template <> void MultiType::createNewValueContainer(const char& value);
@@ -462,29 +497,29 @@
 template <> void MultiType::createNewValueContainer(const orxonox::Degree& value);
 
-inline void MultiType::setValue(const char& value)                  { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
-inline void MultiType::setValue(const unsigned char& value)         { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
-inline void MultiType::setValue(const short& value)                 { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
-inline void MultiType::setValue(const unsigned short& value)        { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
-inline void MultiType::setValue(const int& value)                   { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
-inline void MultiType::setValue(const unsigned int& value)          { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
-inline void MultiType::setValue(const long& value)                  { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
-inline void MultiType::setValue(const unsigned long& value)         { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
-inline void MultiType::setValue(const long long& value)             { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
-inline void MultiType::setValue(const unsigned long long& value)    { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
-inline void MultiType::setValue(const float& value)                 { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
-inline void MultiType::setValue(const double& value)                { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
-inline void MultiType::setValue(const long double& value)           { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
-inline void MultiType::setValue(const bool& value)                  { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
-inline void MultiType::setValue(      void* const& value)           { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
-inline void MultiType::setValue(const std::string& value)           { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
-inline void MultiType::setValue(const orxonox::Vector2& value)      { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
-inline void MultiType::setValue(const orxonox::Vector3& value)      { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
-inline void MultiType::setValue(const orxonox::Vector4& value)      { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
-inline void MultiType::setValue(const orxonox::ColourValue& value)  { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
-inline void MultiType::setValue(const orxonox::Quaternion& value)   { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
-inline void MultiType::setValue(const orxonox::Radian& value)       { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
-inline void MultiType::setValue(const orxonox::Degree& value)       { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
-
-inline void MultiType::setValue(const char* value)                  { if (this->value_) { this->value_->setValue(std::string(value)); } else { this->assignValue(std::string(value)); } }  /** @brief Assigns the given value and converts it to the current type. */
+inline bool MultiType::setValue(const char& value)                  { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+inline bool MultiType::setValue(const unsigned char& value)         { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+inline bool MultiType::setValue(const short& value)                 { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+inline bool MultiType::setValue(const unsigned short& value)        { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+inline bool MultiType::setValue(const int& value)                   { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+inline bool MultiType::setValue(const unsigned int& value)          { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+inline bool MultiType::setValue(const long& value)                  { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+inline bool MultiType::setValue(const unsigned long& value)         { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+inline bool MultiType::setValue(const long long& value)             { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+inline bool MultiType::setValue(const unsigned long long& value)    { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+inline bool MultiType::setValue(const float& value)                 { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+inline bool MultiType::setValue(const double& value)                { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+inline bool MultiType::setValue(const long double& value)           { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+inline bool MultiType::setValue(const bool& value)                  { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+inline bool MultiType::setValue(      void* const& value)           { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+inline bool MultiType::setValue(const std::string& value)           { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+inline bool MultiType::setValue(const orxonox::Vector2& value)      { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+inline bool MultiType::setValue(const orxonox::Vector3& value)      { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+inline bool MultiType::setValue(const orxonox::Vector4& value)      { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+inline bool MultiType::setValue(const orxonox::ColourValue& value)  { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+inline bool MultiType::setValue(const orxonox::Quaternion& value)   { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+inline bool MultiType::setValue(const orxonox::Radian& value)       { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+inline bool MultiType::setValue(const orxonox::Degree& value)       { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+
+inline bool MultiType::setValue(const char* value)                  { if (this->value_) { return this->value_->setValue(std::string(value)); } else { return this->assignValue(std::string(value)); } }  /** @brief Assigns the given value and converts it to the current type. */
 
 #endif /* _MultiType_H__ */
Index: code/trunk/src/util/MultiTypeValue.h
===================================================================
--- code/trunk/src/util/MultiTypeValue.h	(revision 1937)
+++ code/trunk/src/util/MultiTypeValue.h	(revision 2087)
@@ -38,5 +38,5 @@
 
 #include "UtilPrereqs.h"
-#include "Convert.h"
+#include "MathConvert.h"
 #include "MultiType.h"
 
@@ -54,32 +54,67 @@
 
     /** @brief Resets the current value to the default. */
-    inline void reset() { this->value_ = T(); }
+    inline void reset() { this->value_ = zeroise<T>(); bHasDefaultValue_ = true; }
 
     /** @brief Assigns the value of the other MultiType, converted to T. @param other The other MultiType */
-    inline void assimilate(const MultiType& other) { if (other.value_) { T temp; other.getValue(&temp); this->value_ = temp; } else { this->value_ = T(); } }
+    inline bool assimilate(const MultiType& other)
+    {
+        if (other.value_)
+        {
+            return !(bHasDefaultValue_ = !other.value_->getValue(&value_));
+        }
+        else
+        {
+            this->value_ = zeroise<T>();
+            return !(bHasDefaultValue_ = true);
+        }
+    }
 
-    inline void setValue(const char& value)                 { this->value_ = getConvertedValue<char,                 T>(value); } /** @brief Assigns the value by converting it to T. */
-    inline void setValue(const unsigned char& value)        { this->value_ = getConvertedValue<unsigned char,        T>(value); } /** @brief Assigns the value by converting it to T. */
-    inline void setValue(const short& value)                { this->value_ = getConvertedValue<short,                T>(value); } /** @brief Assigns the value by converting it to T. */
-    inline void setValue(const unsigned short& value)       { this->value_ = getConvertedValue<unsigned short,       T>(value); } /** @brief Assigns the value by converting it to T. */
-    inline void setValue(const int& value)                  { this->value_ = getConvertedValue<int,                  T>(value); } /** @brief Assigns the value by converting it to T. */
-    inline void setValue(const unsigned int& value)         { this->value_ = getConvertedValue<unsigned int,         T>(value); } /** @brief Assigns the value by converting it to T. */
-    inline void setValue(const long& value)                 { this->value_ = getConvertedValue<long,                 T>(value); } /** @brief Assigns the value by converting it to T. */
-    inline void setValue(const unsigned long& value)        { this->value_ = getConvertedValue<unsigned long,        T>(value); } /** @brief Assigns the value by converting it to T. */
-    inline void setValue(const long long& value)            { this->value_ = getConvertedValue<long long,            T>(value); } /** @brief Assigns the value by converting it to T. */
-    inline void setValue(const unsigned long long& value)   { this->value_ = getConvertedValue<unsigned long long,   T>(value); } /** @brief Assigns the value by converting it to T. */
-    inline void setValue(const float& value)                { this->value_ = getConvertedValue<float,                T>(value); } /** @brief Assigns the value by converting it to T. */
-    inline void setValue(const double& value)               { this->value_ = getConvertedValue<double,               T>(value); } /** @brief Assigns the value by converting it to T. */
-    inline void setValue(const long double& value)          { this->value_ = getConvertedValue<long double,          T>(value); } /** @brief Assigns the value by converting it to T. */
-    inline void setValue(const bool& value)                 { this->value_ = getConvertedValue<bool,                 T>(value); } /** @brief Assigns the value by converting it to T. */
-    inline void setValue(      void* const& value)          { this->value_ = getConvertedValue<void*,                T>(value); } /** @brief Assigns the value by converting it to T. */
-    inline void setValue(const std::string& value)          { this->value_ = getConvertedValue<std::string,          T>(value); } /** @brief Assigns the value by converting it to T. */
-    inline void setValue(const orxonox::Vector2& value)     { this->value_ = getConvertedValue<orxonox::Vector2,     T>(value); } /** @brief Assigns the value by converting it to T. */
-    inline void setValue(const orxonox::Vector3& value)     { this->value_ = getConvertedValue<orxonox::Vector3,     T>(value); } /** @brief Assigns the value by converting it to T. */
-    inline void setValue(const orxonox::Vector4& value)     { this->value_ = getConvertedValue<orxonox::Vector4,     T>(value); } /** @brief Assigns the value by converting it to T. */
-    inline void setValue(const orxonox::ColourValue& value) { this->value_ = getConvertedValue<orxonox::ColourValue, T>(value); } /** @brief Assigns the value by converting it to T. */
-    inline void setValue(const orxonox::Quaternion& value)  { this->value_ = getConvertedValue<orxonox::Quaternion,  T>(value); } /** @brief Assigns the value by converting it to T. */
-    inline void setValue(const orxonox::Radian& value)      { this->value_ = getConvertedValue<orxonox::Radian,      T>(value); } /** @brief Assigns the value by converting it to T. */
-    inline void setValue(const orxonox::Degree& value)      { this->value_ = getConvertedValue<orxonox::Degree,      T>(value); } /** @brief Assigns the value by converting it to T. */
+    inline bool getValue(char*                 value) const { return ConvertValue<T, char                >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+    inline bool getValue(unsigned char*        value) const { return ConvertValue<T, unsigned char       >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+    inline bool getValue(short*                value) const { return ConvertValue<T, short               >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+    inline bool getValue(unsigned short*       value) const { return ConvertValue<T, unsigned short      >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+    inline bool getValue(int*                  value) const { return ConvertValue<T, int                 >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+    inline bool getValue(unsigned int*         value) const { return ConvertValue<T, unsigned int        >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+    inline bool getValue(long*                 value) const { return ConvertValue<T, long                >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+    inline bool getValue(unsigned long*        value) const { return ConvertValue<T, unsigned long       >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+    inline bool getValue(long long*            value) const { return ConvertValue<T, long long           >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+    inline bool getValue(unsigned long long*   value) const { return ConvertValue<T, unsigned long long  >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+    inline bool getValue(float*                value) const { return ConvertValue<T, float               >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+    inline bool getValue(double*               value) const { return ConvertValue<T, double              >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+    inline bool getValue(long double*          value) const { return ConvertValue<T, long double         >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+    inline bool getValue(bool*                 value) const { return ConvertValue<T, bool                >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+    inline bool getValue(void**                value) const { return ConvertValue<T, void*               >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+    inline bool getValue(std::string*          value) const { return ConvertValue<T, std::string         >(value, value_, zeroise<std::string>         ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+    inline bool getValue(orxonox::Vector2*     value) const { return ConvertValue<T, orxonox::Vector2    >(value, value_, zeroise<orxonox::Vector2>    ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+    inline bool getValue(orxonox::Vector3*     value) const { return ConvertValue<T, orxonox::Vector3    >(value, value_, zeroise<orxonox::Vector3>    ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+    inline bool getValue(orxonox::Vector4*     value) const { return ConvertValue<T, orxonox::Vector4    >(value, value_, zeroise<orxonox::Vector4>    ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+    inline bool getValue(orxonox::ColourValue* value) const { return ConvertValue<T, orxonox::ColourValue>(value, value_, zeroise<orxonox::ColourValue>()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+    inline bool getValue(orxonox::Quaternion*  value) const { return ConvertValue<T, orxonox::Quaternion >(value, value_, zeroise<orxonox::Quaternion> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+    inline bool getValue(orxonox::Radian*      value) const { return ConvertValue<T, orxonox::Radian     >(value, value_, zeroise<orxonox::Radian>     ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+    inline bool getValue(orxonox::Degree*      value) const { return ConvertValue<T, orxonox::Degree     >(value, value_, zeroise<orxonox::Degree>     ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+
+    inline bool setValue(const char& value)                 { return !(bHasDefaultValue_ = !ConvertValue<char                , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+    inline bool setValue(const unsigned char& value)        { return !(bHasDefaultValue_ = !ConvertValue<unsigned char       , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+    inline bool setValue(const short& value)                { return !(bHasDefaultValue_ = !ConvertValue<short               , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+    inline bool setValue(const unsigned short& value)       { return !(bHasDefaultValue_ = !ConvertValue<unsigned short      , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+    inline bool setValue(const int& value)                  { return !(bHasDefaultValue_ = !ConvertValue<int                 , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+    inline bool setValue(const unsigned int& value)         { return !(bHasDefaultValue_ = !ConvertValue<unsigned int        , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+    inline bool setValue(const long& value)                 { return !(bHasDefaultValue_ = !ConvertValue<long                , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+    inline bool setValue(const unsigned long& value)        { return !(bHasDefaultValue_ = !ConvertValue<unsigned long       , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+    inline bool setValue(const long long& value)            { return !(bHasDefaultValue_ = !ConvertValue<long long           , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+    inline bool setValue(const unsigned long long& value)   { return !(bHasDefaultValue_ = !ConvertValue<unsigned long long  , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+    inline bool setValue(const float& value)                { return !(bHasDefaultValue_ = !ConvertValue<float               , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+    inline bool setValue(const double& value)               { return !(bHasDefaultValue_ = !ConvertValue<double              , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+    inline bool setValue(const long double& value)          { return !(bHasDefaultValue_ = !ConvertValue<long double         , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+    inline bool setValue(const bool& value)                 { return !(bHasDefaultValue_ = !ConvertValue<bool                , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+    inline bool setValue(      void* const& value)          { return !(bHasDefaultValue_ = !ConvertValue<void*               , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+    inline bool setValue(const std::string& value)          { return !(bHasDefaultValue_ = !ConvertValue<std::string         , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+    inline bool setValue(const orxonox::Vector2& value)     { return !(bHasDefaultValue_ = !ConvertValue<orxonox::Vector2    , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+    inline bool setValue(const orxonox::Vector3& value)     { return !(bHasDefaultValue_ = !ConvertValue<orxonox::Vector3    , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+    inline bool setValue(const orxonox::Vector4& value)     { return !(bHasDefaultValue_ = !ConvertValue<orxonox::Vector4    , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+    inline bool setValue(const orxonox::ColourValue& value) { return !(bHasDefaultValue_ = !ConvertValue<orxonox::ColourValue, T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+    inline bool setValue(const orxonox::Quaternion& value)  { return !(bHasDefaultValue_ = !ConvertValue<orxonox::Quaternion , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+    inline bool setValue(const orxonox::Radian& value)      { return !(bHasDefaultValue_ = !ConvertValue<orxonox::Radian     , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+    inline bool setValue(const orxonox::Degree& value)      { return !(bHasDefaultValue_ = !ConvertValue<orxonox::Degree     , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
 
     inline operator char()                 const { return getConvertedValue<T, char>                (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
@@ -96,14 +131,14 @@
     inline operator double()               const { return getConvertedValue<T, double>              (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
     inline operator long double()          const { return getConvertedValue<T, long double>         (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
-    inline operator bool()                 const { return getConvertedValue<T, bool>                (this->value_, false); } /** @brief Returns the current value, converted to the requested type. */
+    inline operator bool()                 const { return getConvertedValue<T, bool>                (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
     inline operator void*()                const { return getConvertedValue<T, void*>               (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
-    inline operator std::string()          const { return getConvertedValue<T, std::string>         (this->value_); }        /** @brief Returns the current value, converted to the requested type. */
-    inline operator orxonox::Vector2()     const { return getConvertedValue<T, orxonox::Vector2>    (this->value_); }        /** @brief Returns the current value, converted to the requested type. */
-    inline operator orxonox::Vector3()     const { return getConvertedValue<T, orxonox::Vector3>    (this->value_); }        /** @brief Returns the current value, converted to the requested type. */
-    inline operator orxonox::Vector4()     const { return getConvertedValue<T, orxonox::Vector4>    (this->value_); }        /** @brief Returns the current value, converted to the requested type. */
-    inline operator orxonox::ColourValue() const { return getConvertedValue<T, orxonox::ColourValue>(this->value_); }        /** @brief Returns the current value, converted to the requested type. */
-    inline operator orxonox::Quaternion()  const { return getConvertedValue<T, orxonox::Quaternion> (this->value_); }        /** @brief Returns the current value, converted to the requested type. */
-    inline operator orxonox::Radian()      const { return getConvertedValue<T, orxonox::Radian>     (this->value_); }        /** @brief Returns the current value, converted to the requested type. */
-    inline operator orxonox::Degree()      const { return getConvertedValue<T, orxonox::Degree>     (this->value_); }        /** @brief Returns the current value, converted to the requested type. */
+    inline operator std::string()          const { return getConvertedValue<T, std::string>         (this->value_, zeroise<std::string         >()); } /** @brief Returns the current value, converted to the requested type. */
+    inline operator orxonox::Vector2()     const { return getConvertedValue<T, orxonox::Vector2>    (this->value_, zeroise<orxonox::Vector2    >()); } /** @brief Returns the current value, converted to the requested type. */
+    inline operator orxonox::Vector3()     const { return getConvertedValue<T, orxonox::Vector3>    (this->value_, zeroise<orxonox::Vector3    >()); } /** @brief Returns the current value, converted to the requested type. */
+    inline operator orxonox::Vector4()     const { return getConvertedValue<T, orxonox::Vector4>    (this->value_, zeroise<orxonox::Vector4    >()); } /** @brief Returns the current value, converted to the requested type. */
+    inline operator orxonox::ColourValue() const { return getConvertedValue<T, orxonox::ColourValue>(this->value_, zeroise<orxonox::ColourValue>()); } /** @brief Returns the current value, converted to the requested type. */
+    inline operator orxonox::Quaternion()  const { return getConvertedValue<T, orxonox::Quaternion> (this->value_, zeroise<orxonox::Quaternion >()); } /** @brief Returns the current value, converted to the requested type. */
+    inline operator orxonox::Radian()      const { return getConvertedValue<T, orxonox::Radian>     (this->value_, zeroise<orxonox::Radian     >()); } /** @brief Returns the current value, converted to the requested type. */
+    inline operator orxonox::Degree()      const { return getConvertedValue<T, orxonox::Degree>     (this->value_, zeroise<orxonox::Degree     >()); } /** @brief Returns the current value, converted to the requested type. */
 
     /** @brief Puts the current value on the stream */
Index: code/trunk/src/util/OutputHandler.cc
===================================================================
--- code/trunk/src/util/OutputHandler.cc	(revision 1937)
+++ code/trunk/src/util/OutputHandler.cc	(revision 2087)
@@ -33,4 +33,5 @@
 
 #include "OutputHandler.h"
+#include <time.h>
 
 namespace orxonox
@@ -46,5 +47,11 @@
         this->logfilename_ = logfilename;
         this->logfile_.open(this->logfilename_.c_str(), std::fstream::out);
-        this->logfile_ << "Started log at yyyy/mm/dd hh:mm:ss" << std::endl; // Todo: Get date and time
+
+        time_t rawtime;
+        struct tm* timeinfo;
+        time(&rawtime);
+        timeinfo = localtime(&rawtime);
+
+        this->logfile_ << "Started log at " << asctime(timeinfo) << std::endl;
         this->logfile_.flush();
     }
Index: code/trunk/src/util/SignalHandler.cc
===================================================================
--- code/trunk/src/util/SignalHandler.cc	(revision 2087)
+++ code/trunk/src/util/SignalHandler.cc	(revision 2087)
@@ -0,0 +1,354 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Christoph Renner
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the SignalHandler class.
+*/
+
+#include "SignalHandler.h"
+#include "Debug.h"
+
+#include <cassert>
+#include <iostream>
+#include <cstdlib>
+#include <cstring>
+
+SignalHandler * SignalHandler::singletonRef = NULL;
+
+#if ORXONOX_PLATFORM != ORXONOX_PLATFORM_WIN32
+
+#include <wait.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/keysym.h>
+
+bool SignalHandler::bXAutoKeyRepeatOn_ = false;
+
+SignalHandler::SignalHandler()
+{
+}
+
+/**
+ * register signal handlers for SIGSEGV and SIGABRT
+ * @param appName path to executable eg argv[0]
+ * @param fileName filename to append backtrace to
+ */
+void SignalHandler::doCatch( const std::string & appName, const std::string & fileName )
+{
+  this->appName = appName;
+  this->fileName = fileName;
+
+  // prepare for restoring XAutoKeyRepeat
+  Display* display;
+  if ((display = XOpenDisplay(0)))
+  {
+    XKeyboardState oldState;
+    XGetKeyboardControl(display, &oldState);
+    if (oldState.global_auto_repeat == AutoRepeatModeOn)
+      bXAutoKeyRepeatOn_ = true;
+    else
+      bXAutoKeyRepeatOn_ = false;
+    XCloseDisplay(display);
+  }
+  else
+  {
+    std::cout << "Warning: couldn't open X display to restore XAutoKeyRepeat." << std::endl;
+    bXAutoKeyRepeatOn_ = false;
+  }
+
+
+  // make sure doCatch is only called once without calling dontCatch
+  assert( sigRecList.size() == 0 );
+
+  catchSignal( SIGSEGV );
+  catchSignal( SIGABRT );
+  catchSignal( SIGILL );
+}
+
+/**
+ * restore previous signal handlers
+ */
+void SignalHandler::dontCatch()
+{
+  for ( SignalRecList::iterator it = sigRecList.begin(); it != sigRecList.end(); it++ )
+  {
+    signal( it->signal, it->handler );
+  }
+
+  sigRecList.clear();
+}
+
+/**
+ * catch signal sig
+ * @param sig signal to catch
+ */
+void SignalHandler::catchSignal( int sig )
+{
+  sig_t handler = signal( sig, SignalHandler::sigHandler );
+
+  assert( handler != SIG_ERR );
+
+  SignalRec rec;
+  rec.signal = sig;
+  rec.handler = handler;
+
+  sigRecList.push_front( rec );
+}
+
+/**
+ * sigHandler is called when receiving signals
+ * @param sig
+ */
+void SignalHandler::sigHandler( int sig )
+{
+  for ( SignalCallbackList::iterator it = SignalHandler::getInstance()->callbackList.begin(); it != SignalHandler::getInstance()->callbackList.end(); it++  )
+  {
+    (*(it->cb))( it->someData );
+  }
+
+  std::string sigName = "UNKNOWN";
+
+  switch ( sig )
+  {
+    case SIGSEGV:
+      sigName = "SIGSEGV";
+      break;
+    case SIGABRT:
+      sigName = "SIGABRT";
+      break;
+    case SIGILL:
+      sigName = "SIGILL";
+      break;
+  }
+
+  if (bXAutoKeyRepeatOn_)
+  {
+    std::cout << "Trying to restore XAutoKeyRepeat" << std::endl;
+    Display* display;
+    if ((display = XOpenDisplay(0)))
+    {
+      XAutoRepeatOn(display);
+      XCloseDisplay(display);
+    }
+  }
+
+  COUT(0) << "recieved signal " << sigName.c_str() << std::endl << "try to write backtrace to file orxonox.log" << std::endl;
+
+  int sigPipe[2];
+  if ( pipe(sigPipe) == -1 )
+  {
+    perror("pipe failed!\n");
+    exit(EXIT_FAILURE);
+  }
+
+  int sigPid = fork();
+
+  if ( sigPid == -1 )
+  {
+    perror("fork failed!\n");
+    exit(EXIT_FAILURE);
+  }
+
+  // gdb will be attached to this process
+  if ( sigPid == 0 )
+  {
+    getInstance()->dontCatch();
+    // wait for message from parent when it has attached gdb
+    int someData;
+
+    read( sigPipe[0], &someData, sizeof(someData) );
+
+    if ( someData != 0x12345678 )
+    {
+      COUT(0) << "something went wrong :(" << std::endl;
+    }
+
+    return;
+  }
+
+  int gdbIn[2];
+  int gdbOut[2];
+  int gdbErr[2];
+
+  if ( pipe(gdbIn) == -1 || pipe(gdbOut) == -1 || pipe(gdbErr) == -1 )
+  {
+    perror("pipe failed!\n");
+    kill( sigPid, SIGTERM );
+    waitpid( sigPid, NULL, 0 );
+    exit(EXIT_FAILURE);
+  }
+
+  int gdbPid = fork();
+  // this process will run gdb
+
+  if ( gdbPid == -1 )
+  {
+    perror("fork failed\n");
+    kill( sigPid, SIGTERM );
+    waitpid( sigPid, NULL, 0 );
+    exit(EXIT_FAILURE);
+  }
+
+  if ( gdbPid == 0 )
+  {
+    // start gdb
+
+    close(gdbIn[1]);
+    close(gdbOut[0]);
+    close(gdbErr[0]);
+
+    dup2( gdbIn[0], STDIN_FILENO );
+    dup2( gdbOut[1], STDOUT_FILENO );
+    dup2( gdbErr[1], STDERR_FILENO );
+
+    execlp( "sh", "sh", "-c", "gdb", (void*)NULL);
+  }
+
+  char cmd[256];
+  snprintf( cmd, 256, "file %s\nattach %d\nc\n", getInstance()->appName.c_str(), sigPid );
+  write( gdbIn[1], cmd, strlen(cmd) );
+
+  int charsFound = 0;
+  int promptFound = 0;
+  char byte;
+  while ( read( gdbOut[0], &byte, 1 ) == 1 )
+  {
+    if (
+      charsFound == 0 && byte == '(' ||
+      charsFound == 1 && byte == 'g' ||
+      charsFound == 2 && byte == 'd' ||
+      charsFound == 3 && byte == 'b' ||
+      charsFound == 4 && byte == ')' ||
+      charsFound == 5 && byte == ' '
+        )
+          charsFound++;
+    else
+      charsFound = 0;
+
+    if ( charsFound == 6 )
+    {
+      promptFound++;
+      charsFound = 0;
+    }
+
+    if ( promptFound == 3 )
+    {
+      break;
+    }
+  }
+
+  int someData = 0x12345678;
+  write( sigPipe[1], &someData, sizeof(someData) );
+
+  write( gdbIn[1], "bt\nk\nq\n", 7 );
+
+
+  charsFound = 0;
+  promptFound = 0;
+  std::string bt;
+  while ( read( gdbOut[0], &byte, 1 ) == 1 )
+  {
+    bt += std::string( &byte, 1 );
+
+    if (
+      charsFound == 0 && byte == '(' ||
+      charsFound == 1 && byte == 'g' ||
+      charsFound == 2 && byte == 'd' ||
+      charsFound == 3 && byte == 'b' ||
+      charsFound == 4 && byte == ')' ||
+      charsFound == 5 && byte == ' '
+        )
+          charsFound++;
+    else
+      charsFound = 0;
+
+    if ( charsFound == 6 )
+    {
+      promptFound++;
+      charsFound = 0;
+      bt += "\n";
+    }
+
+    if ( promptFound == 3 )
+    {
+      break;
+    }
+  }
+
+
+  waitpid( sigPid, NULL, 0 );
+  waitpid( gdbPid, NULL, 0 );
+
+  int wsRemoved = 0;
+
+  while ( wsRemoved < 2 && bt.length() > 0 )
+  {
+    if ( bt[1] == '\n' )
+      wsRemoved++;
+    bt.erase(0, 1);
+  }
+
+  if ( bt.length() > 0 )
+    bt.erase(0, 1);
+
+  time_t now = time(NULL);
+
+  std::string timeString = "\n\n\n\n"
+                     "=======================================================\n"
+                     "= time: " + std::string(ctime(&now)) +
+         "=======================================================\n";
+  bt.insert(0, timeString);
+
+  FILE * f = fopen( getInstance()->fileName.c_str(), "a" );
+
+  if ( !f )
+  {
+    perror( ( std::string( "could not append to " ) + getInstance()->fileName ).c_str() );
+    exit(EXIT_FAILURE);
+  }
+
+  if ( fwrite( bt.c_str(), 1, bt.length(), f ) != bt.length() )
+  {
+    COUT(0) << "could not write " << bt.length() << " byte to " << getInstance()->fileName << std::endl;
+    exit(EXIT_FAILURE);
+  }
+
+  exit(EXIT_FAILURE);
+}
+
+void SignalHandler::registerCallback( SignalCallback cb, void * someData )
+{
+  SignalCallbackRec rec;
+  rec.cb = cb;
+  rec.someData = someData;
+
+  callbackList.push_back(rec);
+}
+
+#endif /* ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 */
Index: code/trunk/src/util/SignalHandler.h
===================================================================
--- code/trunk/src/util/SignalHandler.h	(revision 2087)
+++ code/trunk/src/util/SignalHandler.h	(revision 2087)
@@ -0,0 +1,109 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Christoph Renner
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Declaration of the SignalHandler class.
+*/
+
+#ifndef _SignalHandler_H__
+#define _SignalHandler_H__
+
+#include "UtilPrereqs.h"
+
+#include <list>
+#include <string>
+
+typedef int (*SignalCallback)( void * someData );
+
+#if ORXONOX_PLATFORM != ORXONOX_PLATFORM_WIN32
+#include <signal.h>
+
+struct SignalRec
+{
+  int signal;
+  sig_t handler;
+};
+
+struct SignalCallbackRec
+{
+  SignalCallback cb;
+  void * someData;
+};
+
+
+typedef std::list<SignalRec> SignalRecList;
+typedef std::list<SignalCallbackRec> SignalCallbackList;
+
+class SignalHandler
+{
+  private:
+    SignalHandler();
+  public:
+    inline static SignalHandler* getInstance() { if (!SignalHandler::singletonRef) SignalHandler::singletonRef = new SignalHandler(); return SignalHandler::singletonRef; }
+    ~SignalHandler(){ SignalHandler::singletonRef = NULL; }
+
+    void registerCallback( SignalCallback cb, void * someData );
+
+    void doCatch( const std::string & appName, const std::string & fileName );
+    void dontCatch();
+
+  private:
+    static void sigHandler( int sig );
+
+    void catchSignal( int sig );
+    SignalRecList sigRecList;
+
+    SignalCallbackList callbackList;
+
+    static SignalHandler * singletonRef;
+
+    std::string appName;
+    std::string fileName;
+
+    // used to turn on KeyAutoRepeat if OIS crashes
+    static bool bXAutoKeyRepeatOn_;
+};
+
+#else /* ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 */
+
+class _UtilExport SignalHandler
+{
+  public:
+    inline static SignalHandler* getInstance() { if (!SignalHandler::singletonRef) SignalHandler::singletonRef = new SignalHandler(); return SignalHandler::singletonRef; };
+    void doCatch( const std::string & appName, const std::string & fileName ) {};
+    void dontCatch() {};
+    void registerCallback( SignalCallback cb, void * someData ) {};
+
+  private:
+    static SignalHandler * singletonRef;
+};
+
+#endif /* ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 */
+
+#endif /* _SignalHandler_H__ */
Index: code/trunk/src/util/String.cc
===================================================================
--- code/trunk/src/util/String.cc	(revision 1937)
+++ code/trunk/src/util/String.cc	(revision 2087)
@@ -37,8 +37,13 @@
 #include <iostream>
 
-/**
-    @brief Blank string as variable so you can use const std::string& even if you have to return "".
-*/
-std::string blankString = "";
+#include "Convert.h"
+#include "Math.h"
+
+std::string BLANKSTRING("");
+
+std::string getUniqueNumberString()
+{
+    return convertToString(getUniqueNumber());
+}
 
 /**
Index: code/trunk/src/util/String.h
===================================================================
--- code/trunk/src/util/String.h	(revision 1937)
+++ code/trunk/src/util/String.h	(revision 2087)
@@ -40,5 +40,6 @@
 #include <sstream>
 
-extern _UtilExport std::string blankString;
+extern _UtilExport std::string BLANKSTRING;
+_UtilExport std::string getUniqueNumberString();
 
 _UtilExport void        strip(std::string* str);
Index: code/trunk/updateMedia.sh
===================================================================
--- code/trunk/updateMedia.sh	(revision 1937)
+++ code/trunk/updateMedia.sh	(revision 2087)
@@ -1,5 +1,5 @@
 #!/bin/bash
 dir=${pwd}
-cd ../Media
+cd ../media
 svn up
 cd $dir
Index: code/trunk/visual_studio/vc8/audio.vcproj
===================================================================
--- code/trunk/visual_studio/vc8/audio.vcproj	(revision 1937)
+++ code/trunk/visual_studio/vc8/audio.vcproj	(revision 2087)
Index: code/trunk/visual_studio/vc8/audio.vsprops
===================================================================
--- code/trunk/visual_studio/vc8/audio.vsprops	(revision 1937)
+++ code/trunk/visual_studio/vc8/audio.vsprops	(revision 2087)
Index: code/trunk/visual_studio/vc8/base.vsprops
===================================================================
--- code/trunk/visual_studio/vc8/base.vsprops	(revision 1937)
+++ code/trunk/visual_studio/vc8/base.vsprops	(revision 2087)
Index: code/trunk/visual_studio/vc8/ceguilua.vcproj
===================================================================
--- code/trunk/visual_studio/vc8/ceguilua.vcproj	(revision 1937)
+++ code/trunk/visual_studio/vc8/ceguilua.vcproj	(revision 2087)
Index: code/trunk/visual_studio/vc8/ceguilua.vsprops
===================================================================
--- code/trunk/visual_studio/vc8/ceguilua.vsprops	(revision 1937)
+++ code/trunk/visual_studio/vc8/ceguilua.vsprops	(revision 2087)
Index: code/trunk/visual_studio/vc8/core.vcproj
===================================================================
--- code/trunk/visual_studio/vc8/core.vcproj	(revision 1937)
+++ code/trunk/visual_studio/vc8/core.vcproj	(revision 2087)
@@ -165,4 +165,8 @@
 			</File>
 			<File
+				RelativePath="..\..\src\core\Event.cc"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\core\GameState.cc"
 				>
@@ -173,4 +177,8 @@
 			</File>
 			<File
+				RelativePath="..\..\src\core\LuaBind.cc"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\core\OrxonoxClass.cc"
 				>
@@ -181,5 +189,9 @@
 			</File>
 			<File
-				RelativePath="..\..\src\core\Script.cc"
+				RelativePath="..\..\src\core\Template.cc"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\core\XMLNameListener.cc"
 				>
 			</File>
@@ -397,4 +409,12 @@
 			</File>
 			<File
+				RelativePath="..\..\src\core\Event.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\core\EventIncludes.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\core\GameState.h"
 				>
@@ -405,4 +425,8 @@
 			</File>
 			<File
+				RelativePath="..\..\src\core\LuaBind.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\core\OrxonoxClass.h"
 				>
@@ -413,15 +437,19 @@
 			</File>
 			<File
-				RelativePath="..\..\src\core\Script.h"
-				>
-			</File>
-			<File
 				RelativePath="..\..\src\core\Super.h"
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\core\Template.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\core\XMLIncludes.h"
 				>
 			</File>
+			<File
+				RelativePath="..\..\src\core\XMLNameListener.h"
+				>
+			</File>
 			<Filter
 				Name="input"
@@ -596,8 +624,4 @@
 				</File>
 				<File
-					RelativePath="..\..\src\core\Level.h"
-					>
-				</File>
-				<File
 					RelativePath="..\..\src\core\Loader.h"
 					>
@@ -609,4 +633,8 @@
 				<File
 					RelativePath="..\..\src\core\NamespaceNode.h"
+					>
+				</File>
+				<File
+					RelativePath="..\..\src\core\XMLFile.h"
 					>
 				</File>
Index: code/trunk/visual_studio/vc8/core.vsprops
===================================================================
--- code/trunk/visual_studio/vc8/core.vsprops	(revision 1937)
+++ code/trunk/visual_studio/vc8/core.vsprops	(revision 2087)
Index: code/trunk/visual_studio/vc8/cpptcl.vcproj
===================================================================
--- code/trunk/visual_studio/vc8/cpptcl.vcproj	(revision 1937)
+++ code/trunk/visual_studio/vc8/cpptcl.vcproj	(revision 2087)
Index: code/trunk/visual_studio/vc8/cpptcl.vsprops
===================================================================
--- code/trunk/visual_studio/vc8/cpptcl.vsprops	(revision 1937)
+++ code/trunk/visual_studio/vc8/cpptcl.vsprops	(revision 2087)
Index: code/trunk/visual_studio/vc8/debug.vsprops
===================================================================
--- code/trunk/visual_studio/vc8/debug.vsprops	(revision 1937)
+++ code/trunk/visual_studio/vc8/debug.vsprops	(revision 2087)
Index: code/trunk/visual_studio/vc8/directories.vsprops
===================================================================
--- code/trunk/visual_studio/vc8/directories.vsprops	(revision 1937)
+++ code/trunk/visual_studio/vc8/directories.vsprops	(revision 2087)
Index: code/trunk/visual_studio/vc8/lua.vcproj
===================================================================
--- code/trunk/visual_studio/vc8/lua.vcproj	(revision 1937)
+++ code/trunk/visual_studio/vc8/lua.vcproj	(revision 2087)
Index: code/trunk/visual_studio/vc8/lua.vsprops
===================================================================
--- code/trunk/visual_studio/vc8/lua.vsprops	(revision 1937)
+++ code/trunk/visual_studio/vc8/lua.vsprops	(revision 2087)
Index: code/trunk/visual_studio/vc8/lua_static.vcproj
===================================================================
--- code/trunk/visual_studio/vc8/lua_static.vcproj	(revision 1937)
+++ code/trunk/visual_studio/vc8/lua_static.vcproj	(revision 2087)
Index: code/trunk/visual_studio/vc8/lua_static.vsprops
===================================================================
--- code/trunk/visual_studio/vc8/lua_static.vsprops	(revision 1937)
+++ code/trunk/visual_studio/vc8/lua_static.vsprops	(revision 2087)
Index: code/trunk/visual_studio/vc8/network.vcproj
===================================================================
--- code/trunk/visual_studio/vc8/network.vcproj	(revision 1937)
+++ code/trunk/visual_studio/vc8/network.vcproj	(revision 2087)
@@ -18,5 +18,5 @@
 		<Configuration
 			Name="Debug|Win32"
-			ConfigurationType="4"
+			ConfigurationType="2"
 			InheritedPropertySheets=".\debug.vsprops;.\network.vsprops"
 			CharacterSet="1"
@@ -50,5 +50,5 @@
 			/>
 			<Tool
-				Name="VCLibrarianTool"
+				Name="VCLinkerTool"
 			/>
 			<Tool
@@ -56,4 +56,7 @@
 			/>
 			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
 				Name="VCXDCMakeTool"
 			/>
@@ -63,4 +66,10 @@
 			<Tool
 				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
 			/>
 			<Tool
@@ -70,5 +79,5 @@
 		<Configuration
 			Name="Release|Win32"
-			ConfigurationType="4"
+			ConfigurationType="2"
 			InheritedPropertySheets=".\release.vsprops;.\network.vsprops"
 			CharacterSet="1"
@@ -103,5 +112,5 @@
 			/>
 			<Tool
-				Name="VCLibrarianTool"
+				Name="VCLinkerTool"
 			/>
 			<Tool
@@ -109,4 +118,7 @@
 			/>
 			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
 				Name="VCXDCMakeTool"
 			/>
@@ -116,4 +128,10 @@
 			<Tool
 				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
 			/>
 			<Tool
@@ -131,4 +149,8 @@
 			>
 			<File
+				RelativePath="..\..\src\network\ChatListener.cc"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\network\Client.cc"
 				>
@@ -136,4 +158,8 @@
 			<File
 				RelativePath="..\..\src\network\ClientConnection.cc"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\network\ClientConnectionListener.cc"
 				>
 			</File>
@@ -213,4 +239,8 @@
 			>
 			<File
+				RelativePath="..\..\src\network\ChatListener.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\network\Client.h"
 				>
@@ -218,4 +248,8 @@
 			<File
 				RelativePath="..\..\src\network\ClientConnection.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\network\ClientConnectionListener.h"
 				>
 			</File>
Index: code/trunk/visual_studio/vc8/network.vsprops
===================================================================
--- code/trunk/visual_studio/vc8/network.vsprops	(revision 1937)
+++ code/trunk/visual_studio/vc8/network.vsprops	(revision 2087)
@@ -9,5 +9,5 @@
 		Name="VCCLCompilerTool"
 		AdditionalOptions="/MP2"
-		PreprocessorDefinitions="ORXONOX_NO_EXPORTS;NETWORK_STATIC_BUILD"
+		PreprocessorDefinitions="NETWORK_SHARED_BUILD"
 	/>
 	<Tool
Index: code/trunk/visual_studio/vc8/ois.vcproj
===================================================================
--- code/trunk/visual_studio/vc8/ois.vcproj	(revision 1937)
+++ code/trunk/visual_studio/vc8/ois.vcproj	(revision 2087)
Index: code/trunk/visual_studio/vc8/ois.vsprops
===================================================================
--- code/trunk/visual_studio/vc8/ois.vsprops	(revision 1937)
+++ code/trunk/visual_studio/vc8/ois.vsprops	(revision 2087)
Index: code/trunk/visual_studio/vc8/orxonox.vcproj
===================================================================
--- code/trunk/visual_studio/vc8/orxonox.vcproj	(revision 1937)
+++ code/trunk/visual_studio/vc8/orxonox.vcproj	(revision 2087)
@@ -39,5 +39,4 @@
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions="/Zm200"
 			/>
 			<Tool
@@ -103,5 +102,4 @@
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions="/Zm200"
 			/>
 			<Tool
@@ -153,5 +151,13 @@
 			>
 			<File
+				RelativePath="..\..\src\orxonox\CameraManager.cc"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\orxonox\GraphicsEngine.cc"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\orxonox\LevelManager.cc"
 				>
 			</File>
@@ -184,49 +190,17 @@
 				>
 			</File>
-			<File
-				RelativePath="..\..\src\orxonox\SignalHandler.cc"
-				>
-			</File>
 			<Filter
 				Name="objects"
 				>
 				<File
-					RelativePath="..\..\src\orxonox\objects\Ambient.cc"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\Backlight.cc"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\BillboardProjectile.cc"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\Camera.cc"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\CameraHandler.cc"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\Model.cc"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\NPC.cc"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\ParticleProjectile.cc"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\ParticleSpawner.cc"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\Projectile.cc"
+					RelativePath="..\..\src\orxonox\objects\EventDispatcher.cc"
+					>
+				</File>
+				<File
+					RelativePath="..\..\src\orxonox\objects\EventListener.cc"
+					>
+				</File>
+				<File
+					RelativePath="..\..\src\orxonox\objects\EventTarget.cc"
 					>
 				</File>
@@ -234,44 +208,8 @@
 					RelativePath="..\..\src\orxonox\objects\Radar.cc"
 					>
-					<FileConfiguration
-						Name="Debug|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							ObjectFile="$(IntDir)\$(InputName)1.obj"
-							XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							ObjectFile="$(IntDir)\$(InputName)1.obj"
-							XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
-						/>
-					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\src\orxonox\objects\RadarListener.cc"
 					>
-					<FileConfiguration
-						Name="Debug|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							ObjectFile="$(IntDir)\$(InputName)1.obj"
-							XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							ObjectFile="$(IntDir)\$(InputName)1.obj"
-							XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
-						/>
-					</FileConfiguration>
 				</File>
 				<File
@@ -280,17 +218,13 @@
 				</File>
 				<File
-					RelativePath="..\..\src\orxonox\objects\RotatingProjectile.cc"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\Skybox.cc"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\SpaceShip.cc"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\SpaceShipAI.cc"
+					RelativePath="..\..\src\orxonox\objects\Scene.cc"
+					>
+				</File>
+				<File
+					RelativePath="..\..\src\orxonox\objects\Script.cc"
+					>
+				</File>
+				<File
+					RelativePath="..\..\src\orxonox\objects\Test.cc"
 					>
 				</File>
@@ -299,8 +233,152 @@
 					>
 				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\WorldEntity.cc"
-					>
-				</File>
+				<Filter
+					Name="worldentities"
+					>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\Backlight.cc"
+						>
+						<FileConfiguration
+							Name="Debug|Win32"
+							ExcludedFromBuild="true"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Release|Win32"
+							ExcludedFromBuild="true"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+							/>
+						</FileConfiguration>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\Billboard.cc"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\BlinkingBillboard.cc"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\Camera.cc"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\CameraPosition.cc"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\ControllableEntity.cc"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\Light.cc"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\Model.cc"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\MovableEntity.cc"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\ParticleEmitter.cc"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\ParticleSpawner.cc"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\PositionableEntity.cc"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\SpawnPoint.cc"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\WorldEntity.cc"
+						>
+					</File>
+					<Filter
+						Name="pawns"
+						>
+						<File
+							RelativePath="..\..\src\orxonox\objects\worldentities\pawns\Pawn.cc"
+							>
+						</File>
+						<File
+							RelativePath="..\..\src\orxonox\objects\worldentities\pawns\SpaceShip.cc"
+							>
+						</File>
+						<File
+							RelativePath="..\..\src\orxonox\objects\worldentities\pawns\Spectator.cc"
+							>
+						</File>
+					</Filter>
+					<Filter
+						Name="triggers"
+						>
+						<File
+							RelativePath="..\..\src\orxonox\objects\worldentities\triggers\DistanceTrigger.cc"
+							>
+						</File>
+						<File
+							RelativePath="..\..\src\orxonox\objects\worldentities\triggers\EventTrigger.cc"
+							>
+						</File>
+						<File
+							RelativePath="..\..\src\orxonox\objects\worldentities\triggers\Trigger.cc"
+							>
+						</File>
+					</Filter>
+				</Filter>
+				<Filter
+					Name="gametypes"
+					>
+					<File
+						RelativePath="..\..\src\orxonox\objects\gametypes\Gametype.cc"
+						>
+					</File>
+				</Filter>
+				<Filter
+					Name="infos"
+					>
+					<File
+						RelativePath="..\..\src\orxonox\objects\infos\HumanPlayer.cc"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\infos\Info.cc"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\infos\Level.cc"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\infos\PlayerInfo.cc"
+						>
+					</File>
+				</Filter>
+				<Filter
+					Name="controllers"
+					>
+					<File
+						RelativePath="..\..\src\orxonox\objects\controllers\Controller.cc"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\controllers\HumanController.cc"
+						>
+					</File>
+				</Filter>
 			</Filter>
 			<Filter
@@ -309,8 +387,4 @@
 				<File
 					RelativePath="..\..\src\orxonox\tools\BillboardSet.cc"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\tools\Light.cc"
 					>
 				</File>
@@ -413,4 +487,8 @@
 					>
 					<File
+						RelativePath="..\..\src\orxonox\overlays\hud\ChatOverlay.cc"
+						>
+					</File>
+					<File
 						RelativePath="..\..\src\orxonox\overlays\hud\HUDBar.cc"
 						>
@@ -452,60 +530,12 @@
 					RelativePath="..\..\src\orxonox\gui\OgreCEGUIRenderer.cpp"
 					>
-					<FileConfiguration
-						Name="Debug|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							UsePrecompiledHeader="0"
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							UsePrecompiledHeader="0"
-						/>
-					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\src\orxonox\gui\OgreCEGUIResourceProvider.cpp"
 					>
-					<FileConfiguration
-						Name="Debug|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							UsePrecompiledHeader="0"
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							UsePrecompiledHeader="0"
-						/>
-					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\..\src\orxonox\gui\OgreCEGUITexture.cpp"
 					>
-					<FileConfiguration
-						Name="Debug|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							UsePrecompiledHeader="0"
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							UsePrecompiledHeader="0"
-						/>
-					</FileConfiguration>
 				</File>
 			</Filter>
@@ -557,8 +587,16 @@
 			>
 			<File
+				RelativePath="..\..\src\orxonox\CameraManager.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\orxonox\GraphicsEngine.h"
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\orxonox\LevelManager.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\orxonox\OrxonoxPrereqs.h"
 				>
@@ -572,49 +610,17 @@
 				>
 			</File>
-			<File
-				RelativePath="..\..\src\orxonox\SignalHandler.h"
-				>
-			</File>
 			<Filter
 				Name="objects"
 				>
 				<File
-					RelativePath="..\..\src\orxonox\objects\Ambient.h"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\Backlight.h"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\BillboardProjectile.h"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\Camera.h"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\CameraHandler.h"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\Model.h"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\NPC.h"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\ParticleProjectile.h"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\ParticleSpawner.h"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\Projectile.h"
+					RelativePath="..\..\src\orxonox\objects\EventDispatcher.h"
+					>
+				</File>
+				<File
+					RelativePath="..\..\src\orxonox\objects\EventListener.h"
+					>
+				</File>
+				<File
+					RelativePath="..\..\src\orxonox\objects\EventTarget.h"
 					>
 				</File>
@@ -632,17 +638,13 @@
 				</File>
 				<File
-					RelativePath="..\..\src\orxonox\objects\RotatingProjectile.h"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\Skybox.h"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\SpaceShip.h"
-					>
-				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\SpaceShipAI.h"
+					RelativePath="..\..\src\orxonox\objects\Scene.h"
+					>
+				</File>
+				<File
+					RelativePath="..\..\src\orxonox\objects\Script.h"
+					>
+				</File>
+				<File
+					RelativePath="..\..\src\orxonox\objects\Test.h"
 					>
 				</File>
@@ -651,8 +653,132 @@
 					>
 				</File>
-				<File
-					RelativePath="..\..\src\orxonox\objects\WorldEntity.h"
-					>
-				</File>
+				<Filter
+					Name="worldentities"
+					>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\Backlight.h"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\Billboard.h"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\BlinkingBillboard.h"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\Camera.h"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\CameraPosition.h"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\ControllableEntity.h"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\Light.h"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\Model.h"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\MovableEntity.h"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\ParticleEmitter.h"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\ParticleSpawner.h"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\PositionableEntity.h"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\SpawnPoint.h"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\WorldEntity.h"
+						>
+					</File>
+					<Filter
+						Name="pawns"
+						>
+						<File
+							RelativePath="..\..\src\orxonox\objects\worldentities\pawns\Pawn.h"
+							>
+						</File>
+						<File
+							RelativePath="..\..\src\orxonox\objects\worldentities\pawns\SpaceShip.h"
+							>
+						</File>
+						<File
+							RelativePath="..\..\src\orxonox\objects\worldentities\pawns\Spectator.h"
+							>
+						</File>
+					</Filter>
+					<Filter
+						Name="triggers"
+						>
+						<File
+							RelativePath="..\..\src\orxonox\objects\worldentities\triggers\DistanceTrigger.h"
+							>
+						</File>
+						<File
+							RelativePath="..\..\src\orxonox\objects\worldentities\triggers\EventTrigger.h"
+							>
+						</File>
+						<File
+							RelativePath="..\..\src\orxonox\objects\worldentities\triggers\Trigger.h"
+							>
+						</File>
+					</Filter>
+				</Filter>
+				<Filter
+					Name="gametypes"
+					>
+					<File
+						RelativePath="..\..\src\orxonox\objects\gametypes\Gametype.h"
+						>
+					</File>
+				</Filter>
+				<Filter
+					Name="infos"
+					>
+					<File
+						RelativePath="..\..\src\orxonox\objects\infos\Info.h"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\infos\Level.h"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\infos\PlayerInfo.h"
+						>
+					</File>
+				</Filter>
+				<Filter
+					Name="controllers"
+					>
+					<File
+						RelativePath="..\..\src\orxonox\objects\controllers\Controller.h"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\controllers\HumanController.h"
+						>
+					</File>
+				</Filter>
 			</Filter>
 			<Filter
@@ -664,8 +790,4 @@
 				</File>
 				<File
-					RelativePath="..\..\src\orxonox\tools\Light.h"
-					>
-				</File>
-				<File
 					RelativePath="..\..\src\orxonox\tools\Mesh.h"
 					>
@@ -714,4 +836,8 @@
 					Name="hud"
 					>
+					<File
+						RelativePath="..\..\src\orxonox\overlays\hud\ChatOverlay.h"
+						>
+					</File>
 					<File
 						RelativePath="..\..\src\orxonox\overlays\hud\HUDBar.h"
Index: code/trunk/visual_studio/vc8/orxonox.vcproj.user
===================================================================
--- code/trunk/visual_studio/vc8/orxonox.vcproj.user	(revision 1937)
+++ code/trunk/visual_studio/vc8/orxonox.vcproj.user	(revision 2087)
Index: code/trunk/visual_studio/vc8/orxonox.vsprops
===================================================================
--- code/trunk/visual_studio/vc8/orxonox.vsprops	(revision 1937)
+++ code/trunk/visual_studio/vc8/orxonox.vsprops	(revision 2087)
@@ -8,6 +8,6 @@
 	<Tool
 		Name="VCCLCompilerTool"
-		AdditionalOptions="/MP2"
-		PreprocessorDefinitions="ORXONOX_NO_EXPORTS;NETWORK_STATIC_BUILD;LUA_BUILD_AS_DLL"
+		AdditionalOptions="/MP2 /Zm200"
+		PreprocessorDefinitions="ORXONOX_NO_EXPORTS;ORXONOX_ENABLE_PCH;LUA_BUILD_AS_DLL"
 		UsePrecompiledHeader="2"
 		PrecompiledHeaderThrough="OrxonoxStableHeaders.h"
@@ -22,5 +22,5 @@
 		Name="VCPostBuildEventTool"
 		Description="Copying files from init folder..."
-		CommandLine="for %%a in ($(RootDir)\init\$(SolutionName)\$(ConfigurationName)\*) do replace %%a $(OutDir). /A &gt;nul&#x0D;&#x0A;for %%a in ($(RootDir)\init\common\*) do replace %%a $(OutDir). /A &gt;nul"
+		CommandLine="for %%a in ($(RootDir)\init\$(SolutionName)\$(ConfigurationName)\*) do replace %%a $(OutDir). /A &gt;nul&#x0D;&#x0A;for %%a in ($(RootDir)\init\common\*) do replace %%a $(OutDir). /A &gt;nul&#x0D;&#x0A;"
 	/>
 </VisualStudioPropertySheet>
Index: code/trunk/visual_studio/vc8/orxonox_vc8.sln
===================================================================
--- code/trunk/visual_studio/vc8/orxonox_vc8.sln	(revision 1937)
+++ code/trunk/visual_studio/vc8/orxonox_vc8.sln	(revision 2087)
Index: code/trunk/visual_studio/vc8/release.vsprops
===================================================================
--- code/trunk/visual_studio/vc8/release.vsprops	(revision 1937)
+++ code/trunk/visual_studio/vc8/release.vsprops	(revision 2087)
Index: code/trunk/visual_studio/vc8/tinyxml.vcproj
===================================================================
--- code/trunk/visual_studio/vc8/tinyxml.vcproj	(revision 1937)
+++ code/trunk/visual_studio/vc8/tinyxml.vcproj	(revision 2087)
Index: code/trunk/visual_studio/vc8/tinyxml.vsprops
===================================================================
--- code/trunk/visual_studio/vc8/tinyxml.vsprops	(revision 1937)
+++ code/trunk/visual_studio/vc8/tinyxml.vsprops	(revision 2087)
Index: code/trunk/visual_studio/vc8/tolua.vcproj
===================================================================
--- code/trunk/visual_studio/vc8/tolua.vcproj	(revision 1937)
+++ code/trunk/visual_studio/vc8/tolua.vcproj	(revision 2087)
Index: code/trunk/visual_studio/vc8/tolua.vsprops
===================================================================
--- code/trunk/visual_studio/vc8/tolua.vsprops	(revision 1937)
+++ code/trunk/visual_studio/vc8/tolua.vsprops	(revision 2087)
Index: code/trunk/visual_studio/vc8/tolua_static.vcproj
===================================================================
--- code/trunk/visual_studio/vc8/tolua_static.vcproj	(revision 1937)
+++ code/trunk/visual_studio/vc8/tolua_static.vcproj	(revision 2087)
Index: code/trunk/visual_studio/vc8/tolua_static.vsprops
===================================================================
--- code/trunk/visual_studio/vc8/tolua_static.vsprops	(revision 1937)
+++ code/trunk/visual_studio/vc8/tolua_static.vsprops	(revision 2087)
Index: code/trunk/visual_studio/vc8/toluagen.vcproj
===================================================================
--- code/trunk/visual_studio/vc8/toluagen.vcproj	(revision 1937)
+++ code/trunk/visual_studio/vc8/toluagen.vcproj	(revision 2087)
Index: code/trunk/visual_studio/vc8/toluagen.vsprops
===================================================================
--- code/trunk/visual_studio/vc8/toluagen.vsprops	(revision 1937)
+++ code/trunk/visual_studio/vc8/toluagen.vsprops	(revision 2087)
Index: code/trunk/visual_studio/vc8/toluagen_orxonox.vcproj
===================================================================
--- code/trunk/visual_studio/vc8/toluagen_orxonox.vcproj	(revision 1937)
+++ code/trunk/visual_studio/vc8/toluagen_orxonox.vcproj	(revision 2087)
Index: code/trunk/visual_studio/vc8/toluagen_orxonox.vsprops
===================================================================
--- code/trunk/visual_studio/vc8/toluagen_orxonox.vsprops	(revision 1937)
+++ code/trunk/visual_studio/vc8/toluagen_orxonox.vsprops	(revision 2087)
Index: code/trunk/visual_studio/vc8/util.vcproj
===================================================================
--- code/trunk/visual_studio/vc8/util.vcproj	(revision 1937)
+++ code/trunk/visual_studio/vc8/util.vcproj	(revision 2087)
@@ -181,4 +181,8 @@
 			</File>
 			<File
+				RelativePath="..\..\src\util\SignalHandler.cc"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\util\String.cc"
 				>
@@ -227,4 +231,8 @@
 			</File>
 			<File
+				RelativePath="..\..\src\util\MathConvert.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\util\MultiType.h"
 				>
@@ -244,4 +252,8 @@
 			<File
 				RelativePath="..\..\src\util\OutputHandler.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\util\SignalHandler.h"
 				>
 			</File>
Index: code/trunk/visual_studio/vc8/util.vsprops
===================================================================
--- code/trunk/visual_studio/vc8/util.vsprops	(revision 1937)
+++ code/trunk/visual_studio/vc8/util.vsprops	(revision 2087)
