Index: code/branches/presentation/src/core/BaseObject.cc
===================================================================
--- code/branches/presentation/src/core/BaseObject.cc	(revision 2484)
+++ code/branches/presentation/src/core/BaseObject.cc	(revision 2485)
@@ -36,4 +36,5 @@
 #include "CoreIncludes.h"
 #include "EventIncludes.h"
+#include "Functor.h"
 #include "XMLPort.h"
 #include "XMLFile.h"
@@ -60,4 +61,7 @@
         this->oldGametype_ = 0;
 
+        this->functorSetMainState_ = 0;
+        this->functorGetMainState_ = 0;
+
         this->setCreator(creator);
         if (this->creator_)
@@ -82,9 +86,17 @@
     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);
+        if (this->isInitialized())
+        {
+            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);
+
+            if (this->functorSetMainState_)
+                delete this->functorSetMainState_;
+            if (this->functorGetMainState_)
+                delete this->functorGetMainState_;
+        }
     }
 
@@ -100,4 +112,5 @@
         XMLPortParam(BaseObject, "visible", setVisible, isVisible, xmlelement, mode);
         XMLPortParam(BaseObject, "active", setActive, isActive, xmlelement, mode);
+        XMLPortParam(BaseObject, "mainstate", setMainStateName, getMainStateName, xmlelement, mode);
 
         XMLPortObjectTemplate(BaseObject, Template, "templates", addTemplate, getTemplate, xmlelement, mode, Template*);
@@ -109,5 +122,5 @@
             std::list<std::string> eventnames;
 
-            if (mode == XMLPort::LoadObject)
+            if (mode == XMLPort::LoadObject || mode == XMLPort::ExpandObject)
             {
                 for (ticpp::Iterator<ticpp::Element> child = events->FirstChildElement(false); child != child.end(); child++)
@@ -279,3 +292,46 @@
         SetEvent(BaseObject, "visibility", setVisible, event);
     }
+
+    void BaseObject::setMainStateName(const std::string& name)
+    {
+        if (this->mainStateName_ != name)
+        {
+            this->mainStateName_ = name;
+            if (this->functorSetMainState_)
+                delete this->functorSetMainState_;
+            if (this->functorGetMainState_)
+                delete this->functorGetMainState_;
+            this->changedMainState();
+            if (!this->functorSetMainState_)
+                COUT(2) << "Warning: \"" << name << "\" is not a valid MainState." << std::endl;
+        }
+    }
+
+    void BaseObject::setMainState(bool state)
+    {
+        if (this->functorSetMainState_)
+            (*this->functorSetMainState_)(state);
+        else
+            COUT(2) << "Warning: No MainState defined in object \"" << this->getName() << "\" (" << this->getIdentifier()->getName() << ")" << std::endl;
+    }
+
+    bool BaseObject::getMainState() const
+    {
+        if (this->functorGetMainState_)
+        {
+            (*this->functorGetMainState_)();
+            return this->functorGetMainState_->getReturnvalue();
+        }
+        else
+        {
+            COUT(2) << "Warning: No MainState defined in object \"" << this->getName() << "\" (" << this->getIdentifier()->getName() << ")" << std::endl;
+            return false;
+        }
+    }
+
+    void BaseObject::changedMainState()
+    {
+        SetMainState(BaseObject, "activity",   setActive,  isActive);
+        SetMainState(BaseObject, "visibility", setVisible, isVisible);
+    }
 }
Index: code/branches/presentation/src/core/BaseObject.h
===================================================================
--- code/branches/presentation/src/core/BaseObject.h	(revision 2484)
+++ code/branches/presentation/src/core/BaseObject.h	(revision 2485)
@@ -36,4 +36,11 @@
 #ifndef _BaseObject_H__
 #define _BaseObject_H__
+
+#define SetMainState(classname, statename, setfunction, getfunction) \
+    if (this->getMainStateName() == statename) \
+    { \
+        this->functorSetMainState_ = createFunctor(&classname::setfunction)->setObject(this); \
+        this->functorGetMainState_ = createFunctor(&classname::getfunction)->setObject(this); \
+    }
 
 #include <map>
@@ -100,4 +107,11 @@
             virtual void changedVisibility() {}
 
+            void setMainState(bool state);
+            bool getMainState() const;
+
+            void setMainStateName(const std::string& name);
+            inline const std::string& getMainStateName() const { return this->mainStateName_; }
+            virtual void changedMainState();
+
             /** @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; }
@@ -121,8 +135,16 @@
             inline Scene* getScene() const { return this->scene_; }
 
-            inline void setGametype(Gametype* gametype) { this->oldGametype_ = this->gametype_; this->gametype_ = gametype; this->changedGametype(); }
+            inline void setGametype(Gametype* gametype)
+            {
+                if (gametype != this->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() {}
+            virtual void changedGametype() {}
 
             void fireEvent();
@@ -153,6 +175,9 @@
             std::string name_;                          //!< The name of the object
             std::string oldName_;                       //!< The old name of the object
-            mbool bActive_;                             //!< True = the object is active
-            mbool bVisible_;                            //!< True = the object is visible
+            mbool       bActive_;                       //!< True = the object is active
+            mbool       bVisible_;                      //!< True = the object is visible
+            std::string mainStateName_;
+            Functor*    functorSetMainState_;
+            Functor*    functorGetMainState_;
 
         private:
@@ -160,14 +185,14 @@
             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_;
+            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_;
@@ -178,4 +203,7 @@
     SUPER_FUNCTION(3, BaseObject, changedVisibility, false);
     SUPER_FUNCTION(4, BaseObject, processEvent, false);
+    SUPER_FUNCTION(6, BaseObject, changedMainState, false);
+    SUPER_FUNCTION(9, BaseObject, changedName, false);
+    SUPER_FUNCTION(10, BaseObject, changedGametype, false);
 }
 
Index: code/branches/presentation/src/core/CommandExecutor.cc
===================================================================
--- code/branches/presentation/src/core/CommandExecutor.cc	(revision 2484)
+++ code/branches/presentation/src/core/CommandExecutor.cc	(revision 2485)
@@ -53,5 +53,5 @@
     }
 
-    ConsoleCommand& CommandExecutor::addConsoleCommandShortcut(ConsoleCommand* command)
+    ConsoleCommand& CommandExecutor::addConsoleCommandShortcut(ConsoleCommand* command, bool bDeleteAtExit)
     {
         std::map<std::string, ConsoleCommand*>::const_iterator it = CommandExecutor::getInstance().consoleCommandShortcuts_.find(command->getName());
@@ -61,4 +61,9 @@
         }
 
+        // Make sure we can also delete the external ConsoleCommands that don't belong to an Identifier
+        if (command && bDeleteAtExit)
+        {
+            CommandExecutor::getInstance().consoleCommandExternals_.insert(command);
+        }
 
         CommandExecutor::getInstance().consoleCommandShortcuts_[command->getName()] = command;
@@ -647,3 +652,10 @@
         }
     }
+
+    void CommandExecutor::destroyExternalCommands()
+    {
+        for (std::set<ConsoleCommand*>::const_iterator it = CommandExecutor::getInstance().consoleCommandExternals_.begin();
+            it != CommandExecutor::getInstance().consoleCommandExternals_.end(); ++it)
+            delete *it;
+    }
 }
Index: code/branches/presentation/src/core/CommandExecutor.h
===================================================================
--- code/branches/presentation/src/core/CommandExecutor.h	(revision 2484)
+++ code/branches/presentation/src/core/CommandExecutor.h	(revision 2485)
@@ -51,5 +51,5 @@
             static const CommandEvaluation& getLastEvaluation();
 
-            static ConsoleCommand& addConsoleCommandShortcut(ConsoleCommand* command);
+            static ConsoleCommand& addConsoleCommandShortcut(ConsoleCommand* command, bool bDeleteAtExit = false);
             static ConsoleCommand* getConsoleCommandShortcut(const std::string& name);
             static ConsoleCommand* getLowercaseConsoleCommandShortcut(const std::string& name);
@@ -68,4 +68,6 @@
             /** @brief Returns a const_iterator to the end of the map that stores all console commands with their names in lowercase. @return The const_iterator */
             static inline std::map<std::string, ConsoleCommand*>::const_iterator getLowercaseConsoleCommandShortcutMapEnd() { return CommandExecutor::getInstance().consoleCommandShortcuts_LC_.end(); }
+
+            static void destroyExternalCommands();
 
         private:
@@ -101,4 +103,5 @@
             std::map<std::string, ConsoleCommand*> consoleCommandShortcuts_;
             std::map<std::string, ConsoleCommand*> consoleCommandShortcuts_LC_;
+            std::set<ConsoleCommand*>              consoleCommandExternals_;
     }; // tolua_export
 } // tolua_export
Index: code/branches/presentation/src/core/CommandLine.cc
===================================================================
--- code/branches/presentation/src/core/CommandLine.cc	(revision 2484)
+++ code/branches/presentation/src/core/CommandLine.cc	(revision 2485)
@@ -83,9 +83,5 @@
     CommandLine::~CommandLine()
     {
-        for (std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgs_.begin();
-            it != cmdLineArgs_.end(); ++it)
-        {
-            delete it->second;
-        }
+        CommandLine::destroyAllArguments();
     }
 
@@ -98,4 +94,17 @@
         static CommandLine instance;
         return instance;
+    }
+
+    /**
+    @brief
+        Destroys all command line arguments. This should be called at the end
+        of main. Do not use before that.
+    */
+    void CommandLine::destroyAllArguments()
+    {
+        for (std::map<std::string, CommandLineArgument*>::const_iterator it = _getInstance().cmdLineArgs_.begin();
+            it != _getInstance().cmdLineArgs_.end(); ++it)
+            delete it->second;
+        _getInstance().cmdLineArgs_.clear();
     }
 
Index: code/branches/presentation/src/core/CommandLine.h
===================================================================
--- code/branches/presentation/src/core/CommandLine.h	(revision 2484)
+++ code/branches/presentation/src/core/CommandLine.h	(revision 2485)
@@ -155,4 +155,5 @@
         }
 
+        static void destroyAllArguments();
 
     private:
@@ -179,5 +180,5 @@
         //! Holds all pointers to the arguments and serves as a search map by name.
         std::map<std::string, CommandLineArgument*> cmdLineArgs_;
-        //! Search map by chortcut for the arguments.
+        //! Search map by shortcut for the arguments.
         std::map<std::string, CommandLineArgument*> cmdLineArgsShortcut_;
     };
Index: code/branches/presentation/src/core/ConsoleCommand.h
===================================================================
--- code/branches/presentation/src/core/ConsoleCommand.h	(revision 2484)
+++ code/branches/presentation/src/core/ConsoleCommand.h	(revision 2485)
@@ -64,5 +64,5 @@
 
 #define SetConsoleCommandShortcutGeneric(fakevariable, command) \
-    orxonox::ConsoleCommand& fakevariable = orxonox::CommandExecutor::addConsoleCommandShortcut(command)
+    orxonox::ConsoleCommand& fakevariable = orxonox::CommandExecutor::addConsoleCommandShortcut(command, true)
 
 
Index: code/branches/presentation/src/core/Core.cc
===================================================================
--- code/branches/presentation/src/core/Core.cc	(revision 2484)
+++ code/branches/presentation/src/core/Core.cc	(revision 2485)
@@ -46,4 +46,6 @@
     bool Core::bIsMaster_s      = false;
 
+    Core* Core::singletonRef_s = 0;
+
     /**
         @brief Constructor: Registers the object and sets the config-values.
@@ -53,6 +55,10 @@
     {
         RegisterRootObject(Core);
+
+        assert(Core::singletonRef_s == 0);
+        Core::singletonRef_s = this;
+        this->bInitializeRandomNumberGenerator_ = false;
+
         this->setConfigValues();
-        isCreatingCoreSettings() = false;
     }
 
@@ -62,35 +68,6 @@
     Core::~Core()
     {
-        isCreatingCoreSettings() = true;
-    }
-
-    /**
-        @brief Returns true if the Core instance is not yet ready and the static functions have to return a default value.
-    */
-    bool& Core::isCreatingCoreSettings()
-    {
-        static bool bCreatingCoreSettings = true;
-        return bCreatingCoreSettings;
-    }
-
-    /**
-        @brief Returns a unique instance of Core.
-        @return The instance
-    */
-    Core& Core::getInstance()
-    {
-        // If bCreatingSoftDebugLevelObject is true, we're just about to create an instance of the DebugLevel class
-        //if (Core::isCreatingCoreSettings())
-        //{
-        //    isCreatingCoreSettings() = false;
-        //    //instance.setConfigValues();
-        //}
-
-        static bool firstTime = true;
-        if (firstTime)
-            isCreatingCoreSettings() = true;
-
-        static Core instance;
-        return instance;
+        assert(Core::singletonRef_s);
+        Core::singletonRef_s = 0;
     }
 
@@ -104,4 +81,5 @@
         SetConfigValue(softDebugLevelShell_, 1).description("The maximal level of debug output shown in the ingame shell").callback(this, &Core::debugLevelChanged);
         SetConfigValue(language_, Language::getLanguage().defaultLanguage_).description("The language of the ingame text").callback(this, &Core::languageChanged);
+        SetConfigValue(bInitializeRandomNumberGenerator_, true).description("If true, all random actions are different each time you start the game").callback(this, &Core::initializeRandomNumberGenerator);
     }
 
@@ -140,23 +118,18 @@
     int Core::getSoftDebugLevel(OutputHandler::OutputDevice device)
     {
-        if (!Core::isCreatingCoreSettings())
+        switch (device)
         {
-            switch (device)
-            {
-            case OutputHandler::LD_All:
-                return Core::getInstance().softDebugLevel_;
-            case OutputHandler::LD_Console:
-                return Core::getInstance().softDebugLevelConsole_;
-            case OutputHandler::LD_Logfile:
-                return Core::getInstance().softDebugLevelLogfile_;
-            case OutputHandler::LD_Shell:
-                return Core::getInstance().softDebugLevelShell_;
-            default:
-                assert(0);
-            }
+        case OutputHandler::LD_All:
+            return Core::getInstance().softDebugLevel_;
+        case OutputHandler::LD_Console:
+            return Core::getInstance().softDebugLevelConsole_;
+        case OutputHandler::LD_Logfile:
+            return Core::getInstance().softDebugLevelLogfile_;
+        case OutputHandler::LD_Shell:
+            return Core::getInstance().softDebugLevelShell_;
+        default:
+            assert(0);
+            return 2;
         }
-
-        // Return a constant value while we're creating the object
-        return 2;
     }
 
@@ -168,17 +141,14 @@
      void Core::setSoftDebugLevel(OutputHandler::OutputDevice device, int level)
      {
-        if (!Core::isCreatingCoreSettings())
-        {
-            if (device == OutputHandler::LD_All)
-                Core::getInstance().softDebugLevel_ = level;
-            else if (device == OutputHandler::LD_Console)
-                Core::getInstance().softDebugLevelConsole_ = level;
-            else if (device == OutputHandler::LD_Logfile)
-                Core::getInstance().softDebugLevelLogfile_ = level;
-            else if (device == OutputHandler::LD_Shell)
-                Core::getInstance().softDebugLevelShell_ = level;
+        if (device == OutputHandler::LD_All)
+            Core::getInstance().softDebugLevel_ = level;
+        else if (device == OutputHandler::LD_Console)
+            Core::getInstance().softDebugLevelConsole_ = level;
+        else if (device == OutputHandler::LD_Logfile)
+            Core::getInstance().softDebugLevelLogfile_ = level;
+        else if (device == OutputHandler::LD_Shell)
+            Core::getInstance().softDebugLevelShell_ = level;
 
-            OutputHandler::setSoftDebugLevel(device, level);
-        }
+        OutputHandler::setSoftDebugLevel(device, level);
      }
 
@@ -188,8 +158,5 @@
     const std::string& Core::getLanguage()
     {
-        if (!Core::isCreatingCoreSettings())
-            return Core::getInstance().language_;
-
-        return Language::getLanguage().defaultLanguage_;
+        return Core::getInstance().language_;
     }
 
@@ -209,3 +176,14 @@
         ResetConfigValue(language_);
     }
+
+    void Core::initializeRandomNumberGenerator()
+    {
+        static bool bInitialized = false;
+        if (!bInitialized && this->bInitializeRandomNumberGenerator_)
+        {
+            srand(time(0));
+            rand();
+            bInitialized = true;
+        }
+    }
 }
Index: code/branches/presentation/src/core/Core.h
===================================================================
--- code/branches/presentation/src/core/Core.h	(revision 2484)
+++ code/branches/presentation/src/core/Core.h	(revision 2485)
@@ -40,4 +40,5 @@
 #include "CorePrereqs.h"
 
+#include <cassert>
 #include "OrxonoxClass.h"
 #include "util/OutputHandler.h"
@@ -49,14 +50,16 @@
     {
         public:
-            static Core& getInstance();
-            static bool& isCreatingCoreSettings();
+            Core();
+            ~Core();
             void setConfigValues();
             void debugLevelChanged();
             void languageChanged();
 
-            static int getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All);
-            static void setSoftDebugLevel(OutputHandler::OutputDevice device, int level);
+            static Core& getInstance() { assert(Core::singletonRef_s); return *Core::singletonRef_s; }
+
+            static int   getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All);
+            static void  setSoftDebugLevel(OutputHandler::OutputDevice device, int level);
             static const std::string& getLanguage();
-            static void resetLanguage();
+            static void  resetLanguage();
 
             // fast access global variables.
@@ -73,9 +76,7 @@
 
         private:
+            Core(const Core&);
             void resetLanguageIntern();
-
-            Core();
-            Core(const Core& other);
-            virtual ~Core();
+            void initializeRandomNumberGenerator();
 
             int softDebugLevel_;                            //!< The debug level
@@ -84,4 +85,5 @@
             int softDebugLevelShell_;                       //!< The debug level for the ingame shell
             std::string language_;                          //!< The language
+            bool bInitializeRandomNumberGenerator_;          //!< If true, srand(time(0)) is called
 
             static bool bShowsGraphics_s;                   //!< global variable that tells whether to show graphics
@@ -90,4 +92,6 @@
             static bool bIsStandalone_s;
             static bool bIsMaster_s;
+
+            static Core* singletonRef_s;
     };
 }
Index: code/branches/presentation/src/core/CorePrereqs.h
===================================================================
--- code/branches/presentation/src/core/CorePrereqs.h	(revision 2484)
+++ code/branches/presentation/src/core/CorePrereqs.h	(revision 2485)
@@ -69,5 +69,6 @@
     {
       LoadObject,
-      SaveObject
+      SaveObject,
+      ExpandObject
     };
   }
@@ -132,4 +133,5 @@
   class LanguageEntry;
   class Loader;
+  class LuaBind;
   class MetaObjectList;
   class MetaObjectListElement;
Index: code/branches/presentation/src/core/Functor.h
===================================================================
--- code/branches/presentation/src/core/Functor.h	(revision 2484)
+++ code/branches/presentation/src/core/Functor.h	(revision 2485)
@@ -167,5 +167,5 @@
             }
 
-            FunctorMember* setObject(T* object)
+            FunctorMember<T>* setObject(T* object)
             {
                 this->bConstObject_ = false;
@@ -174,5 +174,5 @@
             }
 
-            FunctorMember* setObject(const T* object)
+            FunctorMember<T>* setObject(const T* object)
             {
                 this->bConstObject_ = true;
Index: code/branches/presentation/src/core/Identifier.cc
===================================================================
--- code/branches/presentation/src/core/Identifier.cc	(revision 2484)
+++ code/branches/presentation/src/core/Identifier.cc	(revision 2485)
@@ -93,4 +93,15 @@
         for (std::map<std::string, XMLPortObjectContainer*>::iterator it = this->xmlportObjectContainers_.begin(); it != this->xmlportObjectContainers_.end(); ++it)
             delete (it->second);
+        for (std::vector<Functor*>::iterator it = this->constructionCallbacks_.begin(); it != this->constructionCallbacks_.end(); ++it)
+            delete *it;
+    }
+
+    /**
+        @brief Returns the identifier map with the names as received by typeid(). This is only used internally.
+    */
+    std::map<std::string, Identifier*>& Identifier::getTypeIDIdentifierMap()
+    {
+        static std::map<std::string, Identifier*> identifiers;    //!< The map to store all Identifiers.
+        return identifiers;
     }
 
@@ -103,8 +114,7 @@
     Identifier* Identifier::getIdentifierSingleton(const std::string& name, Identifier* proposal)
     {
-        static std::map<std::string, Identifier*> identifiers;    //!< The map to store all Identifiers.
-        std::map<std::string, Identifier*>::const_iterator it = identifiers.find(name);
-
-        if (it != identifiers.end())
+        std::map<std::string, Identifier*>::const_iterator it = getTypeIDIdentifierMap().find(name);
+
+        if (it != getTypeIDIdentifierMap().end())
         {
             // There is already an entry: return it and delete the proposal
@@ -115,5 +125,5 @@
         {
             // There is no entry: put the proposal into the map and return it
-            identifiers[name] = proposal;
+            getTypeIDIdentifierMap()[name] = proposal;
             return proposal;
         }
@@ -192,5 +202,5 @@
     void Identifier::destroyAllIdentifiers()
     {
-        for (std::map<std::string, Identifier*>::iterator it = Identifier::getIdentifierMapIntern().begin(); it != Identifier::getIdentifierMapIntern().end(); ++it)
+        for (std::map<std::string, Identifier*>::iterator it = Identifier::getTypeIDIdentifierMap().begin(); it != Identifier::getTypeIDIdentifierMap().end(); ++it)
             delete (it->second);
     }
Index: code/branches/presentation/src/core/Identifier.h
===================================================================
--- code/branches/presentation/src/core/Identifier.h	(revision 2484)
+++ code/branches/presentation/src/core/Identifier.h	(revision 2485)
@@ -258,4 +258,6 @@
             void initializeClassHierarchy(std::set<const Identifier*>* parents, bool bRootClass);
 
+            static void destroyAllIdentifiers();
+
         protected:
             Identifier();
@@ -300,7 +302,7 @@
             }
 
+            static std::map<std::string, Identifier*>& getTypeIDIdentifierMap();
+
             void initialize(std::set<const Identifier*>* parents);
-
-            static void destroyAllIdentifiers();
 
             std::set<const Identifier*> parents_;                          //!< The parents of the class the Identifier belongs to
Index: code/branches/presentation/src/core/Language.cc
===================================================================
--- code/branches/presentation/src/core/Language.cc	(revision 2484)
+++ code/branches/presentation/src/core/Language.cc	(revision 2485)
@@ -87,4 +87,7 @@
     // ###        Language         ###
     // ###############################
+
+    Language* Language::singletonRef_s = 0;
+
     /**
         @brief Constructor: Reads the default language file and sets some values.
@@ -92,4 +95,7 @@
     Language::Language()
     {
+        assert(singletonRef_s == 0);
+        singletonRef_s = this;
+
         this->defaultLanguage_ = "default";
         this->defaultLocalisation_ = "ERROR: LANGUAGE ENTRY DOESN'T EXIST!";
@@ -106,14 +112,7 @@
         for (std::map<std::string, LanguageEntry*>::iterator it = this->languageEntries_.begin(); it != this->languageEntries_.end(); ++it)
             delete (it->second);
-    }
-
-    /**
-        @brief Returns a reference to the only existing instance of the Language class and calls the setConfigValues() function.
-        @return The reference to the only existing instance
-    */
-    Language& Language::getLanguage()
-    {
-        static Language instance = Language();
-        return instance;
+
+        assert(singletonRef_s);
+        singletonRef_s = 0;
     }
 
Index: code/branches/presentation/src/core/Language.h
===================================================================
--- code/branches/presentation/src/core/Language.h	(revision 2484)
+++ code/branches/presentation/src/core/Language.h	(revision 2485)
@@ -50,4 +50,5 @@
 #include <map>
 #include <string>
+#include <cassert>
 
 #define AddLanguageEntry(label, fallbackstring) \
@@ -116,12 +117,13 @@
 
         public:
-            static Language& getLanguage();
+            Language();
+            ~Language();
+
+            static Language& getLanguage() { assert(singletonRef_s); return *singletonRef_s; }
             void addEntry(const LanguageEntryLabel& label, const std::string& entry);
             const std::string& getLocalisation(const LanguageEntryLabel& label) const;
 
         private:
-            Language();
-            Language(const Language& language);     // don't copy
-            virtual ~Language();
+            Language(const Language&);
 
             void readDefaultLanguageFile();
@@ -134,4 +136,6 @@
             std::string defaultLocalisation_;                       //!< The returned string, if an entry unavailable entry is requested
             std::map<std::string, LanguageEntry*> languageEntries_; //!< A map to store all LanguageEntry objects and their labels
+
+            static Language* singletonRef_s;
     };
 }
Index: code/branches/presentation/src/core/Loader.cc
===================================================================
--- code/branches/presentation/src/core/Loader.cc	(revision 2484)
+++ code/branches/presentation/src/core/Loader.cc	(revision 2485)
@@ -120,8 +120,8 @@
 
         // let Lua work this out:
-        LuaBind* lua = LuaBind::getInstance();
-        lua->clearLuaOutput();
-        lua->loadFile(file->getFilename(), true);
-        lua->run();
+        LuaBind& lua = LuaBind::getInstance();
+        lua.clearLuaOutput();
+        lua.loadFile(file->getFilename(), true);
+        lua.run();
 
         try
@@ -135,5 +135,5 @@
             ticpp::Document xmlfile;
             //xmlfile.ToDocument();
-            xmlfile.Parse(lua->getLuaOutput(), true);
+            xmlfile.Parse(lua.getLuaOutput(), true);
 
             ticpp::Element rootElement;
Index: code/branches/presentation/src/core/LuaBind.cc
===================================================================
--- code/branches/presentation/src/core/LuaBind.cc	(revision 2484)
+++ code/branches/presentation/src/core/LuaBind.cc	(revision 2485)
@@ -40,8 +40,11 @@
 namespace orxonox
 {
-  LuaBind* LuaBind::singletonRef = NULL;
+  LuaBind* LuaBind::singletonRef_s = NULL;
 
   LuaBind::LuaBind()
   {
+    assert(LuaBind::singletonRef_s == 0);
+    LuaBind::singletonRef_s = this;
+
     luaState_ = lua_open();
     luaSource_ = "";
Index: code/branches/presentation/src/core/LuaBind.h
===================================================================
--- code/branches/presentation/src/core/LuaBind.h	(revision 2484)
+++ code/branches/presentation/src/core/LuaBind.h	(revision 2485)
@@ -42,4 +42,5 @@
 }
 
+#include <cassert>
 #include <list>
 #include <string>
@@ -58,6 +59,8 @@
 
     public:
-      inline static LuaBind* getInstance() { if (!LuaBind::singletonRef) LuaBind::singletonRef = new LuaBind(); return LuaBind::singletonRef; } // tolua_export
-      inline ~LuaBind() { LuaBind::singletonRef = NULL; };
+      LuaBind();
+      inline ~LuaBind() { assert(singletonRef_s); LuaBind::singletonRef_s = NULL; };
+
+      inline static LuaBind& getInstance() { assert(singletonRef_s); return *LuaBind::singletonRef_s; } // tolua_export
 
     void loadFile(std::string filename, bool luaTags);
@@ -83,6 +86,5 @@
 
     private:
-      LuaBind();
-      static LuaBind* singletonRef;
+      static LuaBind* singletonRef_s;
 
       std::string luaSource_;
Index: code/branches/presentation/src/core/RootGameState.cc
===================================================================
--- code/branches/presentation/src/core/RootGameState.cc	(revision 2484)
+++ code/branches/presentation/src/core/RootGameState.cc	(revision 2485)
@@ -31,5 +31,4 @@
 #include "util/Debug.h"
 #include "util/Exception.h"
-#include "Core.h"
 #include "Clock.h"
 #include "CommandLine.h"
@@ -138,7 +137,4 @@
             Clock clock;
 
-            // create the Core settings to configure the output level
-            Core::getInstance();
-
             this->activate();
 
Index: code/branches/presentation/src/core/RootGameState.h
===================================================================
--- code/branches/presentation/src/core/RootGameState.h	(revision 2484)
+++ code/branches/presentation/src/core/RootGameState.h	(revision 2485)
@@ -48,5 +48,5 @@
         void gotoState(const std::string& name);
 
-        std::string           stateRequest_;
+        std::string stateRequest_;
     };
 }
Index: code/branches/presentation/src/core/Shell.cc
===================================================================
--- code/branches/presentation/src/core/Shell.cc	(revision 2484)
+++ code/branches/presentation/src/core/Shell.cc	(revision 2485)
@@ -75,5 +75,5 @@
 
         this->outputBuffer_.registerListener(this);
-        OutputHandler::getOutStream().setOutputBuffer(this->outputBuffer_);
+        OutputHandler::getOutStream().setOutputBuffer(&this->outputBuffer_);
 
         this->setConfigValues();
@@ -84,4 +84,5 @@
     Shell::~Shell()
     {
+        OutputHandler::getOutStream().setOutputBuffer(0);
         if (this->inputBuffer_)
             delete this->inputBuffer_;
Index: code/branches/presentation/src/core/Super.h
===================================================================
--- code/branches/presentation/src/core/Super.h	(revision 2484)
+++ code/branches/presentation/src/core/Super.h	(revision 2485)
@@ -99,4 +99,5 @@
             \
             static void apply(void* temp) {} \
+            \
             static void apply(baseclass* temp) \
             { \
@@ -104,4 +105,11 @@
                 for (std::set<const Identifier*>::iterator it = identifier->getDirectChildrenIntern().begin(); it != identifier->getDirectChildrenIntern().end(); ++it) \
                 { \
+                    if (((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ && ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_) \
+                    { \
+                        delete ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_; \
+                        ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = 0; \
+                        ((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ = false; \
+                    } \
+                    \
                     if (!((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_) \
                     { \
@@ -163,4 +171,13 @@
                 for (std::set<const Identifier*>::iterator it = identifier->getDirectChildrenIntern().begin(); it != identifier->getDirectChildrenIntern().end(); ++it)
                 {
+                    // Check if the caller is a fallback-caller
+                    if (((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ && ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_)
+                    {
+                        // Delete the fallback caller an prepare to get a real caller
+                        delete ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_;
+                        ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = 0;
+                        ((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ = false;
+                    }
+
                     // Check if there's not already a caller
                     if (!((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_)
@@ -183,5 +200,5 @@
         struct SuperFunctionCondition<functionnumber, baseclass, 0, templatehack2> \
         { \
-            // The check function just behaves like the fallback - it advances to the check for the next super-function (functionnumber + 1)
+            // The check function acts like the fallback - it advances to the check for the next super-function (functionnumber + 1)
             static void check() \
             { \
@@ -233,4 +250,22 @@
     #define SUPER_processEvent(classname, functionname, ...) \
         SUPER_ARGS(classname, functionname, __VA_ARGS__)
+
+    #define SUPER_changedScale(classname, functionname, ...) \
+        SUPER_NOARGS(classname, functionname)
+
+    #define SUPER_changedMainState(classname, functionname, ...) \
+        SUPER_NOARGS(classname, functionname)
+
+    #define SUPER_changedOwner(classname, functionname, ...) \
+        SUPER_NOARGS(classname, functionname)
+
+    #define SUPER_changedOverlayGroup(classname, functionname, ...) \
+        SUPER_NOARGS(classname, functionname)
+
+    #define SUPER_changedName(classname, functionname, ...) \
+        SUPER_NOARGS(classname, functionname)
+
+    #define SUPER_changedGametype(classname, functionname, ...) \
+        SUPER_NOARGS(classname, functionname)
     // (1/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
 
@@ -292,4 +327,20 @@
             }; \
             \
+            class _CoreExport SuperFunctionCaller_##functionname \
+            { \
+                public: \
+                    virtual void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) ) = 0; \
+                    virtual ~SuperFunctionCaller_##functionname () {} \
+            }; \
+            \
+            template <class T> \
+            class SuperFunctionClassCaller_purevirtualfallback_##functionname : public SuperFunctionCaller_##functionname \
+            { \
+                public: \
+                    inline void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) ) \
+                    { \
+                    } \
+            }; \
+            \
             template <class T> \
             struct SuperFunctionInitialization<functionnumber, T> \
@@ -297,5 +348,6 @@
                 static void initialize(ClassIdentifier<T>* identifier) \
                 { \
-                    identifier->superFunctionCaller_##functionname##_ = 0; \
+                    identifier->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_purevirtualfallback_##functionname <T>; \
+                    identifier->bSuperFunctionCaller_##functionname##_isFallback_ = true; \
                     SuperFunctionInitialization<functionnumber + 1, T>::initialize(identifier); \
                 } \
@@ -313,11 +365,4 @@
             }; \
             \
-            class _CoreExport SuperFunctionCaller_##functionname \
-            { \
-                public: \
-                    virtual void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) ) = 0; \
-                    virtual ~SuperFunctionCaller_##functionname () {} \
-            }; \
-            \
             template <class T> \
             class SuperFunctionClassCaller_##functionname : public SuperFunctionCaller_##functionname \
@@ -366,5 +411,25 @@
         };
 
-        // Initializes the SuperFunctionCaller-pointer with zero.
+        // Baseclass of the super-function caller. The real call will be done by a
+        // templatized subclass through the virtual () operator.
+        class _CoreExport SuperFunctionCaller_##functionname
+        {
+            public:
+                virtual void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) ) = 0;
+                virtual ~SuperFunctionCaller_##functionname () {}
+        };
+
+        // Fallback if the base is pure virtual
+        template <class T>
+        class SuperFunctionClassCaller_purevirtualfallback_##functionname : public SuperFunctionCaller_##functionname
+        {
+            public:
+                // Fallback does nothing
+                inline void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) )
+                {
+                }
+        };
+
+        // Initializes the SuperFunctionCaller-pointer with a fallback caller in case the base function is pure virtual
         template <class T>
         struct SuperFunctionInitialization<functionnumber, T>
@@ -372,5 +437,6 @@
             static void initialize(ClassIdentifier<T>* identifier)
             {
-                identifier->superFunctionCaller_##functionname##_ = 0;
+                identifier->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_purevirtualfallback_##functionname <T>;
+                identifier->bSuperFunctionCaller_##functionname##_isFallback_ = true;
 
                 // Calls the initialization of the next super-function (functionnumber + 1)
@@ -391,13 +457,4 @@
                 SuperFunctionDestruction<functionnumber + 1, T>::destroy(identifier);
             }
-        };
-
-        // Baseclass of the super-function caller. The real call will be done by a
-        // templatized subclass through the virtual () operator.
-        class _CoreExport SuperFunctionCaller_##functionname
-        {
-            public:
-                virtual void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) ) = 0;
-                virtual ~SuperFunctionCaller_##functionname () {}
         };
 
@@ -441,4 +498,28 @@
             (event)
         SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
+
+        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(5, changedScale, false)
+            ()
+        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
+
+        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(6, changedMainState, false)
+            ()
+        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
+
+        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(7, changedOwner, false)
+            ()
+        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
+
+        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(8, changedOverlayGroup, false)
+            ()
+        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
+
+        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(9, changedName, false)
+            ()
+        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
+
+        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(10, changedGametype, false)
+            ()
+        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
         // (2/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
 
@@ -476,5 +557,6 @@
         #ifndef SUPER_INTRUSIVE_DECLARATION
           #define SUPER_INTRUSIVE_DECLARATION(functionname) \
-            SuperFunctionCaller_##functionname * superFunctionCaller_##functionname##_
+            SuperFunctionCaller_##functionname * superFunctionCaller_##functionname##_; \
+            bool bSuperFunctionCaller_##functionname##_isFallback_
         #endif
 
@@ -488,4 +570,10 @@
     SUPER_INTRUSIVE_DECLARATION(changedVisibility);
     SUPER_INTRUSIVE_DECLARATION(processEvent);
+    SUPER_INTRUSIVE_DECLARATION(changedScale);
+    SUPER_INTRUSIVE_DECLARATION(changedMainState);
+    SUPER_INTRUSIVE_DECLARATION(changedOwner);
+    SUPER_INTRUSIVE_DECLARATION(changedOverlayGroup);
+    SUPER_INTRUSIVE_DECLARATION(changedName);
+    SUPER_INTRUSIVE_DECLARATION(changedGametype);
     // (3/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
 
Index: code/branches/presentation/src/core/Template.cc
===================================================================
--- code/branches/presentation/src/core/Template.cc	(revision 2484)
+++ code/branches/presentation/src/core/Template.cc	(revision 2485)
@@ -43,4 +43,5 @@
 
         this->bIsLink_ = false;
+        this->bLoadDefaults_ = true;
         this->bIsReturningXMLElement_ = false;
         this->baseclassIdentifier_ = 0;
@@ -56,6 +57,7 @@
         SUPER(Template, XMLPort, xmlelement, mode);
 
-        XMLPortParam(Template, "link", setLink, getLink, xmlelement, mode);
-        XMLPortParam(Template, "baseclass", setBaseclass, getBaseclass, xmlelement, mode);
+        XMLPortParam(Template, "link",      setLink,         getLink,         xmlelement, mode);
+        XMLPortParam(Template, "baseclass", setBaseclass,    getBaseclass,    xmlelement, mode);
+        XMLPortParam(Template, "defaults",  setLoadDefaults, getLoadDefaults, xmlelement, mode).defaultValues(true);
 
         Element* element = xmlelement.FirstChildElement(false);
@@ -70,4 +72,6 @@
     void Template::changedName()
     {
+        SUPER(Template, changedName);
+
         if (this->getName() != "")
         {
@@ -134,5 +138,9 @@
 
         Element temp = ((TiXmlElement*)&this->getXMLElement());
-        object->XMLPort(temp, XMLPort::LoadObject);
+
+        if (this->bLoadDefaults_)
+            object->XMLPort(temp, XMLPort::LoadObject);
+        else
+            object->XMLPort(temp, XMLPort::ExpandObject);
     }
 
Index: code/branches/presentation/src/core/Template.h
===================================================================
--- code/branches/presentation/src/core/Template.h	(revision 2484)
+++ code/branches/presentation/src/core/Template.h	(revision 2485)
@@ -53,4 +53,9 @@
                 { return this->link_; }
 
+            inline void setLoadDefaults(bool bLoadDefaults)
+                { this->bLoadDefaults_ = bLoadDefaults; }
+            inline bool getLoadDefaults() const
+                { return this->bLoadDefaults_; }
+
             inline void setXMLElement(const TiXmlElement& xmlelement)
                 { this->xmlelement_ = xmlelement; }
@@ -75,4 +80,5 @@
             Identifier* baseclassIdentifier_;
             bool bIsLink_;
+            bool bLoadDefaults_;
             mutable bool bIsReturningXMLElement_;
     };
Index: code/branches/presentation/src/core/XMLPort.h
===================================================================
--- code/branches/presentation/src/core/XMLPort.h	(revision 2484)
+++ code/branches/presentation/src/core/XMLPort.h	(revision 2485)
@@ -43,4 +43,5 @@
 #include "CorePrereqs.h"
 
+#include <cassert>
 #include "util/Debug.h"
 #include "util/Exception.h"
@@ -369,4 +370,12 @@
             }
 
+            ~XMLPortClassParamContainer()
+            {
+                assert(this->loadexecutor_);
+                delete this->loadexecutor_;
+                if (this->saveexecutor_)
+                    delete this->saveexecutor_;
+            }
+
             XMLPortParamContainer& port(BaseObject* owner, T* object, Element& xmlelement, XMLPort::Mode mode)
             {
@@ -376,17 +385,19 @@
                 this->parseParams_.mode = mode;
 
-                if (mode == XMLPort::LoadObject)
+                if ((mode == XMLPort::LoadObject) || (mode == XMLPort::ExpandObject))
                 {
                     try
                     {
                         std::string attribute = xmlelement.GetAttribute(this->paramname_);
-                        if ((attribute.size() > 0) || (this->loadexecutor_->allDefaultValuesSet()))
+                        if ((attribute.size() > 0) || ((mode != XMLPort::ExpandObject) && this->loadexecutor_->allDefaultValuesSet()))
                         {
                             COUT(5) << this->owner_->getLoaderIndentation() << "Loading parameter " << this->paramname_ << " in " << this->identifier_->getName() << " (objectname " << this->owner_->getName() << ")." << std::endl << this->owner_->getLoaderIndentation();
-                            if (this->loadexecutor_->parse(object, attribute, ","))
+                            if (this->loadexecutor_->parse(object, attribute, ",") || (mode  == XMLPort::ExpandObject))
                                 this->parseResult_ = PR_finished;
                             else
                                 this->parseResult_ = PR_waiting_for_default_values;
                         }
+                        else if (mode == XMLPort::ExpandObject)
+                            this->parseResult_ = PR_finished;
                         else
                             this->parseResult_ = PR_waiting_for_default_values;
@@ -511,7 +522,15 @@
             }
 
+            ~XMLPortClassObjectContainer()
+            {
+                assert(this->loadexecutor_);
+                delete this->loadexecutor_;
+                if (this->saveexecutor_)
+                    delete this->saveexecutor_;
+            }
+
             XMLPortObjectContainer& port(T* object, Element& xmlelement, XMLPort::Mode mode)
             {
-                if (mode == XMLPort::LoadObject)
+                if ((mode == XMLPort::LoadObject) || (mode == XMLPort::ExpandObject))
                 {
                     try
Index: code/branches/presentation/src/core/input/Button.cc
===================================================================
--- code/branches/presentation/src/core/input/Button.cc	(revision 2484)
+++ code/branches/presentation/src/core/input/Button.cc	(revision 2485)
@@ -59,4 +59,5 @@
         nCommands_[1]=0;
         nCommands_[2]=0;
+        this->configContainer_ = 0;
         clear();
     }
@@ -80,4 +81,8 @@
             }
         }
+
+        if (this->configContainer_)
+            delete this->configContainer_;
+        this->configContainer_ = 0;
     }
 
Index: code/branches/presentation/src/core/input/InputBuffer.cc
===================================================================
--- code/branches/presentation/src/core/input/InputBuffer.cc	(revision 2484)
+++ code/branches/presentation/src/core/input/InputBuffer.cc	(revision 2485)
@@ -73,4 +73,11 @@
     }
 
+    InputBuffer::~InputBuffer()
+    {
+        for (std::list<BaseInputBufferListenerTuple*>::const_iterator it = this->listeners_.begin();
+            it != this->listeners_.end(); ++it)
+            delete *it;
+    }
+
     void InputBuffer::setConfigValues()
     {
Index: code/branches/presentation/src/core/input/InputBuffer.h
===================================================================
--- code/branches/presentation/src/core/input/InputBuffer.h	(revision 2484)
+++ code/branches/presentation/src/core/input/InputBuffer.h	(revision 2485)
@@ -79,4 +79,5 @@
         public:
             InputBuffer();
+            ~InputBuffer();
             InputBuffer(const std::string allowedChars);
 
Index: code/branches/presentation/src/network/GamestateClient.cc
===================================================================
--- code/branches/presentation/src/network/GamestateClient.cc	(revision 2484)
+++ code/branches/presentation/src/network/GamestateClient.cc	(revision 2485)
@@ -82,6 +82,8 @@
     NetworkCallbackManager::callCallbacks();
     
-    if (!processed)
-        return false;
+    if (!processed){
+      sendAck(0);
+      return false;
+    }
     //successfully loaded data from gamestate. now save gamestate for diff and delete the old gs
     tempGamestate_=NULL;
Index: code/branches/presentation/src/network/GamestateManager.cc
===================================================================
--- code/branches/presentation/src/network/GamestateManager.cc	(revision 2484)
+++ code/branches/presentation/src/network/GamestateManager.cc	(revision 2485)
@@ -51,4 +51,5 @@
 #include "synchronisable/Synchronisable.h"
 #include "synchronisable/NetworkCallbackManager.h"
+#include "packet/Acknowledgement.h"
 
 namespace orxonox
@@ -172,5 +173,5 @@
     unsigned int curid = temp->getGamestateID();
 
-    if(gamestateID == 0){
+    if(gamestateID == ACKID_NACK){
       temp->setGamestateID(GAMESTATEID_INITIAL);
       return true;
Index: code/branches/presentation/src/network/TrafficControl.cc
===================================================================
--- code/branches/presentation/src/network/TrafficControl.cc	(revision 2484)
+++ code/branches/presentation/src/network/TrafficControl.cc	(revision 2485)
@@ -36,22 +36,22 @@
 
 namespace orxonox {
-  
-  static const unsigned int SCHED_PRIORITY_OFFSET = -1;
+
+  static const unsigned int SCHED_PRIORITY_OFFSET = (unsigned int)-1;
 
   objInfo::objInfo(uint32_t ID, uint32_t creatorID, int32_t curGsID, int32_t diffGsID, uint32_t size, unsigned int prioperm, unsigned int priosched)
-  { 
-    objID = ID; objCreatorID = creatorID; objCurGS = curGsID; objDiffGS = diffGsID; objSize = size; objValuePerm = prioperm; objValueSched = priosched; 
-  }
-  
+  {
+    objID = ID; objCreatorID = creatorID; objCurGS = curGsID; objDiffGS = diffGsID; objSize = size; objValuePerm = prioperm; objValueSched = priosched;
+  }
+
   objInfo::objInfo()
-  { 
-    objID = OBJECTID_UNKNOWN; objCreatorID = OBJECTID_UNKNOWN; objCurGS = GAMESTATEID_INITIAL; objDiffGS = objCurGS; objSize = 0; objValuePerm = 0; objValueSched = 0; 
-  }
-  
-  
-  
+  {
+    objID = OBJECTID_UNKNOWN; objCreatorID = OBJECTID_UNKNOWN; objCurGS = GAMESTATEID_INITIAL; objDiffGS = objCurGS; objSize = 0; objValuePerm = 0; objValueSched = 0;
+  }
+
+
+
   obj::obj()
-  { 
-    objID = OBJECTID_UNKNOWN; objCreatorID = OBJECTID_UNKNOWN; objSize = 0; objDataOffset = 0; 
+  {
+    objID = OBJECTID_UNKNOWN; objCreatorID = OBJECTID_UNKNOWN; objSize = 0; objDataOffset = 0;
   }
   obj::obj( uint32_t ID, uint32_t creatorID, uint32_t size, uint32_t offset )
@@ -59,10 +59,10 @@
     objID = ID; objCreatorID = creatorID; objSize = size; objDataOffset = offset;
   }
-  
+
 /**
 *Initializing protected members
 */
 	TrafficControl *TrafficControl::instance_=0;
-	
+
 	/**
 	* @brief Constructor: assures that only one reference will be created and sets the pointer
@@ -75,5 +75,5 @@
     this->setConfigValues();
 	}
-	
+
 	/**
 	* @brief Destructor: resets the instance pointer to 0
@@ -93,5 +93,5 @@
     SetConfigValue ( targetSize, 5000 );
   }
-  
+
   /**
   * sort-algorithm for sorting the objectlist after priorities
@@ -102,5 +102,5 @@
     assert(clientListPerm_[clientID].find(i.objID) != clientListPerm_[clientID].end()); // make sure the object i is in the client list
     assert(clientListPerm_[clientID].find(j.objID) != clientListPerm_[clientID].end()); // make sure the object j is in the client list
-    
+
     int prio1 = clientListPerm_[clientID][i.objID].objValuePerm + clientListPerm_[clientID][i.objID].objValueSched;
     int prio2 = clientListPerm_[clientID][j.objID].objValuePerm + clientListPerm_[clientID][j.objID].objValueSched;
@@ -118,5 +118,5 @@
   }
 
-  
+
 
 	void TrafficControl::processObjectList(unsigned int clientID, unsigned int gamestateID, std::list<obj> *list)
@@ -128,5 +128,5 @@
 	  return;
 	}
-  
+
   TrafficControl *TrafficControl::getInstance()
   {
@@ -134,14 +134,14 @@
     return instance_;
   }
-	
+
 	void TrafficControl::ack(unsigned int clientID, unsigned int gamestateID)
 	{
 	  std::list<obj>::iterator itvec;  // iterator to iterate through the acked objects
-    
+
     //assertions to make sure the maps already exist
     assert(clientListTemp_.find(clientID) != clientListTemp_.end() );
     assert(clientListPerm_.find(clientID) != clientListPerm_.end() );
 	  assert( clientListTemp_[clientID].find(gamestateID) != clientListTemp_[clientID].end() );
-    
+
     for(itvec = clientListTemp_[clientID][gamestateID].begin(); itvec != clientListTemp_[clientID][gamestateID].end(); itvec++)
 	  {
@@ -173,5 +173,5 @@
 	*/
 	void TrafficControl::insertinClientListPerm(unsigned int clientID, obj objinf)
-	{ 
+	{
 	  std::map<unsigned int,std::map<unsigned int, objInfo> >::iterator itperm;//iterator clientListPerm over clientIDs
 // 	  itperm = (clientListPerm_).find(clientID);
@@ -182,9 +182,9 @@
 //     permObjPrio_.insert(objid, objinf.objValuePerm);
 	}
-	
+
   /**
   * updateClientListTemp
   * takes the shortened list which will be sent to the gsmanager and puts the *info into clientListTemp
-  */	
+  */
   void TrafficControl::updateClientListTemp(std::list<obj> *list)
   {
@@ -225,7 +225,7 @@
 	void TrafficControl::evaluateList(unsigned int clientID, std::list<obj> *list)
 	{
-	
+
 	  //now the sorting
-	
+
 	  //compare listToProcess vs clientListPerm
     //if listToProcess contains new Objects, add them to clientListPerm
@@ -248,5 +248,5 @@
     }
 	  //end compare listToProcess vs clientListPerm
-    
+
     if( bActive_ )
     {
@@ -254,16 +254,16 @@
       // use boost bind here because we need to pass a memberfunction to stl sort
       list->sort(boost::bind(&TrafficControl::prioritySort, this, clientID, _1, _2) );
-      
+
       //now we check, that the creator of an object always exists on a client
       std::list<obj>::iterator itcreator;
       for(itvec = list->begin(); itvec != list->end(); itvec++)
-      { 
+      {
         fixCreatorDependencies(itvec, list, clientID);
       }
       //end of sorting
-      //now the cutting, work the same obj out in processobjectlist and copiedlist, compression rate muss noch festgelegt werden. 
+      //now the cutting, work the same obj out in processobjectlist and copiedlist, compression rate muss noch festgelegt werden.
 //       printList(list, clientID);
       cut(list, targetSize);
-      
+
       //now sort again after objDataOffset
       list->sort(boost::bind(&TrafficControl::dataSort, this, _1, _2) );
@@ -281,5 +281,5 @@
       COUT(0) << "ObjectID: " << (*it).objID << " creatorID: " << (*it).objCreatorID << " Priority: " << clientListPerm_[clientID][(*it).objID].objValuePerm + clientListPerm_[clientID][(*it).objID].objValueSched << " size: " << (*it).objSize << endl;
   }
-  
+
   void TrafficControl::fixCreatorDependencies(std::list<obj>::iterator it1, std::list<obj> *list, unsigned int clientID)
   {
@@ -301,5 +301,5 @@
     }
   }
-  
+
   void TrafficControl::clientDisconnected(unsigned int clientID)
   {
Index: code/branches/presentation/src/network/packet/Acknowledgement.h
===================================================================
--- code/branches/presentation/src/network/packet/Acknowledgement.h	(revision 2484)
+++ code/branches/presentation/src/network/packet/Acknowledgement.h	(revision 2485)
@@ -32,4 +32,5 @@
 #include "Packet.h"
 
+const unsigned int ACKID_NACK = 0;
 
 namespace orxonox {
Index: code/branches/presentation/src/network/packet/Gamestate.cc
===================================================================
--- code/branches/presentation/src/network/packet/Gamestate.cc	(revision 2484)
+++ code/branches/presentation/src/network/packet/Gamestate.cc	(revision 2485)
@@ -31,4 +31,5 @@
 #include "../synchronisable/Synchronisable.h"
 #include "../TrafficControl.h"
+#include "core/Core.h"
 #include "core/CoreIncludes.h"
 #include "core/Iterator.h"
@@ -151,5 +152,8 @@
     if(!s)
     {
-      Synchronisable::fabricate(mem, mode);
+      if (!Core::isMaster())
+        Synchronisable::fabricate(mem, mode);
+      else
+        mem += objectheader->size;
 //         COUT(0) << "could not fabricate synchronisable: " << objectheader->objectID << " classid: " << objectheader->classID << " creator: " << objectheader->creatorID << endl;
 //       else
@@ -170,4 +174,5 @@
       if (it->objectMode_ != 0x0) {
         COUT(0) << "Found object with OBJECTID_UNKNOWN on the client with objectMode != 0x0!" << std::endl;
+        COUT(0) << "Possible reason for this error: Client created a synchronized object without the Server's approval." << std::endl;
         assert(false);
       }
@@ -384,9 +389,11 @@
   //call TrafficControl
   TrafficControl::getInstance()->processObjectList( clientID, HEADER->id, &dataMap_ );
-  
+
   //copy in the zeros
   for(it=dataMap_.begin(); it!=dataMap_.end();){
 //    if((*it).objSize==0)
 //      continue;
+//    if(it->second->getSize(HEADER->id)==0) // merged from objecthierarchy2, doesn't work anymore; TODO: change this
+//      continue;                            // merged from objecthierarchy2, doesn't work anymore; TODO: change this
     oldobjectheader = (synchronisableHeader*)origdata;
     newobjectheader = (synchronisableHeader*)newdata;
Index: code/branches/presentation/src/network/packet/Packet.cc
===================================================================
--- code/branches/presentation/src/network/packet/Packet.cc	(revision 2484)
+++ code/branches/presentation/src/network/packet/Packet.cc	(revision 2485)
@@ -129,7 +129,4 @@
       return false;
     }
-    // Assures we don't create a packet and destroy it right after in another thread
-    // without having a reference in the packetMap_
-    boost::recursive_mutex::scoped_lock lock(Packet::packetMap_mutex);
     // We deliver ENet the data address so that it doesn't memcpy everything again.
     // --> We have to delete data_ ourselves!
@@ -138,5 +135,10 @@
     // 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_[(size_t)(void*)enetPacket_] = this;
+    {
+      // Assures we don't create a packet and destroy it right after in another thread
+      // without having a reference in the packetMap_
+      boost::recursive_mutex::scoped_lock lock(Packet::packetMap_mutex);
+      packetMap_[(size_t)(void*)enetPacket_] = this;
+    }
   }
 #ifndef NDEBUG
Index: code/branches/presentation/src/network/packet/Welcome.cc
===================================================================
--- code/branches/presentation/src/network/packet/Welcome.cc	(revision 2484)
+++ code/branches/presentation/src/network/packet/Welcome.cc	(revision 2485)
@@ -43,5 +43,5 @@
 #define _CLIENTID             _PACKETID + sizeof(ENUM::Type)
 #define _ENDIANTEST           _CLIENTID + sizeof(uint32_t)
-  
+
   Welcome::Welcome( uint32_t clientID, uint32_t shipID )
  : Packet()
@@ -74,5 +74,5 @@
 
 bool Welcome::process(){
-  uint32_t shipID, clientID;
+  uint32_t clientID;
   clientID = *(uint32_t *)(data_ + _CLIENTID );
   assert(*(uint32_t *)(data_ + _ENDIANTEST ) == 0xFEDC4321);
Index: code/branches/presentation/src/network/synchronisable/Synchronisable.cc
===================================================================
--- code/branches/presentation/src/network/synchronisable/Synchronisable.cc	(revision 2484)
+++ code/branches/presentation/src/network/synchronisable/Synchronisable.cc	(revision 2485)
@@ -119,5 +119,5 @@
     if (it != objectMap_.end())
       objectMap_.erase(it);
-    
+
     //HACK HACK HACK HACK HACK HACK
     // this hack ensures that childs of this object also get destroyed
@@ -166,4 +166,10 @@
 
     Identifier* id = ClassByID(header->classID);
+    if (!id)
+    {
+        COUT(0) << "Assertion failed: id" << std::endl;
+        COUT(0) << "Possible reason for this error: Client received a synchronizable object whose class has no factory." << std::endl;
+        abort();
+    }
     assert(id);
     BaseObject* creator = 0;
@@ -253,5 +259,5 @@
 
 /*  void Synchronisable::registerVariable(void *var, int size, variableType t, uint8_t mode, NetworkCallbackBase *cb){
-    assert( mode==direction::toclient || mode==direction::toserver || mode==direction::serverMaster || mode==direction::clientMaster);
+    assert( mode==variableDirection::toclient || mode==variableDirection::toserver || mode==variableDirection::serverMaster || mode==variableDirection::clientMaster);
     // create temporary synch.Var struct
     synchronisableVariable *temp = new synchronisableVariable;
@@ -261,5 +267,5 @@
     temp->type = t;
     temp->callback = cb;
-    if( ( mode & direction::bidirectional ) )
+    if( ( mode & variableDirection::bidirectional ) )
     {
       if(t!=STRING)
@@ -286,5 +292,5 @@
 #endif
   }*/
-  
+
 
   /**
@@ -444,5 +450,5 @@
     objectMode_=mode;
   }
-  
+
 
 }
Index: code/branches/presentation/src/network/synchronisable/Synchronisable.h
===================================================================
--- code/branches/presentation/src/network/synchronisable/Synchronisable.h	(revision 2484)
+++ code/branches/presentation/src/network/synchronisable/Synchronisable.h	(revision 2485)
@@ -61,5 +61,5 @@
     };
   }
-  
+
   namespace priority{
     enum prio{
@@ -100,8 +100,8 @@
     static uint32_t popDeletedObject(){ uint32_t i = deletedObjects_.front(); deletedObjects_.pop(); return i; }
 
-    inline uint32_t getObjectID(){return objectID;}
-    inline unsigned int getCreatorID(){return creatorID;}
-    inline uint32_t getClassID(){return classID;}
-    inline unsigned int getPriority(){ return objectFrequency_;}
+    inline uint32_t getObjectID() const {return objectID;}
+    inline unsigned int getCreatorID() const {return creatorID;}
+    inline uint32_t getClassID() const {return classID;}
+    inline unsigned int getPriority() const { return objectFrequency_;}
 
   protected:
@@ -134,5 +134,5 @@
     static std::queue<uint32_t> deletedObjects_;
   };
-  
+
   template <class T> void Synchronisable::registerVariable(T& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional)
   {
@@ -158,5 +158,5 @@
     // the variable has not been registered before
   }
-  
+
   // ================= Specialisation declarations
   template <> _NetworkExport void Synchronisable::registerVariable( const ColourValue& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional);
Index: code/branches/presentation/src/orxonox/CMakeLists.txt
===================================================================
--- code/branches/presentation/src/orxonox/CMakeLists.txt	(revision 2484)
+++ code/branches/presentation/src/orxonox/CMakeLists.txt	(revision 2485)
@@ -4,4 +4,5 @@
   LevelManager.cc
   Main.cc
+  PawnManager.cc
   PlayerManager.cc
   Settings.cc
Index: code/branches/presentation/src/orxonox/CameraManager.cc
===================================================================
--- code/branches/presentation/src/orxonox/CameraManager.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/CameraManager.cc	(revision 2485)
@@ -29,9 +29,16 @@
 #include "CameraManager.h"
 
+#include <OgreSceneManager.h>
 #include <OgreViewport.h>
+#include <OgreCamera.h>
+#include <OgreCompositorManager.h>
+#include <OgreResource.h>
 
 #include "core/Core.h"
+#include "core/Iterator.h"
 #include "objects/worldentities/Camera.h"
-
+#include "objects/Scene.h"
+#include "tools/Shader.h"
+#include "util/String.h"
 
 namespace orxonox
@@ -44,4 +51,6 @@
         assert(singletonRef_s == 0);
         singletonRef_s = this;
+
+        this->fallbackCamera_ = 0;
     }
 
@@ -50,4 +59,7 @@
         assert(singletonRef_s != 0);
         singletonRef_s = 0;
+
+        if (this->fallbackCamera_)
+            this->fallbackCamera_->getSceneManager()->destroyCamera(this->fallbackCamera_);
     }
 
@@ -68,14 +80,18 @@
         if (this->cameraList_.size() > 0)
             this->cameraList_.front()->removeFocus();
+        else if (this->fallbackCamera_)
+        {
+            this->fallbackCamera_->getSceneManager()->destroyCamera(this->fallbackCamera_);
+            this->fallbackCamera_ = 0;
+        }
 
-        camera->setFocus(this->viewport_);
+        camera->setFocus();
+
+        // make sure we don't add it twice
+        for (std::list<Camera*>::iterator it = this->cameraList_.begin(); it != this->cameraList_.end(); ++it)
+            if ((*it) == camera)
+                return;
 
         // 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);
     }
@@ -92,7 +108,14 @@
             this->cameraList_.pop_front();
 
-            // set new focus if necessary
-            if (cameraList_.size() > 0)
-                cameraList_.front()->setFocus(this->viewport_);
+            // set new focus if possible
+            if (this->cameraList_.size() > 0)
+                this->cameraList_.front()->setFocus();
+            else
+            {
+                // there are no more cameras, create a fallback
+                if (!this->fallbackCamera_)
+                    this->fallbackCamera_ = camera->getScene()->getSceneManager()->createCamera(getUniqueNumberString());
+                this->useCamera(this->fallbackCamera_);
+            }
         }
         else
@@ -101,3 +124,27 @@
         }
     }
+
+    void CameraManager::useCamera(Ogre::Camera* camera)
+    {
+        // This workaround is needed to avoid weird behaviour with active compositors while
+        // switching the camera (like freezing the image)
+        //
+        // Last known Ogre version needing this workaround:
+        // 1.4.8
+
+        // deactivate all compositors
+        {
+            Ogre::ResourceManager::ResourceMapIterator iterator = Ogre::CompositorManager::getSingleton().getResourceIterator();
+            while (iterator.hasMoreElements())
+                Ogre::CompositorManager::getSingleton().setCompositorEnabled(this->viewport_, iterator.getNext()->getName(), false);
+        }
+
+        this->viewport_->setCamera(camera);
+
+        // reactivate all visible compositors
+        {
+            for (ObjectList<Shader>::iterator it = ObjectList<Shader>::begin(); it != ObjectList<Shader>::end(); ++it)
+                it->updateVisibility();
+        }
+    }
 }
Index: code/branches/presentation/src/orxonox/CameraManager.h
===================================================================
--- code/branches/presentation/src/orxonox/CameraManager.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/CameraManager.h	(revision 2485)
@@ -57,4 +57,6 @@
             static CameraManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
 
+            void useCamera(Ogre::Camera* camera);
+
         private:
             CameraManager(const CameraManager&);
@@ -62,4 +64,5 @@
             std::list<Camera*> cameraList_;
             Ogre::Viewport* viewport_;
+            Ogre::Camera* fallbackCamera_;
 
             static CameraManager* singletonRef_s;
Index: code/branches/presentation/src/orxonox/GraphicsEngine.cc
===================================================================
--- code/branches/presentation/src/orxonox/GraphicsEngine.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/GraphicsEngine.cc	(revision 2485)
@@ -77,4 +77,6 @@
         singletonRef_s = this;
 
+        this->viewport_ = 0;
+
         this->detailLevelParticle_ = 0;
 
Index: code/branches/presentation/src/orxonox/GraphicsEngine.h
===================================================================
--- code/branches/presentation/src/orxonox/GraphicsEngine.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/GraphicsEngine.h	(revision 2485)
@@ -72,7 +72,14 @@
         static GraphicsEngine* getInstancePtr() { return singletonRef_s; }
 
+        inline void setViewport(Ogre::Viewport* viewport)
+            { this->viewport_ = viewport; }
+        inline Ogre::Viewport* getViewport() const
+            { return this->viewport_; }
+
     private:
         // don't mess with singletons
         GraphicsEngine(GraphicsEngine&);
+
+        Ogre::Viewport*     viewport_;              //!< default full size viewport
 
         // stats
Index: code/branches/presentation/src/orxonox/Main.cc
===================================================================
--- code/branches/presentation/src/orxonox/Main.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/Main.cc	(revision 2485)
@@ -43,4 +43,8 @@
 #include "core/ConfigFileManager.h"
 #include "core/CommandLine.h"
+#include "core/CommandExecutor.h"
+#include "core/Identifier.h"
+#include "core/Core.h"
+#include "core/Language.h"
 
 #include "gamestates/GSRoot.h"
@@ -92,5 +96,6 @@
 
     // create a signal handler (only works for linux)
-    SignalHandler::getInstance()->doCatch(argv[0], "orxonox.log");
+    SignalHandler signalHandler;
+    signalHandler.doCatch(argv[0], "orxonox.log");
 
     // Parse command line arguments
@@ -109,29 +114,44 @@
     ConfigFileManager* configFileManager = new ConfigFileManager();
     configFileManager->setFilename(ConfigFileType::Settings, CommandLine::getValue("settingsFile").getString());
+    // create the Core settings to configure the output level
+    Language* language = new Language();
+    Core*     core     = new Core();
 
-    // create the gamestates
-    GSRoot root;
-    GSGraphics graphics;
-    GSStandalone standalone;
-    GSServer server;
-    GSClient client;
-    GSDedicated dedicated;
-    GSGUI gui;
-    GSIOConsole ioConsole;
+    // put GameStates in its own scope so we can destroy the identifiers at the end of main().
+    {
+        // create the gamestates
+        GSRoot root;
+        GSGraphics graphics;
+        GSStandalone standalone;
+        GSServer server;
+        GSClient client;
+        GSDedicated dedicated;
+        GSGUI gui;
+        GSIOConsole ioConsole;
 
-    // make the hierarchy
-    root.addChild(&graphics);
-    graphics.addChild(&standalone);
-    graphics.addChild(&server);
-    graphics.addChild(&client);
-    graphics.addChild(&gui);
-    root.addChild(&ioConsole);
-    root.addChild(&dedicated);
+        // make the hierarchy
+        root.addChild(&graphics);
+        graphics.addChild(&standalone);
+        graphics.addChild(&server);
+        graphics.addChild(&client);
+        graphics.addChild(&gui);
+        root.addChild(&ioConsole);
+        root.addChild(&dedicated);
 
-    // Here happens the game
-    root.start();
+        // Here happens the game
+        root.start();
+    }
 
-    // Destroy ConfigFileManager again.
+    // destroy singletons
+    delete core;
+    delete language;
     delete configFileManager;
+
+    // Clean up class hierarchy stuff (identifiers, xmlport, configvalue, consolecommand)
+    Identifier::destroyAllIdentifiers();
+    // destroy command line arguments
+    CommandLine::destroyAllArguments();
+    // Also delete external console command that don't belong to an Identifier
+    CommandExecutor::destroyExternalCommands();
 
     return 0;
Index: code/branches/presentation/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/branches/presentation/src/orxonox/OrxonoxPrereqs.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/OrxonoxPrereqs.h	(revision 2485)
@@ -82,4 +82,5 @@
     class CameraManager;
     class LevelManager;
+    class PawnManager;
     class PlayerManager;
 
@@ -116,4 +117,7 @@
     class Billboard;
     class BlinkingBillboard;
+    class ExplosionChunk;
+    class FadingBillboard;
+    class GlobalShader;
     class Light;
     class Backlight;
@@ -128,4 +132,9 @@
     class Pawn;
     class SpaceShip;
+
+    class Item;
+    class Engine;
+    class MultiStateEngine;
+    class RotatingEngine;
 
     class Trigger;
@@ -146,8 +155,13 @@
     class Controller;
     class HumanController;
+    class ArtificialController;
+    class AIController;
+    class ScriptController;
 
     class Info;
     class PlayerInfo;
     class HumanPlayer;
+    class Bot;
+    class GametypeInfo;
 
     class Gametype;
@@ -166,4 +180,5 @@
     class Mesh;
     class ParticleInterface;
+    class Shader;
     template <class T>
     class Timer;
@@ -177,4 +192,5 @@
     class HUDRadar;
     class HUDSpeedBar;
+    class HUDHealthBar;
     class InGameConsole;
     class Notification;
@@ -184,4 +200,5 @@
     class OverlayGroup;
     class OverlayText;
+    class GametypeStatus;
 
     //gui
Index: code/branches/presentation/src/orxonox/PawnManager.cc
===================================================================
--- code/branches/presentation/src/orxonox/PawnManager.cc	(revision 2485)
+++ code/branches/presentation/src/orxonox/PawnManager.cc	(revision 2485)
@@ -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:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "PawnManager.h"
+
+#include "core/CoreIncludes.h"
+#include "objects/worldentities/pawns/Pawn.h"
+
+
+namespace orxonox
+{
+    PawnManager* PawnManager::singletonRef_s = 0;
+
+    PawnManager::PawnManager()
+    {
+        RegisterRootObject(PawnManager);
+
+        assert(PawnManager::singletonRef_s == 0);
+        PawnManager::singletonRef_s = this;
+    }
+
+    PawnManager::~PawnManager()
+    {
+        assert(PawnManager::singletonRef_s != 0);
+        PawnManager::singletonRef_s = 0;
+    }
+
+    void PawnManager::touch()
+    {
+        if (!PawnManager::singletonRef_s)
+            new PawnManager();
+    }
+
+    void PawnManager::tick(float dt)
+    {
+        unsigned int count = 0;
+        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++count)
+        {
+            if (!it->isAlive())
+                delete (*(it++));
+            else
+                ++it;
+        }
+
+        if (count == 0)
+            delete this;
+    }
+}
Index: code/branches/presentation/src/orxonox/PawnManager.h
===================================================================
--- code/branches/presentation/src/orxonox/PawnManager.h	(revision 2485)
+++ code/branches/presentation/src/orxonox/PawnManager.h	(revision 2485)
@@ -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 _PawnManager_H__
+#define _PawnManager_H__
+
+#include "OrxonoxPrereqs.h"
+#include "objects/Tickable.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport PawnManager : public Tickable
+    {
+        public:
+            static void touch();
+
+            virtual void tick(float dt);
+
+        private:
+            PawnManager();
+            virtual ~PawnManager();
+
+            static PawnManager* singletonRef_s;
+    };
+}
+
+#endif /* _PawnManager_H__ */
Index: code/branches/presentation/src/orxonox/PlayerManager.cc
===================================================================
--- code/branches/presentation/src/orxonox/PlayerManager.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/PlayerManager.cc	(revision 2485)
@@ -38,7 +38,12 @@
 namespace orxonox
 {
+    PlayerManager* PlayerManager::singletonRef_s = 0;
+
     PlayerManager::PlayerManager()
     {
         RegisterRootObject(PlayerManager);
+
+        assert(singletonRef_s == 0);
+        singletonRef_s = this;
 
         this->getConnectedClients();
@@ -47,10 +52,6 @@
     PlayerManager::~PlayerManager()
     {
-    }
-
-    PlayerManager& PlayerManager::getInstance()
-    {
-        static PlayerManager instance;
-        return instance;
+        assert(singletonRef_s);
+        singletonRef_s = 0;
     }
 
Index: code/branches/presentation/src/orxonox/PlayerManager.h
===================================================================
--- code/branches/presentation/src/orxonox/PlayerManager.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/PlayerManager.h	(revision 2485)
@@ -32,4 +32,5 @@
 #include "OrxonoxPrereqs.h"
 
+#include <cassert>
 #include <map>
 #include "network/ClientConnectionListener.h"
@@ -43,5 +44,6 @@
             virtual ~PlayerManager();
 
-            static PlayerManager& getInstance();
+            static PlayerManager& getInstance()
+            { assert(singletonRef_s); return *singletonRef_s; }
 
             PlayerInfo* getClient(unsigned int clientID) const;
@@ -54,4 +56,6 @@
 
             std::map<unsigned int, PlayerInfo*> clients_;
+
+            static PlayerManager* singletonRef_s;
     };
 }
Index: code/branches/presentation/src/orxonox/Settings.cc
===================================================================
--- code/branches/presentation/src/orxonox/Settings.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/Settings.cc	(revision 2485)
@@ -83,5 +83,5 @@
         }
 
-        LuaBind::getInstance()->setIncludePath(this->dataPath_);
+        LuaBind::getInstance().setIncludePath(this->dataPath_);
     }
 
Index: code/branches/presentation/src/orxonox/gamestates/GSGraphics.cc
===================================================================
--- code/branches/presentation/src/orxonox/gamestates/GSGraphics.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/gamestates/GSGraphics.cc	(revision 2485)
@@ -31,4 +31,5 @@
 
 #include <fstream>
+#include <OgreCompositorManager.h>
 #include <OgreConfigFile.h>
 #include <OgreFrameListener.h>
@@ -164,5 +165,6 @@
         FunctorMember<GSGraphics>* functor1 = createFunctor(&GSGraphics::printScreen);
         functor1->setObject(this);
-        CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor1, "printScreen"));
+        ccPrintScreen_ = createConsoleCommand(functor1, "printScreen");
+        CommandExecutor::addConsoleCommandShortcut(ccPrintScreen_);
     }
 
@@ -170,4 +172,6 @@
     {
         using namespace Ogre;
+
+        delete this->ccPrintScreen_;
 
         // remove our WindowEventListener first to avoid bad calls after the window has been destroyed
@@ -184,4 +188,7 @@
         Loader::unload(this->debugOverlay_);
         delete this->debugOverlay_;
+
+        // unload all compositors
+        Ogre::CompositorManager::getSingleton().removeAll();
 
         // destroy render window
@@ -430,4 +437,7 @@
         // create a full screen default viewport
         this->viewport_ = this->renderWindow_->addViewport(0, 0);
+
+        if (this->graphicsEngine_)
+            this->graphicsEngine_->setViewport(this->viewport_);
     }
 
Index: code/branches/presentation/src/orxonox/gamestates/GSGraphics.h
===================================================================
--- code/branches/presentation/src/orxonox/gamestates/GSGraphics.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/gamestates/GSGraphics.h	(revision 2485)
@@ -112,4 +112,7 @@
         unsigned int          detailLevelParticle_;      //!< Detail level of particle effects (0: off, 1: low, 2: normal, 3: high)
         std::string           defaultMasterKeybindings_; //!< Filename of default master keybindings.
+
+        // console commands
+        ConsoleCommand*       ccPrintScreen_;
     };
 }
Index: code/branches/presentation/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- code/branches/presentation/src/orxonox/gamestates/GSLevel.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/gamestates/GSLevel.cc	(revision 2485)
@@ -41,10 +41,9 @@
 #include "core/CoreIncludes.h"
 #include "core/Core.h"
-//#include "objects/Backlight.h"
 #include "objects/Tickable.h"
 #include "objects/Radar.h"
-//#include "tools/ParticleInterface.h"
 #include "CameraManager.h"
 #include "LevelManager.h"
+#include "PlayerManager.h"
 #include "Settings.h"
 
@@ -55,6 +54,5 @@
     GSLevel::GSLevel()
 //        : GameState<GSGraphics>(name)
-        : timeFactor_(1.0f)
-        , keyBinder_(0)
+        : keyBinder_(0)
         , inputState_(0)
         , radar_(0)
@@ -64,4 +62,8 @@
     {
         RegisterObject(GSLevel);
+
+        this->ccKeybind_ = 0;
+        this->ccTkeybind_ = 0;
+
         setConfigValues();
     }
@@ -95,11 +97,10 @@
         }
 
+        this->playerManager_ = new PlayerManager();
+
         if (Core::isMaster())
         {
             // create the global LevelManager
             this->levelManager_ = new LevelManager();
-
-            // reset game speed to normal
-            timeFactor_ = 1.0f;
 
             this->loadLevel();
@@ -114,8 +115,10 @@
             FunctorMember<GSLevel>* functor1 = createFunctor(&GSLevel::keybind);
             functor1->setObject(this);
-            CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor1, "keybind"));
+            ccKeybind_ = createConsoleCommand(functor1, "keybind");
+            CommandExecutor::addConsoleCommandShortcut(ccKeybind_);
             FunctorMember<GSLevel>* functor2 = createFunctor(&GSLevel::tkeybind);
             functor2->setObject(this);
-            CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor2, "tkeybind"));
+            ccTkeybind_ = createConsoleCommand(functor2, "tkeybind");
+            CommandExecutor::addConsoleCommandShortcut(ccTkeybind_);
             // set our console command as callback for the key detector
             InputManager::getInstance().setKeyDetectorCallback(std::string("keybind ") + keyDetectorCallbackCode_);
@@ -124,16 +127,20 @@
             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()
     {
+        // destroy console commands
+        if (this->ccKeybind_)
+        {
+            delete this->ccKeybind_;
+            this->ccKeybind_ = 0;
+        }
+        if (this->ccTkeybind_)
+        {
+            delete this->ccTkeybind_;
+            this->ccTkeybind_ = 0;
+        }
+
         // this call will delete every BaseObject!
         // But currently this will call methods of objects that exist no more
@@ -149,11 +156,26 @@
 
         if (this->radar_)
+        {
             delete this->radar_;
+            this->radar_ = 0;
+        }
 
         if (this->cameraManager_)
+        {
             delete this->cameraManager_;
+            this->cameraManager_ = 0;
+        }
 
         if (this->levelManager_)
+        {
             delete this->levelManager_;
+            this->levelManager_ = 0;
+        }
+
+        if (this->playerManager_)
+        {
+            delete this->playerManager_;
+            this->playerManager_ = 0;
+        }
 
         if (Core::showsGraphics())
@@ -162,5 +184,8 @@
             InputManager::getInstance().requestDestroyState("game");
             if (this->keyBinder_)
+            {
                 delete this->keyBinder_;
+                this->keyBinder_ = 0;
+            }
         }
     }
@@ -172,23 +197,4 @@
         //for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ++it)
         //    it->tick(time.getDeltaTime() * this->timeFactor_);
-    }
-
-    /**
-    @brief
-        Changes the speed of Orxonox
-    */
-    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);
-
-        for (ObjectList<Backlight>::iterator it = ObjectList<Backlight>::begin(); it; ++it)
-            it->setTimeFactor(timeFactor_);
-*/
     }
 
Index: code/branches/presentation/src/orxonox/gamestates/GSLevel.h
===================================================================
--- code/branches/presentation/src/orxonox/gamestates/GSLevel.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/gamestates/GSLevel.h	(revision 2485)
@@ -44,9 +44,4 @@
         ~GSLevel();
 
-        // this has to be public because proteced triggers a bug in msvc
-        // when taking the function address.
-        void setTimeFactor(float factor);
-        float getTimeFactor() { return this->timeFactor_; }
-
     protected:
         void enter(Ogre::Viewport* viewport);
@@ -56,6 +51,4 @@
         void loadLevel();
         void unloadLevel();
-
-        float timeFactor_;       //!< A factor that sets the gamespeed. 1 is normal.
 
         // console commands
@@ -70,4 +63,5 @@
         CameraManager*        cameraManager_;
         LevelManager*         levelManager_;
+        PlayerManager*        playerManager_;
 
         //##### ConfigValues #####
@@ -75,4 +69,8 @@
         //! Filename of default keybindings.
         std::string           defaultKeybindings_;
+
+        // console commands
+        ConsoleCommand*       ccKeybind_;
+        ConsoleCommand*       ccTkeybind_;
 
     private:
Index: code/branches/presentation/src/orxonox/gamestates/GSRoot.cc
===================================================================
--- code/branches/presentation/src/orxonox/gamestates/GSRoot.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/gamestates/GSRoot.cc	(revision 2485)
@@ -32,4 +32,5 @@
 #include "util/Exception.h"
 #include "util/Debug.h"
+#include "core/Core.h"
 #include "core/Factory.h"
 #include "core/ConfigValueIncludes.h"
@@ -40,9 +41,10 @@
 #include "core/TclBind.h"
 #include "core/TclThreadManager.h"
+#include "core/LuaBind.h"
 #include "tools/Timer.h"
 #include "objects/Tickable.h"
 #include "Settings.h"
 
-#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 
+#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
 #  ifndef WIN32_LEAN_AND_MEAN
 #    define WIN32_LEAN_AND_MEAN
@@ -66,4 +68,7 @@
     GSRoot::GSRoot()
         : RootGameState("root")
+        , timeFactor_(1.0f)
+        , bPaused_(false)
+        , timeFactorPauseBackup_(1.0f)
         , settings_(0)
         , tclBind_(0)
@@ -73,4 +78,7 @@
         RegisterRootObject(GSRoot);
         setConfigValues();
+
+        this->ccSetTimeFactor_ = 0;
+        this->ccPause_ = 0;
     }
 
@@ -87,4 +95,10 @@
         // creates the class hierarchy for all classes with factories
         Factory::createClassHierarchy();
+
+        // reset game speed to normal
+        timeFactor_ = 1.0f;
+
+        // Create the lua interface
+        this->luaBind_ = new LuaBind();
 
         // instantiate Settings class
@@ -114,18 +128,42 @@
             setThreadAffinity((unsigned int)(limitToCPU - 1));
 
-        // add console commands
-        FunctorMember<GSRoot>* functor1 = createFunctor(&GSRoot::exitGame);
-        functor1->setObject(this);
-        CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor1, "exit"));
-
-        // add console commands
-        FunctorMember01<GameStateBase, const std::string&>* functor2 = createFunctor(&GameStateBase::requestState);
-        functor2->setObject(this);
-        CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor2, "selectGameState"));
+        {
+            // add console commands
+            FunctorMember<GSRoot>* functor = createFunctor(&GSRoot::exitGame);
+            functor->setObject(this);
+            this->ccExit_ = createConsoleCommand(functor, "exit");
+            CommandExecutor::addConsoleCommandShortcut(this->ccExit_);
+        }
+
+        {
+            // add console commands
+            FunctorMember01<GameStateBase, const std::string&>* functor = createFunctor(&GameStateBase::requestState);
+            functor->setObject(this);
+            this->ccSelectGameState_ = createConsoleCommand(functor, "selectGameState");
+            CommandExecutor::addConsoleCommandShortcut(this->ccSelectGameState_);
+        }
+
+        {
+            // time factor console command
+            FunctorMember<GSRoot>* functor = createFunctor(&GSRoot::setTimeFactor);
+            functor->setObject(this);
+            this->ccSetTimeFactor_ = createConsoleCommand(functor, "setTimeFactor");
+            CommandExecutor::addConsoleCommandShortcut(this->ccSetTimeFactor_).accessLevel(AccessLevel::Offline).defaultValue(0, 1.0);
+        }
+
+        {
+            // time factor console command
+            FunctorMember<GSRoot>* functor = createFunctor(&GSRoot::pause);
+            functor->setObject(this);
+            this->ccPause_ = createConsoleCommand(functor, "pause");
+            CommandExecutor::addConsoleCommandShortcut(this->ccPause_).accessLevel(AccessLevel::Offline);
+        }
     }
 
     void GSRoot::leave()
     {
-        // TODO: remove and destroy console commands
+        // destroy console commands
+        delete this->ccExit_;
+        delete this->ccSelectGameState_;
 
         delete this->shell_;
@@ -133,6 +171,18 @@
         delete this->tclBind_;
 
-        delete settings_;
-
+        delete this->settings_;
+        delete this->luaBind_;
+
+        if (this->ccSetTimeFactor_)
+        {
+            delete this->ccSetTimeFactor_;
+            this->ccSetTimeFactor_ = 0;
+        }
+
+        if (this->ccPause_)
+        {
+            delete this->ccPause_;
+            this->ccPause_ = 0;
+        }
     }
 
@@ -153,5 +203,5 @@
         }
         for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ++it)
-            it->tick(leveldt);
+            it->tick(leveldt * this->timeFactor_);
         /*** HACK *** HACK ***/
 
@@ -166,5 +216,5 @@
 
         Copyright (c) 2000-2008 Torus Knot Software Ltd
-        
+
         OGRE is licensed under the LGPL. For more info, see OGRE license.
     */
@@ -173,16 +223,16 @@
 #if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
         // Get the current process core mask
-	    DWORD procMask;
-	    DWORD sysMask;
+        DWORD procMask;
+        DWORD sysMask;
 #  if _MSC_VER >= 1400 && defined (_M_X64)
-	    GetProcessAffinityMask(GetCurrentProcess(), (PDWORD_PTR)&procMask, (PDWORD_PTR)&sysMask);
+        GetProcessAffinityMask(GetCurrentProcess(), (PDWORD_PTR)&procMask, (PDWORD_PTR)&sysMask);
 #  else
-	    GetProcessAffinityMask(GetCurrentProcess(), &procMask, &sysMask);
+        GetProcessAffinityMask(GetCurrentProcess(), &procMask, &sysMask);
 #  endif
 
-	    // If procMask is 0, consider there is only one core available
-	    // (using 0 as procMask will cause an infinite loop below)
-	    if (procMask == 0)
-		    procMask = 1;
+        // If procMask is 0, consider there is only one core available
+        // (using 0 as procMask will cause an infinite loop below)
+        if (procMask == 0)
+            procMask = 1;
 
         // if the core specified with limitToCPU is not available, take the lowest one
@@ -190,12 +240,62 @@
             limitToCPU = 0;
 
-	    // Find the lowest core that this process uses and limitToCPU suggests
+        // Find the lowest core that this process uses and limitToCPU suggests
         DWORD threadMask = 1;
-	    while ((threadMask & procMask) == 0 || (threadMask < (1u << limitToCPU)))
-		    threadMask <<= 1;
-
-	    // Set affinity to the first core
-	    SetThreadAffinityMask(GetCurrentThread(), threadMask);
+        while ((threadMask & procMask) == 0 || (threadMask < (1u << limitToCPU)))
+            threadMask <<= 1;
+
+        // Set affinity to the first core
+        SetThreadAffinityMask(GetCurrentThread(), threadMask);
 #endif
     }
+
+    /**
+    @brief
+        Changes the speed of Orxonox
+    */
+    void GSRoot::setTimeFactor(float factor)
+    {
+        if (Core::isMaster())
+        {
+            if (!this->bPaused_)
+            {
+                TimeFactorListener::timefactor_s = factor;
+
+                for (ObjectList<TimeFactorListener>::iterator it = ObjectList<TimeFactorListener>::begin(); it != ObjectList<TimeFactorListener>::end(); ++it)
+                    it->changedTimeFactor(factor, this->timeFactor_);
+
+                this->timeFactor_ = factor;
+            }
+            else
+                this->timeFactorPauseBackup_ = factor;
+        }
+    }
+
+    void GSRoot::pause()
+    {
+        if (Core::isMaster())
+        {
+            if (!this->bPaused_)
+            {
+                this->timeFactorPauseBackup_ = this->timeFactor_;
+                this->setTimeFactor(0.0f);
+                this->bPaused_ = true;
+            }
+            else
+            {
+                this->bPaused_ = false;
+                this->setTimeFactor(this->timeFactorPauseBackup_);
+            }
+        }
+    }
+
+    ////////////////////////
+    // TimeFactorListener //
+    ////////////////////////
+    float TimeFactorListener::timefactor_s = 1.0f;
+
+    TimeFactorListener::TimeFactorListener()
+    {
+        RegisterRootObject(TimeFactorListener);
+    }
 }
Index: code/branches/presentation/src/orxonox/gamestates/GSRoot.h
===================================================================
--- code/branches/presentation/src/orxonox/gamestates/GSRoot.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/gamestates/GSRoot.h	(revision 2485)
@@ -47,4 +47,10 @@
         { requestState("root"); }
 
+        // this has to be public because proteced triggers a bug in msvc
+        // when taking the function address.
+        void setTimeFactor(float factor);
+        void pause();
+        float getTimeFactor() { return this->timeFactor_; }
+
     private:
         void enter();
@@ -55,8 +61,35 @@
         void setThreadAffinity(unsigned int limitToCPU);
 
+        float                 timeFactor_;       //!< A factor that sets the gamespeed. 1 is normal.
+        bool                  bPaused_;
+        float                 timeFactorPauseBackup_;
         Settings*             settings_;
         TclBind*              tclBind_;
         TclThreadManager*     tclThreadManager_;
         Shell*                shell_;
+        LuaBind*              luaBind_;
+
+        // console commands
+        ConsoleCommand*       ccExit_;
+        ConsoleCommand*       ccSelectGameState_;
+        ConsoleCommand*       ccSetTimeFactor_;
+        ConsoleCommand*       ccPause_;
+    };
+
+    class _OrxonoxExport TimeFactorListener : virtual public OrxonoxClass
+    {
+        friend class GSRoot;
+
+        public:
+            TimeFactorListener();
+            virtual ~TimeFactorListener() {}
+
+        protected:
+            virtual void changedTimeFactor(float factor_new, float factor_old) {}
+            inline float getTimeFactor() const
+                { return TimeFactorListener::timefactor_s; }
+
+        private:
+            static float timefactor_s;
     };
 }
Index: code/branches/presentation/src/orxonox/gui/GUIManager.cc
===================================================================
--- code/branches/presentation/src/orxonox/gui/GUIManager.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/gui/GUIManager.cc	(revision 2485)
@@ -96,13 +96,13 @@
         {
             // destroy our own tolua interfaces
-	        //lua_pushnil(luaState_);
-	        //lua_setglobal(luaState_, "Orxonox");
-	        //lua_pushnil(luaState_);
-	        //lua_setglobal(luaState_, "Core");
+	        lua_pushnil(luaState_);
+	        lua_setglobal(luaState_, "Orxonox");
+	        lua_pushnil(luaState_);
+	        lua_setglobal(luaState_, "Core");
             // TODO: deleting the script module fails an assertation.
             // However there is not much we can do about it since it occurs too when
             // we don't open Core or Orxonox. Might be a CEGUI issue.
             // The memory leak is not a problem anyway..
-            //delete scriptModule_;
+            delete scriptModule_;
         }
 
Index: code/branches/presentation/src/orxonox/objects/CMakeLists.txt
===================================================================
--- code/branches/presentation/src/orxonox/objects/CMakeLists.txt	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/CMakeLists.txt	(revision 2485)
@@ -3,4 +3,5 @@
   EventDispatcher.cc
   EventTarget.cc
+  GlobalShader.cc
   Level.cc
   Radar.cc
@@ -17,4 +18,5 @@
 ADD_SOURCE_DIRECTORY(SRC_FILES gametypes)
 ADD_SOURCE_DIRECTORY(SRC_FILES infos)
+ADD_SOURCE_DIRECTORY(SRC_FILES items)
 #ADD_SOURCE_DIRECTORY(SRC_FILES pickup)
 ADD_SOURCE_DIRECTORY(SRC_FILES quest)
Index: code/branches/presentation/src/orxonox/objects/EventTarget.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/EventTarget.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/EventTarget.cc	(revision 2485)
@@ -48,4 +48,6 @@
     void EventTarget::changedName()
     {
+        SUPER(EventTarget, changedName);
+
         for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)
             if (it->getName() == this->getName())
Index: code/branches/presentation/src/orxonox/objects/GlobalShader.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/GlobalShader.cc	(revision 2485)
+++ code/branches/presentation/src/orxonox/objects/GlobalShader.cc	(revision 2485)
@@ -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 "OrxonoxStableHeaders.h"
+#include "GlobalShader.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "objects/Scene.h"
+#include "util/Exception.h"
+
+namespace orxonox
+{
+    CreateFactory(GlobalShader);
+
+    GlobalShader::GlobalShader(BaseObject* creator) : BaseObject(creator), Synchronisable(creator)
+    {
+        RegisterObject(GlobalShader);
+
+        if (!this->getScene())
+            ThrowException(AbortLoading, "Can't create GlobalShader, no scene given.");
+        if (!this->getScene()->getSceneManager())
+            ThrowException(AbortLoading, "Can't create GlobalShader, no scene manager given.");
+
+        this->shader_.setSceneManager(this->getScene()->getSceneManager());
+
+        this->registerVariables();
+    }
+
+    GlobalShader::~GlobalShader()
+    {
+    }
+
+    void GlobalShader::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(GlobalShader, XMLPort, xmlelement, mode);
+
+        XMLPortParamExtern(GlobalShader, Shader, &this->shader_, "compositor", setCompositor, getCompositor, xmlelement, mode);
+    }
+
+    void GlobalShader::registerVariables()
+    {
+        registerVariable(this->bVisible_,                                         variableDirection::toclient, new NetworkCallback<GlobalShader>(this, &GlobalShader::changedVisibility));
+        registerVariable(const_cast<std::string&>(this->shader_.getCompositor()), variableDirection::toclient, new NetworkCallback<Shader>(&this->shader_, &Shader::changedCompositor));
+    }
+
+    void GlobalShader::changedVisibility()
+    {
+        SUPER(GlobalShader, changedVisibility);
+
+        this->shader_.setVisible(this->isVisible());
+    }
+}
Index: code/branches/presentation/src/orxonox/objects/GlobalShader.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/GlobalShader.h	(revision 2485)
+++ code/branches/presentation/src/orxonox/objects/GlobalShader.h	(revision 2485)
@@ -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 _GlobalShader_H__
+#define _GlobalShader_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "core/BaseObject.h"
+#include "network/synchronisable/Synchronisable.h"
+#include "tools/Shader.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport GlobalShader : public BaseObject, public Synchronisable
+    {
+        public:
+            GlobalShader(BaseObject* creator);
+            virtual ~GlobalShader();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            void registerVariables();
+
+            virtual void changedVisibility();
+
+            inline const Shader& getShader() const
+                { return this->shader_; }
+
+        private:
+            void changedCompositor();
+
+            Shader shader_;
+    };
+}
+
+#endif /* _GlobalShader_H__ */
Index: code/branches/presentation/src/orxonox/objects/Level.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/Level.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/Level.cc	(revision 2485)
@@ -141,5 +141,5 @@
     void Level::playerEntered(PlayerInfo* player)
     {
-        COUT(3) << "player entered level" << std::endl;
+        COUT(3) << "player entered level (id: " << player->getClientID() << ", name: " << player->getName() << ")" << std::endl;
         player->setGametype(this->getGametype());
     }
@@ -147,5 +147,5 @@
     void Level::playerLeft(PlayerInfo* player)
     {
-        COUT(3) << "player left level" << std::endl;
+        COUT(3) << "player left level (id: " << player->getClientID() << ", name: " << player->getName() << ")" << std::endl;
         player->setGametype(0);
     }
Index: code/branches/presentation/src/orxonox/objects/Radar.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/Radar.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/Radar.cc	(revision 2485)
@@ -99,4 +99,6 @@
     void Radar::tick(float dt)
     {
+        SUPER(Radar, tick, dt);
+
         if (this->focus_ != *(this->itFocus_))
         {
@@ -112,8 +114,6 @@
             for (ObjectList<RadarViewable>::iterator itElement = ObjectList<RadarViewable>::begin(); itElement; ++itElement)
             {
-/*
-                if ((*itElement) != SpaceShip::getLocalShip() && (*itListener)->getRadarSensitivity() > (*itElement)->getRadarObjectCamouflage())
+                if ((*itListener)->getRadarSensitivity() > (*itElement)->getRadarObjectCamouflage())
                     (*itListener)->displayObject(*itElement, *itElement == this->focus_);
-*/
             }
         }
@@ -128,10 +128,11 @@
             this->focus_ = 0;
         }
-        else
-        {
-            Vector3 localPosition;// = SpaceShip::getLocalShip()->getPosition();
+/*
+        else if (this->owner_)
+        {
+            Vector3 localPosition = this->owner_->getPosition();
             Vector3 targetPosition = localPosition;
             if (*(this->itFocus_))
-                targetPosition = this->itFocus_->getWorldPosition();
+                targetPosition = this->itFocus_->getRVWorldPosition();
 
             // find the closed object further away than targetPosition
@@ -143,9 +144,8 @@
             for (ObjectList<RadarViewable>::iterator it = ObjectList<RadarViewable>::begin(); it; ++it)
             {
-/*
-                if (*it == SpaceShip::getLocalShip())
+                if (*it == (RadarViewable*)this->owner_)
                     continue;
-*/
-                float targetDistance = localPosition.squaredDistance((*it)->getWorldPosition());
+
+                float targetDistance = localPosition.squaredDistance((*it)->getRVWorldPosition());
                 if (targetDistance > currentDistance && targetDistance < nextDistance)
                 {
@@ -171,4 +171,5 @@
             }
         }
+*/
     }
 
@@ -186,5 +187,5 @@
         for (ObjectList<RadarViewable>::iterator it = ObjectList<RadarViewable>::begin(); it; ++it, ++i)
         {
-            COUT(3) << i++ << ": " << (*it)->getWorldPosition() << std::endl;
+            COUT(3) << i++ << ": " << (*it)->getRVWorldPosition() << std::endl;
         }
     }
Index: code/branches/presentation/src/orxonox/objects/RadarViewable.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/RadarViewable.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/RadarViewable.cc	(revision 2485)
@@ -29,8 +29,10 @@
 #include "OrxonoxStableHeaders.h"
 #include "RadarViewable.h"
+
 #include "util/Debug.h"
+#include "util/Exception.h"
 #include "core/CoreIncludes.h"
-//#include "objects/WorldEntity.h"
-#include "Radar.h"
+#include "objects/worldentities/WorldEntity.h"
+#include "objects/Radar.h"
 
 namespace orxonox
@@ -40,7 +42,6 @@
     */
     RadarViewable::RadarViewable()
-        : radarObject_(0)
-        , radarObjectCamouflage_(0.0f)
-        , radarObjectType_(Dot)
+        : radarObjectCamouflage_(0.0f)
+        , radarObjectShape_(Dot)
         , radarObjectDescription_("staticObject")
     {
@@ -52,5 +53,5 @@
         Radar* radar = Radar::getInstancePtr();
         if (radar)
-            this->radarObjectType_ = radar->addObjectDescription(str);
+            this->radarObjectShape_ = radar->addObjectDescription(str);
         else
         {
@@ -60,14 +61,16 @@
     }
 
-    const Vector3& RadarViewable::getWorldPosition() const
+    const Vector3& RadarViewable::getRVWorldPosition() const
     {
-        validate();
-        return Vector3::ZERO;//this->radarObject_->getWorldPosition();
+        const WorldEntity* object = this->getWorldEntity();
+        validate(object);
+        return object->getWorldPosition();
     }
 
-    Vector3 RadarViewable::getOrientedVelocity() const
+    Vector3 RadarViewable::getRVOrientedVelocity() const
     {
-        validate();
-        return Vector3::ZERO;//this->radarObject_->getOrientation() * this->radarObject_->getVelocity();
+        const WorldEntity* object = this->getWorldEntity();
+        validate(object);
+        return object->getWorldOrientation() * object->getVelocity();
     }
 }
Index: code/branches/presentation/src/orxonox/objects/RadarViewable.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/RadarViewable.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/RadarViewable.h	(revision 2485)
@@ -44,6 +44,4 @@
     class _OrxonoxExport RadarViewable : virtual public OrxonoxClass
     {
-    class WorldEntity;
-
     public:
         enum Shape
@@ -58,28 +56,40 @@
         virtual ~RadarViewable() { }
 
-        float getRadarObjectCamouflage() const { return this->radarObjectCamouflage_; }
-        void setRadarObjectCamouflage(float camouflage) { this->radarObjectCamouflage_ = camouflage; }
+        inline void setRadarObjectCamouflage(float camouflage)
+            { this->radarObjectCamouflage_ = camouflage; }
+        inline float getRadarObjectCamouflage() const
+            { return this->radarObjectCamouflage_; }
 
-        const ColourValue& getRadarObjectColour() const { return this->radarObjectColour_; }
-        void setRadarObjectColour(const ColourValue& colour) { this->radarObjectColour_ = colour; }
+        inline void setRadarObjectColour(const ColourValue& colour)
+            { this->radarObjectColour_ = colour; }
+        inline const ColourValue& getRadarObjectColour() const
+            { return this->radarObjectColour_; }
 
-        const std::string& getRadarObjectDescription() const { return this->radarObjectDescription_; }
         void setRadarObjectDescription(const std::string& str);
+        inline const std::string& getRadarObjectDescription() const
+            { return this->radarObjectDescription_; }
 
-        const WorldEntity* getWorldEntity() const { return this->radarObject_; }
-        const Vector3& getWorldPosition() const;
-        Vector3 getOrientedVelocity() const;
+        virtual const WorldEntity* getWorldEntity() const = 0;
 
-        Shape getRadarObjectType() const { return this->radarObjectType_; }
+        const Vector3& getRVWorldPosition() const;
+        Vector3 getRVOrientedVelocity() const;
 
-    protected:
-        WorldEntity* radarObject_;
+        inline void setRadarObjectShape(Shape shape)
+            { this->radarObjectShape_ = shape; }
+        inline Shape getRadarObjectShape() const
+            { return this->radarObjectShape_; }
 
     private:
-        void validate() const { if (!this->radarObject_)
-        { COUT(1) << "Assertation: Every RadarViewable has to be assigned a WorldEntity pointer!" << std::endl; assert(0); } }
+        void validate(const WorldEntity* object) const
+        {
+            if (!object)
+            {
+                COUT(1) << "Assertation: Every RadarViewable has to be assigned a WorldEntity pointer!" << std::endl;
+                assert(0);
+            }
+        }
 
         float radarObjectCamouflage_;
-        Shape radarObjectType_;
+        Shape radarObjectShape_;
         std::string radarObjectDescription_;
         ColourValue radarObjectColour_;
Index: code/branches/presentation/src/orxonox/objects/Scene.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/Scene.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/Scene.cc	(revision 2485)
@@ -34,5 +34,4 @@
 #include <OgreSceneManagerEnumerator.h>
 #include <OgreSceneNode.h>
-#include <OgreLight.h>
 
 #include "BulletCollision/BroadphaseCollision/btAxisSweep3.h"
@@ -56,5 +55,5 @@
 
         this->setScene(this);
-        this->bShadows_ = false;
+        this->bShadows_ = true;
 
         if (Core::showsGraphics())
@@ -90,16 +89,4 @@
         this->broadphase_      = 0;
 
-        // 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();
     }
@@ -145,4 +132,5 @@
         registerVariable(this->gravity_,            variableDirection::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_gravity));
         registerVariable(this->bHasPhysics_,        variableDirection::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_hasPhysics));
+        registerVariable(this->bShadows_,           variableDirection::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_applyShadows));
     }
 
@@ -156,5 +144,5 @@
         if (this->hasPhysics())
         {
-            CCOUT(2) << "Warning: Attempting to set the physical world range at run time. " 
+            CCOUT(2) << "Warning: Attempting to set the physical world range at run time. "
                      << "This causes a complete physical reload which might take some time." << std::endl;
             this->setPhysicalWorld(false);
@@ -175,5 +163,5 @@
         if (this->hasPhysics())
         {
-            CCOUT(2) << "Warning: Attempting to set the physical world range at run time. " 
+            CCOUT(2) << "Warning: Attempting to set the physical world range at run time. "
                      << "This causes a complete physical reload which might take some time." << std::endl;
             this->setPhysicalWorld(false);
Index: code/branches/presentation/src/orxonox/objects/Scene.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/Scene.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/Scene.h	(revision 2485)
@@ -76,4 +76,6 @@
             void networkcallback_applyAmbientLight()
                 { this->setAmbientLight(this->ambientLight_); }
+            void networkcallback_applyShadows()
+                { this->setShadow(this->bShadows_); }
 
             Ogre::SceneManager*      sceneManager_;
Index: code/branches/presentation/src/orxonox/objects/Script.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/Script.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/Script.cc	(revision 2485)
@@ -64,7 +64,7 @@
   void Script::execute()
   {
-    LuaBind* lua = LuaBind::getInstance();
-    lua->loadString(this->code_);
-    lua->run();
+    LuaBind& lua = LuaBind::getInstance();
+    lua.loadString(this->code_);
+    lua.run();
   }
 }
Index: code/branches/presentation/src/orxonox/objects/controllers/AIController.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/controllers/AIController.cc	(revision 2485)
+++ code/branches/presentation/src/orxonox/objects/controllers/AIController.cc	(revision 2485)
@@ -0,0 +1,119 @@
+/*
+ *   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 "AIController.h"
+
+#include "core/Core.h"
+#include "core/CoreIncludes.h"
+#include "core/Executor.h"
+#include "objects/worldentities/ControllableEntity.h"
+
+namespace orxonox
+{
+    static const float ACTION_INTERVAL = 1.0f;
+
+    CreateFactory(AIController);
+
+    AIController::AIController(BaseObject* creator) : ArtificialController(creator)
+    {
+        RegisterObject(AIController);
+
+        if (Core::isMaster())
+            this->actionTimer_.setTimer(ACTION_INTERVAL, true, this, createExecutor(createFunctor(&AIController::action)));
+    }
+
+    AIController::~AIController()
+    {
+    }
+
+    void AIController::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->searchRandomTargetPosition();
+
+        // 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->searchRandomTargetPosition();
+/*
+        // 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 AIController::tick(float dt)
+    {
+        if (!this->isActive())
+            return;
+
+        if (this->target_)
+            this->aimAtTarget();
+
+        if (this->bHasTargetPosition_)
+            this->moveToTargetPosition(dt);
+
+        if (this->getControllableEntity() && this->bShooting_ && this->isCloseAtTarget(500) && this->isLookingAtTarget(Ogre::Math::PI / 20.0))
+            this->getControllableEntity()->fire();
+
+        SUPER(AIController, tick, dt);
+    }
+
+}
Index: code/branches/presentation/src/orxonox/objects/controllers/AIController.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/controllers/AIController.h	(revision 2485)
+++ code/branches/presentation/src/orxonox/objects/controllers/AIController.h	(revision 2485)
@@ -0,0 +1,56 @@
+/*
+ *   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 _AIController_H__
+#define _AIController_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "ArtificialController.h"
+#include "objects/Tickable.h"
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport AIController : public ArtificialController, public Tickable
+    {
+        public:
+            AIController(BaseObject* creator);
+            virtual ~AIController();
+
+            virtual void tick(float dt);
+
+        protected:
+            virtual void action();
+
+        private:
+            Timer<AIController> actionTimer_;
+    };
+}
+
+#endif /* _AIController_H__ */
Index: code/branches/presentation/src/orxonox/objects/controllers/ArtificialController.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/controllers/ArtificialController.cc	(revision 2485)
+++ code/branches/presentation/src/orxonox/objects/controllers/ArtificialController.cc	(revision 2485)
@@ -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 "ArtificialController.h"
+
+#include "core/CoreIncludes.h"
+#include "objects/worldentities/ControllableEntity.h"
+#include "objects/worldentities/pawns/Pawn.h"
+
+namespace orxonox
+{
+    ArtificialController::ArtificialController(BaseObject* creator) : Controller(creator)
+    {
+        RegisterObject(ArtificialController);
+
+        this->target_ = 0;
+        this->bShooting_ = false;
+        this->bHasTargetPosition_ = false;
+        this->targetPosition_ = Vector3::ZERO;
+    }
+
+    ArtificialController::~ArtificialController()
+    {
+    }
+
+    void ArtificialController::moveToTargetPosition(float dt)
+    {
+        if (!this->getControllableEntity())
+            return;
+
+        Vector2 coord = get2DViewdirection(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, this->targetPosition_);
+
+        float distance = (this->targetPosition_ - this->getControllableEntity()->getPosition()).length();
+        if (this->target_ || distance > 50)
+        {
+            // Multiply with 0.8 to make them a bit slower
+            this->getControllableEntity()->rotateYaw(0.8 * sgn(coord.x) * coord.x*coord.x);
+            this->getControllableEntity()->rotatePitch(0.8 * sgn(coord.y) * coord.y*coord.y);
+        }
+
+        if (this->target_ && distance < 1000 && this->getControllableEntity()->getVelocity().squaredLength() > this->target_->getVelocity().squaredLength())
+            this->getControllableEntity()->moveFrontBack(-0.5); // They don't brake with full power to give the player a chance
+        else
+            this->getControllableEntity()->moveFrontBack(0.8);
+    }
+
+    void ArtificialController::searchRandomTargetPosition()
+    {
+        this->targetPosition_ = Vector3(rnd(-5000,5000), rnd(-5000,5000), rnd(-5000,5000));
+        this->bHasTargetPosition_ = true;
+    }
+
+    void ArtificialController::searchNewTarget()
+    {
+        if (!this->getControllableEntity())
+            return;
+
+        this->targetPosition_ = this->getControllableEntity()->getPosition();
+        this->forgetTarget();
+
+        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
+        {
+//            if (it->getTeamNr() != this->getTeamNr())
+            {
+                float speed = this->getControllableEntity()->getVelocity().length();
+                Vector3 distanceCurrent = this->targetPosition_ - this->getControllableEntity()->getPosition();
+                Vector3 distanceNew = it->getPosition() - this->getControllableEntity()->getPosition();
+                if (!this->target_ || it->getPosition().squaredDistance(this->getControllableEntity()->getPosition()) * (1.5f + acos((this->getControllableEntity()->getOrientation() * WorldEntity::FRONT).dotProduct(distanceNew) / speed / distanceNew.length()) / (2 * Ogre::Math::PI))
+                        < this->targetPosition_.squaredDistance(this->getControllableEntity()->getPosition()) * (1.5f + acos((this->getControllableEntity()->getOrientation() * WorldEntity::FRONT).dotProduct(distanceCurrent) / speed / distanceCurrent.length()) / (2 * Ogre::Math::PI)) + rnd(-250, 250))
+                {
+                    this->target_ = (*it);
+                    this->targetPosition_ = it->getPosition();
+                }
+            }
+        }
+    }
+
+    void ArtificialController::forgetTarget()
+    {
+        this->target_ = 0;
+        this->bShooting_ = false;
+    }
+
+    void ArtificialController::aimAtTarget()
+    {
+        if (!this->target_ || !this->getControllableEntity())
+            return;
+
+        static const float hardcoded_projectile_speed = 500;
+
+        this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getPosition(), hardcoded_projectile_speed, this->target_->getPosition(), this->target_->getOrientation() * this->target_->getVelocity());
+        this->bHasTargetPosition_ = (this->targetPosition_ != Vector3::ZERO);
+    }
+
+    bool ArtificialController::isCloseAtTarget(float distance) const
+    {
+        if (!this->getControllableEntity())
+            return false;
+
+        if (!this->target_)
+            return (this->getControllableEntity()->getPosition().squaredDistance(this->targetPosition_) < distance*distance);
+        else
+            return (this->getControllableEntity()->getPosition().squaredDistance(this->target_->getPosition()) < distance*distance);
+    }
+
+    bool ArtificialController::isLookingAtTarget(float angle) const
+    {
+        if (!this->getControllableEntity())
+            return false;
+
+        return (getAngle(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->targetPosition_) < angle);
+    }
+
+    void ArtificialController::shipDied(Pawn* ship)
+    {
+        if (ship == this->target_)
+        {
+            this->forgetTarget();
+            this->searchRandomTargetPosition();
+        }
+    }
+}
Index: code/branches/presentation/src/orxonox/objects/controllers/ArtificialController.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/controllers/ArtificialController.h	(revision 2485)
+++ code/branches/presentation/src/orxonox/objects/controllers/ArtificialController.h	(revision 2485)
@@ -0,0 +1,66 @@
+/*
+ *   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 _ArtificialController_H__
+#define _ArtificialController_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "Controller.h"
+#include "util/Math.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport ArtificialController : public Controller
+    {
+        public:
+            ArtificialController(BaseObject* creator);
+            virtual ~ArtificialController();
+
+            void shipDied(Pawn* ship);
+
+        protected:
+            void moveToTargetPosition(float dt);
+            void searchRandomTargetPosition();
+            void searchNewTarget();
+            void forgetTarget();
+            void aimAtTarget();
+
+            bool isCloseAtTarget(float distance) const;
+            bool isLookingAtTarget(float angle) const;
+
+            bool bHasTargetPosition_;
+            Vector3 targetPosition_;
+            Pawn* target_;
+            bool bShooting_;
+
+        private:
+    };
+}
+
+#endif /* _ArtificialController_H__ */
Index: code/branches/presentation/src/orxonox/objects/controllers/CMakeLists.txt
===================================================================
--- code/branches/presentation/src/orxonox/objects/controllers/CMakeLists.txt	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/controllers/CMakeLists.txt	(revision 2485)
@@ -2,4 +2,7 @@
   Controller.cc
   HumanController.cc
+  ArtificialController.cc
+  AIController.cc
+  ScriptController.cc
 )
 
Index: code/branches/presentation/src/orxonox/objects/controllers/Controller.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/controllers/Controller.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/controllers/Controller.cc	(revision 2485)
@@ -31,4 +31,5 @@
 
 #include "core/CoreIncludes.h"
+#include "overlays/OverlayGroup.h"
 
 namespace orxonox
@@ -42,8 +43,40 @@
         this->player_ = 0;
         this->controllableEntity_ = 0;
+        this->hud_ = 0;
+        this->bUpdateHUD_ = false;
     }
 
     Controller::~Controller()
     {
+        if (this->isInitialized() && this->hud_)
+            delete this->hud_;
+    }
+
+    void Controller::changedControllableEntity()
+    {
+        if (this->bUpdateHUD_)
+        {
+            this->updateHUD();
+            this->bUpdateHUD_ = false;
+        }
+
+        if (this->hud_)
+            this->hud_->setOwner(this->getControllableEntity());
+    }
+
+    void Controller::updateHUD()
+    {
+        if (this->hud_)
+        {
+            delete this->hud_;
+            this->hud_ = 0;
+        }
+
+        if (this->hudtemplate_ != "")
+        {
+            this->hud_ = new OverlayGroup(this);
+            this->hud_->addTemplate(this->hudtemplate_);
+            this->hud_->setOwner(this->getControllableEntity());
+        }
     }
 }
Index: code/branches/presentation/src/orxonox/objects/controllers/Controller.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/controllers/Controller.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/controllers/Controller.h	(revision 2485)
@@ -47,12 +47,41 @@
                 { return this->player_; }
 
-            virtual inline void setControllableEntity(ControllableEntity* entity)
-                { this->controllableEntity_ = entity; }
-            virtual inline ControllableEntity* getControllableEntity() const
+            inline void setControllableEntity(ControllableEntity* entity)
+            {
+                if (entity != this->controllableEntity_)
+                {
+                    this->controllableEntity_ = entity;
+                    this->changedControllableEntity();
+                }
+            }
+            inline ControllableEntity* getControllableEntity() const
                 { return this->controllableEntity_; }
+            virtual void changedControllableEntity();
+
+            inline void setHUDTemplate(const std::string& name)
+            {
+                if (name != this->hudtemplate_)
+                {
+                    this->hudtemplate_ = name;
+                    if (this->controllableEntity_)
+                        this->updateHUD();
+                    else
+                        this->bUpdateHUD_ = true;
+                }
+            }
+            inline const std::string& getHUDTemplate() const
+                { return this->hudtemplate_; }
+
+            inline OverlayGroup* getHUD() const
+                { return this->hud_; }
 
         protected:
+            void updateHUD();
+
             PlayerInfo* player_;
             ControllableEntity* controllableEntity_;
+            std::string hudtemplate_;
+            OverlayGroup* hud_;
+            bool bUpdateHUD_;
     };
 }
Index: code/branches/presentation/src/orxonox/objects/controllers/HumanController.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/controllers/HumanController.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/controllers/HumanController.cc	(revision 2485)
@@ -33,4 +33,6 @@
 #include "core/ConsoleCommand.h"
 #include "objects/worldentities/ControllableEntity.h"
+#include "objects/worldentities/pawns/Pawn.h"
+#include "objects/gametypes/Gametype.h"
 
 namespace orxonox
@@ -44,7 +46,12 @@
     SetConsoleCommand(HumanController, fire,          true).keybindMode(KeybindMode::OnHold);
     SetConsoleCommand(HumanController, altFire,       true).keybindMode(KeybindMode::OnHold);
+    SetConsoleCommand(HumanController, boost,         true).keybindMode(KeybindMode::OnHold);
     SetConsoleCommand(HumanController, greet,         true);
     SetConsoleCommand(HumanController, use,           true);
     SetConsoleCommand(HumanController, switchCamera,  true);
+    SetConsoleCommand(HumanController, mouseLook,     true);
+    SetConsoleCommand(HumanController, suicide,       true);
+    SetConsoleCommand(HumanController, addBots,       true).defaultValues(1);
+    SetConsoleCommand(HumanController, killBots,      true).defaultValues(0);
 
     CreateUnloadableFactory(HumanController);
@@ -112,4 +119,10 @@
     }
 
+    void HumanController::boost()
+    {
+        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
+            HumanController::localController_s->controllableEntity_->boost();
+    }
+
     void HumanController::greet()
     {
@@ -129,3 +142,31 @@
             HumanController::localController_s->controllableEntity_->switchCamera();
     }
+
+    void HumanController::mouseLook()
+    {
+        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
+            HumanController::localController_s->controllableEntity_->mouseLook();
+    }
+
+    void HumanController::suicide()
+    {
+        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
+        {
+            Pawn* pawn = dynamic_cast<Pawn*>(HumanController::localController_s->controllableEntity_);
+            if (pawn)
+                pawn->kill();
+        }
+    }
+
+    void HumanController::addBots(unsigned int amount)
+    {
+        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_ && HumanController::localController_s->controllableEntity_->getGametype())
+            HumanController::localController_s->controllableEntity_->getGametype()->addBots(amount);
+    }
+
+    void HumanController::killBots(unsigned int amount)
+    {
+        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_ && HumanController::localController_s->controllableEntity_->getGametype())
+            HumanController::localController_s->controllableEntity_->getGametype()->killBots(amount);
+    }
 }
Index: code/branches/presentation/src/orxonox/objects/controllers/HumanController.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/controllers/HumanController.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/controllers/HumanController.h	(revision 2485)
@@ -54,7 +54,14 @@
             static void altFire();
 
+            static void boost();
             static void greet();
             static void use();
             static void switchCamera();
+            static void mouseLook();
+
+            static void suicide();
+
+            static void addBots(unsigned int amount);
+            static void killBots(unsigned int amount = 0);
 
         private:
Index: code/branches/presentation/src/orxonox/objects/controllers/ScriptController.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/controllers/ScriptController.cc	(revision 2485)
+++ code/branches/presentation/src/orxonox/objects/controllers/ScriptController.cc	(revision 2485)
@@ -0,0 +1,46 @@
+/*
+ *   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 "ScriptController.h"
+
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+    CreateFactory(ScriptController);
+
+    ScriptController::ScriptController(BaseObject* creator) : ArtificialController(creator)
+    {
+        RegisterObject(ScriptController);
+    }
+
+    ScriptController::~ScriptController()
+    {
+    }
+}
Index: code/branches/presentation/src/orxonox/objects/controllers/ScriptController.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/controllers/ScriptController.h	(revision 2485)
+++ code/branches/presentation/src/orxonox/objects/controllers/ScriptController.h	(revision 2485)
@@ -0,0 +1,50 @@
+/*
+ *   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 _ScriptController_H__
+#define _ScriptController_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "ArtificialController.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport ScriptController : public ArtificialController
+    {
+        public:
+            ScriptController(BaseObject* creator);
+            virtual ~ScriptController();
+
+        protected:
+
+        private:
+    };
+}
+
+#endif /* _ScriptController_H__ */
Index: code/branches/presentation/src/orxonox/objects/gametypes/Gametype.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/gametypes/Gametype.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/gametypes/Gametype.cc	(revision 2485)
@@ -34,7 +34,10 @@
 
 #include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
 #include "objects/infos/PlayerInfo.h"
+#include "objects/infos/Bot.h"
 #include "objects/worldentities/pawns/Spectator.h"
 #include "objects/worldentities/SpawnPoint.h"
+#include "objects/worldentities/Camera.h"
 
 #include "network/Host.h"
@@ -44,26 +47,39 @@
     CreateUnloadableFactory(Gametype);
 
-    Gametype::Gametype(BaseObject* creator) : BaseObject(creator)
+    Gametype::Gametype(BaseObject* creator) : BaseObject(creator), gtinfo_(creator)
     {
         RegisterObject(Gametype);
 
+        this->setGametype(this);
+
         this->defaultControllableEntity_ = Class(Spectator);
 
-        this->bStarted_ = false;
-        this->bEnded_ = false;
         this->bAutoStart_ = false;
         this->bForceSpawn_ = false;
+        this->numberOfBots_ = 0;
 
         this->initialStartCountdown_ = 3;
-        this->startCountdown_ = 0;
-        this->bStartCountdownRunning_ = false;
+
+        this->setConfigValues();
+
+        this->addBots(this->numberOfBots_);
+    }
+
+    void Gametype::setConfigValues()
+    {
+        SetConfigValue(initialStartCountdown_, 3.0f);
+        SetConfigValue(bAutoStart_, false);
+        SetConfigValue(bForceSpawn_, false);
+        SetConfigValue(numberOfBots_, 0);
     }
 
     void Gametype::tick(float dt)
     {
-        if (this->bStartCountdownRunning_ && !this->bStarted_)
-            this->startCountdown_ -= dt;
-
-        if (!this->bStarted_)
+        SUPER(Gametype, tick, dt);
+
+        if (this->gtinfo_.bStartCountdownRunning_ && !this->gtinfo_.bStarted_)
+            this->gtinfo_.startCountdown_ -= dt;
+
+        if (!this->gtinfo_.bStarted_)
             this->checkStart();
         else
@@ -76,5 +92,5 @@
     {
         COUT(0) << "game started" << std::endl;
-        this->bStarted_ = true;
+        this->gtinfo_.bStarted_ = true;
 
         this->spawnPlayersIfRequested();
@@ -84,5 +100,5 @@
     {
         COUT(0) << "game ended" << std::endl;
-        this->bEnded_ = true;
+        this->gtinfo_.bEnded_ = true;
     }
 
@@ -140,4 +156,27 @@
     void Gametype::pawnKilled(Pawn* victim, Pawn* killer)
     {
+        if (victim && victim->getPlayer())
+        {
+            std::map<PlayerInfo*, PlayerState::Enum>::iterator it = this->players_.find(victim->getPlayer());
+            if (it != this->players_.end())
+            {
+                it->second = PlayerState::Dead;
+
+                ControllableEntity* entity = this->defaultControllableEntity_.fabricate(victim->getCreator());
+                if (victim->getCamera())
+                {
+                    entity->setPosition(victim->getCamera()->getWorldPosition());
+                    entity->setOrientation(victim->getCamera()->getWorldOrientation());
+                }
+                else
+                {
+                    entity->setPosition(victim->getWorldPosition());
+                    entity->setOrientation(victim->getWorldOrientation());
+                }
+                it->first->startControl(entity);
+            }
+            else
+                COUT(2) << "Warning: Killed Pawn was not in the playerlist" << std::endl;
+        }
     }
 
@@ -150,7 +189,4 @@
         if (this->spawnpoints_.size() > 0)
         {
-            srand(time(0));
-            rnd();
-
             unsigned int randomspawn = (unsigned int)rnd(this->spawnpoints_.size());
             unsigned int index = 0;
@@ -170,55 +206,63 @@
         for (std::map<PlayerInfo*, PlayerState::Enum>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
         {
-            if (!it->first->getControllableEntity() && (!it->first->isReadyToSpawn() || !this->bStarted_))
-            {
-                SpawnPoint* spawn = this->getBestSpawnPoint(it->first);
-                if (spawn)
-                {
-                    // force spawn at spawnpoint with default pawn
-                    ControllableEntity* entity = this->defaultControllableEntity_.fabricate(spawn);
-                    spawn->spawn(entity);
-                    it->first->startControl(entity);
-                    it->second = PlayerState::Dead;
+            if (!it->first->getControllableEntity())
+            {
+                it->second = PlayerState::Dead;
+
+                if (!it->first->isReadyToSpawn() || !this->gtinfo_.bStarted_)
+                {
+                    SpawnPoint* spawn = this->getBestSpawnPoint(it->first);
+                    if (spawn)
+                    {
+                        // force spawn at spawnpoint with default pawn
+                        ControllableEntity* entity = this->defaultControllableEntity_.fabricate(spawn);
+                        spawn->spawn(entity);
+                        it->first->startControl(entity);
+                        it->second = PlayerState::Dead;
+                    }
+                    else
+                    {
+                        COUT(1) << "Error: No SpawnPoints in current Gametype" << std::endl;
+                        abort();
+                    }
+                }
+            }
+        }
+    }
+
+    void Gametype::checkStart()
+    {
+        if (!this->gtinfo_.bStarted_)
+        {
+            if (this->gtinfo_.bStartCountdownRunning_)
+            {
+                if (this->gtinfo_.startCountdown_ <= 0)
+                {
+                    this->gtinfo_.bStartCountdownRunning_ = false;
+                    this->gtinfo_.startCountdown_ = 0;
+                    this->start();
+                }
+            }
+            else if (this->players_.size() > 0)
+            {
+                if (this->bAutoStart_)
+                {
+                    this->start();
                 }
                 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;
+                    bool hashumanplayers = false;
                     for (std::map<PlayerInfo*, PlayerState::Enum>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
                     {
                         if (!it->first->isReadyToSpawn())
                             allplayersready = false;
+                        if (it->first->isHumanPlayer())
+                            hashumanplayers = true;
                     }
-                    if (allplayersready)
+                    if (allplayersready && hashumanplayers)
                     {
-                        this->startCountdown_ = this->initialStartCountdown_;
-                        this->bStartCountdownRunning_ = true;
+                        this->gtinfo_.startCountdown_ = this->initialStartCountdown_;
+                        this->gtinfo_.bStartCountdownRunning_ = true;
                     }
                 }
@@ -256,3 +300,22 @@
         }
     }
+
+    void Gametype::addBots(unsigned int amount)
+    {
+        for (unsigned int i = 0; i < amount; ++i)
+            new Bot(this);
+    }
+
+    void Gametype::killBots(unsigned int amount)
+    {
+        unsigned int i = 0;
+        for (ObjectList<Bot>::iterator it = ObjectList<Bot>::begin(); (it != ObjectList<Bot>::end()) && ((amount == 0) || (i < amount)); )
+        {
+            if (it->getGametype() == this)
+            {
+                delete (*(it++));
+                ++i;
+            }
+        }
+    }
 }
Index: code/branches/presentation/src/orxonox/objects/gametypes/Gametype.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/gametypes/Gametype.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/gametypes/Gametype.h	(revision 2485)
@@ -38,4 +38,5 @@
 #include "objects/worldentities/ControllableEntity.h"
 #include "objects/Tickable.h"
+#include "objects/infos/GametypeInfo.h"
 
 namespace orxonox
@@ -60,10 +61,15 @@
             virtual ~Gametype() {}
 
+            void setConfigValues();
+
             virtual void tick(float dt);
 
+            inline const GametypeInfo* getGametypeInfo() const
+                { return &this->gtinfo_; }
+
             inline bool hasStarted() const
-                { return this->bStarted_; }
+                { return this->gtinfo_.bStarted_; }
             inline bool hasEnded() const
-                { return this->bEnded_; }
+                { return this->gtinfo_.bEnded_; }
 
             virtual void start();
@@ -88,7 +94,10 @@
 
             inline bool isStartCountdownRunning() const
-                { return this->bStartCountdownRunning_; }
+                { return this->gtinfo_.bStartCountdownRunning_; }
             inline float getStartCountdown() const
-                { return this->startCountdown_; }
+                { return this->gtinfo_.startCountdown_; }
+
+            void addBots(unsigned int amount);
+            void killBots(unsigned int amount = 0);
 
         private:
@@ -104,12 +113,11 @@
             void spawnDeadPlayersIfRequested();
 
-            bool bStarted_;
-            bool bEnded_;
+            GametypeInfo gtinfo_;
+
             bool bAutoStart_;
             bool bForceSpawn_;
 
             float initialStartCountdown_;
-            float startCountdown_;
-            bool bStartCountdownRunning_;
+            unsigned int numberOfBots_;
 
             std::map<PlayerInfo*, PlayerState::Enum> players_;
Index: code/branches/presentation/src/orxonox/objects/infos/Bot.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/infos/Bot.cc	(revision 2485)
+++ code/branches/presentation/src/orxonox/objects/infos/Bot.cc	(revision 2485)
@@ -0,0 +1,99 @@
+/*
+ *   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 "Bot.h"
+
+#include "core/Core.h"
+#include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
+#include "objects/gametypes/Gametype.h"
+#include "objects/controllers/AIController.h"
+#include "util/Math.h"
+
+namespace orxonox
+{
+    CreateFactory(Bot);
+
+    Bot::Bot(BaseObject* creator) : PlayerInfo(creator)
+    {
+        RegisterObject(Bot);
+
+        this->bHumanPlayer_ = false;
+        this->bLocalPlayer_ = Core::isMaster();
+        this->bSetUnreadyAfterSpawn_ = false;
+        this->setReadyToSpawn(true);
+        this->defaultController_ = Class(AIController);
+
+        this->setConfigValues();
+
+        this->setName(this->names_[(size_t)(rnd() * this->names_.size())]);
+
+        if (this->getGametype())
+            this->getGametype()->playerEntered(this);
+
+        this->createController();
+    }
+
+    Bot::~Bot()
+    {
+    }
+
+    void Bot::setConfigValues()
+    {
+        static std::string names[] =
+        {
+            "Dr. Julius No",
+            "Rosa Klebb",
+            "Auric Goldfinger",
+            "Emilio Largo",
+            "Ernst Stavro Blofeld",
+            "Dr. Kananga",
+            "Francisco Scaramanga",
+            "Karl Stromberg",
+            "Sir Hugo Drax",
+            "Aris Kristatos",
+            "Kamal Khan",
+            "General Orlov",
+            "Max Zorin",
+            "Brad Whitaker",
+            "General Koskov",
+            "Franz Sanchez",
+            "Alec Trevelyan",
+            "Elliot Carver",
+            "Viktor Zokas",
+            "Gustav Graves",
+            "Le Chiffre",
+            "Mr. White",
+            "Dominic Greene"
+        };
+        static std::vector<std::string> defaultnames(names, names + sizeof(names) / sizeof(std::string));
+
+        SetConfigValueVector(names_, defaultnames);
+    }
+}
Index: code/branches/presentation/src/orxonox/objects/infos/Bot.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/infos/Bot.h	(revision 2485)
+++ code/branches/presentation/src/orxonox/objects/infos/Bot.h	(revision 2485)
@@ -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:
+ *      ...
+ *
+ */
+
+#ifndef _Bot_H__
+#define _Bot_H__
+
+#include "OrxonoxPrereqs.h"
+#include <vector>
+
+#include "PlayerInfo.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport Bot : public PlayerInfo
+    {
+        public:
+            Bot(BaseObject* creator);
+            virtual ~Bot();
+
+            void setConfigValues();
+
+            inline bool isInitialized() const
+                { return true; }
+            inline float getPing() const
+                { return 0; }
+            inline float getPacketLossRatio() const
+                { return 0; }
+
+        private:
+            std::vector<std::string> names_;
+    };
+}
+
+#endif /* _Bot_H__ */
Index: code/branches/presentation/src/orxonox/objects/infos/CMakeLists.txt
===================================================================
--- code/branches/presentation/src/orxonox/objects/infos/CMakeLists.txt	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/infos/CMakeLists.txt	(revision 2485)
@@ -1,6 +1,8 @@
 SET( SRC_FILES
+  Bot.cc
   Info.cc
   PlayerInfo.cc
   HumanPlayer.cc
+  GametypeInfo.cc
 )
 
Index: code/branches/presentation/src/orxonox/objects/infos/GametypeInfo.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/infos/GametypeInfo.cc	(revision 2485)
+++ code/branches/presentation/src/orxonox/objects/infos/GametypeInfo.cc	(revision 2485)
@@ -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:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "GametypeInfo.h"
+
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+    CreateUnloadableFactory(GametypeInfo);
+
+    GametypeInfo::GametypeInfo(BaseObject* creator) : Info(creator)
+    {
+        RegisterObject(GametypeInfo);
+
+        this->bStarted_ = false;
+        this->bEnded_ = false;
+        this->startCountdown_ = 0;
+        this->bStartCountdownRunning_ = false;
+
+        this->registerVariables();
+    }
+
+    GametypeInfo::~GametypeInfo()
+    {
+    }
+
+    void GametypeInfo::registerVariables()
+    {
+        registerVariable(this->bStarted_,               variableDirection::toclient);
+        registerVariable(this->bEnded_,                 variableDirection::toclient);
+        registerVariable(this->startCountdown_,         variableDirection::toclient);
+        registerVariable(this->bStartCountdownRunning_, variableDirection::toclient);
+    }
+}
Index: code/branches/presentation/src/orxonox/objects/infos/GametypeInfo.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/infos/GametypeInfo.h	(revision 2485)
+++ code/branches/presentation/src/orxonox/objects/infos/GametypeInfo.h	(revision 2485)
@@ -0,0 +1,66 @@
+/*
+ *   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 _GametypeInfo_H__
+#define _GametypeInfo_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "Info.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport GametypeInfo : public Info
+    {
+        friend class Gametype;
+
+        public:
+            GametypeInfo(BaseObject* creator);
+            virtual ~GametypeInfo();
+
+            void registerVariables();
+
+            inline bool hasStarted() const
+                { return this->bStarted_; }
+            inline bool hasEnded() const
+                { return this->bEnded_; }
+
+            inline bool isStartCountdownRunning() const
+                { return this->bStartCountdownRunning_; }
+            inline float getStartCountdown() const
+                { return this->startCountdown_; }
+
+        private:
+            bool bStarted_;
+            bool bEnded_;
+            bool bStartCountdownRunning_;
+            float startCountdown_;
+    };
+}
+
+#endif /* _GametypeInfo_H__ */
Index: code/branches/presentation/src/orxonox/objects/infos/HumanPlayer.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/infos/HumanPlayer.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/infos/HumanPlayer.cc	(revision 2485)
@@ -37,4 +37,5 @@
 #include "objects/controllers/HumanController.h"
 #include "objects/gametypes/Gametype.h"
+#include "overlays/OverlayGroup.h"
 
 namespace orxonox
@@ -63,4 +64,5 @@
     {
         SetConfigValue(nick_, "Player").callback(this, &HumanPlayer::configvaluecallback_changednick);
+        SetConfigValue(hudtemplate_, "defaultHUD").callback(this, &HumanPlayer::configvaluecallback_changedHUDTemplate);
     }
 
@@ -69,5 +71,5 @@
         registerVariable(this->synchronize_nick_, variableDirection::toserver, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_changednick));
 
-        registerVariable(this->clientID_,     variableDirection::toclient, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_clientIDchanged));
+        registerVariable(this->clientID_,           variableDirection::toclient, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_clientIDchanged));
         registerVariable(this->server_initialized_, variableDirection::toclient, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_server_initialized));
         registerVariable(this->client_initialized_, variableDirection::toserver, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_client_initialized));
@@ -83,4 +85,9 @@
                 this->setName(this->nick_);
         }
+    }
+
+    void HumanPlayer::configvaluecallback_changedHUDTemplate()
+    {
+        this->changedController();
     }
 
@@ -138,3 +145,14 @@
         this->networkcallback_clientIDchanged();
     }
+
+    void HumanPlayer::changedController()
+    {
+        if (this->getController())
+        {
+            this->getController()->setHUDTemplate(this->hudtemplate_);
+
+            if (this->getController() && this->getController()->getHUD())
+                this->getController()->getHUD()->setOwner(this->getControllableEntity());
+        }
+    }
 }
Index: code/branches/presentation/src/orxonox/objects/infos/HumanPlayer.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/infos/HumanPlayer.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/infos/HumanPlayer.h	(revision 2485)
@@ -33,6 +33,4 @@
 
 #include "PlayerInfo.h"
-#include "core/Identifier.h"
-#include "objects/controllers/Controller.h"
 
 namespace orxonox
@@ -53,6 +51,9 @@
             void setClientID(unsigned int clientID);
 
+            virtual void changedController();
+
         protected:
             void configvaluecallback_changednick();
+            void configvaluecallback_changedHUDTemplate();
             void networkcallback_changednick();
             void networkcallback_clientIDchanged();
@@ -62,4 +63,5 @@
             std::string nick_;
             std::string synchronize_nick_;
+            std::string hudtemplate_;
             bool server_initialized_;
             bool client_initialized_;
Index: code/branches/presentation/src/orxonox/objects/infos/PlayerInfo.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/infos/PlayerInfo.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/infos/PlayerInfo.cc	(revision 2485)
@@ -46,4 +46,5 @@
         this->bLocalPlayer_ = false;
         this->bReadyToSpawn_ = false;
+        this->bSetUnreadyAfterSpawn_ = true;
         this->controller_ = 0;
         this->controllableEntity_ = 0;
@@ -64,4 +65,7 @@
                 this->controller_ = 0;
             }
+
+            if (this->getGametype())
+                this->getGametype()->playerLeft(this);
         }
     }
@@ -76,4 +80,6 @@
     void PlayerInfo::changedName()
     {
+        SUPER(PlayerInfo, changedName);
+
         if (this->isInitialized() && this->getGametype())
             this->getGametype()->playerChangedName(this);
@@ -109,10 +115,14 @@
         if (this->controllableEntity_)
             this->controller_->setControllableEntity(this->controllableEntity_);
+        this->changedController();
     }
 
-    void PlayerInfo::startControl(ControllableEntity* entity)
+    void PlayerInfo::startControl(ControllableEntity* entity, bool callback)
     {
+        if (entity == this->controllableEntity_)
+            return;
+
         if (this->controllableEntity_)
-            this->stopControl(this->controllableEntity_);
+            this->stopControl(this->controllableEntity_, callback);
 
         this->controllableEntity_ = entity;
@@ -122,5 +132,5 @@
             this->controllableEntityID_ = entity->getObjectID();
             entity->setPlayer(this);
-            this->bReadyToSpawn_ = false;
+            this->bReadyToSpawn_ &= (!this->bSetUnreadyAfterSpawn_);
         }
         else
Index: code/branches/presentation/src/orxonox/objects/infos/PlayerInfo.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/infos/PlayerInfo.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/infos/PlayerInfo.h	(revision 2485)
@@ -65,5 +65,5 @@
                 { return this->bReadyToSpawn_; }
 
-            void startControl(ControllableEntity* entity);
+            void startControl(ControllableEntity* entity, bool callback = true);
             void stopControl(ControllableEntity* entity, bool callback = true);
 
@@ -71,16 +71,24 @@
                 { return this->controllableEntity_; }
 
+            inline Controller* getController() const
+                { return this->controller_; }
+            virtual void changedController() {}
+
         protected:
             void createController();
-            void networkcallback_changedcontrollableentityID();
 
             bool bHumanPlayer_;
             bool bLocalPlayer_;
+            bool bSetUnreadyAfterSpawn_;
+            SubclassIdentifier<Controller> defaultController_;
+            unsigned int clientID_;
+
+        private:
+            void networkcallback_changedcontrollableentityID();
+
             bool bReadyToSpawn_;
-            SubclassIdentifier<Controller> defaultController_;
             Controller* controller_;
             ControllableEntity* controllableEntity_;
             unsigned int controllableEntityID_;
-            unsigned int clientID_;
     };
 }
Index: code/branches/presentation/src/orxonox/objects/items/CMakeLists.txt
===================================================================
--- code/branches/presentation/src/orxonox/objects/items/CMakeLists.txt	(revision 2485)
+++ code/branches/presentation/src/orxonox/objects/items/CMakeLists.txt	(revision 2485)
@@ -0,0 +1,7 @@
+SET( SRC_FILES
+  Item.cc
+  Engine.cc
+  MultiStateEngine.cc
+)
+
+ADD_SOURCE_FILES(SRC_FILES)
Index: code/branches/presentation/src/orxonox/objects/items/Engine.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/items/Engine.cc	(revision 2485)
+++ code/branches/presentation/src/orxonox/objects/items/Engine.cc	(revision 2485)
@@ -0,0 +1,241 @@
+/*
+ *   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 "Engine.h"
+
+#include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
+#include "core/XMLPort.h"
+#include "objects/Scene.h"
+#include "objects/worldentities/pawns/SpaceShip.h"
+#include "tools/Shader.h"
+
+namespace orxonox
+{
+    CreateFactory(Engine);
+
+    Engine::Engine(BaseObject* creator) : Item(creator)
+    {
+        RegisterObject(Engine);
+
+        this->ship_ = 0;
+        this->shipID_ = OBJECTID_UNKNOWN;
+
+        this->boostFactor_ = 1.5;
+        this->speedFactor_ = 1.0;
+
+        this->maxSpeedFront_ = 0.0;
+        this->maxSpeedBack_ = 0.0;
+        this->maxSpeedLeftRight_ = 0.0;
+        this->maxSpeedUpDown_ = 0.0;
+
+        this->accelerationFront_ = 0.0;
+        this->accelerationBrake_ = 0.0;
+        this->accelerationBack_ = 0.0;
+        this->accelerationLeftRight_ = 0.0;
+        this->accelerationUpDown_ = 0.0;
+
+        this->boostBlur_ = 0;
+
+        this->setConfigValues();
+        this->registerVariables();
+    }
+
+    Engine::~Engine()
+    {
+        if (this->isInitialized() && this->ship_)
+        {
+            this->ship_->setEngine(0);
+
+            if (this->boostBlur_)
+                delete this->boostBlur_;
+        }
+    }
+
+    void Engine::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(Engine, XMLPort, xmlelement, mode);
+
+        XMLPortParam(Engine, "boostfactor", setBoostFactor, getBoostFactor, xmlelement, mode);
+
+        XMLPortParam(Engine, "speedfront",     setMaxSpeedFront,     setMaxSpeedFront,     xmlelement, mode);
+        XMLPortParam(Engine, "speedback",      setMaxSpeedBack,      setMaxSpeedBack,      xmlelement, mode);
+        XMLPortParam(Engine, "speedleftright", setMaxSpeedLeftRight, setMaxSpeedLeftRight, xmlelement, mode);
+        XMLPortParam(Engine, "speedupdown",    setMaxSpeedUpDown,    setMaxSpeedUpDown,    xmlelement, mode);
+
+        XMLPortParam(Engine, "accelerationfront",     setAccelerationFront,     setAccelerationFront,     xmlelement, mode);
+        XMLPortParam(Engine, "accelerationbrake",     setAccelerationBrake,     setAccelerationBrake,     xmlelement, mode);
+        XMLPortParam(Engine, "accelerationback",      setAccelerationBack,      setAccelerationBack,      xmlelement, mode);
+        XMLPortParam(Engine, "accelerationleftright", setAccelerationLeftRight, setAccelerationLeftRight, xmlelement, mode);
+        XMLPortParam(Engine, "accelerationupdown",    setAccelerationUpDown,    setAccelerationUpDown,    xmlelement, mode);
+    }
+
+    void Engine::setConfigValues()
+    {
+        SetConfigValue(blurStrength_, 3.0f);
+    }
+
+    void Engine::registerVariables()
+    {
+        registerVariable(this->shipID_, variableDirection::toclient, new NetworkCallback<Engine>(this, &Engine::networkcallback_shipID));
+
+        registerVariable(this->speedFactor_, variableDirection::toclient);
+        registerVariable(this->boostFactor_, variableDirection::toclient);
+
+        registerVariable(this->maxSpeedFront_,     variableDirection::toclient);
+        registerVariable(this->maxSpeedBack_,      variableDirection::toclient);
+        registerVariable(this->maxSpeedLeftRight_, variableDirection::toclient);
+        registerVariable(this->maxSpeedUpDown_,    variableDirection::toclient);
+
+        registerVariable(this->accelerationFront_,     variableDirection::toclient);
+        registerVariable(this->accelerationBrake_,     variableDirection::toclient);
+        registerVariable(this->accelerationBack_,      variableDirection::toclient);
+        registerVariable(this->accelerationLeftRight_, variableDirection::toclient);
+        registerVariable(this->accelerationUpDown_,    variableDirection::toclient);
+    }
+
+    void Engine::networkcallback_shipID()
+    {
+        this->ship_ = 0;
+
+        if (this->shipID_ != OBJECTID_UNKNOWN)
+        {
+            Synchronisable* object = Synchronisable::getSynchronisable(this->shipID_);
+            if (object)
+                this->addToSpaceShip(dynamic_cast<SpaceShip*>(object));
+        }
+    }
+
+    void Engine::tick(float dt)
+    {
+        if (!this->ship_)
+        {
+            if (this->shipID_)
+            {
+                this->networkcallback_shipID();
+
+                if (!this->ship_)
+                    return;
+            }
+            else
+                return;
+        }
+
+        if (!this->isActive())
+            return;
+
+        SUPER(Engine, tick, dt);
+
+        const Vector3& direction = this->getDirection();
+        Vector3 velocity = this->ship_->getVelocity();
+        Vector3 acceleration = Vector3::ZERO;
+
+        float factor = 1.0f / this->speedFactor_;
+        velocity *= factor;
+
+        if (direction.z < 0)
+        {
+            if (this->maxSpeedFront_ != 0)
+            {
+                float boostfactor = (this->ship_->getBoost() ? this->boostFactor_ : 1.0f);
+                acceleration.z = direction.z * this->accelerationFront_ * boostfactor * clamp((this->maxSpeedFront_ - -velocity.z/boostfactor) / this->maxSpeedFront_, 0.0f, 1.0f);
+            }
+        }
+        else if (direction.z > 0)
+        {
+            if (velocity.z < 0)
+                acceleration.z = direction.z * this->accelerationBrake_;
+            else if (this->maxSpeedBack_ != 0)
+                acceleration.z = direction.z * this->accelerationBack_ * clamp((this->maxSpeedBack_ - velocity.z) / this->maxSpeedBack_, 0.0f, 1.0f);
+        }
+
+        if (this->maxSpeedLeftRight_ != 0)
+        {
+            if (direction.x < 0)
+                acceleration.x = direction.x * this->accelerationLeftRight_ * clamp((this->maxSpeedLeftRight_ - -velocity.x) / this->maxSpeedLeftRight_, 0.0f, 1.0f);
+            else if (direction.x > 0)
+                acceleration.x = direction.x * this->accelerationLeftRight_ * clamp((this->maxSpeedLeftRight_ - velocity.x) / this->maxSpeedLeftRight_, 0.0f, 1.0f);
+        }
+
+        if (this->maxSpeedUpDown_ != 0)
+        {
+            if (direction.y < 0)
+                acceleration.y = direction.y * this->accelerationUpDown_ * clamp((this->maxSpeedUpDown_ - -velocity.y) / this->maxSpeedUpDown_, 0.0f, 1.0f);
+            else if (direction.y > 0)
+                acceleration.y = direction.y * this->accelerationUpDown_ * clamp((this->maxSpeedUpDown_ - velocity.y) / this->maxSpeedUpDown_, 0.0f, 1.0f);
+        }
+
+        this->ship_->setAcceleration(acceleration);
+
+        this->ship_->setBoost(false);
+        this->ship_->setSteeringDirection(Vector3::ZERO);
+
+        if (!this->boostBlur_ && this->ship_->hasLocalController() && this->ship_->hasHumanController())
+        {
+            this->boostBlur_ = new Shader(this->ship_->getScene()->getSceneManager());
+            this->boostBlur_->setCompositor("Radial Blur");
+        }
+
+        if (this->boostBlur_ && this->maxSpeedFront_ != 0 && this->boostFactor_ != 1)
+            this->boostBlur_->setParameter("Ogre/Compositor/Radial_Blur", 0, 0, "sampleStrength", this->blurStrength_ * clamp((-velocity.z - this->maxSpeedFront_) / ((this->boostFactor_ - 1) * this->maxSpeedFront_), 0.0f, 1.0f));
+    }
+
+    void Engine::changedActivity()
+    {
+        SUPER(Engine, changedActivity);
+
+        if (this->boostBlur_)
+            this->boostBlur_->setVisible(this->isVisible());
+    }
+
+    void Engine::addToSpaceShip(SpaceShip* ship)
+    {
+        this->ship_ = ship;
+        if (ship)
+        {
+            this->shipID_ = ship->getObjectID();
+            if (ship->getEngine() != this)
+                ship->setEngine(this);
+
+            if (this->boostBlur_)
+            {
+                delete this->boostBlur_;
+                this->boostBlur_ = 0;
+            }
+        }
+    }
+
+    const Vector3& Engine::getDirection() const
+    {
+        if (this->ship_)
+            return this->ship_->getSteeringDirection();
+        else
+            return Vector3::ZERO;
+    }
+}
Index: code/branches/presentation/src/orxonox/objects/items/Engine.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/items/Engine.h	(revision 2485)
+++ code/branches/presentation/src/orxonox/objects/items/Engine.h	(revision 2485)
@@ -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:
+ *      ...
+ *
+ */
+
+#ifndef _Engine_H__
+#define _Engine_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "Item.h"
+#include "objects/Tickable.h"
+#include "util/Math.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport Engine : public Item, public Tickable
+    {
+        public:
+            Engine(BaseObject* creator);
+            virtual ~Engine();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            void registerVariables();
+            void setConfigValues();
+
+            virtual void tick(float dt);
+            virtual void changedActivity();
+
+            virtual void addToSpaceShip(SpaceShip* ship);
+            inline SpaceShip* getShip() const
+                { return this->ship_; }
+
+            inline void setBoostFactor(float factor)
+                { this->boostFactor_ = factor; }
+            inline float getBoostFactor() const
+                { return this->boostFactor_; }
+
+            inline void setSpeedFactor(float factor)
+                { this->speedFactor_ = factor; }
+            inline float getSpeedFactor() const
+                { return this->speedFactor_; }
+
+            inline void setMaxSpeedFront(float speed)
+                { this->maxSpeedFront_ = speed; }
+            inline void setMaxSpeedBack(float speed)
+                { this->maxSpeedBack_ = speed; }
+            inline void setMaxSpeedLeftRight(float speed)
+                { this->maxSpeedLeftRight_ = speed; }
+            inline void setMaxSpeedUpDown(float speed)
+                { this->maxSpeedUpDown_ = speed; }
+
+            inline float getMaxSpeedFront() const
+                { return this->maxSpeedFront_; }
+            inline float getMaxSpeedBack() const
+                { return this->maxSpeedBack_; }
+            inline float getMaxSpeedLeftRight() const
+                { return this->maxSpeedLeftRight_; }
+            inline float getMaxSpeedUpDown() const
+                { return this->maxSpeedUpDown_; }
+
+            inline void setAccelerationFront(float acceleration)
+                { this->accelerationFront_ = acceleration; }
+            inline void setAccelerationBrake(float acceleration)
+                { this->accelerationBrake_ = acceleration; }
+            inline void setAccelerationBack(float acceleration)
+                { this->accelerationBack_ = acceleration; }
+            inline void setAccelerationLeftRight(float acceleration)
+                { this->accelerationLeftRight_ = acceleration; }
+            inline void setAccelerationUpDown(float acceleration)
+                { this->accelerationUpDown_ = acceleration; }
+
+            inline float getAccelerationFront() const
+                { return this->accelerationFront_; }
+            inline float getAccelerationBrake() const
+                { return this->accelerationBrake_; }
+            inline float getAccelerationBack() const
+                { return this->accelerationBack_; }
+            inline float getAccelerationLeftRight() const
+                { return this->accelerationLeftRight_; }
+            inline float getAccelerationUpDown() const
+                { return this->accelerationUpDown_; }
+
+            virtual const Vector3& getDirection() const;
+
+        private:
+            void networkcallback_shipID();
+
+            SpaceShip* ship_;
+            unsigned int shipID_;
+
+            float boostFactor_;
+            float speedFactor_;
+
+            float maxSpeedFront_;
+            float maxSpeedBack_;
+            float maxSpeedLeftRight_;
+            float maxSpeedUpDown_;
+
+            float accelerationFront_;
+            float accelerationBrake_;
+            float accelerationBack_;
+            float accelerationLeftRight_;
+            float accelerationUpDown_;
+
+            Shader* boostBlur_;
+            float blurStrength_;
+    };
+}
+
+#endif /* _Engine_H__ */
Index: code/branches/presentation/src/orxonox/objects/items/Item.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/items/Item.cc	(revision 2485)
+++ code/branches/presentation/src/orxonox/objects/items/Item.cc	(revision 2485)
@@ -0,0 +1,44 @@
+/*
+ *   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 "Item.h"
+
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+    Item::Item(BaseObject* creator) : BaseObject(creator), Synchronisable(creator)
+    {
+        RegisterObject(Item);
+    }
+
+    Item::~Item()
+    {
+    }
+}
Index: code/branches/presentation/src/orxonox/objects/items/Item.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/items/Item.h	(revision 2485)
+++ code/branches/presentation/src/orxonox/objects/items/Item.h	(revision 2485)
@@ -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 _Item_H__
+#define _Item_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "core/BaseObject.h"
+#include "network/synchronisable/Synchronisable.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport Item : public BaseObject, public Synchronisable
+    {
+        public:
+            Item(BaseObject* creator);
+            virtual ~Item();
+    };
+}
+
+#endif /* _Item_H__ */
Index: code/branches/presentation/src/orxonox/objects/items/MultiStateEngine.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/items/MultiStateEngine.cc	(revision 2485)
+++ code/branches/presentation/src/orxonox/objects/items/MultiStateEngine.cc	(revision 2485)
@@ -0,0 +1,233 @@
+/*
+ *   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 "MultiStateEngine.h"
+
+#include "core/Core.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "objects/worldentities/pawns/SpaceShip.h"
+
+namespace orxonox
+{
+    static const float FORWARD_EFFECT_VELOCITY_THRESHOLD = 20;
+
+    static const unsigned char STATE_ACTIVE  = 1;
+    static const unsigned char STATE_FORWARD = 2;
+    static const unsigned char STATE_BOOST   = 4;
+    static const unsigned char STATE_BRAKE   = 8;
+
+    CreateFactory(MultiStateEngine);
+
+    MultiStateEngine::MultiStateEngine(BaseObject* creator) : Engine(creator)
+    {
+        RegisterObject(MultiStateEngine);
+
+        this->state_ = 0;
+
+        this->registerVariables();
+    }
+
+    MultiStateEngine::~MultiStateEngine()
+    {
+        if (this->isInitialized() && !this->getShip())
+        {
+            // We have no ship, so the effects are not attached and won't be destroyed automatically
+            for (std::list<WorldEntity*>::const_iterator it = this->activeEffects_.begin(); it != this->activeEffects_.end(); ++it)
+                delete (*it);
+            for (std::list<WorldEntity*>::const_iterator it = this->forwardEffects_.begin(); it != this->forwardEffects_.end(); ++it)
+                delete (*it);
+            for (std::list<WorldEntity*>::const_iterator it = this->boostEffects_.begin(); it != this->boostEffects_.end(); ++it)
+                delete (*it);
+            for (std::list<WorldEntity*>::const_iterator it = this->brakeEffects_.begin(); it != this->brakeEffects_.end(); ++it)
+                delete (*it);
+        }
+    }
+
+    void MultiStateEngine::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(MultiStateEngine, XMLPort, xmlelement, mode);
+
+        XMLPortObject(MultiStateEngine, WorldEntity, "active",  addActiveEffect,  getActiveEffect,  xmlelement, mode);
+        XMLPortObject(MultiStateEngine, WorldEntity, "forward", addForwardEffect, getForwardEffect, xmlelement, mode);
+        XMLPortObject(MultiStateEngine, WorldEntity, "boost",   addBoostEffect,   getBoostEffect,   xmlelement, mode);
+        XMLPortObject(MultiStateEngine, WorldEntity, "brake",   addBrakeEffect,   getBrakeEffect,   xmlelement, mode);
+    }
+
+    void MultiStateEngine::registerVariables()
+    {
+        registerVariable(this->state_, variableDirection::toserver);
+    }
+
+    void MultiStateEngine::tick(float dt)
+    {
+        if (this->getShip())
+        {
+            if (this->getShip()->hasLocalController())
+            {
+                this->setObjectMode(objectDirection::bidirectional);
+
+                const Vector3& direction = this->getDirection();
+                const Vector3& velocity = this->getShip()->getVelocity();
+
+                bool forward = (direction.z < 0 && velocity.z < -FORWARD_EFFECT_VELOCITY_THRESHOLD);
+                bool boost = (this->getShip()->getBoost() && forward);
+                bool brake = (direction.z > 0 && velocity.z < 0);
+                bool active = (direction != Vector3::ZERO && !brake);
+
+                if (active)
+                    this->state_ |= STATE_ACTIVE;
+                else
+                    this->state_ &= ~STATE_ACTIVE;
+
+                if (forward)
+                    this->state_ |= STATE_FORWARD;
+                else
+                    this->state_ &= ~STATE_FORWARD;
+
+                if (boost)
+                    this->state_ |= STATE_BOOST;
+                else
+                    this->state_ &= ~STATE_BOOST;
+
+                if (brake)
+                    this->state_ |= STATE_BRAKE;
+                else
+                    this->state_ &= ~STATE_BRAKE;
+            }
+
+            if (this->getShip()->hasLocalController() || Core::isMaster())
+            {
+                for (std::list<WorldEntity*>::const_iterator it = this->activeEffects_.begin(); it != this->activeEffects_.end(); ++it)
+                    (*it)->setMainState(this->state_ & STATE_ACTIVE);
+                for (std::list<WorldEntity*>::const_iterator it = this->forwardEffects_.begin(); it != this->forwardEffects_.end(); ++it)
+                    (*it)->setMainState(this->state_ & STATE_FORWARD);
+                for (std::list<WorldEntity*>::const_iterator it = this->boostEffects_.begin(); it != this->boostEffects_.end(); ++it)
+                    (*it)->setMainState(this->state_ & STATE_BOOST);
+                for (std::list<WorldEntity*>::const_iterator it = this->brakeEffects_.begin(); it != this->brakeEffects_.end(); ++it)
+                    (*it)->setMainState(this->state_ & STATE_BRAKE);
+            }
+        }
+
+        SUPER(MultiStateEngine, tick, dt);
+    }
+
+    void MultiStateEngine::addToSpaceShip(SpaceShip* ship)
+    {
+        Engine::addToSpaceShip(ship);
+
+        if (!ship)
+            return;
+
+        for (std::list<WorldEntity*>::const_iterator it = this->activeEffects_.begin(); it != this->activeEffects_.end(); ++it)
+            ship->attach(*it);
+        for (std::list<WorldEntity*>::const_iterator it = this->forwardEffects_.begin(); it != this->forwardEffects_.end(); ++it)
+            ship->attach(*it);
+        for (std::list<WorldEntity*>::const_iterator it = this->boostEffects_.begin(); it != this->boostEffects_.end(); ++it)
+            ship->attach(*it);
+        for (std::list<WorldEntity*>::const_iterator it = this->brakeEffects_.begin(); it != this->brakeEffects_.end(); ++it)
+            ship->attach(*it);
+    }
+
+    void MultiStateEngine::addActiveEffect(WorldEntity* effect)
+    {
+        this->activeEffects_.push_back(effect);
+        if (this->getShip())
+            this->getShip()->attach(effect);
+    }
+
+    void MultiStateEngine::addForwardEffect(WorldEntity* effect)
+    {
+        this->forwardEffects_.push_back(effect);
+        if (this->getShip())
+            this->getShip()->attach(effect);
+    }
+
+    void MultiStateEngine::addBoostEffect(WorldEntity* effect)
+    {
+        this->boostEffects_.push_back(effect);
+        if (this->getShip())
+            this->getShip()->attach(effect);
+    }
+
+    void MultiStateEngine::addBrakeEffect(WorldEntity* effect)
+    {
+        this->brakeEffects_.push_back(effect);
+        if (this->getShip())
+            this->getShip()->attach(effect);
+    }
+
+    WorldEntity* MultiStateEngine::getActiveEffect(unsigned int index) const
+    {
+        unsigned int i = 0;
+        for (std::list<WorldEntity*>::const_iterator it = this->activeEffects_.begin(); it != this->activeEffects_.end(); ++it)
+        {
+            if (i == index)
+                return (*it);
+            ++i;
+        }
+        return 0;
+    }
+
+    WorldEntity* MultiStateEngine::getForwardEffect(unsigned int index) const
+    {
+        unsigned int i = 0;
+        for (std::list<WorldEntity*>::const_iterator it = this->forwardEffects_.begin(); it != this->forwardEffects_.end(); ++it)
+        {
+            if (i == index)
+                return (*it);
+            ++i;
+        }
+        return 0;
+    }
+
+    WorldEntity* MultiStateEngine::getBoostEffect(unsigned int index) const
+    {
+        unsigned int i = 0;
+        for (std::list<WorldEntity*>::const_iterator it = this->boostEffects_.begin(); it != this->boostEffects_.end(); ++it)
+        {
+            if (i == index)
+                return (*it);
+            ++i;
+        }
+        return 0;
+    }
+
+    WorldEntity* MultiStateEngine::getBrakeEffect(unsigned int index) const
+    {
+        unsigned int i = 0;
+        for (std::list<WorldEntity*>::const_iterator it = this->brakeEffects_.begin(); it != this->brakeEffects_.end(); ++it)
+        {
+            if (i == index)
+                return (*it);
+            ++i;
+        }
+        return 0;
+    }
+}
Index: code/branches/presentation/src/orxonox/objects/items/MultiStateEngine.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/items/MultiStateEngine.h	(revision 2485)
+++ code/branches/presentation/src/orxonox/objects/items/MultiStateEngine.h	(revision 2485)
@@ -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:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _MultiStateEngine_H__
+#define _MultiStateEngine_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "Engine.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport MultiStateEngine : public Engine
+    {
+        public:
+            MultiStateEngine(BaseObject* creator);
+            virtual ~MultiStateEngine();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            void registerVariables();
+
+            virtual void tick(float dt);
+
+            virtual void addToSpaceShip(SpaceShip* ship);
+
+            void addActiveEffect(WorldEntity* effect);
+            void addForwardEffect(WorldEntity* effect);
+            void addBoostEffect(WorldEntity* effect);
+            void addBrakeEffect(WorldEntity* effect);
+
+            WorldEntity* getActiveEffect(unsigned int index) const;
+            WorldEntity* getForwardEffect(unsigned int index) const;
+            WorldEntity* getBoostEffect(unsigned int index) const;
+            WorldEntity* getBrakeEffect(unsigned int index) const;
+
+        private:
+            unsigned char state_;
+            std::list<WorldEntity*> activeEffects_;
+            std::list<WorldEntity*> forwardEffects_;
+            std::list<WorldEntity*> boostEffects_;
+            std::list<WorldEntity*> brakeEffects_;
+    };
+}
+
+#endif /* _MultiStateEngine_H__ */
Index: code/branches/presentation/src/orxonox/objects/worldentities/Backlight.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/Backlight.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/Backlight.cc	(revision 2485)
@@ -30,13 +30,13 @@
 #include "Backlight.h"
 
-#include <OgreBillboard.h>
 #include <OgreRibbonTrail.h>
 #include <OgreSceneManager.h>
 
+#include "core/Core.h"
 #include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
 #include "core/Executor.h"
-#include "util/Math.h"
-#include "GraphicsEngine.h"
+#include "core/XMLPort.h"
+#include "objects/Scene.h"
+#include "util/Exception.h"
 
 namespace orxonox
@@ -44,42 +44,38 @@
     CreateFactory(Backlight);
 
-    float Backlight::timeFactor_s = 1.0;
-
-    Backlight::Backlight(float maxspeed, float brakingtime, float scale)
+    Backlight::Backlight(BaseObject* creator) : FadingBillboard(creator)
     {
         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;
+        this->ribbonTrail_ = 0;
+        this->ribbonTrailNode_ = 0;
+
+        this->width_ = 0;
+        this->length_ = 1.0f;
+        this->lifetime_ = 0.001f;
+        this->maxelements_ = 1;
+
+        this->tickcount_ = 0;
+
+        if (Core::showsGraphics())
+        {
+            if (!this->getScene())
+                ThrowException(AbortLoading, "Can't create Backlight, no scene given.");
+            if (!this->getScene()->getSceneManager())
+                ThrowException(AbortLoading, "Can't create Backlight, no scene manager given.");
+            if (!this->getScene()->getRootSceneNode())
+                ThrowException(AbortLoading, "Can't create Backlight, no root scene node given.");
+
+            this->ribbonTrail_ = this->getScene()->getSceneManager()->createRibbonTrail(this->getNode()->getName());
+
+            this->ribbonTrailNode_ = this->getScene()->getRootSceneNode()->createChildSceneNode();
+            this->ribbonTrailNode_->attachObject(this->ribbonTrail_);
+
+            this->ribbonTrail_->setMaxChainElements(this->maxelements_);
+            this->ribbonTrail_->setTrailLength(this->length_);
+            this->ribbonTrail_->setInitialWidth(0, 0);
+        }
+
+        this->registerVariables();
     }
 
@@ -88,83 +84,151 @@
         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();
+            if (this->ribbonTrail_)
+            {
+                if (this->ribbonTrailNode_)
+                {
+                    this->ribbonTrailNode_->detachObject(this->ribbonTrail_);
+                    this->getScene()->getSceneManager()->destroySceneNode(this->ribbonTrailNode_->getName());
+                }
+                this->getScene()->getSceneManager()->destroyRibbonTrail(this->ribbonTrail_);
+            }
+        }
+    }
+
+    void Backlight::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(Backlight, XMLPort, xmlelement, mode);
+
+        XMLPortParam(Backlight, "length",        setLength,        getLength,        xmlelement, mode).defaultValues(100.0f);
+        XMLPortParam(Backlight, "width",         setWidth,         getWidth,         xmlelement, mode).defaultValues(1.0f);
+        XMLPortParam(Backlight, "elements",      setMaxElements,   getMaxElements,   xmlelement, mode).defaultValues(10);
+        XMLPortParam(Backlight, "lifetime",      setLifetime,      getLifetime,      xmlelement, mode).defaultValues(1.0f);
+        XMLPortParam(Backlight, "trailmaterial", setTrailMaterial, getTrailMaterial, xmlelement, mode);
+    }
+
+    void Backlight::registerVariables()
+    {
+        registerVariable(this->width_,         variableDirection::toclient, new NetworkCallback<Backlight>(this, &Backlight::update_width));
+        registerVariable(this->lifetime_,      variableDirection::toclient, new NetworkCallback<Backlight>(this, &Backlight::update_lifetime));
+        registerVariable(this->length_,        variableDirection::toclient, new NetworkCallback<Backlight>(this, &Backlight::update_length));
+        registerVariable(this->maxelements_,   variableDirection::toclient, new NetworkCallback<Backlight>(this, &Backlight::update_maxelements));
+        registerVariable(this->trailmaterial_, variableDirection::toclient, new NetworkCallback<Backlight>(this, &Backlight::update_trailmaterial));
+    }
+
+    void Backlight::changedColour()
+    {
+        FadingBillboard::changedColour();
+
+        if (this->ribbonTrail_ && this->tickcount_ >= 2)
+            this->ribbonTrail_->setInitialColour(0, this->getFadedColour());
+    }
+
+    void Backlight::update_width()
+    {
+        if (this->ribbonTrail_ && this->tickcount_ >= 2)
+            this->ribbonTrail_->setInitialWidth(0, this->width_ * this->getWorldScale());
+        this->update_lifetime();
+    }
+
+    void Backlight::update_lifetime()
+    {
+        if (this->ribbonTrail_ && this->tickcount_ >= 2)
+        {
+            this->ribbonTrail_->setWidthChange(0, this->width_ * this->getWorldScale() / this->lifetime_ * this->getTimeFactor());
+            this->ribbonTrail_->setColourChange(0, 0, 0, 0, 1.0f / this->lifetime_ * this->getTimeFactor());
+        }
+    }
+
+    void Backlight::update_length()
+    {
+        if (this->ribbonTrail_ && this->tickcount_ >= 2)
+            this->ribbonTrail_->setTrailLength(this->length_ * this->getWorldScale());
+    }
+
+    void Backlight::update_maxelements()
+    {
+        if (this->ribbonTrail_ && this->tickcount_ >= 2)
+            this->ribbonTrail_->setMaxChainElements(this->maxelements_);
+    }
+
+    void Backlight::update_trailmaterial()
+    {
+        if (this->ribbonTrail_ && this->tickcount_ >= 2)
+            this->ribbonTrail_->setMaterialName(this->trailmaterial_);
+    }
+
+    void Backlight::changedVisibility()
+    {
+        SUPER(Backlight, changedVisibility);
+
+        if (this->ribbonTrail_)
+            this->ribbonTrail_->setVisible(this->isVisible());
+    }
+
+    void Backlight::startturnonoff()
+    {
+        FadingBillboard::startturnonoff();
+
+        if (this->ribbonTrail_ && this->isActive() && this->isVisible())
+            this->ribbonTrail_->setVisible(true);
+    }
+
+    void Backlight::stopturnonoff()
+    {
+        this->postprocessingtime_ = max(0.0f, this->lifetime_ - this->turnofftime_);
+
+        FadingBillboard::stopturnonoff();
+
+        if (this->ribbonTrail_)
+            this->ribbonTrail_->setInitialColour(0, this->getFadedColour());
+    }
+
+    void Backlight::poststopturnonoff()
+    {
+        FadingBillboard::poststopturnonoff();
+
+        if (this->ribbonTrail_)
+            this->ribbonTrail_->setVisible(false);
+    }
+
+    void Backlight::changedScale()
+    {
+        SUPER(Backlight, changedScale);
+
+        this->update_width();
+        this->update_length();
     }
 
     void Backlight::tick(float dt)
     {
+        if (this->tickcount_ < 2)
+        {
+            ++this->tickcount_;
+            if (this->tickcount_ == 2)
+            {
+                this->changedColour();
+                this->update_width();
+                this->update_lifetime();
+                this->update_length();
+                this->update_maxelements();
+                this->update_trailmaterial();
+                if (this->ribbonTrail_)
+                    this->ribbonTrail_->addNode(const_cast<Ogre::SceneNode*>(this->getNode()));
+            }
+        }
+
         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());
+        if (this->ribbonTrail_ && this->changedirection_ != 0)
+        {
+            // we use alpha_blend, only adjust alpha
+            const ColourValue& colour = this->getColour();
+            this->ribbonTrail_->setInitialColour(0, colour.r, colour.g, colour.b, this->getFadedColour().a);
+        }
+    }
+
+    void Backlight::changedTimeFactor(float factor_new, float factor_old)
+    {
+        this->update_lifetime();
     }
 }
Index: code/branches/presentation/src/orxonox/objects/worldentities/Backlight.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/Backlight.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/Backlight.h	(revision 2485)
@@ -31,44 +31,70 @@
 
 #include "OrxonoxPrereqs.h"
-
-#include "StaticEntity.h"
-#include "tools/BillboardSet.h"
+#include "FadingBillboard.h"
+#include "gamestates/GSRoot.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport Backlight : public StaticEntity
+    class _OrxonoxExport Backlight : public FadingBillboard, public TimeFactorListener
     {
         public:
-            Backlight(float maxspeed = 1.0, float brakingtime = 1.0, float scale = 1.0);
+            Backlight(BaseObject* creator);
             virtual ~Backlight();
 
-            void setConfigValues();
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            void registerVariables();
+
             virtual void tick(float dt);
             virtual void changedVisibility();
-            virtual bool create();
 
-            void setColour(const ColourValue& colour);
-            void setTimeFactor(float factor);
+            inline void setWidth(float width)
+                { this->width_ = width; this->update_width(); }
+            inline float getWidth() const
+                { return this->width_; }
+
+            inline void setLifetime(float lifetime)
+                { this->lifetime_ = lifetime; this->update_lifetime(); }
+            inline float getLifetime() const
+                { return this->lifetime_; }
+
+            inline void setLength(float length)
+                { this->length_ = length; this->update_length(); }
+            inline float getLength() const
+                { return this->length_; }
+
+            inline void setMaxElements(size_t maxelements)
+                { this->maxelements_ = maxelements; this->update_maxelements(); }
+            inline size_t getMaxElements() const
+                { return this->maxelements_; }
+
+            inline void setTrailMaterial(const std::string& material)
+                { this->trailmaterial_ = material; this->update_trailmaterial(); }
+            inline const std::string& getTrailMaterial() const
+                { return this->trailmaterial_; }
+
+            virtual void changedScale();
+
+        protected:
+            virtual void changedTimeFactor(float factor_new, float factor_old);
 
         private:
-            void configure(float maxspeed, float brakingtime, float scale = 1);
-            void updateColourChange();
+            virtual void startturnonoff();
+            virtual void stopturnonoff();
+            virtual void poststopturnonoff();
+            virtual void changedColour();
+            void update_width();
+            void update_lifetime();
+            void update_length();
+            void update_maxelements();
+            void update_trailmaterial();
 
-            static float timeFactor_s;
-            BillboardSet billboard_;
+            Ogre::RibbonTrail* ribbonTrail_;
             Ogre::SceneNode* ribbonTrailNode_;
-            Ogre::RibbonTrail* ribbonTrail_;
-
-            float maxLifeTime_;
-            float trailSegmentLength_;
             float width_;
-
-            float brakefactor_;
-
-            float maxTraillength_;
-            float traillength_;
-
-            size_t maxTrailsegments_;
+            float length_;
+            float lifetime_;
+            size_t maxelements_;
+            std::string trailmaterial_;
+            char tickcount_;
     };
 }
Index: code/branches/presentation/src/orxonox/objects/worldentities/Billboard.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/Billboard.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/Billboard.cc	(revision 2485)
@@ -44,4 +44,7 @@
         RegisterObject(Billboard);
 
+        this->material_ = "";
+        this->colour_ = ColourValue::White;
+
         this->registerVariables();
     }
@@ -52,5 +55,5 @@
         {
             if (this->isInitialized() && this->billboard_.getBillboardSet())
-                this->detachOgreObject(this->billboard_.getName());
+                this->detachOgreObject(this->billboard_.getBillboardSet());
         }
     }
@@ -72,4 +75,7 @@
     void Billboard::changedMaterial()
     {
+        if (this->material_ == "")
+            return;
+
         if (!this->billboard_.getBillboardSet())
         {
@@ -90,5 +96,6 @@
         if (!this->billboard_.getBillboardSet())
         {
-            if (this->getScene() && this->getScene()->getSceneManager())
+/*
+            if (this->getScene() && this->getScene()->getSceneManager() && (this->material_ != ""))
             {
                 this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1);
@@ -97,4 +104,5 @@
                 this->billboard_.setVisible(this->isVisible());
             }
+*/
         }
         else
Index: code/branches/presentation/src/orxonox/objects/worldentities/Billboard.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/Billboard.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/Billboard.h	(revision 2485)
@@ -61,7 +61,12 @@
                 { return this->colour_; }
 
+        protected:
+            inline BillboardSet& getBillboardSet()
+                { return this->billboard_; }
+
+            virtual void changedColour();
+
         private:
             void changedMaterial();
-            void changedColour();
 
             BillboardSet billboard_;
Index: code/branches/presentation/src/orxonox/objects/worldentities/BlinkingBillboard.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/BlinkingBillboard.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/BlinkingBillboard.cc	(revision 2485)
@@ -68,11 +68,13 @@
     void BlinkingBillboard::registerVariables()
     {
-//        REGISTERDATA(this->amplitude_, direction::toclient);
-//        REGISTERDATA(this->frequency_, direction::toclient);
-//        REGISTERDATA(this->phase_,     direction::toclient);
+//        registerVariable(this->amplitude_, variableDirection::toclient);
+//        registerVariable(this->frequency_, variableDirection::toclient);
+//        registerVariable(this->phase_,     variableDirection::toclient);
     }
 
     void BlinkingBillboard::tick(float dt)
     {
+        SUPER(BlinkingBillboard, tick, dt);
+
         if (Core::isMaster() && this->isActive())
         {
Index: code/branches/presentation/src/orxonox/objects/worldentities/CMakeLists.txt
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/CMakeLists.txt	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/CMakeLists.txt	(revision 2485)
@@ -5,15 +5,18 @@
   MobileEntity.cc
   ControllableEntity.cc
-  Model.cc
+
+  Backlight.cc
   Billboard.cc
   BlinkingBillboard.cc
+  ExplosionChunk.cc
+  FadingBillboard.cc
   Light.cc
   Camera.cc
   CameraPosition.cc
-  SpawnPoint.cc
+  Model.cc
   ParticleEmitter.cc
   ParticleSpawner.cc
   Planet.cc
-#  Backlight.cc
+  SpawnPoint.cc
 )
 
Index: code/branches/presentation/src/orxonox/objects/worldentities/Camera.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/Camera.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/Camera.cc	(revision 2485)
@@ -36,5 +36,4 @@
 #include <OgreSceneManager.h>
 #include <OgreSceneNode.h>
-#include <OgreViewport.h>
 
 #include "util/Exception.h"
@@ -52,9 +51,15 @@
         RegisterObject(Camera);
 
-        if (!this->getScene() || !this->getScene()->getSceneManager())
-            ThrowException(AbortLoading, "Can't create Camera, no scene or no scene manager given.");
+        if (!this->getScene())
+            ThrowException(AbortLoading, "Can't create Camera, no scene.");
+        if (!this->getScene()->getSceneManager())
+            ThrowException(AbortLoading, "Can't create Camera, no scene-manager given.");
+        if (!this->getScene()->getRootSceneNode())
+            ThrowException(AbortLoading, "Can't create Camera, no root-scene-node given.");
 
         this->camera_ = this->getScene()->getSceneManager()->createCamera(getUniqueNumberString());
-        this->attachOgreObject(this->camera_);
+        this->cameraNode_ = this->getScene()->getRootSceneNode()->createChildSceneNode();
+        this->attachNode(this->cameraNode_);
+        this->cameraNode_->attachObject(this->camera_);
 
         this->bHasFocus_ = false;
@@ -66,6 +71,4 @@
         this->setConfigValues();
         this->configvaluecallback_changedNearClipDistance();
-
-        this->requestFocus(); // ! HACK ! REMOVE THIS !
     }
 
@@ -75,4 +78,13 @@
         {
             this->releaseFocus();
+
+            this->cameraNode_->detachAllObjects();
+            this->getScene()->getSceneManager()->destroyCamera(this->camera_);
+
+            if (this->bDrag_)
+                this->detachNode(this->cameraNode_);
+
+            if (this->getScene()->getSceneManager())
+                this->getScene()->getSceneManager()->destroySceneNode(this->cameraNode_->getName());
         }
     }
@@ -90,13 +102,17 @@
     void Camera::tick(float dt)
     {
-/*
-        // this stuff here may need some adjustments
-        float coeff = (this->bDrag_) ? min(1.0f, 15.0f * dt) : (1.0f);
+        SUPER(Camera, tick, dt);
 
-        Vector3 offset = this->getNode()->getWorldPosition() - this->cameraNode_->getWorldPosition();
-        this->cameraNode_->translate(coeff * offset);
+        if (this->bDrag_)
+        {
+            // this stuff here may need some adjustments
+            float coeff = min(1.0f, 15.0f * dt);
 
-        this->cameraNode_->setOrientation(Quaternion::Slerp(coeff, this->cameraNode_->getWorldOrientation(), this->getWorldOrientation(), false));
-*/
+            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));
+            //this->cameraNode_->setOrientation(this->getWorldOrientation());
+        }
     }
 
@@ -120,8 +136,29 @@
     }
 
-    void Camera::setFocus(Ogre::Viewport* viewport)
+    void Camera::setFocus()
     {
         this->bHasFocus_ = true;
-        viewport->setCamera(this->camera_);
+        CameraManager::getInstance().useCamera(this->camera_);
+    }
+
+    void Camera::setDrag(bool bDrag)
+    {
+        if (bDrag != this->bDrag_)
+        {
+            this->bDrag_ = bDrag;
+
+            if (!bDrag)
+            {
+                this->attachNode(this->cameraNode_);
+                this->cameraNode_->setPosition(Vector3::ZERO);
+                this->cameraNode_->setOrientation(Quaternion::IDENTITY);
+            }
+            else
+            {
+                this->detachNode(this->cameraNode_);
+                this->cameraNode_->setPosition(this->getWorldPosition());
+                this->cameraNode_->setOrientation(this->getWorldOrientation());
+            }
+        }
     }
 }
Index: code/branches/presentation/src/orxonox/objects/worldentities/Camera.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/Camera.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/Camera.h	(revision 2485)
@@ -55,6 +55,5 @@
                 { return this->bHasFocus_; }
 
-            inline void setDrag(bool bDrag)
-                { this->bDrag_ = bDrag; }
+            void setDrag(bool bDrag);
             inline bool getDrag() const
                 { return this->bDrag_; }
@@ -62,11 +61,12 @@
         private:
             void removeFocus();
-            void setFocus(Ogre::Viewport* viewport);
+            void setFocus();
             void configvaluecallback_changedNearClipDistance();
 
-            Ogre::Camera*   camera_;
-            float           nearClipDistance_;
-            bool            bHasFocus_;
-            bool            bDrag_;
+            Ogre::Camera*    camera_;
+            Ogre::SceneNode* cameraNode_;
+            float            nearClipDistance_;
+            bool             bHasFocus_;
+            bool             bDrag_;
     };
 }
Index: code/branches/presentation/src/orxonox/objects/worldentities/CameraPosition.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/CameraPosition.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/CameraPosition.cc	(revision 2485)
@@ -43,4 +43,5 @@
 
         this->bDrag_ = false;
+        this->bAllowMouseLook_ = false;
 
         this->setObjectMode(0x0);
@@ -56,10 +57,16 @@
 
         XMLPortParam(CameraPosition, "drag", setDrag, getDrag, xmlelement, mode).defaultValues(false);
+        XMLPortParam(CameraPosition, "mouselook", setAllowMouseLook, getAllowMouseLook, xmlelement, mode).defaultValues(false);
     }
 
     void CameraPosition::attachCamera(Camera* camera)
     {
-        camera->setDrag(this->bDrag_);
+        if (!this->bDrag_)
+            camera->setDrag(false);
+
         this->attach(camera);
+
+        if (this->bDrag_)
+            camera->setDrag(true);
     }
 }
Index: code/branches/presentation/src/orxonox/objects/worldentities/CameraPosition.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/CameraPosition.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/CameraPosition.h	(revision 2485)
@@ -49,8 +49,14 @@
                 { return this->bDrag_; }
 
+            inline void setAllowMouseLook(bool bAllow)
+                { this->bAllowMouseLook_ = bAllow; }
+            inline bool getAllowMouseLook() const
+                { return this->bAllowMouseLook_; }
+
             void attachCamera(Camera* camera);
 
         private:
             bool bDrag_;
+            bool bAllowMouseLook_;
     };
 }
Index: code/branches/presentation/src/orxonox/objects/worldentities/ControllableEntity.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/ControllableEntity.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/ControllableEntity.cc	(revision 2485)
@@ -30,12 +30,17 @@
 #include "ControllableEntity.h"
 
+#include <OgreSceneManager.h>
+
 #include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
 #include "core/Core.h"
 #include "core/XMLPort.h"
 #include "core/Template.h"
 
+#include "objects/Scene.h"
 #include "objects/infos/PlayerInfo.h"
 #include "objects/worldentities/Camera.h"
 #include "objects/worldentities/CameraPosition.h"
+#include "objects/gametypes/Gametype.h"
 #include "overlays/OverlayGroup.h"
 
@@ -48,5 +53,7 @@
         RegisterObject(ControllableEntity);
 
-        this->bControlled_ = false;
+        this->bHasLocalController_ = false;
+        this->bHasHumanController_ = false;
+
         this->server_overwrite_ = 0;
         this->client_overwrite_ = 0;
@@ -56,4 +63,11 @@
         this->camera_ = 0;
         this->bDestroyWhenPlayerLeft_ = false;
+        this->cameraPositionRootNode_ = this->node_->createChildSceneNode();
+        this->bMouseLook_ = false;
+        this->mouseLookSpeed_ = 200;
+
+        this->gtinfo_ = 0;
+        this->gtinfoID_ = OBJECTID_UNKNOWN;
+        this->changedGametype();
 
         this->server_position_         = Vector3::ZERO;
@@ -67,4 +81,5 @@
 
 
+        this->setConfigValues();
         this->setPriority( priority::very_high );
         this->registerVariables();
@@ -75,6 +90,11 @@
         if (this->isInitialized())
         {
-            if (this->bControlled_)
-                this->stopLocalControl();
+            this->bDestroyWhenPlayerLeft_ = false;
+
+            if (this->bHasLocalController_ && this->bHasHumanController_)
+                this->stopLocalHumanControl();
+
+            if (this->getPlayer() && this->getPlayer()->getControllableEntity() == this)
+                this->getPlayer()->stopControl(this, false);
 
             if (this->hud_)
@@ -84,6 +104,9 @@
                 delete this->camera_;
 
-            if (this->getPlayer() && this->getPlayer()->getControllableEntity() == this)
-                this->getPlayer()->stopControl(this, false);
+            for (std::list<CameraPosition*>::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
+                delete (*it);
+
+            if (this->getScene()->getSceneManager())
+                this->getScene()->getSceneManager()->destroySceneNode(this->cameraPositionRootNode_->getName());
         }
     }
@@ -99,7 +122,30 @@
     }
 
+    void ControllableEntity::setConfigValues()
+    {
+        SetConfigValue(mouseLookSpeed_, 3.0f);
+    }
+
+    void ControllableEntity::changedGametype()
+    {
+        //SUPER(ControllableEntity, changedGametype);
+        WorldEntity::changedGametype();
+
+        this->gtinfo_ = 0;
+        this->gtinfoID_ = OBJECTID_UNKNOWN;
+
+        if (this->getGametype() && this->getGametype()->getGametypeInfo())
+        {
+            this->gtinfo_ = this->getGametype()->getGametypeInfo();
+            this->gtinfoID_ = this->gtinfo_->getObjectID();
+        }
+    }
+
     void ControllableEntity::addCameraPosition(CameraPosition* position)
     {
-        this->attach(position);
+        if (position->getAllowMouseLook())
+            position->attachToNode(this->cameraPositionRootNode_);
+        else
+            this->attach(position);
         this->cameraPositions_.push_back(position);
     }
@@ -142,7 +188,33 @@
             else
             {
-                this->attach(this->camera_);
+                this->camera_->attachToNode(this->cameraPositionRootNode_);
             }
         }
+    }
+
+    void ControllableEntity::mouseLook()
+    {
+        this->bMouseLook_ = !this->bMouseLook_;
+
+        if (!this->bMouseLook_)
+            this->cameraPositionRootNode_->setOrientation(Quaternion::IDENTITY);
+    }
+
+    void ControllableEntity::rotateYaw(const Vector2& value)
+    {
+        if (this->bMouseLook_)
+            this->cameraPositionRootNode_->yaw(Radian(value.y * this->mouseLookSpeed_), Ogre::Node::TS_LOCAL);
+    }
+
+    void ControllableEntity::rotatePitch(const Vector2& value)
+    {
+        if (this->bMouseLook_)
+            this->cameraPositionRootNode_->pitch(Radian(value.y * this->mouseLookSpeed_), Ogre::Node::TS_LOCAL);
+    }
+
+    void ControllableEntity::rotateRoll(const Vector2& value)
+    {
+        if (this->bMouseLook_)
+            this->cameraPositionRootNode_->roll(Radian(value.y * this->mouseLookSpeed_), Ogre::Node::TS_LOCAL);
     }
 
@@ -157,13 +229,14 @@
         this->player_ = player;
         this->playerID_ = player->getObjectID();
-        this->bControlled_ = (player->isLocalPlayer() && player->isHumanPlayer());
-        if (this->bControlled_)
-        {
-            this->startLocalControl();
+        this->bHasLocalController_ = player->isLocalPlayer();
+        this->bHasHumanController_ = player->isHumanPlayer();
+
+        if (this->bHasLocalController_ && this->bHasHumanController_)
+        {
+            this->startLocalHumanControl();
 
             if (!Core::isMaster())
             {
                 this->client_overwrite_ = this->server_overwrite_;
-COUT(0) << "CE: bidirectional synchronization" << std::endl;
                 this->setObjectMode(objectDirection::bidirectional);
             }
@@ -173,10 +246,11 @@
     void ControllableEntity::removePlayer()
     {
-        if (this->bControlled_)
-            this->stopLocalControl();
+        if (this->bHasLocalController_ && this->bHasHumanController_)
+            this->stopLocalHumanControl();
 
         this->player_ = 0;
         this->playerID_ = OBJECTID_UNKNOWN;
-        this->bControlled_ = false;
+        this->bHasLocalController_ = false;
+        this->bHasHumanController_ = false;
         this->setObjectMode(objectDirection::toclient);
 
@@ -196,32 +270,54 @@
     }
 
-    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::networkcallback_changedgtinfoID()
+    {
+        if (this->gtinfoID_ != OBJECTID_UNKNOWN)
+        {
+            this->gtinfo_ = dynamic_cast<GametypeInfo*>(Synchronisable::getSynchronisable(this->gtinfoID_));
+
+            if (!this->gtinfo_)
+                this->gtinfoID_ = OBJECTID_UNKNOWN;
+        }
+    }
+
+    void ControllableEntity::startLocalHumanControl()
+    {
+        if (!this->camera_)
+        {
+            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->camera_->attachToNode(this->cameraPositionRootNode_);
+        }
+
+        if (!this->hud_)
+        {
+            if (this->hudtemplate_ != "")
+            {
+                this->hud_ = new OverlayGroup(this);
+                this->hud_->addTemplate(this->hudtemplate_);
+                this->hud_->setOwner(this);
+            }
+        }
+    }
+
+    void ControllableEntity::stopLocalHumanControl()
+    {
+        if (this->camera_)
+        {
+            this->camera_->detachFromParent();
+            delete this->camera_;
+            this->camera_ = 0;
+        }
+
+        if (this->hud_)
+        {
+            delete this->hud_;
+            this->hud_ = 0;
+        }
     }
 
@@ -242,5 +338,5 @@
                     this->server_angular_velocity_ = this->getAngularVelocity();
                 }
-                else if (this->bControlled_)
+                else if (this->bHasLocalController_)
                 {
                     this->client_position_ = this->getPosition();
@@ -255,5 +351,6 @@
     void ControllableEntity::registerVariables()
     {
-        registerVariable(this->cameraPositionTemplate_, variableDirection::toclient);
+        registerVariable(this->cameraPositionTemplate_,  variableDirection::toclient);
+        registerVariable(this->hudtemplate_,             variableDirection::toclient);
 
         registerVariable(this->server_position_,         variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerPosition));
@@ -271,9 +368,10 @@
 
         registerVariable(this->playerID_,                variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::networkcallback_changedplayerID));
+        registerVariable(this->gtinfoID_,                variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::networkcallback_changedgtinfoID));
     }
 
     void ControllableEntity::processServerPosition()
     {
-        if (!this->bControlled_)
+        if (!this->bHasLocalController_)
             MobileEntity::setPosition(this->server_position_);
     }
@@ -281,5 +379,5 @@
     void ControllableEntity::processServerLinearVelocity()
     {
-        if (!this->bControlled_)
+        if (!this->bHasLocalController_)
             MobileEntity::setVelocity(this->server_linear_velocity_);
     }
@@ -287,5 +385,5 @@
     void ControllableEntity::processServerOrientation()
     {
-        if (!this->bControlled_)
+        if (!this->bHasLocalController_)
             MobileEntity::setOrientation(this->server_orientation_);
     }
@@ -293,5 +391,5 @@
     void ControllableEntity::processServerAngularVelocity()
     {
-        if (!this->bControlled_)
+        if (!this->bHasLocalController_)
             MobileEntity::setAngularVelocity(this->server_angular_velocity_);
     }
@@ -299,5 +397,5 @@
     void ControllableEntity::processOverwrite()
     {
-        if (this->bControlled_)
+        if (this->bHasLocalController_)
         {
             this->setPosition(this->server_position_);
@@ -354,5 +452,5 @@
             ++this->server_overwrite_;
         }
-        else if (this->bControlled_)
+        else if (this->bHasLocalController_)
         {
             MobileEntity::setPosition(position);
@@ -369,5 +467,5 @@
             ++this->server_overwrite_;
         }
-        else if (this->bControlled_)
+        else if (this->bHasLocalController_)
         {
             MobileEntity::setOrientation(orientation);
@@ -384,5 +482,5 @@
             ++this->server_overwrite_;
         }
-        else if (this->bControlled_)
+        else if (this->bHasLocalController_)
         {
             MobileEntity::setVelocity(velocity);
@@ -399,5 +497,5 @@
             ++this->server_overwrite_;
         }
-        else if (this->bControlled_)
+        else if (this->bHasLocalController_)
         {
             MobileEntity::setAngularVelocity(velocity);
@@ -416,5 +514,5 @@
             this->server_angular_velocity_ = this->getAngularVelocity();
         }
-        else if (this->bControlled_)
+        else if (this->bHasLocalController_)
         {
             this->client_position_ = this->getPosition();
Index: code/branches/presentation/src/orxonox/objects/worldentities/ControllableEntity.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/ControllableEntity.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/ControllableEntity.h	(revision 2485)
@@ -45,4 +45,7 @@
             virtual void tick(float dt);
             void registerVariables();
+            void setConfigValues();
+
+            virtual void changedGametype();
 
             virtual void setPlayer(PlayerInfo* player);
@@ -60,14 +63,30 @@
             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 rotateYaw(const Vector2& value);
+            virtual void rotatePitch(const Vector2& value);
+            virtual void rotateRoll(const Vector2& value);
+
+            inline void moveFrontBack(float value)
+                { this->moveFrontBack(Vector2(value, 0)); }
+            inline void moveRightLeft(float value)
+                { this->moveRightLeft(Vector2(value, 0)); }
+            inline void moveUpDown(float value)
+                { this->moveUpDown(Vector2(value, 0)); }
+
+            inline void rotateYaw(float value)
+                { this->rotateYaw(Vector2(value, 0)); }
+            inline void rotatePitch(float value)
+                { this->rotatePitch(Vector2(value, 0)); }
+            inline void rotateRoll(float value)
+                { this->rotateRoll(Vector2(value, 0)); }
 
             virtual void fire() {}
             virtual void altFire() {}
 
+            virtual void boost() {}
             virtual void greet() {}
             virtual void use() {}
             virtual void switchCamera();
+            virtual void mouseLook();
 
             inline const std::string& getHudTemplate() const
@@ -99,13 +118,23 @@
             void setAngularVelocity(const Vector3& velocity);
 
+            inline bool hasLocalController() const
+                { return this->bHasLocalController_; }
+            inline bool hasHumanController() const
+                { return this->bHasHumanController_; }
+
+            inline const GametypeInfo* getGametypeInfo() const
+                { return this->gtinfo_; }
+
+            inline bool isInMouseLook() const
+                { return this->bMouseLook_; }
+            inline float getMouseLookSpeed() const
+                { return this->mouseLookSpeed_; }
+
         protected:
-            virtual void startLocalControl();
-            virtual void stopLocalControl();
+            virtual void startLocalHumanControl();
+            virtual void stopLocalHumanControl();
 
             inline void setHudTemplate(const std::string& name)
                 { this->hudtemplate_ = name; }
-
-            inline bool isLocallyControlled() const
-                { return this->bControlled_; }
 
         private:
@@ -124,4 +153,5 @@
 
             void networkcallback_changedplayerID();
+            void networkcallback_changedgtinfoID();
 
             // Bullet btMotionState related
@@ -131,5 +161,8 @@
             unsigned int client_overwrite_;
 
-            bool bControlled_;
+            bool bHasLocalController_;
+            bool bHasHumanController_;
+            bool bDestroyWhenPlayerLeft_;
+
             Vector3 server_position_;
             Vector3 client_position_;
@@ -143,11 +176,17 @@
             PlayerInfo* player_;
             unsigned int playerID_;
+
             std::string hudtemplate_;
             OverlayGroup* hud_;
+
             Camera* camera_;
-            bool bDestroyWhenPlayerLeft_;
-
+            bool bMouseLook_;
+            float mouseLookSpeed_;
+            Ogre::SceneNode* cameraPositionRootNode_;
             std::list<CameraPosition*> cameraPositions_;
             std::string cameraPositionTemplate_;
+
+            const GametypeInfo* gtinfo_;
+            unsigned int gtinfoID_;
     };
 }
Index: code/branches/presentation/src/orxonox/objects/worldentities/ExplosionChunk.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/ExplosionChunk.cc	(revision 2485)
+++ code/branches/presentation/src/orxonox/objects/worldentities/ExplosionChunk.cc	(revision 2485)
@@ -0,0 +1,160 @@
+/*
+ *   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 "ExplosionChunk.h"
+
+#include <OgreParticleSystem.h>
+
+#include "core/Core.h"
+#include "core/CoreIncludes.h"
+#include "core/Executor.h"
+#include "objects/Scene.h"
+#include "tools/ParticleInterface.h"
+#include "util/Exception.h"
+
+namespace orxonox
+{
+    CreateFactory(ExplosionChunk);
+
+    ExplosionChunk::ExplosionChunk(BaseObject* creator) : MovableEntity(creator)
+    {
+        RegisterObject(ExplosionChunk);
+
+        if (!this->getScene() || !this->getScene()->getSceneManager())
+            ThrowException(AbortLoading, "Can't create ExplosionChunk, no scene or no scene manager given.");
+
+        this->bStop_ = false;
+        this->LOD_ = LODParticle::normal;
+
+        try
+        {
+            this->fire_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/fire4", this->LOD_);
+            this->attachOgreObject(this->fire_->getParticleSystem());
+            this->smoke_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/smoke7", this->LOD_);
+            this->attachOgreObject(this->smoke_->getParticleSystem());
+        }
+        catch (...)
+        {
+            COUT(1) << "Error: Couln't load particle effect in ExplosionChunk." << std::endl;
+            this->fire_ = 0;
+            this->smoke_ = 0;
+        }
+
+        if (Core::isMaster())
+        {
+            Vector3 velocity(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1));
+            velocity.normalise();
+            velocity *= rnd(60, 80);
+            this->setVelocity(velocity);
+
+            this->destroyTimer_.setTimer(rnd(1, 2), false, this, createExecutor(createFunctor(&ExplosionChunk::stop)));
+        }
+
+        this->registerVariables();
+    }
+
+    ExplosionChunk::~ExplosionChunk()
+    {
+        if (this->isInitialized())
+        {
+            if (this->fire_)
+            {
+                this->detachOgreObject(this->fire_->getParticleSystem());
+                delete this->fire_;
+            }
+            if (this->smoke_)
+            {
+                this->detachOgreObject(this->smoke_->getParticleSystem());
+                delete this->smoke_;
+            }
+        }
+    }
+
+    void ExplosionChunk::registerVariables()
+    {
+        registerVariable((int&)(this->LOD_), variableDirection::toclient, new NetworkCallback<ExplosionChunk>(this, &ExplosionChunk::LODchanged));
+        registerVariable(this->bStop_,       variableDirection::toclient, new NetworkCallback<ExplosionChunk>(this, &ExplosionChunk::checkStop));
+    }
+
+    void ExplosionChunk::LODchanged()
+    {
+        if (this->fire_)
+            this->fire_->setDetailLevel(this->LOD_);
+        if (this->smoke_)
+            this->smoke_->setDetailLevel(this->LOD_);
+    }
+
+    void ExplosionChunk::checkStop()
+    {
+        if (this->bStop_)
+            this->stop();
+    }
+
+    void ExplosionChunk::stop()
+    {
+        if (this->fire_)
+            this->fire_->setEnabled(false);
+        if (this->smoke_)
+            this->smoke_->setEnabled(false);
+
+        if (Core::isMaster())
+        {
+            this->bStop_ = true;
+            this->destroyTimer_.setTimer(1.0f, false, this, createExecutor(createFunctor(&ExplosionChunk::destroy)));
+        }
+    }
+
+    void ExplosionChunk::destroy()
+    {
+        delete this;
+    }
+
+    void ExplosionChunk::tick(float dt)
+    {
+        static const unsigned int CHANGES_PER_SECOND = 5;
+
+        if (Core::isMaster() && rnd() < dt*CHANGES_PER_SECOND)
+        {
+            float length = this->getVelocity().length();
+
+            Vector3 change(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1));
+            change.normalise();
+            change *= rnd(0.4, 0.8);
+            Vector3 velocity = this->getVelocity();
+            velocity.normalise();
+            velocity += change;
+            velocity.normalise();
+            velocity *= length * rnd(0.8, 1.0);
+
+            this->setVelocity(velocity);
+        }
+
+        SUPER(ExplosionChunk, tick, dt);
+    }
+}
Index: code/branches/presentation/src/orxonox/objects/worldentities/ExplosionChunk.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/ExplosionChunk.h	(revision 2485)
+++ code/branches/presentation/src/orxonox/objects/worldentities/ExplosionChunk.h	(revision 2485)
@@ -0,0 +1,67 @@
+/*
+ *   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 _ExplosionChunk_H__
+#define _ExplosionChunk_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "MovableEntity.h"
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport ExplosionChunk : public MovableEntity
+    {
+        public:
+            ExplosionChunk(BaseObject* creator);
+            virtual ~ExplosionChunk();
+
+            virtual void tick(float dt);
+            void registerVariables();
+
+            inline void setLOD(LODParticle::LOD level)
+                { this->LOD_ = level; this->LODchanged(); }
+            inline LODParticle::LOD getLOD() const
+                { return this->LOD_; }
+
+        private:
+            void LODchanged();
+            void checkStop();
+            void stop();
+            void destroy();
+
+            bool                  bStop_;
+            ParticleInterface*    fire_;
+            ParticleInterface*    smoke_;
+            LODParticle::LOD      LOD_;
+            Timer<ExplosionChunk> destroyTimer_;
+    };
+}
+
+#endif /* _ExplosionChunk_H__ */
Index: code/branches/presentation/src/orxonox/objects/worldentities/FadingBillboard.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/FadingBillboard.cc	(revision 2485)
+++ code/branches/presentation/src/orxonox/objects/worldentities/FadingBillboard.cc	(revision 2485)
@@ -0,0 +1,165 @@
+/*
+ *   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 "FadingBillboard.h"
+
+#include "core/CoreIncludes.h"
+#include "core/Executor.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+    CreateFactory(FadingBillboard);
+
+    FadingBillboard::FadingBillboard(BaseObject* creator) : Billboard(creator)
+    {
+        RegisterObject(FadingBillboard);
+
+        this->turnontime_ = 0.0f;
+        this->turnofftime_ = 0.0f;
+        this->postprocessingtime_ = 0.0f;
+        this->changedirection_ = 0;
+
+        this->fadedColour_ = ColourValue::White;
+
+        this->registerVariables();
+    }
+
+    FadingBillboard::~FadingBillboard()
+    {
+    }
+
+    void FadingBillboard::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(FadingBillboard, XMLPort, xmlelement, mode);
+
+        XMLPortParam(FadingBillboard, "turnontime",  setTurnOnTime,  getTurnOnTime,  xmlelement, mode).defaultValues(0.5f);
+        XMLPortParam(FadingBillboard, "turnofftime", setTurnOffTime, getTurnOffTime, xmlelement, mode).defaultValues(0.5f);
+    }
+
+    void FadingBillboard::registerVariables()
+    {
+        registerVariable(this->turnontime_,  variableDirection::toclient);
+        registerVariable(this->turnofftime_, variableDirection::toclient);
+    }
+
+    void FadingBillboard::changedColour()
+    {
+        Billboard::changedColour();
+
+        if (this->isActive())
+            this->fadedColour_ = this->getColour();
+        else
+            this->fadedColour_ = ColourValue::ZERO;
+
+        this->getBillboardSet().setColour(this->fadedColour_);
+    }
+
+    void FadingBillboard::changedActivity()
+    {
+        SUPER(FadingBillboard, changedActivity);
+
+        this->startturnonoff();
+    }
+
+    void FadingBillboard::changedVisibility()
+    {
+        SUPER(FadingBillboard, changedVisibility);
+
+        if (this->isVisible() && !this->isActive() && this->changedirection_ == 0)
+        {
+            // Billboard shouldn't be visible
+            this->getBillboardSet().setVisible(false);
+        }
+    }
+
+    void FadingBillboard::startturnonoff()
+    {
+        if (this->isActive())
+        {
+            this->changedirection_ = 1;
+            this->turnonofftimer_.setTimer(this->turnontime_, false, this, createExecutor(createFunctor(&FadingBillboard::stopturnonoff)));
+
+            if (this->isVisible())
+                this->getBillboardSet().setVisible(true);
+        }
+        else
+        {
+            this->changedirection_ = -1;
+            this->turnonofftimer_.setTimer(this->turnofftime_, false, this, createExecutor(createFunctor(&FadingBillboard::stopturnonoff)));
+        }
+    }
+
+    void FadingBillboard::stopturnonoff()
+    {
+        if (this->changedirection_ > 0)
+        {
+            this->fadedColour_ = this->getColour();
+            this->getBillboardSet().setColour(this->fadedColour_);
+        }
+        else if (this->changedirection_ < 0)
+        {
+            this->fadedColour_ = ColourValue::ZERO;
+            this->getBillboardSet().setColour(this->fadedColour_);
+            this->turnonofftimer_.setTimer(this->postprocessingtime_, false, this, createExecutor(createFunctor(&FadingBillboard::poststopturnonoff)));
+        }
+        this->changedirection_ = 0;
+    }
+
+    void FadingBillboard::poststopturnonoff()
+    {
+        this->getBillboardSet().setVisible(false);
+    }
+
+    void FadingBillboard::tick(float dt)
+    {
+        SUPER(FadingBillboard, tick, dt);
+
+        if (this->changedirection_ > 0 && (this->fadedColour_.a < this->getColour().a))
+        {
+            ColourValue colour = this->fadedColour_ + this->getColour() / this->turnontime_ * dt;
+
+            if (colour.a < this->getColour().a)
+            {
+                this->fadedColour_ = colour;
+                this->getBillboardSet().setColour(this->fadedColour_);
+            }
+        }
+        else if (this->changedirection_ < 0 && (this->fadedColour_.a > 0))
+        {
+            ColourValue colour = this->fadedColour_ - this->getColour() / this->turnofftime_ * dt;
+
+            if (colour.a > 0)
+            {
+                this->fadedColour_ = colour;
+                this->getBillboardSet().setColour(this->fadedColour_);
+            }
+        }
+    }
+}
Index: code/branches/presentation/src/orxonox/objects/worldentities/FadingBillboard.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/FadingBillboard.h	(revision 2485)
+++ code/branches/presentation/src/orxonox/objects/worldentities/FadingBillboard.h	(revision 2485)
@@ -0,0 +1,80 @@
+/*
+ *   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 _FadingBillboard_H__
+#define _FadingBillboard_H__
+
+#include "OrxonoxPrereqs.h"
+#include "Billboard.h"
+#include "objects/Tickable.h"
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport FadingBillboard : public Billboard, public Tickable
+    {
+        public:
+            FadingBillboard(BaseObject* creator);
+            virtual ~FadingBillboard();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            void registerVariables();
+
+            virtual void tick(float dt);
+            virtual void changedActivity();
+            virtual void changedVisibility();
+
+            inline void setTurnOnTime(float turnontime)
+                { this->turnontime_ = turnontime; }
+            inline float getTurnOnTime() const
+                { return this->turnontime_; }
+
+            inline void setTurnOffTime(float turnofftime)
+                { this->turnofftime_ = turnofftime; }
+            inline float getTurnOffTime() const
+                { return this->turnofftime_; }
+
+            inline const ColourValue& getFadedColour() const
+                { return this->fadedColour_; }
+
+        protected:
+            virtual void startturnonoff();
+            virtual void stopturnonoff();
+            virtual void poststopturnonoff();
+            virtual void changedColour();
+
+            float turnontime_;
+            float turnofftime_;
+            float postprocessingtime_;
+            Timer<FadingBillboard> turnonofftimer_;
+            char changedirection_;
+            ColourValue fadedColour_;
+    };
+}
+
+#endif /* _FadingBillboard_H__ */
Index: code/branches/presentation/src/orxonox/objects/worldentities/Light.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/Light.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/Light.cc	(revision 2485)
@@ -36,5 +36,6 @@
 
 #include "util/String.h"
-#include "util/Convert.h"
+#include "util/Exception.h"
+#include "core/Core.h"
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
@@ -43,6 +44,4 @@
 namespace orxonox
 {
-    unsigned int Light::lightCounter_s = 0;
-
     CreateFactory(Light);
 
@@ -51,7 +50,31 @@
         RegisterObject(Light);
 
-        if (this->getScene() && this->getScene()->getSceneManager())
-        this->light_ = this->getScene()->getSceneManager()->createLight("Light" + convertToString(Light::lightCounter_s++));
-        this->attachOgreObject(this->light_);
+        this->light_ = 0;
+        this->diffuse_ = ColourValue::White;
+        this->specular_ = ColourValue::White;
+        this->type_ = Ogre::Light::LT_POINT;
+        this->attenuation_ = Vector4(100000, 1, 0, 0);
+        this->spotlightRange_ = Vector3(40.0f, 30.0f, 1.0f);
+
+        if (Core::showsGraphics())
+        {
+            if (!this->getScene())
+                ThrowException(AbortLoading, "Can't create Light, no scene given.");
+            if (!this->getScene()->getSceneManager())
+                ThrowException(AbortLoading, "Can't create Light, no scene manager given.");
+
+            if (this->getScene() && this->getScene()->getSceneManager())
+            {
+                this->light_ = this->getScene()->getSceneManager()->createLight("Light" + getUniqueNumberString());
+                this->light_->setDirection(WorldEntity::FRONT);
+                this->attachOgreObject(this->light_);
+
+                this->updateType();
+                this->updateDiffuseColour();
+                this->updateSpecularColour();
+                this->updateAttenuation();
+                this->updateSpotlightRange();
+            }
+        }
 
         this->registerVariables();
@@ -71,66 +94,42 @@
         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&);
+        XMLPortParam(Light, "type",           setTypeString,     getTypeString,     xmlelement, mode).defaultValues("point");
+        XMLPortParam(Light, "diffuse",        setDiffuseColour,  getDiffuseColour,  xmlelement, mode).defaultValues(ColourValue::White);
+        XMLPortParam(Light, "specular",       setSpecularColour, getSpecularColour, xmlelement, mode).defaultValues(ColourValue::White);
+        XMLPortParam(Light, "attenuation",    setAttenuation,    getAttenuation,    xmlelement, mode).defaultValues(Vector4(100000, 1, 0, 0));
+        XMLPortParam(Light, "spotlightrange", setSpotlightRange, getSpotlightRange, xmlelement, mode).defaultValues(Vector3(40.0f, 30.0f, 1.0f));
     }
 
     void Light::registerVariables()
     {
-        registerVariable((int &)this->type_, variableDirection::toclient, new NetworkCallback<Light>(this, &Light::changedType));
-        registerVariable(this->light_->getDiffuseColour(), variableDirection::toclient);
-        registerVariable(this->light_->getSpecularColour(), variableDirection::toclient);
-        registerVariable(this->light_->getDirection(), variableDirection::toclient);
+        registerVariable((int&)this->type_,     variableDirection::toclient, new NetworkCallback<Light>(this, &Light::updateType));
+        registerVariable(this->diffuse_,        variableDirection::toclient, new NetworkCallback<Light>(this, &Light::updateDiffuseColour));
+        registerVariable(this->specular_,       variableDirection::toclient, new NetworkCallback<Light>(this, &Light::updateSpecularColour));
+        registerVariable(this->attenuation_,    variableDirection::toclient, new NetworkCallback<Light>(this, &Light::updateAttenuation));
+        registerVariable(this->spotlightRange_, variableDirection::toclient, new NetworkCallback<Light>(this, &Light::updateSpotlightRange));
     }
 
-    const std::string& Light::getName() const
+    void Light::updateDiffuseColour()
     {
         if (this->light_)
-            return this->light_->getName();
-        else
-            return BLANKSTRING;
+            this->light_->setDiffuseColour(this->diffuse_);
     }
 
-    void Light::setDiffuseColour(const ColourValue& colour)
+    void Light::updateSpecularColour()
     {
         if (this->light_)
-            this->light_->setDiffuseColour(colour);
+            this->light_->setSpecularColour(this->specular_);
     }
 
-    const ColourValue& Light::getDiffuseColour() const
+    void Light::updateAttenuation()
     {
-        if (this->light_)
-            return this->light_->getDiffuseColour();
-        else
-            return ColourValue::White;
+        if (this->light_ && this->type_ != Ogre::Light::LT_DIRECTIONAL)
+            this->light_->setAttenuation(this->attenuation_.x, this->attenuation_.y, this->attenuation_.z, this->attenuation_.w);
     }
 
-    void Light::setSpecularColour(const ColourValue& colour)
+    void Light::updateSpotlightRange()
     {
-        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;
+        if (this->light_ && this->type_ == Ogre::Light::LT_SPOTLIGHT)
+            this->light_->setSpotlightRange(Degree(this->spotlightRange_.x), Degree(this->spotlightRange_.y), this->spotlightRange_.z);
     }
 
@@ -157,11 +156,19 @@
             case Ogre::Light::LT_POINT:
             default:
-                return "poinT";
+                return "point";
         }
     }
 
-    void Light::changedType()
+    void Light::updateType()
     {
-        this->light_->setType(this->type_);
+        if (this->light_)
+        {
+            this->light_->setType(this->type_);
+
+            if (this->type_ != Ogre::Light::LT_DIRECTIONAL)
+                this->updateAttenuation();
+            if (this->type_ == Ogre::Light::LT_SPOTLIGHT)
+                this->updateSpotlightRange();
+        }
     }
 
@@ -170,5 +177,6 @@
         SUPER(Light, changedVisibility);
 
-        this->light_->setVisible(this->isVisible());
+        if (this->light_)
+            this->light_->setVisible(this->isVisible());
     }
 }
Index: code/branches/presentation/src/orxonox/objects/worldentities/Light.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/Light.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/Light.h	(revision 2485)
@@ -54,19 +54,67 @@
                 { 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
+                { this->type_ = type; this->updateType(); }
+            inline Ogre::Light::LightTypes getType() const
                 { return this->type_; }
 
-            void setDiffuseColour(const ColourValue& colour);
-            const ColourValue& getDiffuseColour() const;
+            inline void setDiffuseColour(const ColourValue& colour)
+                { this->diffuse_ = colour; this->updateDiffuseColour(); }
+            inline const ColourValue& getDiffuseColour() const
+                { return this->diffuse_; }
 
-            void setSpecularColour(const ColourValue& colour);
-            const ColourValue& getSpecularColour() const;
+            inline void setSpecularColour(const ColourValue& colour)
+                { this->specular_ = colour; this->updateSpecularColour(); }
+            inline const ColourValue& getSpecularColour() const
+                { return this->specular_; }
 
-            void setDirection(const Vector3& direction);
-            const Vector3& getDirection() const;
+            /**
+                @brief Sets the attenuation parameters of the light source i.e. how it diminishes with distance.
+
+                @param attenuation.x range (The absolute upper range of the light in world units)
+                @param attenuation.y constant (The constant factor in the attenuation formula: 1.0 means never attenuate, 0.0 is complete attenuation)
+                @param attenuation.z linear (The linear factor in the attenuation formula: 1 means attenuate evenly over the distance)
+                @param attenuation.w quadratic (The quadratic factor in the attenuation formula: adds a curvature to the attenuation formula)
+
+                Quote from the Ogre API:
+                Lights normally get fainter the further they are away. Also, each light is given a maximum range beyond which it cannot affect any objects.
+                Light attenuation is not applicable to directional lights since they have an infinite range and constant intensity.
+                This follows a standard attenuation approach - see any good 3D text for the details of what they mean since i don't have room here!
+
+                Quote from the Ogre wiki:
+                "Using these numbers, the light has 100% intensity at 0 distance, and
+                trails off to near black at a distance equal to the Range. Keep in mind
+                that most of the light falls in the first 20% of the range."
+
+                Range   Constant   Linear     Quadratic
+                3250,     1.0,     0.0014,    0.000007
+                600,      1.0,     0.007,     0.0002
+                325,      1.0,     0.014,     0.0007
+                200,      1.0,     0.022,     0.0019
+                160,      1.0,     0.027,     0.0028
+                100,      1.0,     0.045,     0.0075
+                65,       1.0,     0.07,      0.017
+                50,       1.0,     0.09,      0.032
+                32,       1.0,     0.14,      0.07
+                20,       1.0,     0.22,      0.20
+                13,       1.0,     0.35,      0.44
+                7,        1.0,     0.7,       1.8
+            */
+            inline void setAttenuation(const Vector4& attenuation)
+                { this->attenuation_ = attenuation; this->updateAttenuation(); }
+            inline const Vector4& getAttenuation() const
+                { return this->attenuation_; }
+
+            /**
+                @brief Sets the range of a spotlight, i.e. the angle of the inner and outer cones and the rate of falloff between them.
+
+                @param spotlightRange.x innerAngle (The angle covered by the bright inner cone)
+                @param spotlightRange.x outerAngle (The angle covered by the outer cone)
+                @param spotlightRange.x falloff (The rate of falloff between the inner and outer cones. 1.0 means a linear falloff, less means slower falloff, higher means faster falloff.)
+            */
+            inline void setSpotlightRange(const Vector3& spotlightRange)
+                { this->spotlightRange_ = spotlightRange; this->updateSpotlightRange(); }
+            inline const Vector3& getSpotlightRange() const
+                { return this->spotlightRange_; }
 
         private:
@@ -74,10 +122,16 @@
             std::string getTypeString() const;
 
-            void changedType();
+            void updateType();
+            void updateDiffuseColour();
+            void updateSpecularColour();
+            void updateAttenuation();
+            void updateSpotlightRange();
 
-            static unsigned int lightCounter_s;
             Ogre::Light* light_;
             Ogre::Light::LightTypes type_;
-
+            ColourValue diffuse_;
+            ColourValue specular_;
+            Vector4 attenuation_;
+            Vector3 spotlightRange_;
     };
 }
Index: code/branches/presentation/src/orxonox/objects/worldentities/Model.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/Model.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/Model.cc	(revision 2485)
@@ -42,4 +42,6 @@
     {
         RegisterObject(Model);
+
+        this->bCastShadows_ = true;
 
         this->registerVariables();
Index: code/branches/presentation/src/orxonox/objects/worldentities/MovableEntity.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/MovableEntity.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/MovableEntity.cc	(revision 2485)
@@ -35,5 +35,4 @@
 #include "core/Executor.h"
 #include "core/Core.h"
-#include "tools/Timer.h"
 
 namespace orxonox
@@ -81,5 +80,5 @@
     void MovableEntity::clientConnected(unsigned int clientID)
     {
-        new Timer<MovableEntity>(rnd() * MAX_RESYNCHRONIZE_TIME, false, this, createExecutor(createFunctor(&MovableEntity::resynchronize)), true);
+        this->resynchronizeTimer_.setTimer(rnd() * MAX_RESYNCHRONIZE_TIME, false, this, createExecutor(createFunctor(&MovableEntity::resynchronize)));
     }
 
Index: code/branches/presentation/src/orxonox/objects/worldentities/MovableEntity.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/MovableEntity.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/MovableEntity.h	(revision 2485)
@@ -35,4 +35,5 @@
 #include "MobileEntity.h"
 #include "network/ClientConnectionListener.h"
+#include "tools/Timer.h"
 
 namespace orxonox
@@ -72,4 +73,6 @@
             Vector3    overwrite_position_;
             Quaternion overwrite_orientation_;
+
+            Timer<MovableEntity> resynchronizeTimer_;
             Timer<MovableEntity>* continuousResynchroTimer_;
     };
Index: code/branches/presentation/src/orxonox/objects/worldentities/ParticleEmitter.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/ParticleEmitter.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/ParticleEmitter.cc	(revision 2485)
@@ -52,5 +52,5 @@
 
         if (Core::showsGraphics() && (!this->getScene() || !this->getScene()->getSceneManager()))
-            ThrowException(AbortLoading, "Can't create Camera, no scene or no scene manager given.");
+            ThrowException(AbortLoading, "Can't create ParticleEmitter, no scene or no scene manager given.");
 
         this->particles_ = 0;
@@ -109,5 +109,5 @@
             {
                 this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), this->source_, this->LOD_);
-                this->attachOgreObject(particles_->getParticleSystem());
+                this->attachOgreObject(this->particles_->getParticleSystem());
                 this->particles_->setVisible(this->isVisible());
                 this->particles_->setEnabled(this->isActive());
Index: code/branches/presentation/src/orxonox/objects/worldentities/WorldEntity.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/WorldEntity.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/WorldEntity.cc	(revision 2485)
@@ -95,4 +95,13 @@
         {
             this->node_->detachAllObjects();
+
+            for (std::set<WorldEntity*>::const_iterator it = this->children_.begin(); it != this->children_.end(); )
+                delete (*(it++));
+
+            if (this->parent_)
+                this->detachFromParent();
+
+            this->node_->removeAllChildren();
+
             if (this->getScene()->getSceneManager())
                 this->getScene()->getSceneManager()->destroySceneNode(this->node_->getName());
@@ -140,4 +149,6 @@
     void WorldEntity::registerVariables()
     {
+        registerVariable(this->mainStateName_,  variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::changedMainState));
+
         registerVariable(this->bActive_,        variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::changedActivity));
         registerVariable(this->bVisible_,       variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::changedVisibility));
@@ -212,4 +223,32 @@
     }
 
+    void WorldEntity::attachNode(Ogre::SceneNode* node)
+    {
+        Ogre::Node* parent = node->getParent();
+        if (parent)
+            parent->removeChild(node);
+        this->node_->addChild(node);
+    }
+
+    void WorldEntity::detachNode(Ogre::SceneNode* node)
+    {
+        this->node_->removeChild(node);
+//        this->getScene()->getRootSceneNode()->addChild(node);
+    }
+
+    void WorldEntity::attachToNode(Ogre::SceneNode* node)
+    {
+        Ogre::Node* parent = this->node_->getParent();
+        if (parent)
+            parent->removeChild(this->node_);
+        node->addChild(this->node_);
+    }
+
+    void WorldEntity::detachFromNode(Ogre::SceneNode* node)
+    {
+        node->removeChild(this->node_);
+//        this->getScene()->getRootSceneNode()->addChild(this->node_);
+    }
+
     void WorldEntity::attach(WorldEntity* object)
     {
@@ -243,14 +282,15 @@
         }
 
+        if (object == this)
+        {
+            COUT(2) << "Warning: Can't attach a WorldEntity to itself." << std::endl;
+            return;
+        }
+
         if (object->getParent())
             object->detachFromParent();
-        else
-        {
-            Ogre::Node* parent = object->node_->getParent();
-            if (parent)
-                parent->removeChild(object->node_);
-        }
-
-        this->node_->addChild(object->node_);
+
+        this->attachNode(object->node_);
+
         this->children_.insert(object);
         object->parent_ = this;
@@ -275,9 +315,8 @@
         }
 
-        this->node_->removeChild(object->node_);
+        this->detachNode(object->node_);
         this->children_.erase(object);
         object->parent_ = 0;
         object->parentID_ = OBJECTID_UNKNOWN;
-//        this->getScene()->getRootSceneNode()->addChild(object->node_);
 
         // Note: It is possible that the object has physics but was disabled when attaching
@@ -466,4 +505,17 @@
 
         this->node_->setScale(scale);
+
+        this->changedScale();
+    }
+
+    const Vector3& WorldEntity::getWorldScale3D() const
+    {
+        return this->node_->_getDerivedScale();
+    }
+
+    float WorldEntity::getWorldScale() const
+    {
+        Vector3 scale = this->getWorldScale3D();
+        return (scale.x == scale.y && scale.x == scale.z) ? scale.x : 1;
     }
 
Index: code/branches/presentation/src/orxonox/objects/worldentities/WorldEntity.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/WorldEntity.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/WorldEntity.h	(revision 2485)
@@ -74,4 +74,7 @@
             inline void translate(float x, float y, float z, TransformSpace::Space relativeTo = TransformSpace::Parent)
                 { this->translate(Vector3(x, y, z), relativeTo); }
+
+            virtual inline const Vector3& getVelocity() const
+                { return Vector3::ZERO; }
 
             virtual void setOrientation(const Quaternion& orientation) = 0;
@@ -105,9 +108,11 @@
                 { this->setScale3D(Vector3(x, y, z)); }
             const Vector3& getScale3D(void) const;
-
-            void setScale(float scale)
+            const Vector3& getWorldScale3D() const;
+
+            inline void setScale(float scale)
                 { this->setScale3D(scale, scale, scale); }
             inline float getScale() const
                 { Vector3 scale = this->getScale3D(); return (scale.x == scale.y && scale.x == scale.z) ? scale.x : 1; }
+            float getWorldScale() const;
 
             inline void scale3D(const Vector3& scale)
@@ -118,4 +123,6 @@
                 { this->scale3D(scale, scale, scale); }
 
+            virtual void changedScale() {}
+
             void attach(WorldEntity* object);
             void detach(WorldEntity* object);
@@ -134,4 +141,9 @@
             inline WorldEntity* getParent() const
                 { return this->parent_; }
+
+            void attachNode(Ogre::SceneNode* node);
+            void detachNode(Ogre::SceneNode* node);
+            void attachToNode(Ogre::SceneNode* node);
+            void detachFromNode(Ogre::SceneNode* node);
 
             void notifyChildPropsChanged();
@@ -302,4 +314,6 @@
         { return this->node_->getScale(); }
 #endif
+
+    SUPER_FUNCTION(5, WorldEntity, changedScale, false);
 }
 
Index: code/branches/presentation/src/orxonox/objects/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/pawns/Pawn.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/pawns/Pawn.cc	(revision 2485)
@@ -30,10 +30,14 @@
 #include "Pawn.h"
 
+#include "core/Core.h"
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
 #include "util/Math.h"
+#include "PawnManager.h"
 #include "objects/infos/PlayerInfo.h"
 #include "objects/gametypes/Gametype.h"
 #include "objects/weaponSystem/WeaponSystem.h"
+#include "objects/worldentities/ParticleSpawner.h"
+#include "objects/worldentities/ExplosionChunk.h"
 
 namespace orxonox
@@ -45,5 +49,7 @@
         RegisterObject(Pawn);
 
-        this->bAlive_ = false;
+        PawnManager::touch();
+
+        this->bAlive_ = true;
 
         this->health_ = 0;
@@ -53,4 +59,6 @@
         this->lastHitOriginator_ = 0;
         this->weaponSystem_ = 0;
+
+        this->spawnparticleduration_ = 3.0f;
 
         /*
@@ -62,4 +70,7 @@
         */
 
+        this->setRadarObjectColour(ColourValue::Red);
+        this->setRadarObjectShape(RadarViewable::Dot);
+
         this->registerVariables();
     }
@@ -67,4 +78,9 @@
     Pawn::~Pawn()
     {
+        if (this->isInitialized())
+        {
+            for (ObjectList<PawnListener>::iterator it = ObjectList<PawnListener>::begin(); it != ObjectList<PawnListener>::end(); ++it)
+                it->destroyedPawn(this);
+        }
     }
 
@@ -73,13 +89,17 @@
         SUPER(Pawn, XMLPort, xmlelement, mode);
 
-        XMLPortParam(Pawn, "health", setHealth, getHealht, xmlelement, mode).defaultValues(100);
+        XMLPortParam(Pawn, "health", setHealth, getHealth, xmlelement, mode).defaultValues(100);
         XMLPortParam(Pawn, "maxhealth", setMaxHealth, getMaxHealth, xmlelement, mode).defaultValues(200);
         XMLPortParam(Pawn, "initialhealth", setInitialHealth, getInitialHealth, xmlelement, mode).defaultValues(100);
+        XMLPortParam(Pawn, "spawnparticlesource", setSpawnParticleSource, getSpawnParticleSource, xmlelement, mode);
+        XMLPortParam(Pawn, "spawnparticleduration", setSpawnParticleDuration, getSpawnParticleDuration, xmlelement, mode).defaultValues(3.0f);
+        XMLPortParam(Pawn, "explosionchunks", setExplosionChunks, getExplosionChunks, xmlelement, mode).defaultValues(7);
     }
 
     void Pawn::registerVariables()
     {
-        registerVariable(this->bAlive_, variableDirection::toclient);
-        registerVariable(this->health_, variableDirection::toclient);
+        registerVariable(this->bAlive_,        variableDirection::toclient);
+        registerVariable(this->health_,        variableDirection::toclient);
+        registerVariable(this->initialHealth_, variableDirection::toclient);
     }
 
@@ -119,20 +139,68 @@
     }
 
-    void Pawn::spawn()
+    void Pawn::spawneffect()
     {
         // play spawn effect
+        if (this->spawnparticlesource_ != "")
+        {
+            ParticleSpawner* effect = new ParticleSpawner(this->getCreator());
+            effect->setPosition(this->getPosition());
+            effect->setOrientation(this->getOrientation());
+            effect->setDestroyAfterLife(true);
+            effect->setSource(this->spawnparticlesource_);
+            effect->setLifetime(this->spawnparticleduration_);
+        }
     }
 
     void Pawn::death()
     {
+        // Set bAlive_ to false and wait for PawnManager to do the destruction
         this->bAlive_ = false;
+
+        this->setDestroyWhenPlayerLeft(false);
+
         if (this->getGametype())
             this->getGametype()->pawnKilled(this, this->lastHitOriginator_);
+
         if (this->getPlayer())
             this->getPlayer()->stopControl(this);
 
-        delete this;
-
+        if (Core::isMaster())
+            this->deatheffect();
+    }
+
+    void Pawn::deatheffect()
+    {
         // play death effect
+        {
+            ParticleSpawner* effect = new ParticleSpawner(this->getCreator());
+            effect->setPosition(this->getPosition());
+            effect->setOrientation(this->getOrientation());
+            effect->setDestroyAfterLife(true);
+            effect->setSource("Orxonox/explosion2b");
+            effect->setLifetime(4.0f);
+        }
+        {
+            ParticleSpawner* effect = new ParticleSpawner(this->getCreator());
+            effect->setPosition(this->getPosition());
+            effect->setOrientation(this->getOrientation());
+            effect->setDestroyAfterLife(true);
+            effect->setSource("Orxonox/smoke6");
+            effect->setLifetime(4.0f);
+        }
+        {
+            ParticleSpawner* effect = new ParticleSpawner(this->getCreator());
+            effect->setPosition(this->getPosition());
+            effect->setOrientation(this->getOrientation());
+            effect->setDestroyAfterLife(true);
+            effect->setSource("Orxonox/sparks");
+            effect->setLifetime(4.0f);
+        }
+        for (unsigned int i = 0; i < this->numexplosionchunks_; ++i)
+        {
+            ExplosionChunk* chunk = new ExplosionChunk(this->getCreator());
+            chunk->setPosition(this->getPosition());
+
+        }
     }
 
@@ -146,5 +214,14 @@
     {
         this->setHealth(this->initialHealth_);
-        this->spawn();
+        if (Core::isMaster())
+            this->spawneffect();
+    }
+
+    ///////////////////
+    // Pawn Listener //
+    ///////////////////
+    PawnListener::PawnListener()
+    {
+        RegisterRootObject(PawnListener);
     }
 }
Index: code/branches/presentation/src/orxonox/objects/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/pawns/Pawn.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/pawns/Pawn.h	(revision 2485)
@@ -33,8 +33,9 @@
 
 #include "objects/worldentities/ControllableEntity.h"
+#include "objects/RadarViewable.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport Pawn : public ControllableEntity
+    class _OrxonoxExport Pawn : public ControllableEntity, public RadarViewable
     {
         public:
@@ -54,5 +55,5 @@
             inline void removeHealth(float health)
                 { this->setHealth(this->health_ - health); }
-            inline float getHealht() const
+            inline float getHealth() const
                 { return this->health_; }
 
@@ -78,7 +79,26 @@
             virtual void postSpawn();
 
+            inline const WorldEntity* getWorldEntity() const
+                { return (WorldEntity*)this; }
+
+            inline void setSpawnParticleSource(const std::string& source)
+                { this->spawnparticlesource_ = source; }
+            inline const std::string& getSpawnParticleSource() const
+                { return this->spawnparticlesource_; }
+
+            inline void setSpawnParticleDuration(float duration)
+                { this->spawnparticleduration_ = duration; }
+            inline float getSpawnParticleDuration() const
+                { return this->spawnparticleduration_; }
+
+            inline void setExplosionChunks(unsigned int chunks)
+                { this->numexplosionchunks_ = chunks; }
+            inline unsigned int getExplosionChunks() const
+                { return this->numexplosionchunks_; }
+
         protected:
-            virtual void spawn();
             virtual void death();
+            virtual void deatheffect();
+            virtual void spawneffect();
 
             bool bAlive_;
@@ -91,4 +111,20 @@
 
             WeaponSystem* weaponSystem_;
+
+            std::string spawnparticlesource_;
+            float spawnparticleduration_;
+            unsigned int numexplosionchunks_;
+    };
+
+    class _OrxonoxExport PawnListener : public OrxonoxClass
+    {
+        friend class Pawn;
+
+        public:
+            PawnListener();
+            virtual ~PawnListener() {}
+
+        protected:
+            virtual void destroyedPawn(Pawn* pawn) = 0;
     };
 }
Index: code/branches/presentation/src/orxonox/objects/worldentities/pawns/SpaceShip.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/pawns/SpaceShip.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/pawns/SpaceShip.cc	(revision 2485)
@@ -36,5 +36,7 @@
 #include "core/CoreIncludes.h"
 #include "core/ConfigValueIncludes.h"
+#include "core/Template.h"
 #include "core/XMLPort.h"
+#include "objects/items/Engine.h"
 
 namespace orxonox
@@ -53,4 +55,8 @@
         this->localLinearAcceleration_.setValue(0, 0, 0);
         this->localAngularAcceleration_.setValue(0, 0, 0);
+        this->bBoost_ = false;
+        this->steering_ = Vector3::ZERO;
+        this->engine_ = 0;
+
 
         this->bInvertYAxis_ = false;
@@ -70,4 +76,6 @@
     SpaceShip::~SpaceShip()
     {
+        if (this->isInitialized() && this->engine_)
+            delete this->engine_;
     }
 
@@ -76,4 +84,5 @@
         SUPER(SpaceShip, XMLPort, xmlelement, mode);
 
+        XMLPortParam(SpaceShip, "engine",            setEngineTemplate,    getEngineTemplate,    xmlelement, mode);
         XMLPortParamVariable(SpaceShip, "primaryThrust",  primaryThrust_,  xmlelement, mode);
         XMLPortParamVariable(SpaceShip, "auxilaryThrust", auxilaryThrust_, xmlelement, mode);
@@ -109,14 +118,17 @@
         SUPER(SpaceShip, tick, dt);
 
-        if (this->isLocallyControlled())
+        if (this->hasLocalController())
         {
-            this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() * getMass() * this->auxilaryThrust_);
-            this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() * getMass() * this->auxilaryThrust_);
-            if (this->localLinearAcceleration_.z() > 0)
-                this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->auxilaryThrust_);
-            else
-                this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->primaryThrust_);
-            this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * this->localLinearAcceleration_);
-            this->localLinearAcceleration_.setValue(0, 0, 0);
+            if (!this->isInMouseLook())
+            {
+                this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() * getMass() * this->auxilaryThrust_);
+                this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() * getMass() * this->auxilaryThrust_);
+                if (this->localLinearAcceleration_.z() > 0)
+                    this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->auxilaryThrust_);
+                else
+                    this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->primaryThrust_);
+                this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * this->localLinearAcceleration_);
+                this->localLinearAcceleration_.setValue(0, 0, 0);
+            }
 
             this->localAngularAcceleration_ *= this->getLocalInertia() * this->rotationThrust_;
@@ -129,4 +141,5 @@
     {
         this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() - value.x);
+        this->steering_.z = -value.x;
     }
 
@@ -134,4 +147,5 @@
     {
         this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() + value.x);
+        this->steering_.x = value.x;
     }
 
@@ -139,4 +153,5 @@
     {
         this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() + value.x);
+        this->steering_.y = value.x;
     }
 
@@ -144,4 +159,6 @@
     {
         this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() + value.x);
+
+        Pawn::rotateYaw(value);
     }
 
@@ -149,4 +166,6 @@
     {
         this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x);
+
+        Pawn::rotatePitch(value);
     }
 
@@ -154,4 +173,6 @@
     {
         this->localAngularAcceleration_.setZ(this->localAngularAcceleration_.z() + value.x);
+
+        Pawn::rotateRoll(value);
     }
 
@@ -159,3 +180,44 @@
     {
     }
+
+    void SpaceShip::boost()
+    {
+        this->bBoost_ = true;
+    }
+
+    void SpaceShip::loadEngineTemplate()
+    {
+        if (this->enginetemplate_ != "")
+        {
+            Template* temp = Template::getTemplate(this->enginetemplate_);
+
+            if (temp)
+            {
+                Identifier* identifier = temp->getBaseclassIdentifier();
+
+                if (identifier)
+                {
+                    BaseObject* object = identifier->fabricate(this);
+                    this->engine_ = dynamic_cast<Engine*>(object);
+
+                    if (this->engine_)
+                    {
+                        this->engine_->addTemplate(temp);
+                        this->engine_->addToSpaceShip(this);
+                    }
+                    else
+                    {
+                        delete object;
+                    }
+                }
+            }
+        }
+    }
+
+    void SpaceShip::setEngine(Engine* engine)
+    {
+        this->engine_ = engine;
+        if (engine && engine->getShip() != this)
+            engine->addToSpaceShip(this);
+    }
 }
Index: code/branches/presentation/src/orxonox/objects/worldentities/pawns/SpaceShip.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/pawns/SpaceShip.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/pawns/SpaceShip.h	(revision 2485)
@@ -58,8 +58,30 @@
 
             virtual void fire();
+            virtual void boost();
+
+            void setEngine(Engine* engine);
+            inline Engine* getEngine() const
+                { return this->engine_; }
+
+            inline void setSteeringDirection(const Vector3& direction)
+                { this->steering_ = direction; }
+            inline const Vector3& getSteeringDirection() const
+                { return this->steering_; }
+
+            inline void setBoost(bool bBoost)
+                { this->bBoost_ = bBoost; }
+            inline bool getBoost() const
+                { return this->bBoost_; }
+
+            inline void setEngineTemplate(const std::string& temp)
+                { this->enginetemplate_ = temp; this->loadEngineTemplate(); }
+            inline const std::string& getEngineTemplate() const
+                { return this->enginetemplate_; }
 
         protected:
             bool bInvertYAxis_;
 
+            bool bBoost_;
+            Vector3 steering_;
             float primaryThrust_;
             float auxilaryThrust_;
@@ -71,4 +93,10 @@
         private:
             virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const;
+
+        private:
+            void loadEngineTemplate();
+
+            std::string enginetemplate_;
+            Engine* engine_;
     };
 }
Index: code/branches/presentation/src/orxonox/objects/worldentities/pawns/Spectator.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/pawns/Spectator.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/pawns/Spectator.cc	(revision 2485)
@@ -33,4 +33,5 @@
 
 #include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
 #include "core/Core.h"
 #include "objects/worldentities/Model.h"
@@ -51,6 +52,5 @@
         RegisterObject(Spectator);
 
-        this->speed_ = 100;
-        this->rotationGain_ = 3;
+        this->speed_ = 200;
 
         this->yaw_ = 0;
@@ -59,10 +59,10 @@
         this->localVelocity_ = Vector3::ZERO;
         this->setHudTemplate("spectatorhud");
-        this->hudmode_ = 0;
+        this->greetingFlare_ = 0;
 
         this->setDestroyWhenPlayerLeft(true);
 
-        if ( Core::showsGraphics() )
-	{
+        if (Core::showsGraphics())
+        {
             this->greetingFlare_ = new BillboardSet();
             this->greetingFlare_->setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(1.0, 1.0, 0.8), Vector3(0, 20, 0), 1);
@@ -71,9 +71,9 @@
             this->greetingFlare_->setVisible(false);
         }
-        else
-            this->greetingFlare_ = 0;
+
         this->bGreetingFlareVisible_ = false;
         this->bGreeting_ = false;
 
+        this->setConfigValues();
         this->registerVariables();
     }
@@ -87,4 +87,5 @@
                 if (this->greetingFlare_->getBillboardSet())
                     this->detachOgreObject(this->greetingFlare_->getBillboardSet());
+
                 delete this->greetingFlare_;
             }
@@ -92,9 +93,13 @@
     }
 
+    void Spectator::setConfigValues()
+    {
+        SetConfigValue(speed_, 200.0f);
+    }
+
     void Spectator::registerVariables()
     {
         registerVariable(this->bGreetingFlareVisible_, variableDirection::toclient, new NetworkCallback<Spectator>(this, &Spectator::changedFlareVisibility));
         registerVariable(this->bGreeting_,             variableDirection::toserver, new NetworkCallback<Spectator>(this, &Spectator::changedGreeting));
-        registerVariable(this->hudmode_,               variableDirection::toclient);
     }
 
@@ -107,5 +112,5 @@
     void Spectator::changedFlareVisibility()
     {
-	if ( this->greetingFlare_ )	        
+	if ( this->greetingFlare_ )
             this->greetingFlare_->setVisible(this->bGreetingFlareVisible_);
     }
@@ -113,7 +118,5 @@
     void Spectator::tick(float dt)
     {
-        this->updateHUD();
-
-        if (this->isLocallyControlled())
+        if (this->hasLocalController())
         {
             float localSpeedSquared = this->localVelocity_.squaredLength();
@@ -132,7 +135,10 @@
             this->localVelocity_.z = 0;
 
-            this->yaw  (Radian(this->yaw_   * this->rotationGain_));
-            this->pitch(Radian(this->pitch_ * this->rotationGain_));
-            this->roll (Radian(this->roll_  * this->rotationGain_));
+            if (!this->isInMouseLook())
+            {
+                this->yaw(Radian(this->yaw_ * this->getMouseLookSpeed()));
+                this->pitch(Radian(this->pitch_ * this->getMouseLookSpeed()));
+                this->roll(Radian(this->roll_ * this->getMouseLookSpeed()));
+            }
 
             this->yaw_ = this->pitch_ = this->roll_ = 0;
@@ -146,12 +152,10 @@
         ControllableEntity::setPlayer(player);
 
-//        this->setObjectMode(direction::toclient);
-    }
-
-    void Spectator::startLocalControl()
-    {
-        ControllableEntity::startLocalControl();
-//        if (this->isLocallyControlled())
-//            this->testmesh_->setVisible(false);
+//        this->setObjectMode(objectDirection::toclient);
+    }
+
+    void Spectator::startLocalHumanControl()
+    {
+        ControllableEntity::startLocalHumanControl();
     }
 
@@ -174,4 +178,6 @@
     {
         this->yaw_ += value.y;
+
+        ControllableEntity::rotateYaw(value);
     }
 
@@ -179,4 +185,6 @@
     {
         this->pitch_ += value.y;
+
+        ControllableEntity::rotatePitch(value);
     }
 
@@ -184,4 +192,6 @@
     {
         this->roll_ += value.y;
+
+        ControllableEntity::rotateRoll(value);
     }
 
@@ -202,71 +212,3 @@
         }
     }
-
-    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*(int)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/branches/presentation/src/orxonox/objects/worldentities/pawns/Spectator.h
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/pawns/Spectator.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/pawns/Spectator.h	(revision 2485)
@@ -42,9 +42,10 @@
             virtual ~Spectator();
 
+            void setConfigValues();
             void registerVariables();
             virtual void tick(float dt);
 
             virtual void setPlayer(PlayerInfo* player);
-            virtual void startLocalControl();
+            virtual void startLocalHumanControl();
 
             virtual void moveFrontBack(const Vector2& value);
@@ -62,5 +63,4 @@
             void changedGreeting();
             void changedFlareVisibility();
-            void updateHUD();
 
             BillboardSet* greetingFlare_;
@@ -69,5 +69,4 @@
 
             float speed_;
-            float rotationGain_;
 
             float yaw_;
@@ -76,6 +75,4 @@
 
             Vector3 localVelocity_;
-
-            int hudmode_;
     };
 }
Index: code/branches/presentation/src/orxonox/objects/worldentities/triggers/Trigger.cc
===================================================================
--- code/branches/presentation/src/orxonox/objects/worldentities/triggers/Trigger.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/objects/worldentities/triggers/Trigger.cc	(revision 2485)
@@ -107,4 +107,6 @@
     if (!this->BaseObject::isActive())
         return;
+
+    SUPER(Trigger, tick, dt);
 
     bool newTriggered = this->isTriggered() ^ this->bInvertMode_;
Index: code/branches/presentation/src/orxonox/overlays/OrxonoxOverlay.cc
===================================================================
--- code/branches/presentation/src/orxonox/overlays/OrxonoxOverlay.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/overlays/OrxonoxOverlay.cc	(revision 2485)
@@ -61,13 +61,9 @@
         RegisterObject(OrxonoxOverlay);
 
+        this->owner_ = 0;
+        this->group_ = 0;
+
         if (!Core::showsGraphics())
             ThrowException(NoGraphics, "Can't create OrxonoxOverlay, graphics engine not initialized");
-
-        // 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
@@ -130,8 +126,8 @@
 
         XMLPortParam(OrxonoxOverlay, "size",      setSize,      getSize,      xmlElement, mode);
-        XMLPortParam(OrxonoxOverlay, "pickPoint", setPickPoint, getPickPoint, 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, "correctaspect", setAspectCorrection,   getAspectCorrection,   xmlElement, mode);
         XMLPortParam(OrxonoxOverlay, "background",    setBackgroundMaterial, getBackgroundMaterial, xmlElement, mode);
     }
@@ -139,4 +135,6 @@
     void OrxonoxOverlay::changedName()
     {
+        SUPER(OrxonoxOverlay, changedName);
+
         OrxonoxOverlay::overlays_s.erase(this->getOldName());
 
Index: code/branches/presentation/src/orxonox/overlays/OrxonoxOverlay.h
===================================================================
--- code/branches/presentation/src/orxonox/overlays/OrxonoxOverlay.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/overlays/OrxonoxOverlay.h	(revision 2485)
@@ -125,5 +125,5 @@
 
         //! Gets the rotation angle applied to this overlay in degrees.
-        const Radian& getRotation() const         { return this->angle_; }
+        const Degree& getRotation() const         { return this->angle_; }
 
         //! Rotates the overlay by angle degrees.
@@ -154,4 +154,28 @@
         virtual void changedVisibility();
 
+        inline void setOwner(ControllableEntity* owner)
+        {
+            if (this->owner_ != owner)
+            {
+                this->owner_ = owner;
+                this->changedOwner();
+            }
+        }
+        inline ControllableEntity* getOwner() const
+            { return this->owner_; }
+        virtual void changedOwner() {}
+
+        inline void setOverlayGroup(OverlayGroup* group)
+        {
+            if (group != this->group_)
+            {
+                this->group_ = group;
+                this->changedOverlayGroup();
+            }
+        }
+        inline OverlayGroup* getOverlayGroup() const
+            { return this->group_; }
+        virtual void changedOverlayGroup() {}
+
     protected:
         virtual void angleChanged();
@@ -172,5 +196,5 @@
         Vector2 position_;                         //!< Position of the pickPoint on the screen.
         Vector2 pickPoint_;                        //!< Point on the overlay to pick when translating
-        Radian angle_;                             //!< Rotation angle of the overlay
+        Degree angle_;                             //!< Rotation angle of the overlay
         RotationState rotState_;             //!< horizontal, vertical or inbetween
 
@@ -182,5 +206,10 @@
             We could also use the ObjectList, but that doesn't guarantee XMLPort(.) was called and is slower. */
         static std::map<std::string, OrxonoxOverlay*> overlays_s;
+        ControllableEntity* owner_;
+        OverlayGroup* group_;
   };
+
+  SUPER_FUNCTION(7, OrxonoxOverlay, changedOwner, false);
+  SUPER_FUNCTION(8, OrxonoxOverlay, changedOverlayGroup, false);
 }
 
Index: code/branches/presentation/src/orxonox/overlays/OverlayGroup.cc
===================================================================
--- code/branches/presentation/src/orxonox/overlays/OverlayGroup.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/overlays/OverlayGroup.cc	(revision 2485)
@@ -55,4 +55,6 @@
         RegisterObject(OverlayGroup);
 
+        this->owner_ = 0;
+
         setScale(Vector2(1.0, 1.0));
         setScroll(Vector2(0.0, 0.0));
@@ -113,4 +115,6 @@
             hudElements_[element->getName()] = element;
             element->setVisible(this->isVisible());
+            if (this->owner_)
+                element->setOwner(this->owner_);
         }
     }
@@ -137,4 +141,11 @@
     }
 
+    void OverlayGroup::setOwner(ControllableEntity* owner)
+    {
+        this->owner_ = owner;
+
+        for (std::map<std::string, OrxonoxOverlay*>::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
+            (*it).second->setOwner(owner);
+    }
 
     //########### Console commands ############
Index: code/branches/presentation/src/orxonox/overlays/OverlayGroup.h
===================================================================
--- code/branches/presentation/src/orxonox/overlays/OverlayGroup.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/overlays/OverlayGroup.h	(revision 2485)
@@ -69,5 +69,8 @@
         void changedVisibility();
 
-    private:
+        void setOwner(ControllableEntity* owner);
+        inline ControllableEntity* getOwner() const
+            { return this->owner_; }
+
         //! Scales each OrxonoxOverlay individually by scale.
         void scale(const Vector2& scale) { this->setScale(scale * this->scale_); }
@@ -85,7 +88,9 @@
         OrxonoxOverlay* getElement(unsigned int index);
 
+    private:
         std::map<std::string, OrxonoxOverlay*> hudElements_;    //!< Contains all the OrxonoxOverlays of the this group.
         Vector2 scale_;                                         //!< Current scale (independant of the elements).
         Vector2 scroll_;                                        //!< Current scrolling offset.
+        ControllableEntity* owner_;                             //!< The owner of this OverlayGroup
     };
 }
Index: code/branches/presentation/src/orxonox/overlays/OverlayText.cc
===================================================================
--- code/branches/presentation/src/orxonox/overlays/OverlayText.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/overlays/OverlayText.cc	(revision 2485)
@@ -50,9 +50,9 @@
         this->text_->setCharHeight(1.0);
 
-        setFont("Monofur");
-        setColour(ColourValue(1.0, 1.0, 1.0, 1.0));
-        setCaption("");
-        setTextSize(1.0f);
-        setAlignmentString("left");
+        this->setFont("Monofur");
+        this->setColour(ColourValue(1.0, 1.0, 1.0, 1.0));
+        this->setCaption("");
+        this->setTextSize(1.0f);
+        this->setAlignmentString("left");
 
         this->background_->addChild(this->text_);
@@ -69,9 +69,10 @@
         SUPER(OverlayText, XMLPort, xmlElement, mode);
 
-        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);
+        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);
+        XMLPortParam(OverlayText, "spacewidth", setSpaceWidth,      getSpaceWidth,      xmlElement, mode);
     }
 
Index: code/branches/presentation/src/orxonox/overlays/OverlayText.h
===================================================================
--- code/branches/presentation/src/orxonox/overlays/OverlayText.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/overlays/OverlayText.h	(revision 2485)
@@ -47,24 +47,27 @@
         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(); }
+        inline void setCaption(const std::string& caption) { this->text_->setCaption(caption); }
+        inline std::string getCaption() const              { return this->text_->getCaption(); }
 
         void setFont(const std::string& font);
-        const std::string& getFont() const { return this->text_->getFontName(); }
+        inline 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(); }
+        inline void setSpaceWidth(float width) { this->text_->setSpaceWidth(width); }
+        inline float getSpaceWidth() const     { return this->text_->getSpaceWidth(); }
 
-        void setAlignment(Ogre::TextAreaOverlayElement::Alignment alignment) { this->text_->setAlignment(alignment); }
-        Ogre::TextAreaOverlayElement::Alignment getAlignment() const         { return this->text_->getAlignment(); }
+        inline void setColour(const ColourValue& colour) { this->text_->setColour(colour); }
+        inline const ColourValue& getColour() const      { return this->text_->getColour(); }
 
-    protected:
-        virtual void sizeChanged();
+        inline void setAlignment(Ogre::TextAreaOverlayElement::Alignment alignment) { this->text_->setAlignment(alignment); }
+        inline Ogre::TextAreaOverlayElement::Alignment getAlignment() const         { return this->text_->getAlignment(); }
 
         void setAlignmentString(const std::string& alignment);
         std::string getAlignmentString() const;
 
-        void setTextSize(float size) { this->setSize(Vector2(size, size)); }
-        float getTextSize() const    { return this->getSize().y; }
+        inline void setTextSize(float size) { this->setSize(Vector2(size, size)); }
+        inline float getTextSize() const    { return this->getSize().y; }
+
+    protected:
+        virtual void sizeChanged();
 
         Ogre::TextAreaOverlayElement* text_;
Index: code/branches/presentation/src/orxonox/overlays/debug/DebugFPSText.cc
===================================================================
--- code/branches/presentation/src/orxonox/overlays/debug/DebugFPSText.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/overlays/debug/DebugFPSText.cc	(revision 2485)
@@ -49,4 +49,6 @@
     void DebugFPSText::tick(float dt)
     {
+        SUPER(DebugFPSText, tick, dt);
+
         float fps = GraphicsEngine::getInstance().getAverageFramesPerSecond();
         this->setCaption(convertToString(fps));
Index: code/branches/presentation/src/orxonox/overlays/debug/DebugRTRText.cc
===================================================================
--- code/branches/presentation/src/orxonox/overlays/debug/DebugRTRText.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/overlays/debug/DebugRTRText.cc	(revision 2485)
@@ -49,4 +49,6 @@
     void DebugRTRText::tick(float dt)
     {
+        SUPER(DebugRTRText, tick, dt);
+
         float rtr = GraphicsEngine::getInstance().getAverageTickTime();
         this->setCaption(convertToString(rtr));
Index: code/branches/presentation/src/orxonox/overlays/hud/CMakeLists.txt
===================================================================
--- code/branches/presentation/src/orxonox/overlays/hud/CMakeLists.txt	(revision 2484)
+++ code/branches/presentation/src/orxonox/overlays/hud/CMakeLists.txt	(revision 2485)
@@ -4,5 +4,7 @@
   HUDRadar.cc
   HUDSpeedBar.cc
+  HUDHealthBar.cc
   ChatOverlay.cc
+  GametypeStatus.cc
 )
 
Index: code/branches/presentation/src/orxonox/overlays/hud/GametypeStatus.cc
===================================================================
--- code/branches/presentation/src/orxonox/overlays/hud/GametypeStatus.cc	(revision 2485)
+++ code/branches/presentation/src/orxonox/overlays/hud/GametypeStatus.cc	(revision 2485)
@@ -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 "GametypeStatus.h"
+
+#include <OgreTextAreaOverlayElement.h>
+
+#include "core/CoreIncludes.h"
+#include "util/Convert.h"
+#include "objects/infos/GametypeInfo.h"
+#include "objects/infos/PlayerInfo.h"
+#include "objects/worldentities/ControllableEntity.h"
+#include "objects/worldentities/pawns/Spectator.h"
+
+namespace orxonox
+{
+    CreateFactory(GametypeStatus);
+
+    GametypeStatus::GametypeStatus(BaseObject* creator) : OverlayText(creator)
+    {
+        RegisterObject(GametypeStatus);
+
+        this->owner_ = 0;
+    }
+
+    GametypeStatus::~GametypeStatus()
+    {
+    }
+
+    void GametypeStatus::tick(float dt)
+    {
+        SUPER(GametypeStatus, tick, dt);
+
+        if (this->owner_ && this->owner_->getGametypeInfo() && this->owner_->getPlayer())
+        {
+            const GametypeInfo* gtinfo = this->owner_->getGametypeInfo();
+            PlayerInfo* pinfo = this->owner_->getPlayer();
+
+            if (!gtinfo->hasStarted() && !gtinfo->isStartCountdownRunning())
+            {
+                if (!pinfo->isReadyToSpawn())
+                    this->setCaption("Press [Fire] to start the match");
+                else
+                    this->setCaption("Waiting for other players");
+            }
+            else if (!gtinfo->hasEnded())
+            {
+                if (gtinfo->isStartCountdownRunning())
+                    this->setCaption(convertToString((int)ceil(gtinfo->getStartCountdown())));
+                else if (this->owner_->isA(Class(Spectator)))
+                    this->setCaption("Press [Fire] to respawn");
+                else
+                    this->setCaption("");
+            }
+            else
+                this->setCaption("Game has ended");
+        }
+    }
+
+
+    void GametypeStatus::changedOwner()
+    {
+        SUPER(GametypeStatus, changedOwner);
+
+        this->owner_ = dynamic_cast<ControllableEntity*>(this->getOwner());
+    }
+}
Index: code/branches/presentation/src/orxonox/overlays/hud/GametypeStatus.h
===================================================================
--- code/branches/presentation/src/orxonox/overlays/hud/GametypeStatus.h	(revision 2485)
+++ code/branches/presentation/src/orxonox/overlays/hud/GametypeStatus.h	(revision 2485)
@@ -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 _GametypeStatus_H__
+#define _GametypeStatus_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "overlays/OverlayText.h"
+#include "objects/Tickable.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport GametypeStatus : public OverlayText, public Tickable
+    {
+        public:
+            GametypeStatus(BaseObject* creator);
+            ~GametypeStatus();
+
+            virtual void tick(float dt);
+            virtual void changedOwner();
+
+        private:
+            ControllableEntity* owner_;
+    };
+}
+#endif /* _GametypeStatus_H__ */
Index: code/branches/presentation/src/orxonox/overlays/hud/HUDBar.cc
===================================================================
--- code/branches/presentation/src/orxonox/overlays/hud/HUDBar.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/overlays/hud/HUDBar.cc	(revision 2485)
@@ -51,6 +51,6 @@
         RegisterObject(BarColour);
 
-        setColour(ColourValue(1.0, 1.0, 1.0, 1.0));
-        setPosition(0.0);
+        this->setColour(ColourValue(1.0, 1.0, 1.0, 1.0));
+        this->setPosition(0.0);
     }
 
@@ -84,7 +84,9 @@
         this->bar_->setMaterialName(materialname);
 
-        setValue(0.4567654f);
-        setRightToLeft(false);
-        setAutoColour(true);
+        this->value_ = 1.0f;  // initielize with 1.0f to trigger a change when calling setValue(0.0f) on the line below
+        this->setValue(0.0f); // <--
+        this->setRightToLeft(false);
+        this->setAutoColour(true);
+        this->currentColour_ = ColourValue::White;
 
         this->background_->addChild(bar_);
@@ -101,7 +103,8 @@
         SUPER(HUDBar, XMLPort, xmlElement, mode);
 
-        XMLPortParam(HUDBar, "initialValue", setValue,       getValue,       xmlElement, mode);
-        XMLPortParam(HUDBar, "rightToLeft",  setRightToLeft, getRightToLeft, xmlElement, mode);
-        XMLPortParam(HUDBar, "autoColour",   setAutoColour,  getAutoColour,  xmlElement, mode);
+        XMLPortParam(HUDBar, "initialvalue", setValue,       getValue,       xmlElement, mode);
+        XMLPortParam(HUDBar, "righttoleft",  setRightToLeft, getRightToLeft, xmlElement, mode);
+        XMLPortParam(HUDBar, "autocolour",   setAutoColour,  getAutoColour,  xmlElement, mode);
+        XMLPortParam(HUDBar, "bartexture",   setBarTexture,  getBarTexture, xmlElement, mode);
         XMLPortObject(HUDBar, BarColour, "", addColour, getColour, xmlElement, mode);
     }
@@ -130,8 +133,10 @@
                 {
                     this->textureUnitState_->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, colour2);
+                    this->currentColour_ = colour2;
                 }
                 else if (value1 < this->value_)
                 {
                     this->textureUnitState_->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, colour1);
+                    this->currentColour_ = colour1;
                 }
                 else
@@ -139,5 +144,7 @@
                     //float interpolationfactor = (this->value_ - value2) / (value1 - value2);
                     float interpolationfactor = interpolateSmooth((this->value_ - value2) / (value1 - value2), 0.0f, 1.0f);
-                    this->textureUnitState_->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, colour1 * interpolationfactor + colour2 * (1 - interpolationfactor));
+                    this->currentColour_ = colour1 * interpolationfactor + colour2 * (1 - interpolationfactor);
+                    this->textureUnitState_->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, this->currentColour_);
+
                 }
             }
@@ -181,3 +188,13 @@
         this->colours_.clear();
     }
+
+    void HUDBar::setBarTexture(const std::string& texture)
+    {
+        this->textureUnitState_->setTextureName(texture);
+    }
+
+    const std::string& HUDBar::getBarTexture() const
+    {
+        return this->textureUnitState_->getTextureName();
+    }
 }
Index: code/branches/presentation/src/orxonox/overlays/hud/HUDBar.h
===================================================================
--- code/branches/presentation/src/orxonox/overlays/hud/HUDBar.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/overlays/hud/HUDBar.h	(revision 2485)
@@ -71,12 +71,46 @@
         void clearColours();
 
-        void setRightToLeft(bool r2l) { this->right2Left_ = r2l; this->valueChanged(); }
-        bool getRightToLeft() const   { return this->right2Left_; }
+        inline void setRightToLeft(bool r2l)
+        {
+            if (r2l != this->right2Left_)
+            {
+                this->right2Left_ = r2l;
+                this->valueChanged();
+            }
+        }
+        inline bool getRightToLeft() const
+            { return this->right2Left_; }
 
-        void setValue(float value)    { this->value_ = clamp(value, 0.0f, 1.0f); this->valueChanged(); }
-        float getValue() const        { return this->value_; }
+        inline void setValue(float value)
+        {
+            float temp = clamp(value, 0.0f, 1.0f);
+            if (temp != this->value_)
+            {
+                this->value_ = temp;
+                this->valueChanged();
+            }
+        }
+        inline float getValue() const
+            { return this->value_; }
 
-        void setAutoColour(bool val)  { this->autoColour_ = val; this->valueChanged(); }
-        bool getAutoColour() const    { return this->autoColour_; }
+        inline void setAutoColour(bool val)
+        {
+            if (val != this->autoColour_)
+            {
+                this->autoColour_ = val;
+                this->valueChanged();
+
+                if (!val)
+                    this->currentColour_ = ColourValue::White;
+            }
+        }
+        inline bool getAutoColour() const
+            { return this->autoColour_; }
+
+        void setBarTexture(const std::string& texture);
+        const std::string& getBarTexture() const;
+
+        inline const ColourValue& getCurrentBarColour() const
+            { return this->currentColour_; }
 
     protected:
@@ -90,4 +124,5 @@
         bool autoColour_;                   //!< whether bar changes colour automatically
         float value_;                       //!< progress of bar
+        ColourValue currentColour_;
 
         Ogre::PanelOverlayElement* bar_;
Index: code/branches/presentation/src/orxonox/overlays/hud/HUDHealthBar.cc
===================================================================
--- code/branches/presentation/src/orxonox/overlays/hud/HUDHealthBar.cc	(revision 2485)
+++ code/branches/presentation/src/orxonox/overlays/hud/HUDHealthBar.cc	(revision 2485)
@@ -0,0 +1,138 @@
+/*
+ *   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 "HUDHealthBar.h"
+
+#include <OgreOverlayManager.h>
+#include <OgrePanelOverlayElement.h>
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "objects/worldentities/pawns/Pawn.h"
+#include "objects/items/Engine.h"
+#include "overlays/OverlayGroup.h"
+#include "util/Convert.h"
+
+namespace orxonox
+{
+    CreateFactory(HUDHealthBar);
+
+    HUDHealthBar::HUDHealthBar(BaseObject* creator) : HUDBar(creator)
+    {
+        RegisterObject(HUDHealthBar);
+
+        this->owner_ = 0;
+        this->bUseBarColour_ = false;
+
+        this->textoverlay_ = new OverlayText(this);
+
+        assert(this->textoverlay_);
+
+        this->textoverlay_->setCaption("");
+    }
+
+    HUDHealthBar::~HUDHealthBar()
+    {
+        if (this->isInitialized())
+            delete this->textoverlay_;
+    }
+
+    void HUDHealthBar::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(HUDHealthBar, XMLPort, xmlelement, mode);
+
+        XMLPortParam(HUDHealthBar, "showtext",          setTextVisible,          getTextVisible,          xmlelement, mode).defaultValues(true);
+        XMLPortParam(HUDHealthBar, "textfont",          setTextFont,             getTextFont,             xmlelement, mode).defaultValues("Monofur");
+        XMLPortParam(HUDHealthBar, "textusebarcolour",  setTextUseBarColour,     getTextUseBarColour,     xmlelement, mode).defaultValues(false);
+        XMLPortParam(HUDHealthBar, "textcolour",        setTextColour,           getTextColour,           xmlelement, mode).defaultValues(ColourValue(1.0, 1.0, 1.0, 1.0));
+        XMLPortParam(HUDHealthBar, "textsize",          setTextSize,             getTextSize,             xmlelement, mode).defaultValues(1.0f);
+        XMLPortParam(HUDHealthBar, "textalign",         setTextAlignmentString,  getTextAlignmentString,  xmlelement, mode).defaultValues("left");
+        XMLPortParam(HUDHealthBar, "textoffset",        setTextOffset,           getTextOffset,           xmlelement, mode).defaultValues(Vector2::ZERO);
+        XMLPortParam(HUDHealthBar, "textpickpoint",     setTextPickPoint,        getTextPickPoint,        xmlelement, mode).defaultValues(Vector2::ZERO);
+        XMLPortParam(HUDHealthBar, "textrotation",      setTextRotation,         getTextRotation,         xmlelement, mode).defaultValues(0.0f);
+        XMLPortParam(HUDHealthBar, "textcorrectaspect", setTextAspectCorrection, getTextAspectCorrection, xmlelement, mode).defaultValues(true);
+        XMLPortParam(HUDHealthBar, "textspacewidth",    setTextSpaceWidth,       getTextSpaceWidth,       xmlelement, mode).defaultValues(true);
+    }
+
+    void HUDHealthBar::tick(float dt)
+    {
+        SUPER(HUDHealthBar, tick, dt);
+
+        if (this->owner_)
+        {
+            this->setValue(this->owner_->getHealth() / this->owner_->getInitialHealth());
+            this->textoverlay_->setCaption(convertToString((int)this->owner_->getHealth()));
+        }
+
+        if (this->bUseBarColour_)
+            this->textoverlay_->setColour(this->getCurrentBarColour());
+    }
+
+    void HUDHealthBar::changedOwner()
+    {
+        SUPER(HUDHealthBar, changedOwner);
+
+        this->owner_ = dynamic_cast<Pawn*>(this->getOwner());
+    }
+
+    void HUDHealthBar::changedOverlayGroup()
+    {
+        SUPER(HUDHealthBar, changedOverlayGroup);
+
+        this->getOverlayGroup()->addElement(this->textoverlay_);
+    }
+
+    void HUDHealthBar::changedVisibility()
+    {
+        SUPER(HUDHealthBar, changedVisibility);
+
+        this->textoverlay_->setVisible(this->isVisible());
+    }
+
+    void HUDHealthBar::changedName()
+    {
+        SUPER(HUDHealthBar, changedName);
+
+        this->textoverlay_->setName(this->getName() + "text");
+    }
+
+    void HUDHealthBar::setTextColour(const ColourValue& colour)
+    {
+        this->textColour_ = colour;
+        if (!this->bUseBarColour_)
+            this->textoverlay_->setColour(colour);
+    }
+
+    void HUDHealthBar::setTextUseBarColour(bool bUseBarColour)
+    {
+        this->bUseBarColour_ = bUseBarColour;
+        if (!bUseBarColour)
+            this->textoverlay_->setColour(this->textColour_);
+    }
+}
Index: code/branches/presentation/src/orxonox/overlays/hud/HUDHealthBar.h
===================================================================
--- code/branches/presentation/src/orxonox/overlays/hud/HUDHealthBar.h	(revision 2485)
+++ code/branches/presentation/src/orxonox/overlays/hud/HUDHealthBar.h	(revision 2485)
@@ -0,0 +1,118 @@
+/*
+ *   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 _HUDHealthBar_H__
+#define _HUDHealthBar_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "HUDBar.h"
+#include "objects/Tickable.h"
+#include "overlays/OverlayText.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport HUDHealthBar : public HUDBar, public Tickable
+    {
+        public:
+            HUDHealthBar(BaseObject* creator);
+            ~HUDHealthBar();
+
+            virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
+            virtual void tick(float dt);
+            virtual void changedOwner();
+            virtual void changedOverlayGroup();
+            virtual void changedVisibility();
+            virtual void changedName();
+
+            inline void setTextFont(const std::string& font)
+                { if (font != "") { this->textoverlay_->setFont(font); } }
+            inline const std::string& getTextFont() const
+                { return this->textoverlay_->getFont(); }
+
+            void setTextColour(const ColourValue& colour);
+            inline const ColourValue& getTextColour() const
+                { return this->textoverlay_->getColour(); }
+
+            void setTextUseBarColour(bool bUseBarColour);
+            inline bool getTextUseBarColour() const
+                { return this->bUseBarColour_; }
+
+            inline void setTextAlignment(Ogre::TextAreaOverlayElement::Alignment alignment)
+                { this->textoverlay_->setAlignment(alignment); }
+            inline Ogre::TextAreaOverlayElement::Alignment getTextAlignment() const
+                { return this->textoverlay_->getAlignment(); }
+
+            void setTextAlignmentString(const std::string& alignment)
+                { this->textoverlay_->setAlignmentString(alignment); }
+            std::string getTextAlignmentString() const
+                { return this->textoverlay_->getAlignmentString(); }
+
+            inline void setTextSize(float size)
+                { this->textoverlay_->setTextSize(size); }
+            inline float getTextSize() const
+                { return this->textoverlay_->getTextSize(); }
+
+            inline void setTextVisible(bool bVisible)
+                { this->textoverlay_->setVisible(bVisible); }
+            inline bool getTextVisible() const
+                { return this->textoverlay_->isVisible(); }
+
+            inline void setTextPickPoint(const Vector2& pickpoint)
+                { this->textoverlay_->setPickPoint(pickpoint); }
+            inline Vector2 getTextPickPoint() const
+                { return this->textoverlay_->getPickPoint(); }
+
+            inline void setTextOffset(const Vector2& position)
+                { this->textoverlay_->setPosition(this->getPosition() + (position - this->getPickPoint()) * this->getSize()); }
+            inline Vector2 getTextOffset() const
+                { return (this->textoverlay_->getPosition() - this->getPosition()) / this->getSize() + this->getPickPoint(); }
+
+            inline void setTextAspectCorrection(bool correct)
+                { this->textoverlay_->setAspectCorrection(correct); }
+            inline bool getTextAspectCorrection() const
+                { return this->textoverlay_->getAspectCorrection(); }
+
+            inline void setTextRotation(const Degree& angle)
+                { this->textoverlay_->setRotation(angle); }
+            inline const Degree& getTextRotation() const
+                { return this->textoverlay_->getRotation(); }
+
+            inline void setTextSpaceWidth(float width)
+                { this->textoverlay_->setSpaceWidth(width); }
+            inline float getTextSpaceWidth() const
+                { return this->textoverlay_->getSpaceWidth(); }
+
+        private:
+            Pawn* owner_;
+            OverlayText* textoverlay_;
+            bool bUseBarColour_;
+            ColourValue textColour_;
+    };
+}
+#endif /* _HUDHealthBar_H__ */
Index: code/branches/presentation/src/orxonox/overlays/hud/HUDNavigation.cc
===================================================================
--- code/branches/presentation/src/orxonox/overlays/hud/HUDNavigation.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/overlays/hud/HUDNavigation.cc	(revision 2485)
@@ -129,4 +129,6 @@
     void HUDNavigation::tick(float dt)
     {
+        SUPER(HUDNavigation, tick, dt);
+
         if (!Radar::getInstance().getFocus())
         {
@@ -149,5 +151,5 @@
 */
         // transform to screen coordinates
-        Vector3 pos = /*transformationMatrix * */Radar::getInstance().getFocus()->getWorldPosition();
+        Vector3 pos = /*transformationMatrix * */Radar::getInstance().getFocus()->getRVWorldPosition();
 
         bool outOfView;
@@ -223,5 +225,5 @@
 /*
             Vector3 aimpos = transformationMatrix * getPredictedPosition(SpaceShip::getLocalShip()->getPosition(),
-                    Projectile::getSpeed(), Radar::getInstance().getFocus()->getWorldPosition(), Radar::getInstance().getFocus()->getOrientedVelocity());
+                    Projectile::getSpeed(), Radar::getInstance().getFocus()->getRVWorldPosition(), Radar::getInstance().getFocus()->getRVOrientedVelocity());
 */
             if (wasOutOfView_)
@@ -250,5 +252,5 @@
 /*
         if (Radar::getInstance().getFocus())
-            return (Radar::getInstance().getFocus()->getWorldPosition() - SpaceShip::getLocalShip()->getPosition()).length();
+            return (Radar::getInstance().getFocus()->getRVWorldPosition() - SpaceShip::getLocalShip()->getPosition()).length();
         else
 */
Index: code/branches/presentation/src/orxonox/overlays/hud/HUDRadar.cc
===================================================================
--- code/branches/presentation/src/orxonox/overlays/hud/HUDRadar.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/overlays/hud/HUDRadar.cc	(revision 2485)
@@ -40,4 +40,6 @@
 #include "core/XMLPort.h"
 #include "objects/Radar.h"
+#include "objects/worldentities/WorldEntity.h"
+#include "objects/worldentities/pawns/Pawn.h"
 #include "tools/TextureGenerator.h"
 
@@ -51,17 +53,19 @@
         RegisterObject(HUDRadar);
 
-        marker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
+        this->marker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
             .createOverlayElement("Panel", "HUDRadar_marker_" + getUniqueNumberString()));
-        marker_->setMaterialName("Orxonox/RadarMarker");
-        overlay_->add2D(marker_);
-        marker_->hide();
+        this->marker_->setMaterialName("Orxonox/RadarMarker");
+        this->overlay_->add2D(this->marker_);
+        this->marker_->hide();
 
-        setRadarSensitivity(1.0f);
-        setHalfDotSizeDistance(3000.0f);
-        setMaximumDotSize(0.1f);
+        this->setRadarSensitivity(1.0f);
+        this->setHalfDotSizeDistance(3000.0f);
+        this->setMaximumDotSize(0.1f);
 
-        shapeMaterials_[RadarViewable::Dot]      = "RadarSquare.tga";
-        shapeMaterials_[RadarViewable::Triangle] = "RadarSquare.tga";
-        shapeMaterials_[RadarViewable::Square]   = "RadarSquare.tga";
+        this->shapeMaterials_[RadarViewable::Dot]      = "RadarDot.tga";
+        this->shapeMaterials_[RadarViewable::Triangle] = "RadarSquare.tga";
+        this->shapeMaterials_[RadarViewable::Square]   = "RadarSquare.tga";
+
+        this->owner_ = 0;
     }
 
@@ -90,15 +94,20 @@
     void HUDRadar::displayObject(RadarViewable* object, bool bIsMarked)
     {
-/*
+        if (object == (RadarViewable*)this->owner_)
+            return;
+
         const WorldEntity* wePointer = object->getWorldEntity();
 
         // Just to be sure that we actually have a WorldEntity.
         // We could do a dynamic_cast, but that would be a lot slower.
-        if (!wePointer)
+        if (!wePointer || !this->owner_)
         {
-            CCOUT(4) << "Cannot display a non-WorldEntitiy on the radar" << std::endl;
+            if (!wePointer)
+                CCOUT(2) << "Cannot display a non-WorldEntitiy on the radar" << std::endl;
+            if (!this->owner_)
+                CCOUT(2) << "No owner defined" << std::endl;
             return;
         }
-*/
+
         // try to find a panel already created
         Ogre::PanelOverlayElement* panel;
@@ -112,5 +121,5 @@
             // get right material
             panel->setMaterialName(TextureGenerator::getMaterialName(
-                shapeMaterials_[object->getRadarObjectType()], object->getRadarObjectColour()));
+                shapeMaterials_[object->getRadarObjectShape()], object->getRadarObjectColour()));
             this->overlay_->add2D(panel);
             this->itRadarDots_ = this->radarDots_.end();
@@ -121,12 +130,12 @@
             ++itRadarDots_;
             std::string materialName = TextureGenerator::getMaterialName(
-                shapeMaterials_[object->getRadarObjectType()], object->getRadarObjectColour());
+                shapeMaterials_[object->getRadarObjectShape()], object->getRadarObjectColour());
             if (materialName != panel->getMaterialName())
                 panel->setMaterialName(materialName);
         }
         panel->show();
-/*
+
         // set size to fit distance...
-        float distance = (wePointer->getWorldPosition() - SpaceShip::getLocalShip()->getPosition()).length();
+        float distance = (wePointer->getWorldPosition() - this->owner_->getPosition()).length();
         // calculate the size with 1/distance dependency for simplicity (instead of exp(-distance * lambda)
         float size = maximumDotSize_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance);
@@ -134,5 +143,5 @@
 
         // calc position on radar...
-        Vector2 coord = get2DViewcoordinates(SpaceShip::getLocalShip()->getPosition(), SpaceShip::getLocalShip()->getDir(), SpaceShip::getLocalShip()->getOrth(), wePointer->getWorldPosition());
+        Vector2 coord = get2DViewcoordinates(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition());
         coord *= Ogre::Math::PI / 3.5; // small adjustment to make it fit the texture
         panel->setPosition((1.0 + coord.x - size) * 0.5, (1.0 - coord.y - size) * 0.5);
@@ -144,5 +153,4 @@
             this->marker_->setPosition((1.0 + coord.x - size * 1.5) * 0.5, (1.0 - coord.y - size * 1.5) * 0.5);
         }
-*/
     }
 
@@ -154,3 +162,10 @@
         this->marker_->hide();
     }
+
+    void HUDRadar::changedOwner()
+    {
+        SUPER(HUDRadar, changedOwner);
+
+        this->owner_ = dynamic_cast<Pawn*>(this->getOwner());
+    }
 }
Index: code/branches/presentation/src/orxonox/overlays/hud/HUDRadar.h
===================================================================
--- code/branches/presentation/src/orxonox/overlays/hud/HUDRadar.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/overlays/hud/HUDRadar.h	(revision 2485)
@@ -49,4 +49,5 @@
 
         virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
+        virtual void changedOwner();
 
     private:
@@ -76,4 +77,6 @@
 
         float sensitivity_;
+
+        Pawn* owner_;
     };
 }
Index: code/branches/presentation/src/orxonox/overlays/hud/HUDSpeedBar.cc
===================================================================
--- code/branches/presentation/src/orxonox/overlays/hud/HUDSpeedBar.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/overlays/hud/HUDSpeedBar.cc	(revision 2485)
@@ -31,4 +31,6 @@
 #include "HUDSpeedBar.h"
 #include "core/CoreIncludes.h"
+#include "objects/worldentities/pawns/SpaceShip.h"
+#include "objects/items/Engine.h"
 
 namespace orxonox
@@ -41,4 +43,5 @@
         RegisterObject(HUDSpeedBar);
 
+        this->owner_ = 0;
     }
 
@@ -49,14 +52,18 @@
     void HUDSpeedBar::tick(float dt)
     {
-/*
-        SpaceShip* ship = SpaceShip::getLocalShip();
-        if (ship)
+        SUPER(HUDSpeedBar, tick, dt);
+
+        if (this->owner_ && this->owner_->getEngine())
         {
-            float v = ship->getVelocity().length();
-            float value = v / ship->getMaxSpeed();
-            if (value != this->getValue())
-                this->setValue(value);
+            float value = this->owner_->getVelocity().length() / (this->owner_->getEngine()->getMaxSpeedFront() * this->owner_->getEngine()->getSpeedFactor() * this->owner_->getEngine()->getBoostFactor());
+            this->setValue(value);
         }
-*/
+    }
+
+    void HUDSpeedBar::changedOwner()
+    {
+        SUPER(HUDSpeedBar, changedOwner);
+
+        this->owner_ = dynamic_cast<SpaceShip*>(this->getOwner());
     }
 }
Index: code/branches/presentation/src/orxonox/overlays/hud/HUDSpeedBar.h
===================================================================
--- code/branches/presentation/src/orxonox/overlays/hud/HUDSpeedBar.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/overlays/hud/HUDSpeedBar.h	(revision 2485)
@@ -45,4 +45,8 @@
 
         virtual void tick(float dt);
+        virtual void changedOwner();
+
+    private:
+        SpaceShip* owner_;
     };
 }
Index: code/branches/presentation/src/orxonox/tools/CMakeLists.txt
===================================================================
--- code/branches/presentation/src/orxonox/tools/CMakeLists.txt	(revision 2484)
+++ code/branches/presentation/src/orxonox/tools/CMakeLists.txt	(revision 2485)
@@ -3,4 +3,5 @@
   Mesh.cc
   ParticleInterface.cc
+  Shader.cc
   TextureGenerator.cc
   Timer.cc
Index: code/branches/presentation/src/orxonox/tools/ParticleInterface.cc
===================================================================
--- code/branches/presentation/src/orxonox/tools/ParticleInterface.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/tools/ParticleInterface.cc	(revision 2485)
@@ -52,5 +52,5 @@
     ParticleInterface::ParticleInterface(Ogre::SceneManager* scenemanager, const std::string& templateName, LODParticle::LOD detaillevel)
     {
-        RegisterRootObject(ParticleInterface);
+        RegisterObject(ParticleInterface);
 
         assert(scenemanager);
@@ -62,4 +62,5 @@
         this->bVisible_ = true;
         this->bAllowedByLOD_ = true;
+        this->speedFactor_ = 1.0f;
 
         if (Core::showsGraphics())
@@ -68,6 +69,5 @@
             {
                 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->setSpeedFactor(1.0f);
             }
             catch (...)
@@ -200,19 +200,12 @@
     void ParticleInterface::setSpeedFactor(float factor)
     {
-        if (this->particleSystem_)
-        {
-//            this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor() * factor);
-            this->particleSystem_->setSpeedFactor(1.0f * factor);
-        }
-    }
-    float ParticleInterface::getSpeedFactor() const
-    {
-        if (this->particleSystem_)
-        {
-//            return (this->particleSystem_->getSpeedFactor() / Orxonox::getInstance().getTimeFactor());
-            return (this->particleSystem_->getSpeedFactor() / 1.0f);
-        }
-        else
-            return 1.0f;
+        this->speedFactor_ = factor;
+
+        if (this->particleSystem_)
+            this->particleSystem_->setSpeedFactor(factor * this->getTimeFactor());
+    }
+    void ParticleInterface::changedTimeFactor(float factor_new, float factor_old)
+    {
+        this->setSpeedFactor(this->speedFactor_);
     }
 
Index: code/branches/presentation/src/orxonox/tools/ParticleInterface.h
===================================================================
--- code/branches/presentation/src/orxonox/tools/ParticleInterface.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/tools/ParticleInterface.h	(revision 2485)
@@ -37,4 +37,5 @@
 #include "core/OrxonoxClass.h"
 #include "util/Math.h"
+#include "gamestates/GSRoot.h"
 
 #define getAllEmitters() \
@@ -45,5 +46,5 @@
 namespace orxonox
 {
-    class _OrxonoxExport ParticleInterface : public OrxonoxClass
+    class _OrxonoxExport ParticleInterface : public TimeFactorListener
     {
         public:
@@ -66,5 +67,6 @@
             unsigned int getNumAffectors() const;
 
-            float getSpeedFactor() const;
+            inline float getSpeedFactor() const
+                { return this->speedFactor_; }
             void setSpeedFactor(float factor);
             bool getKeepParticlesInLocalSpace() const;
@@ -87,4 +89,7 @@
                 { return ParticleInterface::currentParticleInterface_s; }
 
+        protected:
+            virtual void changedTimeFactor(float factor_new, float factor_old);
+
         private:
             void updateVisibility();
@@ -98,4 +103,5 @@
             bool                      bAllowedByLOD_;
             unsigned int              detaillevel_;     //!< Detail level of this particle effect (0: off, 1: low, 2: normal, 3: high)
+            float                     speedFactor_;
             Ogre::SceneManager*       scenemanager_;
     };
Index: code/branches/presentation/src/orxonox/tools/Shader.cc
===================================================================
--- code/branches/presentation/src/orxonox/tools/Shader.cc	(revision 2485)
+++ code/branches/presentation/src/orxonox/tools/Shader.cc	(revision 2485)
@@ -0,0 +1,336 @@
+/*
+ *   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 "Shader.h"
+
+#include <OgreCompositorManager.h>
+#include <OgreCompositorInstance.h>
+#include <OgreSceneManager.h>
+#include <OgreRoot.h>
+#include <OgrePlugin.h>
+
+#include "core/Core.h"
+#include "core/CoreIncludes.h"
+#include "core/Executor.h"
+#include "GraphicsEngine.h"
+#include "util/Exception.h"
+
+#include <OgreMaterial.h>
+#include <OgreTechnique.h>
+#include <OgrePass.h>
+#include <OgreMaterialManager.h>
+
+namespace orxonox
+{
+    bool Shader::bLoadedCgPlugin_s = false;
+    Shader::MaterialMap Shader::parameters_s;
+
+    Shader::Shader(Ogre::SceneManager* scenemanager) : compositorInstance_(0)
+    {
+        RegisterObject(Shader);
+
+        this->scenemanager_ = scenemanager;
+        this->compositorInstance_ = 0;
+        this->bVisible_ = true;
+        this->bLoadCompositor_ = Core::showsGraphics() && GraphicsEngine::getInstancePtr();
+        this->bViewportInitialized_ = false;
+        this->compositor_ = "";
+        this->oldcompositor_ = "";
+
+        if (this->bLoadCompositor_ && Ogre::Root::getSingletonPtr())
+        {
+            Shader::bLoadedCgPlugin_s = false;
+            const Ogre::Root::PluginInstanceList& plugins = Ogre::Root::getSingleton().getInstalledPlugins();
+            for (size_t i = 0; i < plugins.size(); ++i)
+            {
+                if (plugins[i]->getName() == "Cg Program Manager")
+                {
+                    Shader::bLoadedCgPlugin_s = true;
+                    break;
+                }
+            }
+        }
+
+        this->bLoadCompositor_ &= Shader::bLoadedCgPlugin_s;
+    }
+
+    Shader::~Shader()
+    {
+
+        if (this->bLoadCompositor_ && this->compositorInstance_)
+        {
+            Ogre::Viewport* viewport = GraphicsEngine::getInstance().getViewport();
+            assert(viewport);
+            Ogre::CompositorManager::getSingleton().removeCompositor(viewport, this->compositor_);
+        }
+
+    }
+
+    void Shader::setSceneManager(Ogre::SceneManager* scenemanager)
+    {
+        this->scenemanager_ = scenemanager;
+        this->bViewportInitialized_ = false;
+    }
+
+    void Shader::tick(float dt)
+    {
+        SUPER(Shader, tick, dt);
+
+        if (this->bLoadCompositor_ && !this->bViewportInitialized_ && this->scenemanager_ && this->scenemanager_->getCurrentViewport())
+        {
+            this->bViewportInitialized_ = true;
+            this->updateVisibility();
+        }
+    }
+
+    void Shader::changedCompositor()
+    {
+        if (this->bLoadCompositor_)
+        {
+            Ogre::Viewport* viewport = GraphicsEngine::getInstance().getViewport();
+            assert(viewport);
+            if (this->oldcompositor_ != "")
+            {
+                Ogre::CompositorManager::getSingleton().removeCompositor(viewport, this->oldcompositor_);
+                this->compositorInstance_ = 0;
+            }
+            if (this->compositor_ != "")
+            {
+                this->compositorInstance_ = Ogre::CompositorManager::getSingleton().addCompositor(viewport, this->compositor_);
+                if (!this->compositorInstance_)
+                    COUT(2) << "Warning: Couldn't load compositor with name \"" << this->compositor_ << "\"." << std::endl;
+                Ogre::CompositorManager::getSingleton().setCompositorEnabled(viewport, this->compositor_, this->bViewportInitialized_ && this->isVisible());
+            }
+            this->oldcompositor_ = this->compositor_;
+        }
+    }
+
+    void Shader::updateVisibility()
+    {
+        if (this->compositorInstance_ && this->scenemanager_)
+            this->compositorInstance_->setEnabled(this->scenemanager_->getCurrentViewport() && this->isVisible());
+    }
+
+    void Shader::setParameter(const std::string& material, size_t technique, size_t pass, const std::string& parameter, float value)
+    {
+        if (Shader::_setParameter(material, technique, pass, parameter, value))
+        {
+            if (this->bViewportInitialized_ && this->compositorInstance_ && this->isVisible())
+            {
+                this->compositorInstance_->setEnabled(false);
+                this->compositorInstance_->setEnabled(true);
+            }
+        }
+    }
+
+    void Shader::setParameter(const std::string& material, size_t technique, size_t pass, const std::string& parameter, int value)
+    {
+        if (Shader::_setParameter(material, technique, pass, parameter, value))
+        {
+            if (this->bViewportInitialized_ && this->compositorInstance_ && this->isVisible())
+            {
+                this->compositorInstance_->setEnabled(false);
+                this->compositorInstance_->setEnabled(true);
+            }
+        }
+    }
+
+    bool Shader::_setParameter(const std::string& material, size_t technique, size_t pass, const std::string& parameter, float value)
+    {
+        ParameterPointer* pointer = Shader::getParameterPointer(material, technique, pass, parameter);
+        if (pointer)
+        {
+            if (pointer->first)
+            {
+                if ((*((float*)pointer->second)) != value)
+                {
+                    (*((float*)pointer->second)) = value;
+                    return true;
+                }
+            }
+            else
+            {
+                if ((*((int*)pointer->second)) != (int)value)
+                {
+                    (*((int*)pointer->second)) = (int)value;
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    bool Shader::_setParameter(const std::string& material, size_t technique, size_t pass, const std::string& parameter, int value)
+    {
+        ParameterPointer* pointer = Shader::getParameterPointer(material, technique, pass, parameter);
+        if (pointer)
+        {
+            if (pointer->first)
+            {
+                if ((*((float*)pointer->second)) != (float)value)
+                {
+                    (*((float*)pointer->second)) = (float)value;
+                    return true;
+                }
+            }
+            else
+            {
+                if ((*((int*)pointer->second)) != value)
+                {
+                    (*((int*)pointer->second)) = value;
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    float Shader::getParameter(const std::string& material, size_t technique, size_t pass, const std::string& parameter)
+    {
+        ParameterPointer* pointer = Shader::getParameterPointer(material, technique, pass, parameter);
+        if (pointer)
+        {
+            if (pointer->first)
+                return (*((float*)pointer->second));
+            else
+                return (*((int*)pointer->second));
+        }
+        else
+            return 0;
+    }
+
+    bool Shader::getParameterIsFloat(const std::string& material, size_t technique, size_t pass, const std::string& parameter)
+    {
+        ParameterPointer* pointer = Shader::getParameterPointer(material, technique, pass, parameter);
+        if (pointer)
+            return pointer->first;
+        else
+            return false;
+    }
+
+    bool Shader::getParameterIsInt(const std::string& material, size_t technique, size_t pass, const std::string& parameter)
+    {
+        ParameterPointer* pointer = Shader::getParameterPointer(material, technique, pass, parameter);
+        if (pointer)
+            return (!pointer->first);
+        else
+            return false;
+    }
+
+    Shader::ParameterPointer* Shader::getParameterPointer(const std::string& material, size_t technique, size_t pass, const std::string& parameter)
+    {
+        if (!Core::showsGraphics() || !Shader::bLoadedCgPlugin_s)
+            return 0;
+
+        MaterialMap::iterator material_iterator = Shader::parameters_s.find(material);
+        if (material_iterator != Shader::parameters_s.end())
+        {
+            TechniqueVector& technique_vector = material_iterator->second;
+            if (technique < technique_vector.size())
+            {
+                PassVector& pass_vector = technique_vector[technique];
+                if (pass < pass_vector.size())
+                {
+                    ParameterMap& parameter_map = pass_vector[pass];
+                    ParameterMap::iterator parameter_iterator = parameter_map.find(parameter);
+
+                    if (parameter_iterator != parameter_map.end())
+                        return (&parameter_iterator->second);
+                    else
+                        COUT(2) << "Warning: No shader parameter \"" << parameter << "\" in pass " << pass << " in technique " << technique << " in material \"" << material << "\"." << std::endl;
+                }
+                else
+                    COUT(2) << "Warning: No pass " << pass << " in technique " << technique << " in material \"" << material << "\" or pass has no shader." << std::endl;
+            }
+            else
+                COUT(2) << "Warning: No technique " << technique << " in material \"" << material << "\" or technique has no pass with shader." << std::endl;
+        }
+        else
+        {
+            bool foundAtLeastOneShaderParameter = false;
+            Ogre::MaterialManager::ResourceMapIterator iterator = Ogre::MaterialManager::getSingleton().getResourceIterator();
+            Ogre::Material* material_pointer = 0;
+
+            while (iterator.hasMoreElements())
+            {
+                Ogre::Resource* resource = iterator.getNext().get();
+                if (resource->getName() == material)
+                    material_pointer = (Ogre::Material*)resource;
+            }
+
+            if (!material_pointer)
+            {
+                COUT(2) << "Warning: No material with name \"" << material << "\" found." << std::endl;
+                return 0;
+            }
+
+            for (unsigned int t = 0; t < material_pointer->getNumTechniques(); ++t)
+            {
+                Ogre::Technique* technique_pointer = material_pointer->getTechnique(t);
+                if (!technique_pointer)
+                    continue;
+
+                for (unsigned int p = 0; p < technique_pointer->getNumPasses(); ++p)
+                {
+                    Ogre::Pass* pass_pointer = technique_pointer->getPass(p);
+                    if (!pass_pointer)
+                        continue;
+
+                    if (pass_pointer->getFragmentProgramName() != "")
+                    {
+                        Ogre::GpuProgramParameters* parameter_pointer = pass_pointer->getFragmentProgramParameters().get();
+                        if (!parameter_pointer)
+                            continue;
+
+                        const Ogre::GpuConstantDefinitionMap& constant_definitions = parameter_pointer->getConstantDefinitions().map;
+                        for (Ogre::GpuConstantDefinitionMap::const_iterator definition_iterator = constant_definitions.begin(); definition_iterator != constant_definitions.end(); ++definition_iterator)
+                        {
+                            void* temp = (definition_iterator->second.isFloat())
+                                            ? (void*)parameter_pointer->getFloatPointer(definition_iterator->second.physicalIndex)
+                                            : (void*)parameter_pointer->getIntPointer(definition_iterator->second.physicalIndex);
+                            ParameterPointer parameter_pointer = ParameterPointer(definition_iterator->second.isFloat(), temp);
+
+                            TechniqueVector& technique_vector = Shader::parameters_s[material];
+                            technique_vector.resize(technique + 1);
+                            PassVector& pass_vector = technique_vector[technique];
+                            pass_vector.resize(pass + 1);
+                            pass_vector[pass][definition_iterator->first] = parameter_pointer;
+                            foundAtLeastOneShaderParameter = true;
+                        }
+                    }
+                }
+            }
+
+            // recursive call if the material was added to the map
+            if (foundAtLeastOneShaderParameter)
+                return Shader::getParameterPointer(material, technique, pass, parameter);
+        }
+        return 0;
+    }
+}
Index: code/branches/presentation/src/orxonox/tools/Shader.h
===================================================================
--- code/branches/presentation/src/orxonox/tools/Shader.h	(revision 2485)
+++ code/branches/presentation/src/orxonox/tools/Shader.h	(revision 2485)
@@ -0,0 +1,107 @@
+/*
+ *   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 _Shader_H__
+#define _Shader_H__
+
+#include "OrxonoxPrereqs.h"
+#include <OgrePrerequisites.h>
+#include <vector>
+#include <map>
+
+#include "objects/Tickable.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport Shader : public Tickable
+    {
+        typedef std::pair<bool, void*>                  ParameterPointer;
+        typedef std::map<std::string, ParameterPointer> ParameterMap;
+        typedef std::vector<ParameterMap>               PassVector;
+        typedef std::vector<PassVector>                 TechniqueVector;
+        typedef std::map<std::string, TechniqueVector>  MaterialMap;
+
+        public:
+            Shader(Ogre::SceneManager* scenemanager = 0);
+            virtual ~Shader();
+
+            virtual void tick(float dt);
+
+            inline void setVisible(bool bVisible)
+            {
+                if (this->bVisible_ != bVisible)
+                {
+                    this->bVisible_ = bVisible;
+                    this->updateVisibility();
+                }
+            }
+            inline bool isVisible() const
+                { return this->bVisible_; }
+            void updateVisibility();
+
+            inline void setCompositor(const std::string& compositor)
+            {
+                if (this->compositor_ != compositor)
+                {
+                    this->compositor_ = compositor;
+                    this->changedCompositor();
+                }
+            }
+            inline const std::string& getCompositor() const
+                { return this->compositor_; }
+            void changedCompositor();
+
+            void setSceneManager(Ogre::SceneManager* scenemanager);
+            inline Ogre::SceneManager* getSceneManager() const
+                { return this->scenemanager_; }
+
+            void setParameter(const std::string& material, size_t technique, size_t pass, const std::string& parameter, float value);
+            void setParameter(const std::string& material, size_t technique, size_t pass, const std::string& parameter, int value);
+
+            static bool _setParameter(const std::string& material, size_t technique, size_t pass, const std::string& parameter, float value);
+            static bool _setParameter(const std::string& material, size_t technique, size_t pass, const std::string& parameter, int value);
+            static float getParameter(const std::string& material, size_t technique, size_t pass, const std::string& parameter);
+            static bool  getParameterIsFloat(const std::string& material, size_t technique, size_t pass, const std::string& parameter);
+            static bool  getParameterIsInt  (const std::string& material, size_t technique, size_t pass, const std::string& parameter);
+            static ParameterPointer* getParameterPointer(const std::string& material, size_t technique, size_t pass, const std::string& parameter);
+
+        private:
+            Ogre::SceneManager* scenemanager_;
+            Ogre::CompositorInstance* compositorInstance_;
+            bool bVisible_;
+            bool bLoadCompositor_;
+            bool bViewportInitialized_;
+            std::string compositor_;
+            std::string oldcompositor_;
+
+            static MaterialMap parameters_s;
+            static bool bLoadedCgPlugin_s;
+    };
+}
+
+#endif /* _Shader_H__ */
Index: code/branches/presentation/src/orxonox/tools/Timer.cc
===================================================================
--- code/branches/presentation/src/orxonox/tools/Timer.cc	(revision 2484)
+++ code/branches/presentation/src/orxonox/tools/Timer.cc	(revision 2485)
@@ -96,5 +96,5 @@
         this->time_ = 0;
 
-        RegisterRootObject(TimerBase);
+        RegisterObject(TimerBase);
     }
 
@@ -137,5 +137,5 @@
         {
             // If active: Decrease the timer by the duration of the last frame
-            this->time_ -= time.getDeltaTimeMicroseconds();
+            this->time_ -= (long long)(time.getDeltaTimeMicroseconds() * this->getTimeFactor());
 
             if (this->time_ <= 0)
Index: code/branches/presentation/src/orxonox/tools/Timer.h
===================================================================
--- code/branches/presentation/src/orxonox/tools/Timer.h	(revision 2484)
+++ code/branches/presentation/src/orxonox/tools/Timer.h	(revision 2485)
@@ -63,4 +63,5 @@
 #include "OrxonoxPrereqs.h"
 #include "core/OrxonoxClass.h"
+#include "gamestates/GSRoot.h"
 
 namespace orxonox
@@ -72,5 +73,5 @@
 
     //! TimerBase is the parent of the Timer class.
-    class _OrxonoxExport TimerBase : public OrxonoxClass
+    class _OrxonoxExport TimerBase : public TimeFactorListener
     {
         public:
Index: code/branches/presentation/src/util/Convert.h
===================================================================
--- code/branches/presentation/src/util/Convert.h	(revision 2484)
+++ code/branches/presentation/src/util/Convert.h	(revision 2485)
@@ -460,5 +460,5 @@
             else
               *output = "false";
-            return false;
+            return true;
         }
     };
Index: code/branches/presentation/src/util/OutputHandler.cc
===================================================================
--- code/branches/presentation/src/util/OutputHandler.cc	(revision 2484)
+++ code/branches/presentation/src/util/OutputHandler.cc	(revision 2485)
@@ -100,8 +100,13 @@
         @param buffer The OutputBuffer
     */
-    void OutputHandler::setOutputBuffer(OutputBuffer& buffer)
-    {
-        buffer.getStream() >> this->outputBuffer_->getStream().rdbuf();
-        this->outputBuffer_ = &buffer;
+    void OutputHandler::setOutputBuffer(OutputBuffer* buffer)
+    {
+        if (buffer == NULL)
+            this->outputBuffer_ = &this->fallbackBuffer_;
+        else
+        {
+            buffer->getStream() >> this->outputBuffer_->getStream().rdbuf();
+            this->outputBuffer_ = buffer;
+        }
     }
 
Index: code/branches/presentation/src/util/OutputHandler.h
===================================================================
--- code/branches/presentation/src/util/OutputHandler.h	(revision 2484)
+++ code/branches/presentation/src/util/OutputHandler.h	(revision 2485)
@@ -101,5 +101,5 @@
             static int getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All);
 
-            void setOutputBuffer(OutputBuffer& buffer);
+            void setOutputBuffer(OutputBuffer* buffer);
 
             template <class T>
Index: code/branches/presentation/src/util/SignalHandler.cc
===================================================================
--- code/branches/presentation/src/util/SignalHandler.cc	(revision 2484)
+++ code/branches/presentation/src/util/SignalHandler.cc	(revision 2485)
@@ -35,5 +35,4 @@
 #include "Debug.h"
 
-#include <cassert>
 #include <iostream>
 #include <cstdlib>
@@ -42,5 +41,5 @@
 namespace orxonox
 {
-    SignalHandler * SignalHandler::singletonRef = NULL;
+    SignalHandler* SignalHandler::singletonRef_s = NULL;
 }
 
@@ -55,8 +54,4 @@
 {
     bool SignalHandler::bXAutoKeyRepeatOn_ = false;
-
-    SignalHandler::SignalHandler()
-    {
-    }
 
     /**
@@ -133,5 +128,5 @@
     void SignalHandler::sigHandler( int sig )
     {
-      for ( SignalCallbackList::iterator it = SignalHandler::getInstance()->callbackList.begin(); it != SignalHandler::getInstance()->callbackList.end(); it++  )
+      for ( SignalCallbackList::iterator it = SignalHandler::getInstance().callbackList.begin(); it != SignalHandler::getInstance().callbackList.end(); it++  )
       {
         (*(it->cb))( it->someData );
@@ -184,5 +179,5 @@
       if ( sigPid == 0 )
       {
-        getInstance()->dontCatch();
+        getInstance().dontCatch();
         // wait for message from parent when it has attached gdb
         int someData;
@@ -237,5 +232,5 @@
 
       char cmd[256];
-      snprintf( cmd, 256, "file %s\nattach %d\nc\n", getInstance()->appName.c_str(), sigPid );
+      snprintf( cmd, 256, "file %s\nattach %d\nc\n", getInstance().appName.c_str(), sigPid );
       write( gdbIn[1], cmd, strlen(cmd) );
 
@@ -331,9 +326,9 @@
       bt.insert(0, timeString);
 
-      FILE * f = fopen( getInstance()->filename.c_str(), "a" );
+      FILE * f = fopen( getInstance().filename.c_str(), "a" );
 
       if ( !f )
       {
-        perror( ( std::string( "could not append to " ) + getInstance()->filename ).c_str() );
+        perror( ( std::string( "could not append to " ) + getInstance().filename ).c_str() );
         exit(EXIT_FAILURE);
       }
@@ -341,5 +336,5 @@
       if ( fwrite( bt.c_str(), 1, bt.length(), f ) != bt.length() )
       {
-        COUT(0) << "could not write " << bt.length() << " byte to " << getInstance()->filename << std::endl;
+        COUT(0) << "could not write " << bt.length() << " byte to " << getInstance().filename << std::endl;
         exit(EXIT_FAILURE);
       }
Index: code/branches/presentation/src/util/SignalHandler.h
===================================================================
--- code/branches/presentation/src/util/SignalHandler.h	(revision 2484)
+++ code/branches/presentation/src/util/SignalHandler.h	(revision 2485)
@@ -37,4 +37,5 @@
 #include "UtilPrereqs.h"
 
+#include <cassert>
 #include <list>
 #include <string>
@@ -68,9 +69,8 @@
     class SignalHandler
     {
-    private:
-        SignalHandler();
     public:
-        inline static SignalHandler* getInstance() { if (!SignalHandler::singletonRef) SignalHandler::singletonRef = new SignalHandler(); return SignalHandler::singletonRef; }
-        ~SignalHandler(){ SignalHandler::singletonRef = NULL; }
+        SignalHandler()  { assert(SignalHandler::singletonRef_s == 0); SignalHandler::singletonRef_s = this; }
+        ~SignalHandler() { assert(SignalHandler::singletonRef_s != 0); SignalHandler::singletonRef_s = NULL; }
+        inline static SignalHandler& getInstance() { assert(SignalHandler::singletonRef_s); return *SignalHandler::singletonRef_s; }
 
         void registerCallback( SignalCallback cb, void * someData );
@@ -87,5 +87,5 @@
         SignalCallbackList callbackList;
 
-        static SignalHandler * singletonRef;
+        static SignalHandler* singletonRef_s;
 
         std::string appName;
@@ -104,11 +104,13 @@
     {
     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 ) {};
+        SignalHandler()  { assert(SignalHandler::singletonRef_s == 0); SignalHandler::singletonRef_s = this; }
+        ~SignalHandler() { assert(SignalHandler::singletonRef_s != 0); SignalHandler::singletonRef_s = 0; }
+        inline static SignalHandler& getInstance() { assert(SignalHandler::singletonRef_s); return *SignalHandler::singletonRef_s; }
+        void doCatch( const std::string & appName, const std::string & filename ) {}
+        void dontCatch() {}
+        void registerCallback( SignalCallback cb, void * someData ) {}
 
     private:
-        static SignalHandler * singletonRef;
+        static SignalHandler* singletonRef_s;
     };
 }
