Index: code/trunk/src/orxonox/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/CMakeLists.txt	(revision 2262)
+++ code/trunk/src/orxonox/CMakeLists.txt	(revision 2662)
@@ -4,4 +4,5 @@
   LevelManager.cc
   Main.cc
+  PawnManager.cc
   PlayerManager.cc
   Settings.cc
@@ -48,4 +49,7 @@
   tinyxml_orxonox
   tolualib_orxonox
+  BulletDynamics
+  BulletCollision
+  LinearMath
   util
   core
Index: code/trunk/src/orxonox/CameraManager.cc
===================================================================
--- code/trunk/src/orxonox/CameraManager.cc	(revision 2262)
+++ code/trunk/src/orxonox/CameraManager.cc	(revision 2662)
@@ -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/trunk/src/orxonox/CameraManager.h
===================================================================
--- code/trunk/src/orxonox/CameraManager.h	(revision 2262)
+++ code/trunk/src/orxonox/CameraManager.h	(revision 2662)
@@ -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/trunk/src/orxonox/GraphicsEngine.cc
===================================================================
--- code/trunk/src/orxonox/GraphicsEngine.cc	(revision 2262)
+++ code/trunk/src/orxonox/GraphicsEngine.cc	(revision 2662)
@@ -77,4 +77,6 @@
         singletonRef_s = this;
 
+        this->viewport_ = 0;
+
         this->detailLevelParticle_ = 0;
 
Index: code/trunk/src/orxonox/GraphicsEngine.h
===================================================================
--- code/trunk/src/orxonox/GraphicsEngine.h	(revision 2262)
+++ code/trunk/src/orxonox/GraphicsEngine.h	(revision 2662)
@@ -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/trunk/src/orxonox/Main.cc
===================================================================
--- code/trunk/src/orxonox/Main.cc	(revision 2262)
+++ code/trunk/src/orxonox/Main.cc	(revision 2662)
@@ -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/trunk/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/trunk/src/orxonox/OrxonoxPrereqs.h	(revision 2262)
+++ code/trunk/src/orxonox/OrxonoxPrereqs.h	(revision 2662)
@@ -73,4 +73,27 @@
     }
 
+    //put here all existing munitionTypes
+    namespace MunitionType
+    {
+
+
+
+        enum Enum
+        { laserGunMunition };
+    }
+
+    //put here all weapon fire modes.
+    //they have to be added to Pawn and HumanController, too.
+    namespace WeaponMode
+    {
+        enum Enum
+        {
+            fire     = 0x1,
+            altFire  = 0x2,
+            altFire2 = 0x4
+        };
+    }
+
+
     class GraphicsEngine;
     class Settings;
@@ -82,4 +105,5 @@
     class CameraManager;
     class LevelManager;
+    class PawnManager;
     class PlayerManager;
 
@@ -102,11 +126,13 @@
     class QuestHint;
     class QuestItem;
+    class QuestListener;
     class QuestManager;
     class Rewardable;
 
     class WorldEntity;
-    class PositionableEntity;
+    class StaticEntity;
+    class MobileEntity;
+    class ControllableEntity;
     class MovableEntity;
-    class ControllableEntity;
     class Sublevel;
 
@@ -114,4 +140,7 @@
     class Billboard;
     class BlinkingBillboard;
+    class ExplosionChunk;
+    class FadingBillboard;
+    class GlobalShader;
     class Light;
     class Backlight;
@@ -127,4 +156,9 @@
     class SpaceShip;
 
+    class Item;
+    class Engine;
+    class MultiStateEngine;
+    class RotatingEngine;
+
     class Trigger;
     class DistanceTrigger;
@@ -135,6 +169,9 @@
     class WeaponSet;
     class WeaponSlot;
+    class WeaponPack;
     class Weapon;
     class Munition;
+    class LaserGun;
+    class LaserGunMunition;
 
     class EventListener;
@@ -144,12 +181,27 @@
     class Controller;
     class HumanController;
+    class ArtificialController;
+    class AIController;
+    class ScriptController;
 
     class Info;
     class PlayerInfo;
     class HumanPlayer;
+    class Bot;
+    class GametypeInfo;
 
     class Gametype;
 
     class Scores;
+    class CreateLines;
+    class Scoreboard;
+    class Stats;
+
+    // collision
+    class CollisionShape;
+    class SphereCollisionShape;
+    class CompoundCollisionShape;
+    class PlaneCollisionShape;
+    class WorldEntityCollisionShape;
 
     // tools
@@ -158,4 +210,5 @@
     class Mesh;
     class ParticleInterface;
+    class Shader;
     template <class T>
     class Timer;
@@ -169,8 +222,15 @@
     class HUDRadar;
     class HUDSpeedBar;
+    class HUDHealthBar;
     class InGameConsole;
+    class Notification;
+    class NotificationManager;
+    class NotificationQueue;
     class OrxonoxOverlay;
     class OverlayGroup;
     class OverlayText;
+    class GametypeStatus;
+    class CreateLines;
+    class Scoreboard;
 
     //gui
@@ -206,4 +266,26 @@
 }
 
+// Bullet Physics Engine
+
+class btTransform;
+class btVector3;
+
+class btRigidBody;
+class btCollisionObject;
+class btGhostObject;
+class btManifoldPoint;
+
+class btCollisionShape;
+class btSphereShape;
+class btCompoundShape;
+class btStaticPlaneShape;
+
+class btDiscreteDynamicsWorld;
+class bt32BitAxisSweep3;
+class btDefaultCollisionConfiguration;
+class btCollisionDispatcher;
+class btSequentialImpulseConstraintSolver;
+
+// lua
 struct lua_State;
 
Index: code/trunk/src/orxonox/OrxonoxStableHeaders.h
===================================================================
--- code/trunk/src/orxonox/OrxonoxStableHeaders.h	(revision 2262)
+++ code/trunk/src/orxonox/OrxonoxStableHeaders.h	(revision 2662)
@@ -47,5 +47,4 @@
 #include <Ogre.h>
 #include <CEGUI.h>
-#include "ois/OIS.h"
 #include <boost/thread/recursive_mutex.hpp>
 //#include <boost/thread/mutex.hpp>
@@ -53,4 +52,7 @@
 //#include <boost/thread/thread.hpp>
 #include <boost/static_assert.hpp>
+
+#include "BulletDynamics/Dynamics/btRigidBody.h"
+#include "ois/OIS.h"
 #include "tinyxml/ticpp.h"
 #include "tinyxml/tinyxml.h"
@@ -95,11 +97,11 @@
 #include "core/input/InputManager.h"
 
-#include "network/Synchronisable.h"
+#include "network/synchronisable/Synchronisable.h"
 
-#include "Settings.h"
+//#include "Settings.h"
 
 //#endif /* ifdef NDEBUG */
 
-#endif /* ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC && !defined(ORXONOX_DISABLE_PCH) */
+#endif /* defined(ORXONOX_ENABLE_PCH) */
 
 #endif /* _OrxonoxStableHeaders_H__ */
Index: code/trunk/src/orxonox/PawnManager.cc
===================================================================
--- code/trunk/src/orxonox/PawnManager.cc	(revision 2662)
+++ code/trunk/src/orxonox/PawnManager.cc	(revision 2662)
@@ -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/trunk/src/orxonox/PawnManager.h
===================================================================
--- code/trunk/src/orxonox/PawnManager.h	(revision 2662)
+++ code/trunk/src/orxonox/PawnManager.h	(revision 2662)
@@ -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/trunk/src/orxonox/PlayerManager.cc
===================================================================
--- code/trunk/src/orxonox/PlayerManager.cc	(revision 2262)
+++ code/trunk/src/orxonox/PlayerManager.cc	(revision 2662)
@@ -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/trunk/src/orxonox/PlayerManager.h
===================================================================
--- code/trunk/src/orxonox/PlayerManager.h	(revision 2262)
+++ code/trunk/src/orxonox/PlayerManager.h	(revision 2662)
@@ -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/trunk/src/orxonox/Settings.cc
===================================================================
--- code/trunk/src/orxonox/Settings.cc	(revision 2262)
+++ code/trunk/src/orxonox/Settings.cc	(revision 2662)
@@ -83,5 +83,5 @@
         }
 
-        LuaBind::getInstance()->setIncludePath(this->dataPath_);
+        LuaBind::getInstance().setIncludePath(this->dataPath_);
     }
 
Index: code/trunk/src/orxonox/gamestates/GSDedicated.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSDedicated.cc	(revision 2262)
+++ code/trunk/src/orxonox/gamestates/GSDedicated.cc	(revision 2662)
@@ -35,4 +35,5 @@
 #include "network/Server.h"
 #include "objects/Tickable.h"
+#include "util/Sleep.h"
 
 namespace orxonox
@@ -41,4 +42,5 @@
         : GameState<GSRoot>("dedicated")
         , server_(0)
+        , timeSinceLastUpdate_(0)
     {
     }
@@ -72,7 +74,21 @@
     void GSDedicated::ticked(const Clock& time)
     {
-        GSLevel::ticked(time);
-        server_->tick(time.getDeltaTime());
-        this->tickChild(time);
+//        static float startTime = time.getSecondsPrecise();
+//        static int nrOfTicks = 0;
+        timeSinceLastUpdate_ += time.getDeltaTime();
+        if (timeSinceLastUpdate_ >= NETWORK_PERIOD)
+        {
+//            ++nrOfTicks;
+//            COUT(0) << "estimated ticks/sec: " << nrOfTicks/(time.getSecondsPrecise()-startTime) << endl;
+            timeSinceLastUpdate_ -= static_cast<unsigned int>(timeSinceLastUpdate_ / NETWORK_PERIOD) * NETWORK_PERIOD;
+            GSLevel::ticked(time);
+            server_->tick(time.getDeltaTime());
+            this->tickChild(time);
+        }
+        else
+        {
+            usleep((int)((NETWORK_PERIOD - timeSinceLastUpdate_) * 1000 * 1000));
+//            COUT(0) << "sleeping for " << (int)((NETWORK_PERIOD - timeSinceLastUpdate_) * 1000 * 1000) << " usec" << endl;
+        }
     }
 }
Index: code/trunk/src/orxonox/gamestates/GSDedicated.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSDedicated.h	(revision 2262)
+++ code/trunk/src/orxonox/gamestates/GSDedicated.h	(revision 2662)
@@ -49,4 +49,5 @@
 
         Server*      server_;
+        float        timeSinceLastUpdate_;
     };
 }
Index: code/trunk/src/orxonox/gamestates/GSGraphics.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSGraphics.cc	(revision 2262)
+++ code/trunk/src/orxonox/gamestates/GSGraphics.cc	(revision 2662)
@@ -31,4 +31,5 @@
 
 #include <fstream>
+#include <OgreCompositorManager.h>
 #include <OgreConfigFile.h>
 #include <OgreFrameListener.h>
@@ -75,9 +76,4 @@
         , graphicsEngine_(0)
         , masterKeyBinder_(0)
-        , frameCount_(0)
-        , statisticsRefreshCycle_(0)
-        , statisticsStartTime_(0)
-        , statisticsStartCount_(0)
-        , tickTime_(0)
         , debugOverlay_(0)
     {
@@ -106,6 +102,4 @@
         SetConfigValue(ogreLogLevelCritical_, 2)
             .description("Corresponding orxonox debug level for ogre Critical");
-        SetConfigValue(statisticsRefreshCycle_, 200000)
-            .description("Sets the time in microseconds interval at which average fps, etc. get updated.");
         SetConfigValue(defaultMasterKeybindings_, "def_masterKeybindings.ini")
             .description("Filename of default master keybindings.");
@@ -155,14 +149,9 @@
         guiManager_->initialise(this->renderWindow_);
 
-        // reset frame counter
-        this->frameCount_ = 0;
-        this->tickTime_ = 0;
-        statisticsStartTime_ = 0;
-        statisticsStartCount_ = 0;
-
         // add console commands
         FunctorMember<GSGraphics>* functor1 = createFunctor(&GSGraphics::printScreen);
         functor1->setObject(this);
-        CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor1, "printScreen"));
+        ccPrintScreen_ = createConsoleCommand(functor1, "printScreen");
+        CommandExecutor::addConsoleCommandShortcut(ccPrintScreen_);
     }
 
@@ -170,4 +159,6 @@
     {
         using namespace Ogre;
+
+        delete this->ccPrintScreen_;
 
         // remove our WindowEventListener first to avoid bad calls after the window has been destroyed
@@ -184,4 +175,7 @@
         Loader::unload(this->debugOverlay_);
         delete this->debugOverlay_;
+
+        // unload all compositors
+        Ogre::CompositorManager::getSingleton().removeAll();
 
         // destroy render window
@@ -206,10 +200,10 @@
         delete this->ogreRoot_;
 
-#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
+//#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
         // delete the ogre log and the logManager (since we have created it).
         this->ogreLogger_->getDefaultLog()->removeListener(this);
         this->ogreLogger_->destroyLog(Ogre::LogManager::getSingleton().getDefaultLog());
         delete this->ogreLogger_;
-#endif
+//#endif
 
         delete graphicsEngine_;
@@ -219,10 +213,5 @@
 
     /**
-        Main loop of the orxonox game.
-        We use the Ogre::Timer to measure time since it uses the most precise
-        method an a platform (however the windows timer lacks time when under
-        heavy kernel load!).
-        There is a simple mechanism to measure the average time spent in our
-        ticks as it may indicate performance issues.
+    @note
         A note about the Ogre::FrameListener: Even though we don't use them,
         they still get called. However, the delta times are not correct (except
@@ -233,5 +222,6 @@
     void GSGraphics::ticked(const Clock& time)
     {
-        unsigned long long timeBeforeTick = time.getRealMicroseconds();
+        uint64_t timeBeforeTick = time.getRealMicroseconds();
+
         float dt = time.getDeltaTime();
 
@@ -248,19 +238,12 @@
         }
 
-        unsigned long long timeAfterTick = time.getRealMicroseconds();
-
-        tickTime_ += (unsigned int)(timeAfterTick - timeBeforeTick);
-        if (timeAfterTick > statisticsStartTime_ + statisticsRefreshCycle_)
-        {
-            GraphicsEngine::getInstance().setAverageTickTime(
-                (float)tickTime_ * 0.001f / (frameCount_ - statisticsStartCount_));
-            float avgFPS = (float)(frameCount_ - statisticsStartCount_)
-                / (timeAfterTick - statisticsStartTime_) * 1000000.0;
-            GraphicsEngine::getInstance().setAverageFramesPerSecond(avgFPS);
-
-            tickTime_ = 0;
-            statisticsStartCount_ = frameCount_;
-            statisticsStartTime_  = timeAfterTick;
-        }
+        uint64_t timeAfterTick = time.getRealMicroseconds();
+
+        // Also add our tick time to the list in GSRoot
+        this->getParent()->addTickTime(timeAfterTick - timeBeforeTick);
+
+        // Update statistics overlay. Note that the values only change periodically in GSRoot.
+        GraphicsEngine::getInstance().setAverageFramesPerSecond(this->getParent()->getAvgFPS());
+        GraphicsEngine::getInstance().setAverageTickTime(this->getParent()->getAvgTickTime());
 
         // don't forget to call _fireFrameStarted in ogre to make sure
@@ -283,6 +266,4 @@
         // again, just to be sure ogre works fine
         ogreRoot_->_fireFrameEnded(evt); // note: uses the same time as _fireFrameStarted
-
-        ++frameCount_;
     }
 
@@ -296,5 +277,5 @@
 
         // TODO: LogManager doesn't work on oli platform. The why is yet unknown.
-#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
+//#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
         // create a new logManager
         ogreLogger_ = new Ogre::LogManager();
@@ -311,5 +292,5 @@
         myLog->setLogDetail(Ogre::LL_BOREME);
         myLog->addListener(this);
-#endif
+//#endif
 
         // Root will detect that we've already created a Log
@@ -430,4 +411,7 @@
         // create a full screen default viewport
         this->viewport_ = this->renderWindow_->addViewport(0, 0);
+
+        if (this->graphicsEngine_)
+            this->graphicsEngine_->setViewport(this->viewport_);
     }
 
Index: code/trunk/src/orxonox/gamestates/GSGraphics.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSGraphics.h	(revision 2262)
+++ code/trunk/src/orxonox/gamestates/GSGraphics.h	(revision 2662)
@@ -93,11 +93,4 @@
 
         KeyBinder*            masterKeyBinder_;
-
-        // variables for time statistics
-        unsigned long         frameCount_;
-        unsigned int          statisticsRefreshCycle_;
-        unsigned long long    statisticsStartTime_;
-        unsigned long         statisticsStartCount_;
-        unsigned int          tickTime_;
         XMLFile*              debugOverlay_;
 
@@ -110,6 +103,8 @@
         int                   ogreLogLevelNormal_;       //!< Corresponding Orxonx debug level for LL_NORMAL
         int                   ogreLogLevelCritical_;     //!< Corresponding Orxonx debug level for LL_CRITICAL
-        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/trunk/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSLevel.cc	(revision 2262)
+++ code/trunk/src/orxonox/gamestates/GSLevel.cc	(revision 2662)
@@ -41,20 +41,18 @@
 #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"
 
 namespace orxonox
 {
-    SetCommandLineArgument(level, "sample2.oxw").shortcut("l");
+    SetCommandLineArgument(level, "presentation.oxw").shortcut("l");
 
     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/trunk/src/orxonox/gamestates/GSLevel.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSLevel.h	(revision 2262)
+++ code/trunk/src/orxonox/gamestates/GSLevel.h	(revision 2662)
@@ -32,10 +32,9 @@
 #include "OrxonoxPrereqs.h"
 #include <OgrePrerequisites.h>
-#include "core/GameState.h"
-#include "GSGraphics.h"
+#include "core/OrxonoxClass.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport GSLevel : public OrxonoxClass //,public GameState<GSGraphics>
+    class _OrxonoxExport GSLevel : public OrxonoxClass
     {
         friend class ClassIdentifier<GSLevel>;
@@ -43,9 +42,4 @@
         GSLevel();
         ~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:
@@ -56,6 +50,4 @@
         void loadLevel();
         void unloadLevel();
-
-        float timeFactor_;       //!< A factor that sets the gamespeed. 1 is normal.
 
         // console commands
@@ -70,4 +62,5 @@
         CameraManager*        cameraManager_;
         LevelManager*         levelManager_;
+        PlayerManager*        playerManager_;
 
         //##### ConfigValues #####
@@ -75,4 +68,8 @@
         //! Filename of default keybindings.
         std::string           defaultKeybindings_;
+
+        // console commands
+        ConsoleCommand*       ccKeybind_;
+        ConsoleCommand*       ccTkeybind_;
 
     private:
Index: code/trunk/src/orxonox/gamestates/GSRoot.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSRoot.cc	(revision 2262)
+++ code/trunk/src/orxonox/gamestates/GSRoot.cc	(revision 2662)
@@ -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;
     }
 
@@ -81,4 +89,8 @@
     void GSRoot::setConfigValues()
     {
+        SetConfigValue(statisticsRefreshCycle_, 250000)
+            .description("Sets the time in microseconds interval at which average fps, etc. get updated.");
+        SetConfigValue(statisticsAvgLength_, 1000000)
+            .description("Sets the time in microseconds interval at which average fps, etc. gets calculated.");
     }
 
@@ -87,4 +99,17 @@
         // creates the class hierarchy for all classes with factories
         Factory::createClassHierarchy();
+
+        // reset game speed to normal
+        timeFactor_ = 1.0f;
+
+        // reset frame counter
+        this->statisticsStartTime_ = 0;
+        this->statisticsTickTimes_.clear();
+        this->periodTickTime_ = 0;
+        this->avgFPS_ = 0.0f;
+        this->avgTickTime_ = 0.0f;
+
+        // Create the lua interface
+        this->luaBind_ = new LuaBind();
 
         // instantiate Settings class
@@ -114,18 +139,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,10 +182,24 @@
         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;
+        }
     }
 
     void GSRoot::ticked(const Clock& time)
     {
+        uint64_t timeBeforeTick = time.getRealMicroseconds();
+
         TclThreadManager::getInstance().tick(time.getDeltaTime());
 
@@ -146,9 +209,50 @@
         /*** HACK *** HACK ***/
         // Call the Tickable objects
+        float leveldt = time.getDeltaTime();
+        if (leveldt > 1.0f)
+        {
+            // just loaded
+            leveldt = 0.0f;
+        }
         for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ++it)
-            it->tick(time.getDeltaTime());
+            it->tick(leveldt * this->timeFactor_);
         /*** HACK *** HACK ***/
 
+        uint64_t timeAfterTick = time.getRealMicroseconds();
+
+        // STATISTICS
+        assert(timeAfterTick - timeBeforeTick >= 0 );
+        statisticsTickInfo tickInfo = {timeAfterTick, timeAfterTick - timeBeforeTick};
+        statisticsTickTimes_.push_back(tickInfo);
+        assert(statisticsTickTimes_.back().tickLength==tickInfo.tickLength);
+        this->periodTickTime_ += tickInfo.tickLength;
+
+        // Ticks GSGraphics or GSDedicated
         this->tickChild(time);
+
+        if (timeAfterTick > statisticsStartTime_ + statisticsRefreshCycle_)
+        {
+            std::list<statisticsTickInfo>::iterator it = this->statisticsTickTimes_.begin();
+            assert(it != this->statisticsTickTimes_.end());
+            int64_t lastTime = timeAfterTick - statisticsAvgLength_;
+            if ((int64_t)it->tickTime < lastTime)
+            {
+                do
+                {
+                    assert(this->periodTickTime_ > it->tickLength);
+                    this->periodTickTime_ -= it->tickLength;
+                    ++it;
+                    assert(it != this->statisticsTickTimes_.end());
+                } while ((int64_t)it->tickTime < lastTime);
+                this->statisticsTickTimes_.erase(this->statisticsTickTimes_.begin(), it);
+            }
+
+            uint32_t framesPerPeriod = this->statisticsTickTimes_.size();
+            this->avgFPS_ = (float)framesPerPeriod / (timeAfterTick - this->statisticsTickTimes_.front().tickTime) * 1000000.0;
+            this->avgTickTime_ = (float)this->periodTickTime_ / framesPerPeriod / 1000.0;
+
+            statisticsStartTime_ = timeAfterTick;
+        }
+
     }
 
@@ -160,5 +264,5 @@
 
         Copyright (c) 2000-2008 Torus Knot Software Ltd
-        
+
         OGRE is licensed under the LGPL. For more info, see OGRE license.
     */
@@ -167,16 +271,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
@@ -184,12 +288,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/trunk/src/orxonox/gamestates/GSRoot.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSRoot.h	(revision 2262)
+++ code/trunk/src/orxonox/gamestates/GSRoot.h	(revision 2662)
@@ -31,4 +31,6 @@
 
 #include "OrxonoxPrereqs.h"
+
+#include <list>
 #include <OgreLog.h>
 #include "core/RootGameState.h"
@@ -40,4 +42,12 @@
     {
         friend class ClassIdentifier<GSRoot>;
+
+    public:
+        struct statisticsTickInfo
+        {
+            uint64_t    tickTime;
+            uint32_t    tickLength;
+        };
+    
     public:
         GSRoot();
@@ -46,4 +56,17 @@
         void exitGame()
         { 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_; }
+
+        float getAvgTickTime() { return this->avgTickTime_; }
+        float getAvgFPS()      { return this->avgFPS_; }
+
+        inline void addTickTime(uint32_t length)
+            { assert(!this->statisticsTickTimes_.empty()); this->statisticsTickTimes_.back().tickLength += length;
+              this->periodTickTime_+=length; }
 
     private:
@@ -55,8 +78,47 @@
         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_;
+
+        // variables for time statistics
+        uint64_t              statisticsStartTime_;
+        std::list<statisticsTickInfo>
+                              statisticsTickTimes_;
+        uint32_t              periodTickTime_;
+        float                 avgFPS_;
+        float                 avgTickTime_;
+
+        // config values
+        unsigned int          statisticsRefreshCycle_;
+        unsigned int          statisticsAvgLength_;
+
+        // 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/trunk/src/orxonox/gui/GUIManager.cc
===================================================================
--- code/trunk/src/orxonox/gui/GUIManager.cc	(revision 2262)
+++ code/trunk/src/orxonox/gui/GUIManager.cc	(revision 2662)
@@ -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/trunk/src/orxonox/objects/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/objects/CMakeLists.txt	(revision 2262)
+++ code/trunk/src/orxonox/objects/CMakeLists.txt	(revision 2662)
@@ -3,4 +3,5 @@
   EventDispatcher.cc
   EventTarget.cc
+  GlobalShader.cc
   Level.cc
   Radar.cc
@@ -13,8 +14,10 @@
 )
 
+ADD_SOURCE_DIRECTORY(SRC_FILES collisionshapes)
 ADD_SOURCE_DIRECTORY(SRC_FILES controllers)
 ADD_SOURCE_DIRECTORY(SRC_FILES gametypes)
 ADD_SOURCE_DIRECTORY(SRC_FILES infos)
-#ADD_SOURCE_DIRECTORY(SRC_FILES pickup)
+ADD_SOURCE_DIRECTORY(SRC_FILES items)
+ADD_SOURCE_DIRECTORY(SRC_FILES pickup)
 ADD_SOURCE_DIRECTORY(SRC_FILES quest)
 ADD_SOURCE_DIRECTORY(SRC_FILES weaponSystem)
Index: code/trunk/src/orxonox/objects/EventTarget.cc
===================================================================
--- code/trunk/src/orxonox/objects/EventTarget.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/EventTarget.cc	(revision 2662)
@@ -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/trunk/src/orxonox/objects/GlobalShader.cc
===================================================================
--- code/trunk/src/orxonox/objects/GlobalShader.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/GlobalShader.cc	(revision 2662)
@@ -0,0 +1,79 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      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.");
+
+        if (this->getScene()->getSceneManager())
+            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/trunk/src/orxonox/objects/GlobalShader.h
===================================================================
--- code/trunk/src/orxonox/objects/GlobalShader.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/GlobalShader.h	(revision 2662)
@@ -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/trunk/src/orxonox/objects/Level.cc
===================================================================
--- code/trunk/src/orxonox/objects/Level.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/Level.cc	(revision 2662)
@@ -83,7 +83,7 @@
     void Level::registerVariables()
     {
-        REGISTERSTRING(this->xmlfilename_, direction::toclient, new NetworkCallback<Level>(this, &Level::networkcallback_applyXMLFile));
-        REGISTERSTRING(this->name_,        direction::toclient, new NetworkCallback<Level>(this, &Level::changedName));
-        REGISTERSTRING(this->description_, direction::toclient);
+        registerVariable(this->xmlfilename_, variableDirection::toclient, new NetworkCallback<Level>(this, &Level::networkcallback_applyXMLFile));
+        registerVariable(this->name_,        variableDirection::toclient, new NetworkCallback<Level>(this, &Level::changedName));
+        registerVariable(this->description_, variableDirection::toclient);
     }
 
@@ -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/trunk/src/orxonox/objects/Level.h
===================================================================
--- code/trunk/src/orxonox/objects/Level.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/Level.h	(revision 2662)
@@ -32,5 +32,5 @@
 #include "OrxonoxPrereqs.h"
 
-#include "network/Synchronisable.h"
+#include "network/synchronisable/Synchronisable.h"
 #include "core/BaseObject.h"
 
Index: code/trunk/src/orxonox/objects/Radar.cc
===================================================================
--- code/trunk/src/orxonox/objects/Radar.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/Radar.cc	(revision 2662)
@@ -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/trunk/src/orxonox/objects/RadarViewable.cc
===================================================================
--- code/trunk/src/orxonox/objects/RadarViewable.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/RadarViewable.cc	(revision 2662)
@@ -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/trunk/src/orxonox/objects/RadarViewable.h
===================================================================
--- code/trunk/src/orxonox/objects/RadarViewable.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/RadarViewable.h	(revision 2662)
@@ -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/trunk/src/orxonox/objects/Scene.cc
===================================================================
--- code/trunk/src/orxonox/objects/Scene.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/Scene.cc	(revision 2662)
@@ -22,4 +22,5 @@
  *   Author:
  *      Fabian 'x3n' Landau
+ *      Reto Grieder (physics)
  *   Co-authors:
  *      ...
@@ -33,9 +34,15 @@
 #include <OgreSceneManagerEnumerator.h>
 #include <OgreSceneNode.h>
-#include <OgreLight.h>
+
+#include "BulletCollision/BroadphaseCollision/btAxisSweep3.h"
+#include "BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h"
+#include "BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h"
+#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
 
 #include "core/CoreIncludes.h"
 #include "core/Core.h"
 #include "core/XMLPort.h"
+#include "tools/BulletConversions.h"
+#include "objects/worldentities/WorldEntity.h"
 
 namespace orxonox
@@ -48,5 +55,5 @@
 
         this->setScene(this);
-        this->bShadows_ = false;
+        this->bShadows_ = true;
 
         if (Core::showsGraphics())
@@ -70,15 +77,14 @@
         }
 
-        // 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
+        // No physics yet, XMLPort will do that.
+        const int defaultMaxWorldSize = 100000;
+        this->negativeWorldRange_ = Vector3::UNIT_SCALE * -defaultMaxWorldSize;
+        this->positiveWorldRange_ = Vector3::UNIT_SCALE *  defaultMaxWorldSize;
+        this->gravity_ = Vector3::ZERO;
+        this->physicalWorld_   = 0;
+        this->solver_          = 0;
+        this->dispatcher_      = 0;
+        this->collisionConfig_ = 0;
+        this->broadphase_      = 0;
 
         this->registerVariables();
@@ -91,5 +97,4 @@
             if (Ogre::Root::getSingletonPtr())
             {
-//                this->sceneManager_->destroySceneNode(this->rootSceneNode_->getName()); // TODO: remove getName() for newer versions of Ogre
                 Ogre::Root::getSingleton().destroySceneManager(this->sceneManager_);
             }
@@ -98,4 +103,6 @@
                 delete this->sceneManager_;
             }
+
+            this->setPhysicalWorld(false);
         }
     }
@@ -109,4 +116,9 @@
         XMLPortParam(Scene, "shadow", setShadow, getShadow, xmlelement, mode).defaultValues(true);
 
+        XMLPortParam(Scene, "gravity", setGravity, getGravity, xmlelement, mode);
+        XMLPortParam(Scene, "negativeWorldRange", setNegativeWorldRange, getNegativeWorldRange, xmlelement, mode);
+        XMLPortParam(Scene, "positiveWorldRange", setPositiveWorldRange, getPositiveWorldRange, xmlelement, mode);
+        XMLPortParam(Scene, "hasPhysics", setPhysicalWorld, hasPhysics, xmlelement, mode).defaultValues(true);
+
         XMLPortObjectExtended(Scene, BaseObject, "", addObject, getObject, xmlelement, mode, true, false);
     }
@@ -114,6 +126,130 @@
     void Scene::registerVariables()
     {
-        REGISTERSTRING(this->skybox_,     direction::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_applySkybox));
-        REGISTERDATA(this->ambientLight_, direction::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_applyAmbientLight));
+        registerVariable(this->skybox_,             variableDirection::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_applySkybox));
+        registerVariable(this->ambientLight_,       variableDirection::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_applyAmbientLight));
+        registerVariable(this->negativeWorldRange_, variableDirection::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_negativeWorldRange));
+        registerVariable(this->positiveWorldRange_, variableDirection::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_positiveWorldRange));
+        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));
+    }
+
+    void Scene::setNegativeWorldRange(const Vector3& range)
+    {
+        if (range.length() < 10.0f)
+        {
+            CCOUT(2) << "Warning: Setting the negative world range to a very small value: "
+                     << omni_cast<std::string>(range) << std::endl;
+        }
+        if (this->hasPhysics())
+        {
+            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);
+            this->negativeWorldRange_ = range;
+            this->setPhysicalWorld(true);
+        }
+        else
+            this->negativeWorldRange_ = range;
+    }
+
+    void Scene::setPositiveWorldRange(const Vector3& range)
+    {
+        if (range.length() < 10.0f)
+        {
+            CCOUT(2) << "Warning: Setting the positive world range to a very small value: "
+                     << omni_cast<std::string>(range) << std::endl;
+        }
+        if (this->hasPhysics())
+        {
+            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);
+            this->positiveWorldRange_ = range;
+            this->setPhysicalWorld(true);
+        }
+        else
+            this->positiveWorldRange_ = range;
+    }
+
+    void Scene::setGravity(const Vector3& gravity)
+    {
+        this->gravity_ = gravity;
+        if (this->hasPhysics())
+            this->physicalWorld_->setGravity(omni_cast<btVector3>(this->gravity_));
+    }
+
+    void Scene::setPhysicalWorld(bool wantPhysics)
+    {
+        this->bHasPhysics_ = wantPhysics;
+        if (wantPhysics && !hasPhysics())
+        {
+            // Note: These are all little known default classes and values.
+            //       It would require further investigation to properly dertermine the right choices.
+            this->broadphase_      = new bt32BitAxisSweep3(
+                omni_cast<btVector3>(this->negativeWorldRange_), omni_cast<btVector3>(this->positiveWorldRange_));
+            this->collisionConfig_ = new btDefaultCollisionConfiguration();
+            this->dispatcher_      = new btCollisionDispatcher(this->collisionConfig_);
+            this->solver_          = new btSequentialImpulseConstraintSolver();
+
+            this->physicalWorld_   = new btDiscreteDynamicsWorld(this->dispatcher_, this->broadphase_, this->solver_, this->collisionConfig_);
+            this->physicalWorld_->setGravity(omni_cast<btVector3>(this->gravity_));
+
+            // also set the collision callback variable.
+            // Note: This is a global variable which we assign a static function.
+            // TODO: Check whether this (or anything about Bullet) works with multiple physics engine instances.
+            gContactAddedCallback = &Scene::collisionCallback;
+        }
+        else if (!wantPhysics && hasPhysics())
+        {
+            // Remove all WorldEntities and shove them to the queue since they would still like to be in a physical world.
+            for (std::set<WorldEntity*>::const_iterator it = this->physicalObjects_.begin();
+                it != this->physicalObjects_.end(); ++it)
+            {
+                this->physicalWorld_->removeRigidBody((*it)->physicalBody_);
+                this->physicalObjectQueue_.insert(*it);
+            }
+            this->physicalObjects_.clear();
+
+            delete this->physicalWorld_;
+            delete this->solver_;
+            delete this->dispatcher_;
+            delete this->collisionConfig_;
+            delete this->broadphase_;
+            this->physicalWorld_   = 0;
+            this->solver_          = 0;
+            this->dispatcher_      = 0;
+            this->collisionConfig_ = 0;
+            this->broadphase_      = 0;
+        }
+    }
+
+    void Scene::tick(float dt)
+    {
+        if (!Core::showsGraphics())
+        {
+            // We need to update the scene nodes if we don't render
+            this->rootSceneNode_->_update(true, false);
+        }
+        if (this->hasPhysics())
+        {
+            // TODO: This here is bad practice! It will slow down the first tick() by ages.
+            //       Rather have an initialise() method as well, called by the Level after everything has been loaded.
+            if (this->physicalObjectQueue_.size() > 0)
+            {
+                // Add all scheduled WorldEntities
+                for (std::set<WorldEntity*>::const_iterator it = this->physicalObjectQueue_.begin();
+                    it != this->physicalObjectQueue_.end(); ++it)
+                {
+                    this->physicalWorld_->addRigidBody((*it)->physicalBody_);
+                    this->physicalObjects_.insert(*it);
+                }
+                this->physicalObjectQueue_.clear();
+            }
+
+            // Note: 60 means that Bullet will do physics correctly down to 1 frames per seconds.
+            //       Under that mark, the simulation will "loose time" and get unusable.
+            physicalWorld_->stepSimulation(dt, 60);
+        }
     }
 
@@ -165,11 +301,56 @@
     }
 
-    void Scene::tick(float dt)
-    {
-        if (!Core::showsGraphics())
-        {
-            // We need to update the scene nodes if we don't render
-            this->rootSceneNode_->_update(true, false);
-        }
+    void Scene::addPhysicalObject(WorldEntity* object)
+    {
+        if (object)
+        {
+            std::set<WorldEntity*>::iterator it = this->physicalObjects_.find(object);
+            if (it != this->physicalObjects_.end())
+                return;
+
+            this->physicalObjectQueue_.insert(object);
+        }
+    }
+
+    void Scene::removePhysicalObject(WorldEntity* object)
+    {
+        // check queue first
+        std::set<WorldEntity*>::iterator it = this->physicalObjectQueue_.find(object);
+        if (it != this->physicalObjectQueue_.end())
+        {
+            this->physicalObjectQueue_.erase(it);
+            return;
+        }
+
+        it = this->physicalObjects_.find(object);
+        if (it == this->physicalObjects_.end())
+            return;
+        this->physicalObjects_.erase(it);
+
+        if (this->hasPhysics())
+            this->physicalWorld_->removeRigidBody(object->physicalBody_);
+    }
+
+    /*static*/ bool Scene::collisionCallback(btManifoldPoint& cp, const btCollisionObject* colObj0, int partId0,
+                                             int index0, const btCollisionObject* colObj1, int partId1, int index1)
+    {
+        // get the WorldEntity pointers
+        WorldEntity* object0 = (WorldEntity*)colObj0->getUserPointer();
+        assert(dynamic_cast<WorldEntity*>(object0));
+        WorldEntity* object1 = (WorldEntity*)colObj1->getUserPointer();
+        assert(dynamic_cast<WorldEntity*>(object1));
+
+        // false means that bullet will assume we didn't modify the contact
+        bool modified = false;
+        if (object0->isCollisionCallbackActive())
+        {
+            modified |= object0->collidesAgainst(object1, cp);
+            if (object1->isCollisionCallbackActive())
+                modified |= object1->collidesAgainst(object0, cp);
+        }
+        else
+            modified |= object1->collidesAgainst(object0, cp);
+
+        return modified;
     }
 }
Index: code/trunk/src/orxonox/objects/Scene.h
===================================================================
--- code/trunk/src/orxonox/objects/Scene.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/Scene.h	(revision 2662)
@@ -22,4 +22,5 @@
  *   Author:
  *      Fabian 'x3n' Landau
+ *      Reto Grieder (physics)
  *   Co-authors:
  *      ...
@@ -32,5 +33,5 @@
 #include "OrxonoxPrereqs.h"
 
-#include "network/Synchronisable.h"
+#include "network/synchronisable/Synchronisable.h"
 #include "core/BaseObject.h"
 #include "util/Math.h"
@@ -75,11 +76,67 @@
             void networkcallback_applyAmbientLight()
                 { this->setAmbientLight(this->ambientLight_); }
+            void networkcallback_applyShadows()
+                { this->setShadow(this->bShadows_); }
 
-            Ogre::SceneManager*    sceneManager_;
-            Ogre::SceneNode*       rootSceneNode_;
-            std::string            skybox_;
-            ColourValue            ambientLight_;
-            std::list<BaseObject*> objects_;
-            bool                   bShadows_;
+            Ogre::SceneManager*      sceneManager_;
+            Ogre::SceneNode*         rootSceneNode_;
+
+            std::string              skybox_;
+            ColourValue              ambientLight_;
+            std::list<BaseObject*>   objects_;
+            bool                     bShadows_;
+
+
+        /////////////
+        // Physics //
+        /////////////
+
+        public:
+            inline bool hasPhysics()
+                { return this->physicalWorld_ != 0; }
+            void setPhysicalWorld(bool wantsPhysics);
+
+            void setNegativeWorldRange(const Vector3& range);
+            inline const Vector3& getNegativeWorldRange() const
+                { return this->negativeWorldRange_; }
+
+            void setPositiveWorldRange(const Vector3& range);
+            inline const Vector3& getPositiveWorldRange() const
+                { return this->positiveWorldRange_; }
+
+            void setGravity(const Vector3& gravity);
+            inline const Vector3& getGravity() const
+                { return this->gravity_; }
+
+            void addPhysicalObject(WorldEntity* object);
+            void removePhysicalObject(WorldEntity* object);
+
+        private:
+            inline void networkcallback_hasPhysics()
+                { this->setPhysicalWorld(this->bHasPhysics_); }
+            inline void networkcallback_negativeWorldRange()
+                { this->setNegativeWorldRange(this->negativeWorldRange_); }
+            inline void networkcallback_positiveWorldRange()
+                { this->setPositiveWorldRange(this->positiveWorldRange_); }
+            inline void networkcallback_gravity()
+                { this->setGravity(this->gravity_); }
+
+            // collision callback from bullet
+            static bool collisionCallback(btManifoldPoint& cp, const btCollisionObject* colObj0, int partId0,
+                                          int index0, const btCollisionObject* colObj1, int partId1, int index1);
+
+            // Bullet objects
+            btDiscreteDynamicsWorld*             physicalWorld_;
+            bt32BitAxisSweep3*                   broadphase_;
+            btDefaultCollisionConfiguration*     collisionConfig_;
+            btCollisionDispatcher*               dispatcher_;
+            btSequentialImpulseConstraintSolver* solver_;
+
+            std::set<WorldEntity*>               physicalObjectQueue_;
+            std::set<WorldEntity*>               physicalObjects_;
+            bool                                 bHasPhysics_;
+            Vector3                              negativeWorldRange_;
+            Vector3                              positiveWorldRange_;
+            Vector3                              gravity_;
     };
 }
Index: code/trunk/src/orxonox/objects/Script.cc
===================================================================
--- code/trunk/src/orxonox/objects/Script.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/Script.cc	(revision 2662)
@@ -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/trunk/src/orxonox/objects/Test.cc
===================================================================
--- code/trunk/src/orxonox/objects/Test.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/Test.cc	(revision 2662)
@@ -61,8 +61,13 @@
 	void Test::setConfigValues()
 	{
-		SetConfigValue ( v1, 1 )/*.callback ( this, &Test::checkV1 )*/;
-    SetConfigValue ( v2, 2 )/*.callback ( this, &Test::checkV2 )*/;
-    SetConfigValue ( v3, 3 )/*.callback ( this, &Test::checkV3 )*/;
-    SetConfigValue ( v4, 4 )/*.callback ( this, &Test::checkV4 )*/;
+		SetConfigValue ( u1, 1 )/*.callback ( this, &Test::checkV1 )*/;
+    SetConfigValue ( u2, 2 )/*.callback ( this, &Test::checkV2 )*/;
+    SetConfigValue ( u3, 3 )/*.callback ( this, &Test::checkV3 )*/;
+    SetConfigValue ( u4, 4 )/*.callback ( this, &Test::checkV4 )*/;
+    
+    SetConfigValue ( s1, 1 )/*.callback ( this, &Test::checkV1 )*/;
+    SetConfigValue ( s2, 2 )/*.callback ( this, &Test::checkV2 )*/;
+    SetConfigValue ( s3, 3 )/*.callback ( this, &Test::checkV3 )*/;
+    SetConfigValue ( s4, 4 )/*.callback ( this, &Test::checkV4 )*/;
 	}
 
@@ -70,26 +75,24 @@
 	void Test::registerVariables()
 	{
-		REGISTERDATA ( v1,direction::toclient, new NetworkCallback<Test> ( this, &Test::checkV1 ) );
-    REGISTERDATA ( v2,direction::toserver, new NetworkCallback<Test> ( this, &Test::checkV2 ) );
-		REGISTERDATA ( v3,direction::serverMaster, new NetworkCallback<Test> ( this, &Test::checkV3 ) );
-    REGISTERDATA ( v4,direction::clientMaster, new NetworkCallback<Test> ( this, &Test::checkV4 ) );
+		registerVariable ( u1, variableDirection::toclient, new NetworkCallback<Test> ( this, &Test::checkU1 ));
+    registerVariable ( u2, variableDirection::toserver, new NetworkCallback<Test> ( this, &Test::checkU2 ));
+		registerVariable ( u3, variableDirection::serverMaster, new NetworkCallback<Test> ( this, &Test::checkU3 ), true );
+    registerVariable ( u4, variableDirection::clientMaster, new NetworkCallback<Test> ( this, &Test::checkU4 ), true );
+    
+    registerVariable ( s1, variableDirection::toclient, new NetworkCallback<Test> ( this, &Test::checkS1 ));
+    registerVariable ( s2, variableDirection::toserver, new NetworkCallback<Test> ( this, &Test::checkS2 ));
+    registerVariable ( s3, variableDirection::serverMaster, new NetworkCallback<Test> ( this, &Test::checkS3 ), true );
+    registerVariable ( s4, variableDirection::clientMaster, new NetworkCallback<Test> ( this, &Test::checkS4 ), true );
 	}
 
-  void Test::checkV1(){
-    COUT(1) << "V1 changed: " << v1 << std::endl;
-  }
+  void Test::checkU1(){ COUT(1) << "U1 changed: " << u1 << std::endl; }
+  void Test::checkU2(){ COUT(1) << "U2 changed: " << u2 << std::endl; }
+  void Test::checkU3(){ COUT(1) << "U3 changed: " << u3 << std::endl; }
+  void Test::checkU4(){ COUT(1) << "U4 changed: " << u4 << std::endl; }
 
-  void Test::checkV2(){
-    COUT(1) << "V2 changed: " << v2 << std::endl;
-  }
-
-  void Test::checkV3(){
-    COUT(1) << "V3 changed: " << v3 << std::endl;
-  }
-  
-  void Test::checkV4(){
-    COUT(1) << "V4 changed: " << v4 << std::endl;
-  }
-
+  void Test::checkS1(){ COUT(1) << "S1 changed: " << s1 << std::endl; }
+  void Test::checkS2(){ COUT(1) << "S2 changed: " << s2 << std::endl; }
+  void Test::checkS3(){ COUT(1) << "S3 changed: " << s3 << std::endl; }
+  void Test::checkS4(){ COUT(1) << "S4 changed: " << s4 << std::endl; }
 
 }
Index: code/trunk/src/orxonox/objects/Test.h
===================================================================
--- code/trunk/src/orxonox/objects/Test.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/Test.h	(revision 2662)
@@ -32,5 +32,10 @@
 #include "OrxonoxPrereqs.h"
 #include "core/BaseObject.h"
-#include "network/Synchronisable.h"
+#include "network/synchronisable/Synchronisable.h"
+
+
+typedef int TYPE;
+typedef unsigned int UTYPE;
+
 
 namespace orxonox
@@ -45,24 +50,40 @@
       void registerVariables();
 
-      void setV1(unsigned int value){ v1 = value; }
-      void setV2(unsigned int value){ v2 = value; }
-      void setV3(unsigned int value){ v3 = value; }
-      void setV4(unsigned int value){ v4 = value; }
 
-      void checkV1();
-      void checkV2();
-      void checkV3();
-      void checkV4();
+      //unsigned functions
+      void setU1(UTYPE value){ u1 = value; }
+      void setU2(UTYPE value){ u2 = value; }
+      void setU3(UTYPE value){ u3 = value; }
+      void setU4(UTYPE value){ u4 = value; }
+      void checkU1();
+      void checkU2();
+      void checkU3();
+      void checkU4();
       
-      void printV1(){ instance_->checkV1(); }
-      void printV2(){ instance_->checkV2(); }
-      void printV3(){ instance_->checkV3(); }
-      void printV4(){ instance_->checkV4(); }
+      //signed functions
+      void setS1(TYPE value){ s1 = value; }
+      void setS2(TYPE value){ s2 = value; }
+      void setS3(TYPE value){ s3 = value; }
+      void setS4(TYPE value){ s4 = value; }
+      void checkS1();
+      void checkS2();
+      void checkS3();
+      void checkS4();
+      
+      static void printV1(){ instance_->checkU1(); }
+      static void printV2(){ instance_->checkU2(); }
+      static void printV3(){ instance_->checkU3(); }
+      static void printV4(){ instance_->checkU4(); }
 
     private:
-      unsigned int v1;
-      unsigned int v2;
-      unsigned int v3;
-      unsigned int v4;
+      UTYPE u1;
+      UTYPE u2;
+      UTYPE u3;
+      UTYPE u4;
+      
+      TYPE s1;
+      TYPE s2;
+      TYPE s3;
+      TYPE s4;
       
       static Test* instance_;
Index: code/trunk/src/orxonox/objects/collisionshapes/BoxCollisionShape.cc
===================================================================
--- code/trunk/src/orxonox/objects/collisionshapes/BoxCollisionShape.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/collisionshapes/BoxCollisionShape.cc	(revision 2662)
@@ -0,0 +1,77 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "BoxCollisionShape.h"
+
+#include "BulletCollision/CollisionShapes/btBoxShape.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "tools/BulletConversions.h"
+
+namespace orxonox
+{
+    CreateFactory(BoxCollisionShape);
+
+    BoxCollisionShape::BoxCollisionShape(BaseObject* creator) : CollisionShape(creator)
+    {
+        RegisterObject(BoxCollisionShape);
+
+        this->halfExtents_ = Vector3(1, 1, 1);
+        updateShape();
+
+        this->registerVariables();
+    }
+
+    BoxCollisionShape::~BoxCollisionShape()
+    {
+        if (this->isInitialized())
+            delete this->collisionShape_;
+    }
+
+    void BoxCollisionShape::registerVariables()
+    {
+        registerVariable(this->halfExtents_, variableDirection::toclient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
+    }
+
+    void BoxCollisionShape::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(BoxCollisionShape, XMLPort, xmlelement, mode);
+
+        XMLPortParam(BoxCollisionShape, "halfExtents",  setHalfExtents,  getHalfExtents,  xmlelement, mode);
+        XMLPortParamLoadOnly(BoxCollisionShape, "width",  setWidth,  xmlelement, mode);
+        XMLPortParamLoadOnly(BoxCollisionShape, "height", setHeight, xmlelement, mode);    
+        XMLPortParamLoadOnly(BoxCollisionShape, "length", setLength, xmlelement, mode);    
+    }
+
+    btCollisionShape* BoxCollisionShape::createNewShape() const
+    {
+        return new btBoxShape(omni_cast<btVector3>(this->halfExtents_));
+    }
+}
Index: code/trunk/src/orxonox/objects/collisionshapes/BoxCollisionShape.h
===================================================================
--- code/trunk/src/orxonox/objects/collisionshapes/BoxCollisionShape.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/collisionshapes/BoxCollisionShape.h	(revision 2662)
@@ -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:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _BoxCollisionShape_H__
+#define _BoxCollisionShape_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "CollisionShape.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport BoxCollisionShape : public CollisionShape
+    {
+        public:
+            BoxCollisionShape(BaseObject* creator);
+            virtual ~BoxCollisionShape();
+
+            void registerVariables();
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            inline void setHalfExtents(const Vector3& extents)
+                { this->halfExtents_ = extents; updateShape(); }
+            inline const Vector3& getHalfExtents() const
+                { return halfExtents_;}
+
+            inline void setWidth(float value)
+                { this->halfExtents_.z = value / 2; updateShape(); }
+            inline float getWidth() const
+                { return this->halfExtents_.z * 2; }
+
+            inline void setHeight(float value)
+                { this->halfExtents_.y = value / 2; updateShape(); }
+            inline float getHeight() const
+                { return this->halfExtents_.y * 2; }
+
+            inline void setLength(float value)
+                { this->halfExtents_.x = value / 2; updateShape(); }
+            inline float getLength() const
+                { return this->halfExtents_.x * 2; }
+
+        private:
+            btCollisionShape* createNewShape() const;
+
+            Vector3 halfExtents_;
+     };
+}
+
+#endif /* _BoxCollisionShape_H__ */
Index: code/trunk/src/orxonox/objects/collisionshapes/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/objects/collisionshapes/CMakeLists.txt	(revision 2662)
+++ code/trunk/src/orxonox/objects/collisionshapes/CMakeLists.txt	(revision 2662)
@@ -0,0 +1,11 @@
+SET( SRC_FILES
+  BoxCollisionShape.cc
+  CollisionShape.cc
+  CompoundCollisionShape.cc
+  ConeCollisionShape.cc
+  PlaneCollisionShape.cc
+  SphereCollisionShape.cc
+  WorldEntityCollisionShape.cc
+)
+
+ADD_SOURCE_FILES(SRC_FILES)
Index: code/trunk/src/orxonox/objects/collisionshapes/CollisionShape.cc
===================================================================
--- code/trunk/src/orxonox/objects/collisionshapes/CollisionShape.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/collisionshapes/CollisionShape.cc	(revision 2662)
@@ -0,0 +1,163 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "CollisionShape.h"
+
+#include "BulletCollision/CollisionShapes/btCollisionShape.h"
+
+#include "util/Exception.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "tools/BulletConversions.h"
+
+#include "objects/worldentities/WorldEntity.h"
+#include "CompoundCollisionShape.h"
+#include "WorldEntityCollisionShape.h"
+
+namespace orxonox
+{
+    CollisionShape::CollisionShape(BaseObject* creator)
+        : BaseObject(creator)
+        , Synchronisable(creator)
+    {
+        RegisterObject(CollisionShape);
+
+        this->parent_ = 0;
+        this->parentID_ = OBJECTID_UNKNOWN;
+        this->collisionShape_ = 0;
+        this->position_ = Vector3::ZERO;
+        this->orientation_ = Quaternion::IDENTITY;
+        this->scale_ = Vector3::UNIT_SCALE;
+
+        this->registerVariables();
+    }
+
+    CollisionShape::~CollisionShape()
+    {
+        // Detach from parent
+        if (this->isInitialized() && this->parent_)
+            this->parent_->detach(this);
+    }
+
+    void CollisionShape::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(CollisionShape, XMLPort, xmlelement, mode);
+
+        XMLPortParamTemplate(CollisionShape, "position", setPosition, getPosition, xmlelement, mode, const Vector3&);
+        XMLPortParamTemplate(CollisionShape, "orientation", setOrientation, getOrientation, xmlelement, mode, const Quaternion&);
+        XMLPortParamTemplate(CollisionShape, "scale3D", setScale3D, getScale3D, xmlelement, mode, const Vector3&);
+        XMLPortParamLoadOnly(CollisionShape, "scale", setScale, xmlelement, mode);
+        XMLPortParamLoadOnly(CollisionShape, "yaw",   yaw,   xmlelement, mode);
+        XMLPortParamLoadOnly(CollisionShape, "pitch", pitch, xmlelement, mode);
+        XMLPortParamLoadOnly(CollisionShape, "roll",  roll,  xmlelement, mode);
+    }
+
+    void CollisionShape::registerVariables()
+    {
+        registerVariable(this->parentID_, variableDirection::toclient, new NetworkCallback<CollisionShape>(this, &CollisionShape::parentChanged));
+    }
+
+    void CollisionShape::parentChanged()
+    {
+        Synchronisable* parent = Synchronisable::getSynchronisable(this->parentID_);
+        // Parent can either be a WorldEntity or a CompoundCollisionShape. The reason is that the
+        // internal collision shape (which is compound) of a WE doesn't get synchronised.
+        CompoundCollisionShape* parentCCS = dynamic_cast<CompoundCollisionShape*>(parent);
+        if (parentCCS)
+            parentCCS->attach(this);
+        else
+        {
+            WorldEntity* parentWE = dynamic_cast<WorldEntity*>(parent);
+            if (parentWE)
+                parentWE->attachCollisionShape(this);
+        }
+    }
+
+    bool CollisionShape::notifyBeingAttached(CompoundCollisionShape* newParent)
+    {
+        if (this->parent_)
+            this->parent_->detach(this);
+
+        this->parent_ = newParent;
+
+        WorldEntityCollisionShape* parentWECCS = dynamic_cast<WorldEntityCollisionShape*>(newParent);
+        if (parentWECCS)
+            this->parentID_ = parentWECCS->getWorldEntityOwner()->getObjectID();
+        else
+            this->parentID_ = newParent->getObjectID();
+
+        return true;
+    }
+
+    void CollisionShape::notifyDetached()
+    {
+        this->parent_ = 0;
+        this->parentID_ = OBJECTID_UNKNOWN;
+    }
+
+    void CollisionShape::updateParent()
+    {
+        if (this->parent_)
+            this->parent_->updateAttachedShape(this);
+    }
+
+    bool CollisionShape::hasTransform() const
+    {
+        return (!this->position_.positionEquals(Vector3(0, 0, 0), 0.001) ||
+                !this->orientation_.equals(Quaternion(1,0,0,0), Degree(0.1)));
+    }
+
+    void CollisionShape::setScale3D(const Vector3& scale)
+    {
+        CCOUT(2) << "Warning: Cannot set the scale of a collision shape: Not yet implemented." << std::endl;
+    }
+
+    void CollisionShape::setScale(float scale)
+    {
+        CCOUT(2) << "Warning: Cannot set the scale of a collision shape: Not yet implemented." << std::endl;
+    }
+
+    void CollisionShape::updateShape()
+    {
+        btCollisionShape* oldShape = this->collisionShape_;
+        this->collisionShape_ = this->createNewShape();
+        // When we recreate the shape, we have to inform the parent about this to update the shape
+        this->updateParent();
+        if (oldShape)
+            delete oldShape;
+    }
+
+    void CollisionShape::calculateLocalInertia(btScalar mass, btVector3& inertia) const
+    {
+        if (this->collisionShape_)
+            this->collisionShape_->calculateLocalInertia(mass, inertia);
+        else
+            inertia.setValue(0, 0, 0);
+    }
+}
Index: code/trunk/src/orxonox/objects/collisionshapes/CollisionShape.h
===================================================================
--- code/trunk/src/orxonox/objects/collisionshapes/CollisionShape.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/collisionshapes/CollisionShape.h	(revision 2662)
@@ -0,0 +1,96 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _CollisionShape_H__
+#define _CollisionShape_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "util/Math.h"
+#include "core/BaseObject.h"
+#include "network/synchronisable/Synchronisable.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport CollisionShape : public BaseObject, public Synchronisable
+    {
+        public:
+            CollisionShape(BaseObject* creator);
+            virtual ~CollisionShape();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            void registerVariables();
+
+            inline void setPosition(const Vector3& position)
+                { this->position_ = position; this->updateParent(); }
+            inline const Vector3& getPosition() const
+                { return this->position_; }
+
+            inline void setOrientation(const Quaternion& orientation)
+                { this->orientation_ = orientation; this->updateParent(); }
+            inline const Quaternion& getOrientation() const
+                { return this->orientation_; }
+
+            void yaw(const Degree& angle)   { this->setOrientation(this->orientation_ * Quaternion(angle, Vector3::UNIT_Y)); }
+            void pitch(const Degree& angle) { this->setOrientation(this->orientation_ * Quaternion(angle, Vector3::UNIT_X)); }
+            void roll(const Degree& angle)  { this->setOrientation(this->orientation_ * Quaternion(angle, Vector3::UNIT_Z)); }
+
+            virtual void setScale3D(const Vector3& scale);
+            virtual void setScale(float scale);
+            inline const Vector3& getScale3D(void) const
+                { return this->scale_; }
+
+            void updateShape();
+
+            void calculateLocalInertia(float mass, btVector3& inertia) const;
+
+            inline btCollisionShape* getCollisionShape() const
+                { return this->collisionShape_; }
+
+            bool hasTransform() const;
+
+            bool notifyBeingAttached(CompoundCollisionShape* newParent);
+            void notifyDetached();
+
+        protected:
+            virtual void updateParent();
+            virtual void parentChanged();
+            virtual btCollisionShape* createNewShape() const = 0;
+
+            btCollisionShape*       collisionShape_;
+            CompoundCollisionShape* parent_;
+            unsigned int            parentID_;
+
+        private:
+            Vector3                 position_;
+            Quaternion              orientation_;
+            Vector3                 scale_;
+    };
+}
+
+#endif /* _CollisionShape_H__ */
Index: code/trunk/src/orxonox/objects/collisionshapes/CompoundCollisionShape.cc
===================================================================
--- code/trunk/src/orxonox/objects/collisionshapes/CompoundCollisionShape.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/collisionshapes/CompoundCollisionShape.cc	(revision 2662)
@@ -0,0 +1,194 @@
+/*
+ *   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:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "CompoundCollisionShape.h"
+
+#include "BulletCollision/CollisionShapes/btCompoundShape.h"
+
+#include "util/Exception.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "tools/BulletConversions.h"
+
+namespace orxonox
+{
+    CreateFactory(CompoundCollisionShape);
+
+    CompoundCollisionShape::CompoundCollisionShape(BaseObject* creator) : CollisionShape(creator)
+    {
+        RegisterObject(CompoundCollisionShape);
+
+        this->compoundShape_  = new btCompoundShape();
+    }
+
+    CompoundCollisionShape::~CompoundCollisionShape()
+    {
+        if (this->isInitialized())
+        {
+            // Delete all children
+            for (std::map<CollisionShape*, btCollisionShape*>::iterator it = this->attachedShapes_.begin();
+                it != this->attachedShapes_.end(); ++it)
+            {
+                // make sure that the child doesn't want to detach itself --> speedup because of the missing update
+                it->first->notifyDetached();
+                delete it->first;
+            }
+
+            delete this->compoundShape_;
+        }
+    }
+
+    void CompoundCollisionShape::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(CompoundCollisionShape, XMLPort, xmlelement, mode);
+        // Attached collision shapes
+        XMLPortObject(CompoundCollisionShape, CollisionShape, "", attach, detach, xmlelement, mode);
+    }
+
+    void CompoundCollisionShape::attach(CollisionShape* shape)
+    {
+        if (!shape || static_cast<CollisionShape*>(this) == shape)
+            return;
+        if (this->attachedShapes_.find(shape) != this->attachedShapes_.end())
+        {
+            CCOUT(2) << "Warning: Attaching a CollisionShape twice is not yet supported." << std::endl;
+            return;
+        }
+
+        if (!shape->notifyBeingAttached(this))
+            return;
+
+        this->attachedShapes_[shape] = shape->getCollisionShape();
+
+        if (shape->getCollisionShape())
+        {
+            // Only actually attach if we didn't pick a CompoundCollisionShape with no content
+            btTransform transf(omni_cast<btQuaternion>(shape->getOrientation()), omni_cast<btVector3>(shape->getPosition()));
+            this->compoundShape_->addChildShape(transf, shape->getCollisionShape());
+
+            this->updatePublicShape();
+        }
+    }
+
+    void CompoundCollisionShape::detach(CollisionShape* shape)
+    {
+        if (this->attachedShapes_.find(shape) != this->attachedShapes_.end())
+        {
+            this->attachedShapes_.erase(shape);
+            if (shape->getCollisionShape())
+                this->compoundShape_->removeChildShape(shape->getCollisionShape());
+            shape->notifyDetached();
+
+            this->updatePublicShape();
+        }
+        else
+            CCOUT(2) << "Warning: Cannot detach non child collision shape" << std::endl;
+    }
+
+    void CompoundCollisionShape::detachAll()
+    {
+        while (this->attachedShapes_.size() > 0)
+            this->detach(this->attachedShapes_.begin()->first);
+    }
+
+    void CompoundCollisionShape::updateAttachedShape(CollisionShape* shape)
+    {
+        if (!shape)
+            return;
+        std::map<CollisionShape*, btCollisionShape*>::iterator it = this->attachedShapes_.find(shape);
+        if (it == this->attachedShapes_.end())
+        {
+            CCOUT(2) << "Warning: Cannot update child shape: Instance not a child." << std::endl;
+            return;
+        }
+
+        // Remove old btCollisionShape, stored in the children map
+        if (it->second)
+            this->compoundShape_->removeChildShape(it->second);
+        if (shape->getCollisionShape())
+        {
+            // Only actually attach if we didn't pick a CompoundCollisionShape with no content
+            btTransform transf(omni_cast<btQuaternion>(shape->getOrientation()), omni_cast<btVector3>(shape->getPosition()));
+            this->compoundShape_->addChildShape(transf, shape->getCollisionShape());
+            it->second = shape->getCollisionShape();
+        }
+
+        this->updatePublicShape();
+    }
+
+    void CompoundCollisionShape::updatePublicShape()
+    {
+        btCollisionShape* primitive = 0;
+        bool bPrimitive = true;
+        bool bEmpty = true;
+        for (std::map<CollisionShape*, btCollisionShape*>::const_iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); ++it)
+        {
+            if (it->second)
+            {
+                bEmpty = false;
+                if (!it->first->hasTransform() && !bPrimitive)
+                    primitive = it->second;
+                else
+                    bPrimitive = false;
+            }
+        }
+        if (bEmpty)
+        {
+            if (this->collisionShape_ == 0)
+            {
+                this->collisionShape_ = 0;
+                return;
+            }
+            this->collisionShape_ = 0;
+        }
+        else if (bPrimitive)
+        {
+            // --> Only one shape to be added, no transform; return it directly
+            this->collisionShape_ = primitive;
+        }
+        else
+        {
+            // Make sure we use the compound shape when returning a btCollisionShape
+            this->collisionShape_ = this->compoundShape_;
+        }
+        this->updateParent();
+    }
+
+    CollisionShape* CompoundCollisionShape::getAttachedShape(unsigned int index) const
+    {
+        unsigned int i = 0;
+        for (std::map<CollisionShape*, btCollisionShape*>::const_iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); ++it)
+        {
+            if (i == index)
+                return it->first;
+            ++i;
+        }
+        return 0;
+    }
+}
Index: code/trunk/src/orxonox/objects/collisionshapes/CompoundCollisionShape.h
===================================================================
--- code/trunk/src/orxonox/objects/collisionshapes/CompoundCollisionShape.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/collisionshapes/CompoundCollisionShape.h	(revision 2662)
@@ -0,0 +1,65 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _CompoundCollisionShape_H__
+#define _CompoundCollisionShape_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <vector>
+#include <cassert>
+#include "CollisionShape.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport CompoundCollisionShape : public CollisionShape
+    {
+        public:
+            CompoundCollisionShape(BaseObject* creator);
+            virtual ~CompoundCollisionShape();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            void attach(CollisionShape* shape);
+            void detach(CollisionShape* shape);
+            void detachAll();
+            CollisionShape* getAttachedShape(unsigned int index) const;
+
+            void updateAttachedShape(CollisionShape* shape);
+
+        private:
+            void updatePublicShape();
+            inline virtual btCollisionShape* createNewShape() const
+                { assert(false); return 0; }
+
+            btCompoundShape* compoundShape_;
+            std::map<CollisionShape*, btCollisionShape*> attachedShapes_;
+    };
+}
+
+#endif /* _CompoundCollisionShape_H__ */
Index: code/trunk/src/orxonox/objects/collisionshapes/ConeCollisionShape.cc
===================================================================
--- code/trunk/src/orxonox/objects/collisionshapes/ConeCollisionShape.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/collisionshapes/ConeCollisionShape.cc	(revision 2662)
@@ -0,0 +1,77 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "ConeCollisionShape.h"
+
+#include "BulletCollision/CollisionShapes/btConeShape.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "tools/BulletConversions.h"
+
+namespace orxonox
+{
+    CreateFactory(ConeCollisionShape);
+
+    ConeCollisionShape::ConeCollisionShape(BaseObject* creator) : CollisionShape(creator)
+    {
+        RegisterObject(ConeCollisionShape);
+
+        this->radius_ = 1.0f;
+        this->height_ = 1.0f;
+        updateShape();
+
+        this->registerVariables();
+    }
+
+    ConeCollisionShape::~ConeCollisionShape()
+    {
+        if (this->isInitialized())
+            delete this->collisionShape_;
+    }
+
+    void ConeCollisionShape::registerVariables()
+    {
+        registerVariable(this->radius_, variableDirection::toclient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
+        registerVariable(this->height_, variableDirection::toclient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
+    }
+
+    void ConeCollisionShape::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(ConeCollisionShape, XMLPort, xmlelement, mode);
+
+        XMLPortParam(ConeCollisionShape, "radius", setRadius, getRadius, xmlelement, mode);
+        XMLPortParam(ConeCollisionShape, "height", setHeight, getHeight, xmlelement, mode);    
+    }
+
+    btCollisionShape* ConeCollisionShape::createNewShape() const
+    {
+        return new btConeShape(this->radius_, this->height_);
+    }
+}
Index: code/trunk/src/orxonox/objects/collisionshapes/ConeCollisionShape.h
===================================================================
--- code/trunk/src/orxonox/objects/collisionshapes/ConeCollisionShape.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/collisionshapes/ConeCollisionShape.h	(revision 2662)
@@ -0,0 +1,65 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _ConeCollisionShape_H__
+#define _ConeCollisionShape_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "CollisionShape.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport ConeCollisionShape : public CollisionShape
+    {
+        public:
+            ConeCollisionShape(BaseObject* creator);
+            virtual ~ConeCollisionShape();
+
+            void registerVariables();
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            inline void setRadius(float value)
+                { this->radius_ = value; updateShape(); }
+            inline float getRadius() const
+                { return radius_; }
+
+            inline void setHeight(float value)
+                { this->height_ = value; updateShape(); }
+            inline float getHeight() const
+                { return this->height_; }
+
+        private:
+            btCollisionShape* createNewShape() const;
+
+            float radius_;
+            float height_;
+     };
+}
+
+#endif /* _ConeCollisionShape_H__ */
Index: code/trunk/src/orxonox/objects/collisionshapes/PlaneCollisionShape.cc
===================================================================
--- code/trunk/src/orxonox/objects/collisionshapes/PlaneCollisionShape.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/collisionshapes/PlaneCollisionShape.cc	(revision 2662)
@@ -0,0 +1,77 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Martin Stypinski
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "PlaneCollisionShape.h"
+
+#include "BulletCollision/CollisionShapes/btStaticPlaneShape.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "tools/BulletConversions.h"
+
+namespace orxonox
+{
+    CreateFactory(PlaneCollisionShape);
+
+    PlaneCollisionShape::PlaneCollisionShape(BaseObject* creator) : CollisionShape(creator)
+    {
+        RegisterObject(PlaneCollisionShape);
+
+        this->normal_ = Vector3(0, 1, 0);
+        this->offset_ = 0.0f;
+        updateShape();
+
+        this->registerVariables();
+    }
+
+    PlaneCollisionShape::~PlaneCollisionShape()
+    {
+        if (this->isInitialized())
+            delete this->collisionShape_;
+    }
+
+    void PlaneCollisionShape::registerVariables()
+    {
+        registerVariable(this->normal_, variableDirection::toclient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
+        registerVariable(this->offset_, variableDirection::toclient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
+    }
+
+    void PlaneCollisionShape::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(PlaneCollisionShape, XMLPort, xmlelement, mode);
+
+        XMLPortParam(PlaneCollisionShape, "normal", setNormal, getNormal, xmlelement, mode);
+        XMLPortParam(PlaneCollisionShape, "offset", setOffset, getOffset, xmlelement, mode);    
+    }
+
+    btCollisionShape* PlaneCollisionShape::createNewShape() const
+    {
+        return new btStaticPlaneShape(omni_cast<btVector3>(this->normal_), this->offset_);
+    }
+}
Index: code/trunk/src/orxonox/objects/collisionshapes/PlaneCollisionShape.h
===================================================================
--- code/trunk/src/orxonox/objects/collisionshapes/PlaneCollisionShape.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/collisionshapes/PlaneCollisionShape.h	(revision 2662)
@@ -0,0 +1,65 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Martin Stypinski
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _PlaneCollisionShape_H__
+#define _PlaneCollisionShape_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "CollisionShape.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport PlaneCollisionShape : public CollisionShape
+    {
+        public:
+            PlaneCollisionShape(BaseObject* creator);
+            virtual ~PlaneCollisionShape();
+
+            void registerVariables();
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            inline void setNormal(const Vector3& normal)
+                { this->normal_ = normal; updateShape(); }
+            inline const Vector3& getNormal()
+                { return normal_;}
+
+            inline void setOffset(float offset)
+                { this->offset_ = offset; updateShape(); }
+            inline float getOffset()
+                { return this->offset_;}
+
+        private:
+            btCollisionShape* createNewShape()const;
+
+            Vector3 normal_;
+            float   offset_;
+     };
+}
+
+#endif /* _PlaneCollisionShape_H__ */
Index: code/trunk/src/orxonox/objects/collisionshapes/SphereCollisionShape.cc
===================================================================
--- code/trunk/src/orxonox/objects/collisionshapes/SphereCollisionShape.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/collisionshapes/SphereCollisionShape.cc	(revision 2662)
@@ -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:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "SphereCollisionShape.h"
+
+#include "BulletCollision/CollisionShapes/btSphereShape.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "tools/BulletConversions.h"
+
+namespace orxonox
+{
+    CreateFactory(SphereCollisionShape);
+
+    SphereCollisionShape::SphereCollisionShape(BaseObject* creator) : CollisionShape(creator)
+    {
+        RegisterObject(SphereCollisionShape);
+
+        this->radius_ = 1.0f;
+        updateShape();
+
+        this->registerVariables();
+    }
+
+    SphereCollisionShape::~SphereCollisionShape()
+    {
+        if (this->isInitialized())
+            delete this->collisionShape_;
+    }
+
+    void SphereCollisionShape::registerVariables()
+    {
+        registerVariable(this->radius_, variableDirection::toclient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
+    }
+
+    void SphereCollisionShape::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(SphereCollisionShape, XMLPort, xmlelement, mode);
+
+        XMLPortParam(SphereCollisionShape, "radius", setRadius, getRadius, xmlelement, mode);
+    }
+
+    btCollisionShape* SphereCollisionShape::createNewShape() const
+    {
+        return new btSphereShape(this->radius_);
+    }
+}
Index: code/trunk/src/orxonox/objects/collisionshapes/SphereCollisionShape.h
===================================================================
--- code/trunk/src/orxonox/objects/collisionshapes/SphereCollisionShape.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/collisionshapes/SphereCollisionShape.h	(revision 2662)
@@ -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:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _SphereCollisionShape_H__
+#define _SphereCollisionShape_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "CollisionShape.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport SphereCollisionShape : public CollisionShape
+    {
+        public:
+            SphereCollisionShape(BaseObject* creator);
+            virtual ~SphereCollisionShape();
+
+            void registerVariables();
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            inline void setRadius(float radius)
+                { this->radius_ = radius; updateShape(); }
+            inline float getRadius() const
+                { return this->radius_; }
+
+        private:
+            btCollisionShape* createNewShape() const;
+
+            float radius_;
+    };
+}
+
+#endif /* _SphereCollisionShape_H__ */
Index: code/trunk/src/orxonox/objects/collisionshapes/WorldEntityCollisionShape.cc
===================================================================
--- code/trunk/src/orxonox/objects/collisionshapes/WorldEntityCollisionShape.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/collisionshapes/WorldEntityCollisionShape.cc	(revision 2662)
@@ -0,0 +1,69 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "WorldEntityCollisionShape.h"
+
+#include "BulletCollision/CollisionShapes/btCompoundShape.h"
+
+#include "util/Exception.h"
+#include "core/CoreIncludes.h"
+#include "objects/worldentities/WorldEntity.h"
+
+namespace orxonox
+{
+    WorldEntityCollisionShape::WorldEntityCollisionShape(WorldEntity* creator) : CompoundCollisionShape(creator)
+    {
+        RegisterObject(WorldEntityCollisionShape);
+
+        this->worldEntityOwner_ = creator;
+        // suppress synchronisation
+        this->setObjectMode(0x0);
+    }
+
+    WorldEntityCollisionShape::~WorldEntityCollisionShape()
+    {
+        // Called always by WE destructor
+    }
+
+    void WorldEntityCollisionShape::updateParent()
+    {
+        // Note: This shape may also be attached to a CompoundCollisionShape because it's hosting
+        // WorldEntity has been attached to another one.
+        CollisionShape::updateParent();
+
+        assert(this->worldEntityOwner_ != 0);
+        this->worldEntityOwner_->notifyCollisionShapeChanged();
+    }
+
+    void WorldEntityCollisionShape::parentChanged()
+    {
+        // This object does not get synchronised. This method should never be called then!
+        OrxAssert(false, "parentChanged has been called on a non synchronised WorldEntityCollisionShape!");
+    }
+}
Index: code/trunk/src/orxonox/objects/collisionshapes/WorldEntityCollisionShape.h
===================================================================
--- code/trunk/src/orxonox/objects/collisionshapes/WorldEntityCollisionShape.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/collisionshapes/WorldEntityCollisionShape.h	(revision 2662)
@@ -0,0 +1,57 @@
+/*
+ *   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:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _WorldEntityCollisionShape_H__
+#define _WorldEntityCollisionShape_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "CompoundCollisionShape.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport WorldEntityCollisionShape : public CompoundCollisionShape
+    {
+        public:
+            WorldEntityCollisionShape(WorldEntity* creator);
+            virtual ~WorldEntityCollisionShape();
+
+            inline WorldEntity* getWorldEntityOwner()
+                { return this->worldEntityOwner_; }
+
+        protected:
+            virtual void updateParent();
+
+        private:
+            void parentChanged();
+
+            WorldEntity* worldEntityOwner_;
+    };
+}
+
+#endif /* _WorldEntityCollisionShape_H__ */
Index: code/trunk/src/orxonox/objects/controllers/AIController.cc
===================================================================
--- code/trunk/src/orxonox/objects/controllers/AIController.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/controllers/AIController.cc	(revision 2662)
@@ -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:
+ *      ...
+ *
+ */
+
+#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(WeaponMode::fire);
+
+        SUPER(AIController, tick, dt);
+    }
+
+}
Index: code/trunk/src/orxonox/objects/controllers/AIController.h
===================================================================
--- code/trunk/src/orxonox/objects/controllers/AIController.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/controllers/AIController.h	(revision 2662)
@@ -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/trunk/src/orxonox/objects/controllers/ArtificialController.cc
===================================================================
--- code/trunk/src/orxonox/objects/controllers/ArtificialController.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/controllers/ArtificialController.cc	(revision 2662)
@@ -0,0 +1,149 @@
+/*
+ *   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 > 10)
+        {
+            // 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 < 200 && 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(-2000,2000), rnd(-2000,2000), rnd(-2000,2000));
+        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())
+            if (static_cast<ControllableEntity*>(*it) != this->getControllableEntity())
+            {
+                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 = 1250;
+
+        this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getPosition(), hardcoded_projectile_speed, this->target_->getPosition(), 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::destroyedPawn(Pawn* ship)
+    {
+        if (ship == this->target_)
+        {
+            this->forgetTarget();
+            this->searchRandomTargetPosition();
+        }
+    }
+}
Index: code/trunk/src/orxonox/objects/controllers/ArtificialController.h
===================================================================
--- code/trunk/src/orxonox/objects/controllers/ArtificialController.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/controllers/ArtificialController.h	(revision 2662)
@@ -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 _ArtificialController_H__
+#define _ArtificialController_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "Controller.h"
+#include "objects/worldentities/pawns/Pawn.h"
+#include "util/Math.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport ArtificialController : public Controller, public PawnListener
+    {
+        public:
+            ArtificialController(BaseObject* creator);
+            virtual ~ArtificialController();
+
+            virtual void destroyedPawn(Pawn* pawn);
+
+        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/trunk/src/orxonox/objects/controllers/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/objects/controllers/CMakeLists.txt	(revision 2262)
+++ code/trunk/src/orxonox/objects/controllers/CMakeLists.txt	(revision 2662)
@@ -2,4 +2,7 @@
   Controller.cc
   HumanController.cc
+  ArtificialController.cc
+  AIController.cc
+  ScriptController.cc
 )
 
Index: code/trunk/src/orxonox/objects/controllers/Controller.cc
===================================================================
--- code/trunk/src/orxonox/objects/controllers/Controller.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/controllers/Controller.cc	(revision 2662)
@@ -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/trunk/src/orxonox/objects/controllers/Controller.h
===================================================================
--- code/trunk/src/orxonox/objects/controllers/Controller.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/controllers/Controller.h	(revision 2662)
@@ -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/trunk/src/orxonox/objects/controllers/HumanController.cc
===================================================================
--- code/trunk/src/orxonox/objects/controllers/HumanController.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/controllers/HumanController.cc	(revision 2662)
@@ -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,13 @@
     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);
+    SetConsoleCommand(HumanController, dropItems,     true);
 
     CreateUnloadableFactory(HumanController);
@@ -103,5 +111,5 @@
     {
         if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
-            HumanController::localController_s->controllableEntity_->fire();
+            HumanController::localController_s->controllableEntity_->fire(WeaponMode::fire);
     }
 
@@ -109,5 +117,11 @@
     {
         if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
-            HumanController::localController_s->controllableEntity_->altFire();
+            HumanController::localController_s->controllableEntity_->fire(WeaponMode::altFire);
+    }
+
+    void HumanController::boost()
+    {
+        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
+            HumanController::localController_s->controllableEntity_->boost();
     }
 
@@ -129,3 +143,37 @@
             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);
+    }
+
+    void HumanController::dropItems()
+    {
+        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
+            HumanController::localController_s->controllableEntity_->dropItems();
+    }
 }
Index: code/trunk/src/orxonox/objects/controllers/HumanController.h
===================================================================
--- code/trunk/src/orxonox/objects/controllers/HumanController.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/controllers/HumanController.h	(revision 2662)
@@ -54,7 +54,15 @@
             static void altFire();
 
+            static void boost();
             static void greet();
             static void use();
             static void switchCamera();
+            static void mouseLook();
+            static void dropItems();
+
+            static void suicide();
+
+            static void addBots(unsigned int amount);
+            static void killBots(unsigned int amount = 0);
 
         private:
Index: code/trunk/src/orxonox/objects/controllers/ScriptController.cc
===================================================================
--- code/trunk/src/orxonox/objects/controllers/ScriptController.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/controllers/ScriptController.cc	(revision 2662)
@@ -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/trunk/src/orxonox/objects/controllers/ScriptController.h
===================================================================
--- code/trunk/src/orxonox/objects/controllers/ScriptController.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/controllers/ScriptController.h	(revision 2662)
@@ -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/trunk/src/orxonox/objects/gametypes/Gametype.cc
===================================================================
--- code/trunk/src/orxonox/objects/gametypes/Gametype.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/gametypes/Gametype.cc	(revision 2662)
@@ -34,7 +34,14 @@
 
 #include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
+#include "core/Template.h"
+#include "core/Core.h"
+#include "overlays/OverlayGroup.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 "Settings.h"
 
 #include "network/Host.h"
@@ -44,26 +51,50 @@
     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_);
+
+        // load the corresponding score board
+        if (Core::showsGraphics() && this->scoreboardTemplate_ != "")
+        {
+            this->scoreboard_ = new OverlayGroup(this);
+            this->scoreboard_->addTemplate(this->scoreboardTemplate_);
+            this->scoreboard_->setGametype(this);
+        }
+        else
+            this->scoreboard_ = 0;
+    }
+
+    void Gametype::setConfigValues()
+    {
+        SetConfigValue(initialStartCountdown_, 3.0f);
+        SetConfigValue(bAutoStart_, false);
+        SetConfigValue(bForceSpawn_, false);
+        SetConfigValue(numberOfBots_, 0);
+        SetConfigValue(scoreboardTemplate_, "defaultScoreboard");
     }
 
     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 +107,5 @@
     {
         COUT(0) << "game started" << std::endl;
-        this->bStarted_ = true;
+        this->gtinfo_.bStarted_ = true;
 
         this->spawnPlayersIfRequested();
@@ -84,10 +115,10 @@
     {
         COUT(0) << "game ended" << std::endl;
-        this->bEnded_ = true;
+        this->gtinfo_.bEnded_ = true;
     }
 
     void Gametype::playerEntered(PlayerInfo* player)
     {
-        this->players_[player] = PlayerState::Joined;
+        this->players_[player].state_ = PlayerState::Joined;
 
         std::string message = player->getName() + " entered the game";
@@ -98,5 +129,5 @@
     void Gametype::playerLeft(PlayerInfo* player)
     {
-        std::map<PlayerInfo*, PlayerState::Enum>::iterator it = this->players_.find(player);
+        std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);
         if (it != this->players_.end())
         {
@@ -140,8 +171,62 @@
     void Gametype::pawnKilled(Pawn* victim, Pawn* killer)
     {
-    }
-
-    void Gametype::playerScored(PlayerInfo* player)
-    {
+        if (victim && victim->getPlayer())
+        {
+            std::string message;
+            if (killer)
+            {
+                if (killer->getPlayer())
+                    message = victim->getPlayer()->getName() + " was killed by " + killer->getPlayer()->getName();
+                else
+                    message = victim->getPlayer()->getName() + " was killed";
+            }
+            else
+                message = victim->getPlayer()->getName() + " died";
+
+            COUT(0) << message << std::endl;
+            Host::Broadcast(message);
+        }
+
+        if (victim && victim->getPlayer())
+        {
+            std::map<PlayerInfo*, Player>::iterator it = this->players_.find(victim->getPlayer());
+            if (it != this->players_.end())
+            {
+                it->second.state_ = PlayerState::Dead;
+                it->second.killed_++;
+
+                // Reward killer
+                if (killer)
+                {
+                    std::map<PlayerInfo*, Player>::iterator itKiller = this->players_.find(killer->getPlayer());
+                    if (itKiller != this->players_.end())
+                    {
+                        this->playerScored(itKiller->second);
+                    }
+                    else
+                        COUT(2) << "Warning: Killing Pawn was not in the playerlist" << std::endl;
+                }
+
+                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;
+        }
+    }
+
+    void Gametype::playerScored(Player& player)
+    {
+        player.frags_++;
     }
 
@@ -150,7 +235,4 @@
         if (this->spawnpoints_.size() > 0)
         {
-            srand(time(0));
-            rnd();
-
             unsigned int randomspawn = (unsigned int)rnd(this->spawnpoints_.size());
             unsigned int index = 0;
@@ -168,57 +250,65 @@
     void Gametype::assignDefaultPawnsIfNeeded()
     {
-        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;
+        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
+        {
+            if (!it->first->getControllableEntity())
+            {
+                it->second.state_ = 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.state_ = 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;
-                    for (std::map<PlayerInfo*, PlayerState::Enum>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
+                    bool hashumanplayers = false;
+                    for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
                     {
                         if (!it->first->isReadyToSpawn())
                             allplayersready = false;
-                    }
-                    if (allplayersready)
-                    {
-                        this->startCountdown_ = this->initialStartCountdown_;
-                        this->bStartCountdownRunning_ = true;
+                        if (it->first->isHumanPlayer())
+                            hashumanplayers = true;
+                    }
+                    if (allplayersready && hashumanplayers)
+                    {
+                        this->gtinfo_.startCountdown_ = this->initialStartCountdown_;
+                        this->gtinfo_.bStartCountdownRunning_ = true;
                     }
                 }
@@ -229,5 +319,5 @@
     void Gametype::spawnPlayersIfRequested()
     {
-        for (std::map<PlayerInfo*, PlayerState::Enum>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
+        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
             if (it->first->isReadyToSpawn() || this->bForceSpawn_)
                 this->spawnPlayer(it->first);
@@ -236,6 +326,6 @@
     void Gametype::spawnDeadPlayersIfRequested()
     {
-        for (std::map<PlayerInfo*, PlayerState::Enum>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
-            if (it->second == PlayerState::Dead)
+        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
+            if (it->second.state_ == PlayerState::Dead)
                 if (it->first->isReadyToSpawn() || this->bForceSpawn_)
                     this->spawnPlayer(it->first);
@@ -248,5 +338,5 @@
         {
             player->startControl(spawnpoint->spawn());
-            this->players_[player] = PlayerState::Alive;
+            this->players_[player].state_ = PlayerState::Alive;
         }
         else
@@ -256,3 +346,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/trunk/src/orxonox/objects/gametypes/Gametype.h
===================================================================
--- code/trunk/src/orxonox/objects/gametypes/Gametype.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/gametypes/Gametype.h	(revision 2662)
@@ -38,4 +38,5 @@
 #include "objects/worldentities/ControllableEntity.h"
 #include "objects/Tickable.h"
+#include "objects/infos/GametypeInfo.h"
 
 namespace orxonox
@@ -52,4 +53,12 @@
     }
 
+    struct Player
+    {
+        PlayerInfo* info_;
+        PlayerState::Enum state_;
+        int frags_;
+        int killed_;
+    };
+
     class _OrxonoxExport Gametype : public BaseObject, public Tickable
     {
@@ -60,10 +69,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();
@@ -75,5 +89,5 @@
             virtual void playerChangedName(PlayerInfo* player);
 
-            virtual void playerScored(PlayerInfo* player);
+            virtual void playerScored(Player& player);
 
             virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
@@ -81,5 +95,5 @@
             virtual void pawnPostSpawn(Pawn* pawn);
 
-            inline const std::map<PlayerInfo*, PlayerState::Enum>& getPlayers() const
+            inline const std::map<PlayerInfo*, Player>& getPlayers() const
                 { return this->players_; }
 
@@ -88,7 +102,13 @@
 
             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);
+
+            inline unsigned int getNumberOfPlayers() const
+                { return this->players_.size(); }
 
         private:
@@ -104,16 +124,20 @@
             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_;
+            std::map<PlayerInfo*, Player> players_;
             std::set<SpawnPoint*> spawnpoints_;
             SubclassIdentifier<ControllableEntity> defaultControllableEntity_;
+
+            OverlayGroup* scoreboard_;
+
+            // Config Values
+            std::string scoreboardTemplate_;
     };
 }
Index: code/trunk/src/orxonox/objects/infos/Bot.cc
===================================================================
--- code/trunk/src/orxonox/objects/infos/Bot.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/infos/Bot.cc	(revision 2662)
@@ -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/trunk/src/orxonox/objects/infos/Bot.h
===================================================================
--- code/trunk/src/orxonox/objects/infos/Bot.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/infos/Bot.h	(revision 2662)
@@ -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/trunk/src/orxonox/objects/infos/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/objects/infos/CMakeLists.txt	(revision 2262)
+++ code/trunk/src/orxonox/objects/infos/CMakeLists.txt	(revision 2662)
@@ -1,6 +1,8 @@
 SET( SRC_FILES
+  Bot.cc
   Info.cc
   PlayerInfo.cc
   HumanPlayer.cc
+  GametypeInfo.cc
 )
 
Index: code/trunk/src/orxonox/objects/infos/GametypeInfo.cc
===================================================================
--- code/trunk/src/orxonox/objects/infos/GametypeInfo.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/infos/GametypeInfo.cc	(revision 2662)
@@ -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/trunk/src/orxonox/objects/infos/GametypeInfo.h
===================================================================
--- code/trunk/src/orxonox/objects/infos/GametypeInfo.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/infos/GametypeInfo.h	(revision 2662)
@@ -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/trunk/src/orxonox/objects/infos/HumanPlayer.cc
===================================================================
--- code/trunk/src/orxonox/objects/infos/HumanPlayer.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/infos/HumanPlayer.cc	(revision 2662)
@@ -37,4 +37,5 @@
 #include "objects/controllers/HumanController.h"
 #include "objects/gametypes/Gametype.h"
+#include "overlays/OverlayGroup.h"
 
 namespace orxonox
@@ -63,13 +64,14 @@
     {
         SetConfigValue(nick_, "Player").callback(this, &HumanPlayer::configvaluecallback_changednick);
+        SetConfigValue(hudtemplate_, "defaultHUD").callback(this, &HumanPlayer::configvaluecallback_changedHUDTemplate);
     }
 
     void HumanPlayer::registerVariables()
     {
-        REGISTERSTRING(this->synchronize_nick_, direction::toserver, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_changednick));
+        registerVariable(this->synchronize_nick_, variableDirection::toserver, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_changednick));
 
-        REGISTERDATA(this->clientID_,     direction::toclient, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_clientIDchanged));
-        REGISTERDATA(this->server_initialized_, direction::toclient, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_server_initialized));
-        REGISTERDATA(this->client_initialized_, direction::toserver, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_client_initialized));
+        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();
     }
 
@@ -99,5 +106,5 @@
 
             if (!Core::isMaster())
-                this->setObjectMode(direction::bidirectional);
+                this->setObjectMode(objectDirection::bidirectional);
             else
                 this->setName(this->nick_);
@@ -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/trunk/src/orxonox/objects/infos/HumanPlayer.h
===================================================================
--- code/trunk/src/orxonox/objects/infos/HumanPlayer.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/infos/HumanPlayer.h	(revision 2662)
@@ -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/trunk/src/orxonox/objects/infos/Info.h
===================================================================
--- code/trunk/src/orxonox/objects/infos/Info.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/infos/Info.h	(revision 2662)
@@ -32,5 +32,5 @@
 #include "OrxonoxPrereqs.h"
 
-#include "network/Synchronisable.h"
+#include "network/synchronisable/Synchronisable.h"
 #include "core/BaseObject.h"
 
Index: code/trunk/src/orxonox/objects/infos/PlayerInfo.cc
===================================================================
--- code/trunk/src/orxonox/objects/infos/PlayerInfo.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/infos/PlayerInfo.cc	(revision 2662)
@@ -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);
         }
     }
@@ -69,11 +73,13 @@
     void PlayerInfo::registerVariables()
     {
-        REGISTERSTRING(this->name_,                 direction::toclient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::changedName));
-        REGISTERDATA  (this->controllableEntityID_, direction::toclient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedcontrollableentityID));
-        REGISTERDATA  (this->bReadyToSpawn_,        direction::toserver);
+        registerVariable(this->name_,                 variableDirection::toclient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::changedName));
+        registerVariable(this->controllableEntityID_, variableDirection::toclient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedcontrollableentityID));
+        registerVariable(this->bReadyToSpawn_,        variableDirection::toserver);
     }
 
     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/trunk/src/orxonox/objects/infos/PlayerInfo.h
===================================================================
--- code/trunk/src/orxonox/objects/infos/PlayerInfo.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/infos/PlayerInfo.h	(revision 2662)
@@ -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/trunk/src/orxonox/objects/items/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/objects/items/CMakeLists.txt	(revision 2662)
+++ code/trunk/src/orxonox/objects/items/CMakeLists.txt	(revision 2662)
@@ -0,0 +1,7 @@
+SET( SRC_FILES
+  Item.cc
+  Engine.cc
+  MultiStateEngine.cc
+)
+
+ADD_SOURCE_FILES(SRC_FILES)
Index: code/trunk/src/orxonox/objects/items/Engine.cc
===================================================================
--- code/trunk/src/orxonox/objects/items/Engine.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/items/Engine.cc	(revision 2662)
@@ -0,0 +1,242 @@
+/*
+ *   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_->getLocalVelocity();
+        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(this->ship_->getOrientation() * acceleration);
+
+        if (!this->ship_->getPermanentBoost())
+            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/trunk/src/orxonox/objects/items/Engine.h
===================================================================
--- code/trunk/src/orxonox/objects/items/Engine.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/items/Engine.h	(revision 2662)
@@ -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/trunk/src/orxonox/objects/items/Item.cc
===================================================================
--- code/trunk/src/orxonox/objects/items/Item.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/items/Item.cc	(revision 2662)
@@ -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/trunk/src/orxonox/objects/items/Item.h
===================================================================
--- code/trunk/src/orxonox/objects/items/Item.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/items/Item.h	(revision 2662)
@@ -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/trunk/src/orxonox/objects/items/MultiStateEngine.cc
===================================================================
--- code/trunk/src/orxonox/objects/items/MultiStateEngine.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/items/MultiStateEngine.cc	(revision 2662)
@@ -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()->getLocalVelocity();
+
+                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 (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/trunk/src/orxonox/objects/items/MultiStateEngine.h
===================================================================
--- code/trunk/src/orxonox/objects/items/MultiStateEngine.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/items/MultiStateEngine.h	(revision 2662)
@@ -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/trunk/src/orxonox/objects/pickup/BaseItem.cc
===================================================================
--- code/trunk/src/orxonox/objects/pickup/BaseItem.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/pickup/BaseItem.cc	(revision 2662)
@@ -0,0 +1,78 @@
+/* has to be added to player
+   multimap<std::string, BaseItem*> Equipment;*/
+
+
+#include "OrxonoxStableHeaders.h"
+#include "BaseItem.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "util/String.h"
+#include "objects/worldentities/pawns/Pawn.h"
+
+
+namespace orxonox
+{
+BaseItem::BaseItem(BaseObject* creator) : BaseObject(creator)
+{
+	RegisterObject(BaseItem);
+
+	this->playerBaseClass_ = 0;
+}
+
+BaseItem::~BaseItem()
+{
+}
+    void BaseItem::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(BaseItem, XMLPort, xmlelement, mode);
+
+        XMLPortParam(BaseItem, "playerclass", setPlayerBaseClassName, getPlayerBaseClassName, xmlelement, mode);
+    }
+
+bool BaseItem::addTo (Pawn* player)
+{
+
+	return player->getPickUp().insert(this);
+	/*if(checkSlot(player)==true)
+	player->pickUp.Equipment.insert ( std::pair<std::string, BaseItem*>(this->getName(),this) );
+	else
+	COUT(3) << "swap?" << std::endl;*/
+}
+bool BaseItem::remove(Pawn* player)
+{
+ 	/*if(player->pickUp.Equipment.find(this->getName())!= player->pickUp.Equipment.end())
+ 	{
+ 	std::multimap<std::string,BaseItem*>::iterator it;
+ 	it=player->pickUp.Equipment.find(this->getName());
+  	player->pickUp.Equipment.erase (it);
+  	return true;
+  	}
+  	else
+  	return false;*/
+  	return player->getPickUp().erase(this);
+}
+bool BaseItem::checkSlot(Pawn* player)
+{
+	/*std::multimap<std::string,BaseItem*>::iterator it;
+	for ( it=player->getPickUp().getEquipment().begin() ; it != player->getPickUp().getEquipment().end(); it++ )
+	{
+	if((*it).second->playerBaseClass_==this->playerBaseClass_)
+		//das isch schmarre...machs mit isExactlyA(...)
+	return false;
+	}
+	return true;*/
+	return player->getPickUp().checkSlot(this);
+}
+void BaseItem::setPlayerBaseClassName(const std::string& name)
+{
+	this->playerBaseClass_ = ClassByString(name);
+}
+
+const std::string& BaseItem::getPlayerBaseClassName() const
+{
+	if (this->playerBaseClass_)
+		return this->playerBaseClass_->getName();
+	else
+		return BLANKSTRING;
+}
+}
Index: code/trunk/src/orxonox/objects/pickup/BaseItem.h
===================================================================
--- code/trunk/src/orxonox/objects/pickup/BaseItem.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/pickup/BaseItem.h	(revision 2662)
@@ -0,0 +1,37 @@
+#ifndef _BaseItem_H__
+#define _BaseItem_H__
+
+#include "core/BaseObject.h"
+#include "OrxonoxPrereqs.h"
+
+namespace orxonox
+{
+	class ShipEquipment;
+
+	class _OrxonoxExport BaseItem : public BaseObject
+	{
+	public:
+	BaseItem( BaseObject* creator);
+	virtual ~BaseItem();
+	bool checkSlot(Pawn* player);
+	virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+	virtual bool pickedUp(Pawn* player) { return true; }
+	virtual bool dropped(Pawn* player) { return true; } //erst bei festen Items
+	bool remove(Pawn* player);
+	bool addTo(Pawn* player);
+
+	inline void setPlayerBaseClass(Identifier* identifier)
+		{ this->playerBaseClass_ = identifier; }
+	inline Identifier* getPlayerBaseClass() const
+		{ return this->playerBaseClass_; }
+
+	private:
+	void setPlayerBaseClassName(const std::string& name);
+	const std::string& getPlayerBaseClassName() const;
+
+	Identifier* playerBaseClass_;
+	};
+}
+
+#endif /* _BaseItem_H__ */
Index: code/trunk/src/orxonox/objects/pickup/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/objects/pickup/CMakeLists.txt	(revision 2262)
+++ code/trunk/src/orxonox/objects/pickup/CMakeLists.txt	(revision 2662)
@@ -1,5 +1,7 @@
 SET( SRC_FILES
-  ShipEquipmentClasses.cc
-  ShipItem.cc
+  PickupSpawner.cc
+  BaseItem.cc
+  Turbo.cc
+  ShipEquipment.cc
 )
 
Index: code/trunk/src/orxonox/objects/pickup/PickupSpawner.cc
===================================================================
--- code/trunk/src/orxonox/objects/pickup/PickupSpawner.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/pickup/PickupSpawner.cc	(revision 2662)
@@ -0,0 +1,121 @@
+#include "OrxonoxStableHeaders.h"
+#include "PickupSpawner.h"
+#include "BaseItem.h"
+#include "objects/worldentities/pawns/Pawn.h"
+#include "objects/worldentities/triggers/DistanceTrigger.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "core/Template.h"
+
+namespace orxonox
+{
+CreateFactory(PickupSpawner);
+
+PickupSpawner::PickupSpawner(BaseObject* creator) : StaticEntity(creator)
+{
+	RegisterObject(PickupSpawner);
+
+	this->template_ = 0;
+	this->distance_ = 20;
+	this->respawntimer_= 0;
+}
+
+PickupSpawner::~PickupSpawner()
+{
+}
+
+void PickupSpawner::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+{
+	SUPER(PickupSpawner, XMLPort, xmlelement, mode);
+
+	XMLPortParam(PickupSpawner, "item", setItemTemplate, getItemTemplate, xmlelement, mode);
+	XMLPortParam(PickupSpawner, "distance", setDistance, getDistance, xmlelement, mode).defaultValues(20.0f);
+	XMLPortParam(PickupSpawner, "respawntimer", setRespawnTimer, getRespawnTimer, xmlelement, mode);
+
+}
+
+void PickupSpawner::tick(float dt)
+{
+  if (this->isActive())
+  {
+    for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
+    {
+      Vector3 distanceVec = it->getWorldPosition() - this->getWorldPosition();
+      if (distanceVec.length() < this->distance_)
+        this->triggering(*it);
+    }
+  }
+}
+
+void PickupSpawner::setItemTemplate(const std::string& itemtemplate)
+{
+	this->itemtemplate_ = itemtemplate;
+	this->template_ = Template::getTemplate(itemtemplate);
+}
+
+void PickupSpawner::triggering(Pawn* player)
+{
+	if (this->isActive() && this->template_ && this->template_->getBaseclassIdentifier())
+	{
+		COUT(0) << "ITEM PICKED UP" << std::endl;
+		//if(player->isA(itemtemplate_->getPlayerBaseClass()))
+		{
+		BaseObject* newobject = this->template_->getBaseclassIdentifier()->fabricate(this);
+		BaseItem* newitem = dynamic_cast<BaseItem*>(newobject);
+		if (newitem)
+		{
+			newitem->addTemplate(this->itemtemplate_);
+			if (newitem->pickedUp(player)== true)
+			{
+				if(respawntimer_!=0)
+					this->triggerRespawnTimer();
+				this->setActive(false);
+				this->fireEvent();
+			}
+			else
+				delete newobject;
+		}
+		}
+		//else
+		//	delete newobject;
+	}
+}
+
+void PickupSpawner::triggerRespawnTimer()
+{
+
+	if(respawntimer_!=0)
+	{
+		ExecutorMember<BaseObject>* executor = createExecutor(createFunctor(&BaseObject::setActive));
+		executor->setDefaultValues(true);
+		RespawnTimer_.setTimer(this->respawntimer_, false, (BaseObject*)this, executor);
+		COUT(0) << "TIMER SET" << std::endl;
+	}
+}
+void PickupSpawner::changedActivity()
+{
+/*
+	COUT(0) << "Visble?" << std::endl;
+	if(isActive())
+	{
+		setVisible(true);
+		COUT(0) << "Visble!" << std::endl;
+	}
+	if(isActive()==false)
+	{
+		setVisible(false);
+		COUT(0) << "INvisble!" << std::endl;
+	}
+
+*/
+	SUPER(PickupSpawner, changedActivity);
+
+	for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); ++it)
+		(*it)->setVisible(this->isActive());
+}
+
+
+}
+
+
+
Index: code/trunk/src/orxonox/objects/pickup/PickupSpawner.h
===================================================================
--- code/trunk/src/orxonox/objects/pickup/PickupSpawner.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/pickup/PickupSpawner.h	(revision 2662)
@@ -0,0 +1,67 @@
+#ifndef _PickupSpawner_H__
+#define _PickupSpawner_H__
+
+#include "OrxonoxPrereqs.h"
+#include "BaseItem.h"
+#include "tools/Timer.h"
+#include "objects/worldentities/StaticEntity.h"
+#include "objects/Tickable.h"
+
+namespace orxonox
+{
+	class _OrxonoxExport PickupSpawner : public StaticEntity, public Tickable
+	{
+	public:
+	PickupSpawner(BaseObject* creator);
+	virtual ~PickupSpawner();
+	virtual void changedActivity();
+	virtual void tick(float dt);
+	virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+	virtual void triggering(Pawn* trigger); // Wenn ein Spieler in die Naehe kommt
+	void triggerRespawnTimer();
+
+	/*inline void setVisibility(bool visible)
+		{ this->setActive(visible); }
+	inline float getVisibility() const
+		{ return this->isActive(); }*/
+
+	void setItemTemplate(const std::string& itemtemplate);
+	inline const std::string& getItemTemplate() const
+		{ return this->itemtemplate_; }
+
+	inline void setDistance(float distance)
+		{ this->distance_ = distance; }
+	inline float getDistance() const
+		{ return this->distance_; }
+	inline void setRespawnTimer (float respawntimer)
+		{ this->respawntimer_ = respawntimer; }
+	inline float getRespawnTimer() const
+		{ return this->respawntimer_; }
+
+	private:
+	std::string itemtemplate_;
+	Template* template_;
+	float distance_;
+	float respawntimer_;
+	Timer<BaseObject> RespawnTimer_;
+	};
+}
+
+#endif /* _PickupSpawner_H__ */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: code/trunk/src/orxonox/objects/pickup/ShipEquipment.cc
===================================================================
--- code/trunk/src/orxonox/objects/pickup/ShipEquipment.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/pickup/ShipEquipment.cc	(revision 2662)
@@ -0,0 +1,98 @@
+#include "OrxonoxStableHeaders.h"
+#include "BaseItem.h"
+#include "ShipEquipment.h"
+#include "objects/worldentities/pawns/Pawn.h"
+
+
+namespace orxonox
+{
+/**
+@brief
+    Insert a permanent Item to the Equipment. Is usually called by the addTo function in Items.
+
+@param item
+    pointer to the item which is to be inserted.
+
+@return
+    if new item has sucessfully been added it will return true, in any other case the return value is false.
+*/
+	bool ShipEquipment::insert(BaseItem* item)
+	{
+	if(checkSlot(item)==NULL)
+	{
+		Equipment.insert ( std::pair<std::string, BaseItem*>(item->getName(),item) );
+		return true;
+	}
+	else
+	{
+		COUT(3) << "SWAP?" <<  endl;
+		//Abfrage- irgendne ifschleife...
+		if((checkSlot(item)->dropped(player))==true)
+		{
+			Equipment.insert ( std::pair<std::string, BaseItem*>(item->getName(),item) );
+			COUT(3) << "SWAPPED!" <<  endl;
+			return true;
+		}
+		return false;
+	}
+
+	return false;
+	};
+
+/**
+@brief
+    Erases a permanent Item in the Equipment. Is usually called by the remove/dropped function in Items.
+
+@param item
+    pointer to the item which is to be erased.
+
+@return
+    if new item has sucessfully been erased it will return true, in any other case the return value is false.
+*/
+	bool ShipEquipment::erase (BaseItem* item)
+	{
+	std::multimap<std::string,BaseItem*>::iterator it = Equipment.find(item->getName());
+	if(it != Equipment.end())
+ 	{
+  		Equipment.erase (it);
+  		return true;
+  	}
+  	return false;
+	};
+	/*void print(std::multimap<std::string, BaseItem*> eut)
+	{
+		std::multimap<std::string,BaseItem*>::iterator it;
+		COUT(3) << "Liste:" <<  endl;
+		for ( it=eut.begin() ; it != eut.end(); ++it )
+		    COUT(3) << (*it).first << endl;
+
+	}*/
+/**
+@brief
+    Erases all permanent Items in the Equipment. Its Triggered by hitting the L button.
+
+*/
+	void ShipEquipment::eraseAll()
+	{
+		//print(Equipment);
+		for (std::multimap<std::string,BaseItem*>::iterator it = Equipment.begin(); it != Equipment.end(); )
+		{
+
+			(it++)->second->dropped(this->getPlayer());
+		}
+		//print(Equipment);
+	}
+
+	BaseItem* ShipEquipment::checkSlot(BaseItem* item)
+	{
+	std::multimap<std::string,BaseItem*>::iterator it;
+	for ( it= getPlayer()->getPickUp().getEquipment().begin() ; it != getPlayer()->getPickUp().getEquipment().end(); it++ )
+	{
+		//if((*it).second->getPlayerBaseClass()==item->getPlayerBaseClass())
+		if(item->isExactlyA((*it).second->getIdentifier()))
+		return (*it).second;
+	}
+	return NULL;
+	};
+
+}
Index: code/trunk/src/orxonox/objects/pickup/ShipEquipment.h
===================================================================
--- code/trunk/src/orxonox/objects/pickup/ShipEquipment.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/pickup/ShipEquipment.h	(revision 2662)
@@ -1,26 +1,51 @@
-
 #ifndef _ShipEquipment_H__
 #define _ShipEquipment_H__
 #include <string>
-#include <multimap>
+#include <map>
+
+/*
+multimap<std::string, BaseItem*> equipment_;
+equipment_.insert(pair<std::string, BaseItem*>("Weapon", new BaseItem()));*/
 
 
-/*
-multimap<std::string, Item*> equipment_;
-equipment_.insert(pair<std::string, Item*>("Weapon", new Item()));*/
+/*          std::map<std::itemtype, BaseItem*> EQClasses;
+            EQClasses["jacke"] = 0;
+            BaseItem* item = itemMap_["jacke"];
 
-
+           if (itemMap_["jacke"])
+           if (itemMap_.find("jacke") != itemMap_.end()) */
 namespace orxonox
 {
+    class BaseItem;
+/**
+@brief
+    ShipEquipment is the inventory of a player. It's part of the Pawn class.
+
+*/
     class _OrxonoxExport ShipEquipment
     {
         public:
-            void AddItem(Shipitem toAddItem);
-            void RemoveItem(Shipitem toRemoveItem);
-            bool CheckifValid(Shipitem toBeChecked);
-            int
-
+	inline int getSpace()
+	{
+	return Usable.size()+Trunk.size();
+	};
+	bool insert(BaseItem* item);
+	bool erase (BaseItem* item);
+	//void print(std::multimap<std::string, BaseItem*> eut);
+	void eraseAll();
+	//bool checkSlot(BaseItem* item);
+	BaseItem* checkSlot(BaseItem* item);
+//	const std::multimap<std::string, BaseItem*>& getEquipment() const { return this->Equipment; }
+	inline std::multimap<std::string, BaseItem*>& getEquipment() {return this->Equipment;}
+	inline std::multimap<std::string, BaseItem*>& getUsable() {return this->Usable;}
+	inline std::multimap<std::string, BaseItem*>& getTrunk() {return this->Trunk;}
+	inline Pawn* getPlayer() {return this->player ;}
+	inline void setPlayer(Pawn* setplayer)
+	{this->player = setplayer;}
         private:
-            std::multimap<std::string, Item*> Equipment;
+            Pawn* player;//!< Is a pointer to the belonging player
+            std::multimap<std::string, BaseItem*> Equipment;//!< the Equipment for permanent Items
+            std::multimap<std::string, BaseItem*> Usable;//!< Where Usables are stored
+            std::multimap<std::string, BaseItem*> Trunk;//!< Every other Item is stored here
     };
 }
@@ -39,7 +64,3 @@
 
 
-
-
-
-
 #endif
Index: code/trunk/src/orxonox/objects/pickup/ShipEquipmentClasses.cc
===================================================================
--- code/trunk/src/orxonox/objects/pickup/ShipEquipmentClasses.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/pickup/ShipEquipmentClasses.cc	(revision 2662)
@@ -57,9 +57,7 @@
                 }
                 break;
-            default:;
             }
         case Useable:
             return CheckifSpace();
-        case default:;
         }
         return true;
@@ -67,5 +65,5 @@
 
     /*Adds the Item to the Ship*/
-    void ShipEquipment::AddItem(Shipitem* toAddItem)
+    void ShipEquipment::AddItem(ShipItem* toAddItem)
     {
         if(CheckifValid(toAddItem)==true)
@@ -90,3 +88,49 @@
         }
     }
+
+    /*Adds the Item to the Ship*/
+    void ShipEquipment::AddItem(Shipitem* toAddItem)
+    {
+        if(CheckifValid(toAddItem)==true)
+        {
+            switch(toAddItem.CheckType()){
+                case Permanent:
+                    Equipment.insert ( pair<std::string, ShipItem*>(toAddItem.itemname,toAddItem) );
+                    break;
+                case Usable:
+                    Usable.insert ( pair<std::string, ShipItem*>(toAddItem.itemname,toAddItem) );
+                    break;
+                case Trunk:
+                    Trunk.insert ( pair<std::string, ShipItem*>(toAddItem.itemname,toAddItem) );
+                    break;
+            }
+        }
+        else if(toAddItem.CheckType()==Permanent)
+        {
+            if(CheckifSpace()==true)
+                Trunk.insert ( pair<std::string, ShipItem*>(toAddItem.itemname,toAddItem) );
+        }
+    }
+
+    void ShipEquipment::SwitchItem(Permanent* toSwitchItem)
+    {
+        multimap<string, ShipItem*>::iterator it;
+        string equippedname;
+        equippedname=GetNameofPermanent(toSwitchItem.CheckSubType());
+        it=Equipment.find(equippedname);
+        Trunk.insert (find(equippedname));
+        Equipment.erase (it);
+        Equipment.insert(pair<std::string, ShipItem*>(toSwitchItem.itemname,toSwitchItem)
+    }
+
+    string ShipEquipment::GetNameofPermanent (subItemTypePermanent NametoGet)
+    {
+        multimap<string, ShipItem*>::iterator it;
+        for ( it=Equipment.begin() ; it != Equipment.end(); it++ ){
+            if((*it).second->CheckSubType()==NametoGet){
+                return (*it).first.itemname;
+            }
+        }
+        return 0;
+    }
 }
Index: code/trunk/src/orxonox/objects/pickup/ShipEquipmentClasses.h
===================================================================
--- code/trunk/src/orxonox/objects/pickup/ShipEquipmentClasses.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/pickup/ShipEquipmentClasses.h	(revision 2662)
@@ -8,11 +8,11 @@
 
 /*
-multimap<std::string, Item*> equipment_;
-equipment_.insert(pair<std::string, Item*>("Weapon", new Item()));*/
+multimap<std::string, BaseItem*> equipment_;
+equipment_.insert(pair<std::string, BaseItem*>("Weapon", new BaseItem()));*/
 
 
-/*          std::map<std::itemtype, Item*> EQClasses;
+/*          std::map<std::itemtype, BaseItem*> EQClasses;
             EQClasses["jacke"] = 0;
-            Item* item = itemMap_["jacke"];
+            BaseItem* item = itemMap_["jacke"];
 
            if (itemMap_["jacke"])
@@ -23,13 +23,15 @@
     {
         public:
-            void AddItem(Shipitem* toAddItem);
+            /*void AddItem(Shipitem* toAddItem);
             void RemoveItem(Shipitem* toRemoveItem);
             bool CheckifValid(Shipitem* toBeChecked);
             bool CheckifSpace();
+            void SwitchItem(Permanent* toSwitchItem);
+            string GetNameofPermanent (subItemTypePermanent NametoGet);*/ //holt den Namen des getragenen Items im jeweiligen Slot.
 
         private:
-            multimap<std::string, ShipItem*> Equipment;
-            multimap<std::string, ShipItem*> Usable;
-            multimap<std::string, ShipItem*> Trunk;
+            multimap<std::string, BaseItem*> Equipment;
+            multimap<std::string, BaseItem*> Usable;
+            multimap<std::string, BaseItem*> Trunk;
     };
 }
Index: code/trunk/src/orxonox/objects/pickup/ShipItem.cc
===================================================================
--- code/trunk/src/orxonox/objects/pickup/ShipItem.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/pickup/ShipItem.cc	(revision 2662)
@@ -5,10 +5,20 @@
     itemtype ShipItem::CheckType()
     {
-        return this.type;
+        return this->type;
     }
 
     subItemTypePermanent CheckSubType()
     {
-        return this.subtype_permanent;
+        return this->subtype_permanent;
     }
+
+    subItemTypePowerups CheckSubType()
+    {
+        return this->subtype_powerups;
+    }
+    subItemTypeUsable CheckSubType()
+    {
+        return this->subtype_usables;
+    }
+
 }
Index: code/trunk/src/orxonox/objects/pickup/ShipItem.h
===================================================================
--- code/trunk/src/orxonox/objects/pickup/ShipItem.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/pickup/ShipItem.h	(revision 2662)
@@ -21,5 +21,5 @@
         public:
             itemType CheckType();
-            virtual
+            //virtual ChecksubType();
 
         private:
@@ -27,5 +27,4 @@
             string itemname;
     };
-
 
     /* Useables are Items the Player can choose when to activate and then show an instant action/effect
@@ -37,5 +36,5 @@
             Rockets,
             Repairkits,
-            Triggers,		//trigger events usable by the player (Quests f.exp.)
+            Triggers,       //trigger events usable by the player (Quests f.exp.)
             Boosters,
             Shields,
Index: code/trunk/src/orxonox/objects/pickup/Turbo.cc
===================================================================
--- code/trunk/src/orxonox/objects/pickup/Turbo.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/pickup/Turbo.cc	(revision 2662)
@@ -0,0 +1,128 @@
+#include "OrxonoxStableHeaders.h"
+#include "Turbo.h"
+
+#include "objects/worldentities/pawns/SpaceShip.h"
+#include "core/Executor.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+
+
+	CreateFactory(Turbo);
+
+	Turbo::Turbo(BaseObject* creator) : BaseItem(creator)
+	{
+		RegisterObject(Turbo);
+
+		this->boost_ = 0;
+		this->duration_ = 0;
+		this->accboost_ = 1;
+		this->rotacc_= 0;
+	}
+
+	Turbo::~Turbo()
+	{
+	}
+
+    void Turbo::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(Turbo, XMLPort, xmlelement, mode);
+
+        XMLPortParam(Turbo, "boost", setBoost, getBoost, xmlelement, mode);
+        XMLPortParam(Turbo, "duration", setDuration, getDuration, xmlelement, mode);
+        XMLPortParam(Turbo, "accboost", setAccBoost, getAccBoost, xmlelement, mode);
+        XMLPortParam(Turbo, "rotacc", setRotAcc, getRotAcc, xmlelement, mode);
+    }
+
+	bool Turbo::pickedUp(Pawn* player)
+	{
+
+		if(player-> isA(this->getPlayerBaseClass()))
+			{
+			SpaceShip* ship = dynamic_cast <SpaceShip*>(player);
+			if(duration_==0 )
+			{
+				if(addTo(player))
+				{
+						COUT(3)<<"ITEM EQUIPPED"<<std::endl;
+						this->setSpeedBoost(ship);
+						return true;
+				}
+				return false;
+			}
+			else
+			{
+				this->setSpeedBoost(ship);
+				return true;
+			}
+			return false;
+			}
+		return false;
+
+	}
+
+
+	void Turbo::unsetSpeedBoost(SpaceShip* ship)
+	{
+/*
+	ship->setMaxSpeed( ship->getMaxSpeed() - this->boost_);
+	ship->setTransAcc( ship->getTransAcc()/this->accboost_);
+	ship->setMaxRotation( ship->getMaxRotation()-this->rotacc_);
+	ship->setRotAcc( ship->getRotAcc()-this->rotacc_);
+	COUT(3)<<"BOOST UNSET"<<std::endl;
+	COUT(3)<<"Speed:"<< ship->getMaxSpeed()<<std::endl;
+*/
+        ship->setPermanentBoost(false);
+	}
+
+	void Turbo::setSpeedBoost(SpaceShip* ship)
+	{
+/*
+	COUT(3)<<"Speed:"<< ship->getMaxSpeed()<<std::endl;
+	ship->setMaxSpeed( ship->getMaxSpeed() + this->boost_);
+	ship->setTransAcc( ship->getTransAcc()*this->accboost_);
+	ship->setMaxRotation( ship->getMaxRotation()+this->rotacc_);
+	ship->setRotAcc( ship->getRotAcc()+this->rotacc_);
+*/
+    ship->setPermanentBoost(true);
+    ship->setBoost(true);
+
+	if( this->duration_ != 0)
+	{
+		ExecutorMember<Turbo>* executor = createExecutor(createFunctor(&Turbo::unsetSpeedBoost));
+		executor->setDefaultValues(ship);
+		turbotimer_.setTimer(this->duration_, false, this, executor);
+	}
+//	COUT(3)<<"Speed:"<< ship->getMaxSpeed()<<std::endl;
+	}
+	bool Turbo::dropped(Pawn* player)
+	{
+		if (this->duration_ == 0)
+		{
+			COUT(0) << "ITEM DROPPED" << std::endl;
+			if(remove(player)==true)
+			{
+			    SpaceShip* ship = dynamic_cast <SpaceShip*>(player);
+			    this->unsetSpeedBoost(ship);
+			}
+		}
+		return true;
+	}
+
+}
+/*<Template baseclass="Turbo" name=turboitem>
+      <Turbo playerclass="SpaceShip" boost=150 duration=10 accboost=10 />
+    </Template>
+
+    <PickupSpawner item=turboitem>
+      <attached>
+        <Billboard material="Examples/Flare" scale=0.2 colour="0.0, 0.0, 1.0, 1.0" />
+      </attached>
+    </PickupSpawner>*/
+
+
+
+
+
Index: code/trunk/src/orxonox/objects/pickup/Turbo.h
===================================================================
--- code/trunk/src/orxonox/objects/pickup/Turbo.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/pickup/Turbo.h	(revision 2662)
@@ -0,0 +1,56 @@
+#ifndef _Turbo_H__
+#define _Turbo_H__
+
+#include "tools/Timer.h"
+#include "BaseItem.h"
+#include "OrxonoxPrereqs.h"
+#include "util/Math.h"
+
+namespace orxonox
+{
+	class _OrxonoxExport Turbo : public BaseItem
+	{
+
+	public:
+	Turbo(BaseObject* creator);
+	virtual ~Turbo();
+
+	virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+	virtual bool pickedUp(Pawn* player);
+	virtual bool dropped(Pawn* player); //erst bei festen Items
+
+	void setSpeedBoost(SpaceShip* ship);
+	void unsetSpeedBoost(SpaceShip* ship);
+
+	inline void setBoost(float boost)
+		{ this->boost_ = boost; }
+	inline float getBoost() const
+		{ return this->boost_; }
+
+	inline void setDuration(float duration)
+		{ this->duration_ = duration; }
+	inline float getDuration() const
+		{ return this->duration_; }
+
+	inline void setRotAcc(Degree rotacc)
+		{ this->rotacc_ = rotacc; }
+	inline Degree getRotAcc() const
+		{ return this->rotacc_; }
+
+
+	inline void setAccBoost(float accboost)
+		{ this->accboost_ = accboost; }
+	inline float getAccBoost() const
+		{ return this->accboost_; }
+
+	private:
+	Timer<Turbo> turbotimer_;
+	float boost_;
+	float duration_;
+	float accboost_;
+	Degree rotacc_;
+	};
+}
+
+#endif /* _Turbo_H__ */
Index: code/trunk/src/orxonox/objects/quest/AddQuest.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/AddQuest.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/AddQuest.cc	(revision 2662)
@@ -28,7 +28,6 @@
 
 /**
-    @file AddQuest.cc
-    @brief
-    Implementation of the AddQuest class.
+    @file
+    @brief Implementation of the AddQuest class.
 */
 
@@ -45,6 +44,6 @@
 #include "Quest.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     CreateFactory(AddQuest);
 
@@ -109,5 +108,5 @@
         }
 
-        COUT(3) << "Quest {" << this->getQuestId() << "} successfully added to player." << std::endl;
+        COUT(3) << "Quest {" << this->getQuestId() << "} successfully added to player: " << player << " ." << std::endl;
         return true;
     }
Index: code/trunk/src/orxonox/objects/quest/AddQuest.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/AddQuest.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/AddQuest.h	(revision 2662)
@@ -28,7 +28,6 @@
 
 /**
-    @file AddQuest.h
-    @brief
-    Definition of the AddQuest class.
+    @file
+    @brief Definition of the AddQuest class.
 */
 
@@ -43,6 +42,6 @@
 #include "ChangeQuestStatus.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     /**
     @brief
@@ -58,10 +57,10 @@
     {
         public:
-            AddQuest(BaseObject* creator);
-            virtual ~AddQuest();
-
-            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a AddQuest object through XML.
-
-            virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect.
+        AddQuest(BaseObject* creator);
+        virtual ~AddQuest();
+    
+        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a AddQuest object through XML.
+    
+        virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect.
 
     };
Index: code/trunk/src/orxonox/objects/quest/AddQuestHint.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/AddQuestHint.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/AddQuestHint.cc	(revision 2662)
@@ -28,7 +28,6 @@
 
 /**
-    @file AddQuestHint.cc
-    @brief
-    Implementation of the AddQuestHint class.
+    @file
+    @brief Implementation of the AddQuestHint class.
 */
 
@@ -44,6 +43,6 @@
 #include "QuestHint.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     CreateFactory(AddQuestHint);
 
@@ -130,5 +129,5 @@
         }
 
-        COUT(3) << "QuestHint {" << this->getHintId() << "} successfully added to player." << std::endl;
+        COUT(3) << "QuestHint {" << this->getHintId() << "} successfully added to player: " << player << " ." << std::endl;
         return true;
 
Index: code/trunk/src/orxonox/objects/quest/AddQuestHint.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/AddQuestHint.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/AddQuestHint.h	(revision 2662)
@@ -28,7 +28,6 @@
 
 /**
-    @file AddQuestHint.h
-    @brief
-    Definition of the AddQuestHint class.
+    @file
+    @brief Definition of the AddQuestHint class.
 */
 
@@ -42,6 +41,6 @@
 #include "QuestEffect.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     /**
     @brief
@@ -73,4 +72,5 @@
             inline const std::string & getHintId(void) const
                 { return this->hintId_; }
+            
             bool setHintId(const std::string & id); //!< Sets the id of the QuestHint.
 
Index: code/trunk/src/orxonox/objects/quest/AddReward.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/AddReward.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/AddReward.cc	(revision 2662)
@@ -28,7 +28,6 @@
 
 /**
-    @file AddReward.cc
-    @brief
-    Implementation of the AddReward class.
+    @file
+    @brief Implementation of the AddReward class.
 */
 
@@ -41,6 +40,6 @@
 #include "Rewardable.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     CreateFactory(AddReward);
 
@@ -106,4 +105,6 @@
     bool AddReward::invoke(PlayerInfo* player)
     {
+        COUT(3) << "AddReward on player: " << player << " ." << std::endl;
+        
         bool check = true;
         for ( std::list<Rewardable*>::iterator reward = this->rewards_.begin(); reward != this->rewards_.end(); ++reward )
@@ -111,4 +112,6 @@
             check = check && (*reward)->reward(player);
         }
+        
+        COUT(3) << "Rewardable successfully added to player." << player << " ." << std::endl;
 
         return check;
Index: code/trunk/src/orxonox/objects/quest/AddReward.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/AddReward.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/AddReward.h	(revision 2662)
@@ -28,7 +28,6 @@
 
 /**
-    @file AddReward.h
-    @brief
-    Definition of the AddReward class.
+    @file
+    @brief Definition of the AddReward class.
 */
 
@@ -43,6 +42,6 @@
 #include "QuestEffect.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     /**
     @brief
@@ -78,4 +77,5 @@
             inline void addRewardable(Rewardable* reward)
                 { this->rewards_.push_back(reward); }
+        
             const Rewardable* getRewardables(unsigned int index) const; //!< Returns the Rewardable object at the given index.
 
Index: code/trunk/src/orxonox/objects/quest/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/objects/quest/CMakeLists.txt	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/CMakeLists.txt	(revision 2662)
@@ -14,4 +14,5 @@
   QuestHint.cc
   QuestItem.cc
+  QuestListener.cc
   QuestManager.cc
   Rewardable.cc
Index: code/trunk/src/orxonox/objects/quest/ChangeQuestStatus.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/ChangeQuestStatus.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/ChangeQuestStatus.cc	(revision 2662)
@@ -28,7 +28,6 @@
 
 /**
-    @file ChangeQuestStatus.cc
-    @brief
-    Implementation of the ChangeQuestStatus class.
+    @file
+    @brief Implementation of the ChangeQuestStatus class.
 */
 
@@ -40,6 +39,6 @@
 #include "QuestItem.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     /**
     @brief
Index: code/trunk/src/orxonox/objects/quest/ChangeQuestStatus.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/ChangeQuestStatus.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/ChangeQuestStatus.h	(revision 2662)
@@ -28,7 +28,6 @@
 
 /**
-    @file ChangeQuestStatus.h
-    @brief
-    Definition of the ChangeQuestStatus class.
+    @file
+    @brief Definition of the ChangeQuestStatus class.
 */
 
@@ -43,6 +42,6 @@
 #include "QuestEffect.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     /**
     @brief
@@ -63,6 +62,6 @@
         protected:
             /**
-                @brief Returns the id of the Quest.
-                @return Returns the id of the Quest.
+            @brief Returns the id of the Quest.
+            @return Returns the id of the Quest.
             */
             inline const std::string & getQuestId(void) const
Index: code/trunk/src/orxonox/objects/quest/CompleteQuest.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/CompleteQuest.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/CompleteQuest.cc	(revision 2662)
@@ -28,7 +28,6 @@
  
 /**
-    @file CompleteQuest.cc
-    @brief
-    Implementation of the CompleteQuest class.
+    @file
+    @brief Implementation of the CompleteQuest class.
 */
 
@@ -43,6 +42,6 @@
 #include "Quest.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     CreateFactory(CompleteQuest);
 
Index: code/trunk/src/orxonox/objects/quest/CompleteQuest.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/CompleteQuest.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/CompleteQuest.h	(revision 2662)
@@ -28,7 +28,6 @@
 
 /**
-    @file CompleteQuest.h
-    @brief
-    Definition of the CompleteQuest class.
+    @file
+    @brief Definition of the CompleteQuest class.
 */
 
@@ -43,6 +42,6 @@
 #include "ChangeQuestStatus.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     /**
     @brief
Index: code/trunk/src/orxonox/objects/quest/FailQuest.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/FailQuest.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/FailQuest.cc	(revision 2662)
@@ -28,7 +28,6 @@
  
 /**
-    @file FailQuest.cc
-    @brief
-    Implementation of the FailQuest class.
+    @file
+    @brief Implementation of the FailQuest class.
 */
 
@@ -43,6 +42,6 @@
 #include "Quest.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     CreateFactory(FailQuest);
 
Index: code/trunk/src/orxonox/objects/quest/FailQuest.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/FailQuest.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/FailQuest.h	(revision 2662)
@@ -28,7 +28,6 @@
 
 /**
-    @file FailQuest.h
-    @brief
-    Definition of the FailQuest class.
+    @file
+    @brief Definition of the FailQuest class.
 */
 
@@ -43,6 +42,6 @@
 #include "ChangeQuestStatus.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     /**
     @brief
Index: code/trunk/src/orxonox/objects/quest/GlobalQuest.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/GlobalQuest.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/GlobalQuest.cc	(revision 2662)
@@ -28,7 +28,6 @@
  
 /**
-    @file GlobalQuest.cc
-    @brief
-    Implementation of the GlobalQuest class.
+    @file
+    @brief Implementation of the GlobalQuest class.
 */
 
@@ -38,10 +37,11 @@
 #include "orxonox/objects/infos/PlayerInfo.h"
 #include "core/CoreIncludes.h"
+#include "core/Super.h"
 #include "util/Exception.h"
 
 #include "QuestEffect.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     CreateFactory(GlobalQuest);
 
@@ -88,19 +88,19 @@
     bool GlobalQuest::fail(PlayerInfo* player)
     {
-        if(this->isFailable(player)) //!< Check whether the Quest can be failed.
-        {
-            this->setStatus(player, questStatus::failed);
-            
-            //! Iterate through all players possessing this Quest.
-            for(std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++)
-            {
-                QuestEffect::invokeEffects(*it, this->getFailEffectList());
-            }
-
-            return true;
-        }
-        
-        COUT(4) << "A non-completable quest was trying to be failed." << std::endl;
-        return false;
+        if(!this->isFailable(player)) //!< Check whether the Quest can be failed.
+        {
+            COUT(4) << "A non-completable quest was trying to be failed." << std::endl;
+            return false;
+        }
+        
+        Quest::fail(player);
+    
+    //! Iterate through all players possessing this Quest.
+    for(std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++)
+    {
+        QuestEffect::invokeEffects(*it, this->getFailEffectList());
+    }
+
+    return true;
     }
 
@@ -117,20 +117,20 @@
     bool GlobalQuest::complete(PlayerInfo* player)
     {
-        if(this->isCompletable(player)) //!< Check whether the Quest can be completed.
-        {
-            this->setStatus(player, questStatus::completed);
-            
-            //! Iterate through all players possessing the Quest.
-            for(std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++)
-            {
-                QuestEffect::invokeEffects(*it, this->getCompleteEffectList());
-            }
-            
-            QuestEffect::invokeEffects(player, this->rewards_); //!< Invoke reward QuestEffects on the player completing the Quest.
-            return true;
-        }
-        
-        COUT(4) << "A non-completable quest was trying to be completed." << std::endl;
-        return false;
+        if(!this->isCompletable(player)) //!< Check whether the Quest can be completed.
+        {
+            COUT(4) << "A non-completable quest was trying to be completed." << std::endl;
+            return false;
+        }
+        
+        //! Iterate through all players possessing the Quest.
+        for(std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++)
+        {
+            QuestEffect::invokeEffects(*it, this->getCompleteEffectList());
+        }
+    
+        Quest::complete(player);
+    
+        QuestEffect::invokeEffects(player, this->rewards_); //!< Invoke reward QuestEffects on the player completing the Quest.
+        return true;
     }
 
@@ -207,5 +207,5 @@
         }
 
-    return questStatus::inactive;
+        return questStatus::inactive;
     }
 
Index: code/trunk/src/orxonox/objects/quest/GlobalQuest.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/GlobalQuest.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/GlobalQuest.h	(revision 2662)
@@ -28,7 +28,6 @@
  
 /**
-    @file GlobalQuest.h
-    @brief
-    Definition of the GlobalQuest class.
+    @file
+    @brief Definition of the GlobalQuest class.
 */
 
@@ -44,6 +43,6 @@
 #include "Quest.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     /**
     @brief
@@ -56,13 +55,13 @@
             <QuestDescription title="Title" description="Description." /> //The description of the quest.
             <subquests>
-        <Quest id ="questId1" /> //A list of n subquest, be aware, each of the <Quest /> tags must have a description and so on and so forth as well.
-        ...
-        <Quest id="questIdn" />
-        </subquests>
-        <hints>
-        <QuestHint id="hintId1" /> //A list of n QuestHints, see QuestHint for the full XML representation of those.
-        ...
-        <QuestHint id="hintIdn" />
-        </hints>
+                <Quest id ="questId1" /> //A list of n subquest, be aware, each of the <Quest /> tags must have a description and so on and so forth as well.
+                ...
+                <Quest id="questIdn" />
+            </subquests>
+            <hints>
+                <QuestHint id="hintId1" /> //A list of n QuestHints, see QuestHint for the full XML representation of those.
+                ...
+                <QuestHint id="hintIdn" />
+            </hints>
             <fail-effects>
                 <QuestEffect /> //A list of QuestEffects, invoked on all players possessing this quest, when the Quest is failed, see QuestEffect for the full XML representation.
Index: code/trunk/src/orxonox/objects/quest/LocalQuest.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/LocalQuest.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/LocalQuest.cc	(revision 2662)
@@ -28,7 +28,6 @@
 
 /**
-    @file LocalQuest.cc
-    @brief
-    Implementation of the LocalQuest class.
+    @file
+    @brief Implementation of the LocalQuest class.
 */
 
@@ -37,4 +36,5 @@
 
 #include "core/CoreIncludes.h"
+#include "core/Super.h"
 #include "util/Exception.h"
 
@@ -42,6 +42,6 @@
 #include "QuestEffect.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     CreateFactory(LocalQuest);
 
@@ -86,13 +86,14 @@
     bool LocalQuest::fail(PlayerInfo* player)
     {
-        if(this->isFailable(player)) //!< Checks whether the quest can be failed.
-        {
-            this->setStatus(player, questStatus::failed);
-            QuestEffect::invokeEffects(player, this->getFailEffectList()); //!< Invoke the failEffects.
-            return true;
-        }
-        
-        COUT(4) << "A non-failable quest was trying to be failed." << std::endl;
-        return false;
+        if(!this->isFailable(player)) //!< Checks whether the quest can be failed.
+        {
+            COUT(4) << "A non-failable quest was trying to be failed." << std::endl;
+            return false;
+        }
+        
+        Quest::fail(player);
+        
+        QuestEffect::invokeEffects(player, this->getFailEffectList()); //!< Invoke the failEffects.
+        return true;
     }
 
@@ -108,13 +109,14 @@
     bool LocalQuest::complete(PlayerInfo* player)
     {
-        if(this->isCompletable(player)) //!< Checks whether the Quest can be completed.
-        {
-            this->setStatus(player, questStatus::completed);
-            QuestEffect::invokeEffects(player, this->getCompleteEffectList()); //!< Invoke the complete QuestEffects.
-            return true;
-        }
-        
-        COUT(4) << "A non-completable quest was trying to be completed." << std::endl;
-        return false;
+        if(!this->isCompletable(player)) //!< Checks whether the Quest can be completed.
+        {
+            COUT(4) << "A non-completable quest was trying to be completed." << std::endl;
+            return false;
+        }
+        
+        Quest::complete(player);
+        
+        QuestEffect::invokeEffects(player, this->getCompleteEffectList()); //!< Invoke the complete QuestEffects.
+        return true;
     }
 
Index: code/trunk/src/orxonox/objects/quest/LocalQuest.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/LocalQuest.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/LocalQuest.h	(revision 2662)
@@ -28,7 +28,6 @@
  
 /**
-    @file LocalQuest.h
-    @brief
-    Definition of the LocalQuest class.
+    @file
+    @brief Definition of the LocalQuest class.
 */
 
@@ -44,6 +43,6 @@
 #include "Quest.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     /**
     @brief
@@ -56,13 +55,13 @@
             <QuestDescription title="Title" description="Description." /> //The description of the quest.
             <subquests>
-        <Quest id ="questId1" /> //A list of n subquest, be aware, each of the <Quest /> tags must have a description and so on and so forth as well.
-        ...
-        <Quest id="questIdn" />
-        </subquests>
-        <hints>
-        <QuestHint id="hintId1" /> //A list of n QuestHints, see QuestHint for the full XML representation of those.
-        ...
-        <QuestHint id="hintIdn" />
-        </hints>
+                <Quest id ="questId1" /> //A list of n subquest, be aware, each of the <Quest /> tags must have a description and so on and so forth as well.
+                ...
+                <Quest id="questIdn" />
+                </subquests>
+                <hints>
+                <QuestHint id="hintId1" /> //A list of n QuestHints, see QuestHint for the full XML representation of those.
+                ...
+                <QuestHint id="hintIdn" />
+                </hints>
             <fail-effects>
                 <QuestEffect /> //A list of QuestEffects, invoked when the Quest is failed, see QuestEffect for the full XML representation.
Index: code/trunk/src/orxonox/objects/quest/Quest.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/Quest.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/Quest.cc	(revision 2662)
@@ -28,7 +28,6 @@
  
 /**
-    @file Quest.cc
-    @brief
-    Implementation of the Quest class.
+    @file
+    @brief Implementation of the Quest class.
 */
 
@@ -43,7 +42,8 @@
 #include "QuestHint.h"
 #include "QuestEffect.h"
-
-namespace orxonox {
-
+#include "QuestListener.h"
+
+namespace orxonox
+{
     /**
     @brief
@@ -363,4 +363,42 @@
         return this->getStatus(player) == questStatus::completed;
     }
+    
+    /**
+    @brief
+        Fails the Quest for an input player.
+    @param player
+        The player.
+    @return
+        Returns true if the Quest could be failed, false if not.
+    */
+    bool Quest::fail(PlayerInfo* player)
+    {
+        QuestListener::advertiseStatusChange(this->listeners_, "fail"); //!< Tells the QuestListeners, that the status has changed to failed.
+        this->setStatus(player, questStatus::failed);
+        
+        COUT(4) << "Quest {" << this->getId() << "} is failed for player: " << player << " ." <<std::endl;
+        
+        this->getDescription()->sendFailQuestNotification();
+        return true;
+    }
+    
+    /**
+    @brief
+        Completes the Quest for an input player.
+    @param player
+        The player.
+    @return
+        Returns true if the Quest could be completed, false if not.
+    */
+    bool Quest::complete(PlayerInfo* player)
+    {
+        QuestListener::advertiseStatusChange(this->listeners_, "complete"); //!< Tells the QuestListeners, that the status has changed to completed.
+        this->setStatus(player, questStatus::completed);
+        
+        COUT(4) << "Quest {" << this->getId() << "} is completed for player: " << player << " ." <<std::endl;
+        
+        this->getDescription()->sendCompleteQuestNotification();
+        return true;
+    }
 
     /**
@@ -374,12 +412,38 @@
     bool Quest::start(PlayerInfo* player)
     {
-        if(this->isStartable(player)) //!< Checks whether the quest can be started.
-        {
-            this->setStatus(player, questStatus::active);
-            return true;
-        }
-        
-        COUT(4) << "A non-startable quest was trying to be started." << std::endl;
-        return false;
+        if(!this->isStartable(player)) //!< Checks whether the quest can be started.
+        {
+            COUT(4) << "A non-startable quest was trying to be started." << std::endl;
+            return false;
+        }
+        
+        COUT(4) << "Quest {" << this->getId() << "} is started for player: " << player << " ." <<std::endl;
+        
+        QuestListener::advertiseStatusChange(this->listeners_, "start"); //!< Tells the QuestListeners, that the status has changed to active.
+        
+        this->setStatus(player, questStatus::active);
+        
+        this->getDescription()->sendAddQuestNotification();
+        return true;
+    }
+    
+    /**
+    @brief
+        Adds a QuestListener to the list of QuestListeners listening to this Quest.
+    @param listener
+        The QuestListener to be added.
+    @return
+        Returns true if successful, false if not.
+    */
+    bool Quest::addListener(QuestListener* listener)
+    {
+        if(listener == NULL)
+        {
+            COUT(2) << "A NULL-QuestListener was trying to be added to a Quests listeners." << std::endl;
+            return false;
+        }
+        
+        this->listeners_.push_back(listener);
+        return true;
     }
 
Index: code/trunk/src/orxonox/objects/quest/Quest.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/Quest.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/Quest.h	(revision 2662)
@@ -28,9 +28,7 @@
  
 /**
-    @file Quest.h
-    @brief
-    Definition of the Quest class.
-    
-    The Quest is the parent class of LocalQuest and GlobalQuest.
+    @file
+    @brief Definition of the Quest class.
+        The Quest is the parent class of LocalQuest and GlobalQuest.
 */
  
@@ -47,19 +45,19 @@
 #include "QuestItem.h"
 
-namespace questStatus
+namespace orxonox
 {
+    namespace questStatus
+    {
 
-    //!Different states of a Quest.
-    enum Enum
-    {
-        inactive,
-        active,
-        failed,
-        completed
-    };
+        //!Different states of a Quest.
+        enum Enum
+        {
+            inactive,
+            active,
+            failed,
+            completed
+        };
 
-}
-
-namespace orxonox {
+    }
 
     /**
@@ -90,26 +88,28 @@
                 { return this->parentQuest_; }
                 
-	    /**
-	    @brief Returns the list of subquests.
-	    @return Returns a reference to the list of subquests of the quest.
-	    */
-	    inline const std::list<Quest*> & getSubQuestList(void) const
-		{ return this->subQuests_; }
-		    
-	    /**
-	    @brief Returns the list of all QuestHints of this Quest.
-	    @return Returns a reference to the list of QuestHints of the Quest.
-	    */
-	    inline const std::list<QuestHint*> & getHintsList(void) const
-		{ return this->hints_; }
-	    
-	    bool isInactive(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'inactive'.
-	    bool isActive(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'active'.
-	    bool isFailed(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'failed'.
-	    bool isCompleted(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'completed'.
-	    
-	    bool start(PlayerInfo* player); //!< Sets a Quest to active.
-	    virtual bool fail(PlayerInfo* player) = 0; //!< Fails the Quest.
-	    virtual bool complete(PlayerInfo* player) = 0; //!< Completes the Quest.
+            /**
+            @brief Returns the list of subquests.
+            @return Returns a reference to the list of subquests of the quest.
+            */
+            inline const std::list<Quest*> & getSubQuestList(void) const
+                { return this->subQuests_; }
+
+            /**
+            @brief Returns the list of all QuestHints of this Quest.
+            @return Returns a reference to the list of QuestHints of the Quest.
+            */
+            inline const std::list<QuestHint*> & getHintsList(void) const
+                { return this->hints_; }
+        
+            bool isInactive(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'inactive'.
+            bool isActive(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'active'.
+            bool isFailed(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'failed'.
+            bool isCompleted(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'completed'.
+        
+            bool start(PlayerInfo* player); //!< Sets a Quest to active.
+            virtual bool fail(PlayerInfo* player); //!< Fails the Quest.
+            virtual bool complete(PlayerInfo* player); //!< Completes the Quest.
+        
+            bool addListener(QuestListener* listener); //!< Adds a QuestListener to the list of QuestListeners listening to this Quest.
 
         protected:
@@ -131,9 +131,9 @@
                 { return this->failEffects_; }
                 
-	    /**
-	    @brief Returns the list of complete QuestEffects.
-	    @return Returns a reference to the list of complete QuestEffects.
-	    */
-	    inline std::list<QuestEffect*> & getCompleteEffectList(void)
+            /**
+            @brief Returns the list of complete QuestEffects.
+            @return Returns a reference to the list of complete QuestEffects.
+            */
+            inline std::list<QuestEffect*> & getCompleteEffectList(void)
                 { return this->completeEffects_; }
 
@@ -141,5 +141,5 @@
             virtual bool setStatus(PlayerInfo* player, const questStatus::Enum & status) = 0; //!< Changes the status for a specific player.
             
-    private:
+        private:
             Quest* parentQuest_; //!< Pointer to the parentquest.
             std::list<Quest*> subQuests_; //!< List of all the subquests.
@@ -149,4 +149,6 @@
             std::list<QuestEffect*> failEffects_; //!< A list of all QuestEffects to be invoked, when the Quest has been failed.
             std::list<QuestEffect*> completeEffects_; //!< A list of QuestEffects to be invoked, when the Quest has been completed.
+            
+            std::list<QuestListener*> listeners_; //!< A list of QuestListeners, that listen to what exactly happens with this Quest.
             
             bool setParentQuest(Quest* quest); //!< Sets the parentquest of the Quest.
Index: code/trunk/src/orxonox/objects/quest/QuestDescription.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestDescription.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/QuestDescription.cc	(revision 2662)
@@ -28,7 +28,6 @@
 
 /**
-    @file QuestDescription.cc
-    @brief
-    Implementation of the QuestDescription class.
+    @file
+    @brief Implementation of the QuestDescription class.
 */
 
@@ -38,7 +37,8 @@
 
 #include "core/CoreIncludes.h"
+#include "orxonox/overlays/notifications/Notification.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     CreateFactory(QuestDescription);
 
@@ -74,6 +74,61 @@
         XMLPortParam(QuestDescription, "title", setTitle, getTitle, xmlelement, mode);
         XMLPortParam(QuestDescription, "description", setDescription, getDescription, xmlelement, mode);
+        XMLPortParam(QuestDescription, "failMessage", setFailMessage, getFailMessage, xmlelement, mode);
+        XMLPortParam(QuestDescription, "completeMessage", setCompleteMessage, getCompleteMessage, xmlelement, mode);
 
         COUT(3) << "New QuestDescription with title '" << this->getTitle() << "' created." << std::endl;
+    }
+    
+    /**
+    @brief
+        This method is a helper for sending QuestDescriptions as Notifications.
+    @param item
+        The item the QuestDescription is for.
+    @param status
+        The status the QuestDescription us for.
+    @return
+        Returns true if successful.
+    */
+    bool QuestDescription::notificationHelper(const std::string & item, const std::string & status) const
+    {
+        std::string message = "";
+        std::string title = "";
+        if(item == "hint")
+        {
+            title = "You received a hint: '" + this->title_ + "'";
+            message = this->description_;
+        }
+        else if(item == "quest")
+        {
+            if(status == "start")
+            {
+                title = "You received a new quest: '" + this->title_ + "'";
+                message = this->description_;
+            }
+            else if(status == "fail")
+            {
+                title = "You failed the quest: '" + this->title_ + "'";
+                message = this->failMessage_;
+            }
+            else if(status == "complete")
+            {
+                title = "You successfully completed the quest: '" + this->title_ + "'";
+                message = this->completeMessage_;
+            }
+            else
+            {
+                COUT(2) << "Bad input in notificationHelper, this should not be happening!" << std::endl;
+                return false;
+            }
+        }
+        else
+        {
+            COUT(2) << "Bad input in notificationHelper, this should not be happening!" << std::endl;
+            return false;
+        }
+        
+        Notification* notification = new Notification(0, message, title, 30);
+        notification->send();
+        return true;
     }
 
Index: code/trunk/src/orxonox/objects/quest/QuestDescription.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestDescription.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/QuestDescription.h	(revision 2662)
@@ -28,7 +28,6 @@
 
 /**
-    @file QuestDescription.h
-    @brief
-    Definition of the QuestDescription class.
+    @file
+    @brief Definition of the QuestDescription class.
 */
 
@@ -43,6 +42,6 @@
 #include "core/XMLPort.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     /**
     @brief
@@ -52,10 +51,10 @@
         Creating a QuestDescription through XML goes as follows:
         
-        <QuestDescription title="Title" description="Description Text" />
+        <QuestDescription title="Title" description="Description Text" failMessage="You fail." completeMessage="You win!" />
     @author
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport QuestDescription : public BaseObject {
-
+    class _OrxonoxExport QuestDescription : public BaseObject
+    {
         public:
             QuestDescription(BaseObject* creator);
@@ -64,21 +63,67 @@
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestDescription object through XML.
 
-        /**
-        @brief Returns the title.
-        @return Returns a string containing the title of the QuestDescription.
-        */
+            /**
+            @brief Returns the title.
+            @return Returns a string containing the title of the QuestDescription.
+            */
             inline const std::string & getTitle(void) const
                 { return this->title_; }
         
-        /**
-        @brief Returns the description text.
-        @return Returns a string containing the description text of the QuestDescription.
-        */
+            /**
+            @brief Returns the description text.
+            @return Returns a string containing the description text of the QuestDescription.
+            */
             inline const std::string & getDescription(void) const
                 { return this->description_; }
+        
+            /**
+            @brief Returns the fail message.
+            @return Returns a string containing the fail message of the QuestDescription.
+            */
+            inline const std::string & getFailMessage(void) const
+                { return this->failMessage_; }
+        
+            /**
+            @brief Returns the complete message.
+            @return Returns a string containing the complete message of the QuestDescription.
+            */
+            inline const std::string & getCompleteMessage(void) const
+                { return this->completeMessage_; }
+        
+            /**
+            @brief Sends a Notification displaying that a QuestHint was added.
+            @return Returns true if successful.
+            */
+            inline bool sendAddHintNotification(void) const
+                { return notificationHelper("hint", ""); }
+        
+            /**
+            @brief Sends a Notification displaying that a Quest was added.
+            @return Returns true if successful.
+            */
+            inline bool sendAddQuestNotification(void) const
+                { return notificationHelper("quest", "start"); }
+        
+            /**
+            @brief Sends a Notification displaying that a Quest was failed.
+            @return Returns true if successful.
+            */
+            inline bool sendFailQuestNotification(void) const
+                { return notificationHelper("quest", "fail"); }
+        
+            /**
+            @brief Sends a Notification displaying that a Quest was completed.
+            @return Returns true if successful.
+            */
+            inline bool sendCompleteQuestNotification(void) const
+                { return notificationHelper("quest", "complete"); }
 
         private:
             std::string title_; //!< The title.
             std::string description_; //!< The description.
+            std::string failMessage_; //!< The message displayed when the Quest is failed.
+            std::string completeMessage_; //!< The message displayed when the Quest is completed.
+
+            bool notificationHelper(const std::string & item, const std::string & status) const; //!< Helper for sending QuestDescriptions as Notifications.
 
             /**
@@ -89,5 +134,5 @@
                 { this->title_ = title; }
                 
-        /**
+            /**
             @brief Sets the description text.
             @param description The description text to be set.
@@ -96,4 +141,18 @@
                 { this->description_ = description; }
 
+            /**
+            @brief Sets the fail message.
+            @param message The fail message to be set.
+            */
+            inline void setFailMessage(const std::string & message)
+                { this->failMessage_ = message; }
+                
+            /**
+            @brief Sets the complete message.
+            @param message The complete message to be set.
+            */
+            inline void setCompleteMessage(const std::string & message)
+                { this->completeMessage_ = message; }
+
     };
 
Index: code/trunk/src/orxonox/objects/quest/QuestEffect.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestEffect.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/QuestEffect.cc	(revision 2662)
@@ -28,7 +28,6 @@
 
 /**
-    @file QuestEffect.cc
-    @brief
-    Implementation of the QuestEffect class.
+    @file
+    @brief Implementation of the QuestEffect class.
 */
 
@@ -40,6 +39,6 @@
 #include "orxonox/objects/infos/PlayerInfo.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     /**
     @brief
@@ -71,7 +70,9 @@
         Returns false if there was an error, view console of log for further detail.
     */
-    bool QuestEffect::invokeEffects(PlayerInfo* player, std::list<QuestEffect*> & effects)
+    /*static*/ bool QuestEffect::invokeEffects(PlayerInfo* player, std::list<QuestEffect*> & effects)
     {
         bool check = true;
+        
+        COUT(4) << "Invoking QuestEffects on player: " << player << " ."  << std::endl;
 
         for (std::list<QuestEffect*>::iterator effect = effects.begin(); effect != effects.end(); effect++)
Index: code/trunk/src/orxonox/objects/quest/QuestEffect.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestEffect.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/QuestEffect.h	(revision 2662)
@@ -28,7 +28,6 @@
  
 /**
-    @file QuestEffect.h
-    @brief
-    Definition of the QuestEffect class.
+    @file
+    @brief Definition of the QuestEffect class.
 */
 
@@ -42,6 +41,6 @@
 #include "core/BaseObject.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     /**
     @brief
Index: code/trunk/src/orxonox/objects/quest/QuestEffectBeacon.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestEffectBeacon.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/QuestEffectBeacon.cc	(revision 2662)
@@ -28,7 +28,6 @@
 
 /**
-    @file QuestEffectBeacon.cc
-    @brief
-    Implementation of the QuestEffectBeacon class.
+    @file
+    @brief Implementation of the QuestEffectBeacon class.
 */
 
@@ -46,6 +45,6 @@
 #include "QuestEffect.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     CreateFactory(QuestEffectBeacon);
 
@@ -54,10 +53,10 @@
         Constructor. Registers the object and initializes defaults.
     */
-    QuestEffectBeacon::QuestEffectBeacon(BaseObject* creator) : PositionableEntity(creator)
+    QuestEffectBeacon::QuestEffectBeacon(BaseObject* creator) : StaticEntity(creator)
     {
         RegisterObject(QuestEffectBeacon);
         
         this->status_ = QuestEffectBeaconStatus::active;
-        this->times_ = INFINITE;
+        this->times_ = INFINITE_TIME;
     }
 
@@ -91,5 +90,5 @@
         SUPER(QuestEffectBeacon, processEvent, event);
     
-    SetSubclassEvent(QuestEffectBeacon, "execute", execute, event, PlayerTrigger);
+        SetSubclassEvent(QuestEffectBeacon, "execute", execute, event, PlayerTrigger);
     }
     
@@ -145,7 +144,7 @@
             this->decrementTimes(); //!< Decrement the number of times the beacon can be used.
             return true;
-    }
-
-    return false;
+        }
+
+        return false;
     }
     
@@ -187,5 +186,5 @@
             return false;
         }
-        if(this->getTimes() == INFINITE) //!< If times is infinity the QuestEffectBeacon can be executed an infinite number fo times.
+        if(this->getTimes() == INFINITE_TIME) //!< If times is infinity the QuestEffectBeacon can be executed an infinite number fo times.
         {
             return true;
@@ -193,8 +192,8 @@
         
         this->times_ = this->times_ - 1; //!< Decrement number of times the QuestEffectBeacon can be executed.
-    if(this->getTimes() == 0) //!< Set the QuestEffectBeacon to inactive when the number of times it can be executed is reduced to 0.
-    {
+        if(this->getTimes() == 0) //!< Set the QuestEffectBeacon to inactive when the number of times it can be executed is reduced to 0.
+        {
             this->status_ = QuestEffectBeaconStatus::inactive;
-    }
+        }
         
         return true;
@@ -213,5 +212,5 @@
     bool QuestEffectBeacon::setTimes(const int & n)
     {
-        if(n < 0 && n != INFINITE)
+        if(n < 0 && n != INFINITE_TIME)
         {
             return false;
Index: code/trunk/src/orxonox/objects/quest/QuestEffectBeacon.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestEffectBeacon.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/QuestEffectBeacon.h	(revision 2662)
@@ -28,7 +28,6 @@
 
 /**
-    @file QuestEffectBeacon.h
-    @brief
-    Definition of the QuestEffectBeacon class.
+    @file
+    @brief Definition of the QuestEffectBeacon class.
 */
 
@@ -38,19 +37,19 @@
 #include "OrxonoxPrereqs.h"
 
-#include "orxonox/objects/worldentities/PositionableEntity.h"
+#include "orxonox/objects/worldentities/StaticEntity.h"
 
-namespace QuestEffectBeaconStatus
+namespace orxonox
 {
+    namespace QuestEffectBeaconStatus
+    {
 
-    //! The status of the beacon, can be either active or inactive.
-    enum Enum
-    {
-        inactive,
-        active
-    };
+        //! The status of the beacon, can be either active or inactive.
+        enum Enum
+        {
+            inactive,
+            active
+        };
 
-}
-
-namespace orxonox {
+    }
 
     /**
@@ -61,7 +60,7 @@
         A QuestEffectBeacon can be inactive or active.
         
-    Creating a QuestEffectBeacon through XML goes as follows:
-    
-    <QuestEffectBeacon times=n> //Where 'n' is eighter a number >= 0, which means the QuestEffectBeacon can be executed n times. Or n = -1, which means the QuestEffectBeacon can be executed an infinite number of times.
+        Creating a QuestEffectBeacon through XML goes as follows:
+        
+        <QuestEffectBeacon times=n> //Where 'n' is eighter a number >= 0, which means the QuestEffectBeacon can be executed n times. Or n = -1, which means the QuestEffectBeacon can be executed an infinite number of times.
             <effects>
                 <QuestEffect /> //A list of QuestEffects, invoked when the QuestEffectBeacon is executed, see QuestEffect for the full XML representation.
@@ -70,37 +69,37 @@
             </effects>
             <events>
-        <execute>
-            <EventListener event=eventIdString />
-        </execute>
-        </events>
-        <attached>
-           <PlayerTrigger name=eventIdString /> //A PlayerTrigger triggering the execution of the QuestEffectBeacon.
-        </attached>
-    </QuestEffectBeacon>
+                <execute>
+                    <EventListener event=eventIdString />
+                </execute>
+            </events>
+            <attached>
+                <PlayerTrigger name=eventIdString /> //A PlayerTrigger triggering the execution of the QuestEffectBeacon.
+            </attached>
+        </QuestEffectBeacon>
     @author
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport QuestEffectBeacon : public PositionableEntity
+    class _OrxonoxExport QuestEffectBeacon : public StaticEntity
     {
-    public:
-        QuestEffectBeacon(BaseObject* creator);
-        virtual ~QuestEffectBeacon();
-        
-        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestEffectBeacon object through XML.
-        
-        virtual void processEvent(Event& event); //!< Processes an event for this QuestEffectBeacon.
-        
-        bool execute(bool b, PlayerTrigger* trigger); //!< Executes the QuestEffects of the QuestEffectBeacon.
-        
-        /**
-        @brief Tests whether the QuestEffectBeacon is active.
-        @return Returns true if the QuestEffectBeacon is active, fals if not.
-        */
-        inline bool isActive(void)
-           { return this->status_ == QuestEffectBeaconStatus::active; }
-        
-        bool setActive(bool activate); //!< Set the status of the QuestEffectBeacon.
-        
-    protected:
+        public:
+            QuestEffectBeacon(BaseObject* creator);
+            virtual ~QuestEffectBeacon();
+            
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestEffectBeacon object through XML.
+            
+            virtual void processEvent(Event& event); //!< Processes an event for this QuestEffectBeacon.
+            
+            bool execute(bool b, PlayerTrigger* trigger); //!< Executes the QuestEffects of the QuestEffectBeacon.
+            
+            /**
+            @brief Tests whether the QuestEffectBeacon is active.
+            @return Returns true if the QuestEffectBeacon is active, fals if not.
+            */
+            inline bool isActive(void)
+            { return this->status_ == QuestEffectBeaconStatus::active; }
+            
+            bool setActive(bool activate); //!< Set the status of the QuestEffectBeacon.
+            
+        protected:
             bool decrementTimes(void); //!< Decrement the number of times the QuestEffectBeacon can still be executed.
             
@@ -111,8 +110,8 @@
             inline const int & getTimes(void) const
                 { return this->times_; }
-
+    
         private:
-            static const int INFINITE = -1; //!< Constant to avoid using magic numbers.
-        
+            static const int INFINITE_TIME = -1; //!< Constant to avoid using magic numbers.
+            
             std::list<QuestEffect*> effects_; //!< The list of QuestEffects to be invoked on the executing player.
             int times_; //!< Number of times the beacon can be exectued.
Index: code/trunk/src/orxonox/objects/quest/QuestHint.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestHint.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/QuestHint.cc	(revision 2662)
@@ -28,7 +28,6 @@
  
 /**
-    @file QuestHint.cc
-    @brief
-    Implementation of the QuestHint class.
+    @file
+    @brief Implementation of the QuestHint class.
 */
 
@@ -41,8 +40,9 @@
 #include "orxonox/objects/infos/PlayerInfo.h"
 #include "QuestManager.h"
+#include "QuestDescription.h"
 #include "Quest.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     CreateFactory(QuestHint);
 
@@ -122,4 +122,6 @@
             {
                 this->playerStatus_[player] = questHintStatus::active;
+                
+                this->getDescription()->sendAddHintNotification();
                 return true;
             }
Index: code/trunk/src/orxonox/objects/quest/QuestHint.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestHint.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/QuestHint.h	(revision 2662)
@@ -28,7 +28,6 @@
  
 /**
-    @file QuestHint.h
-    @brief
-    Definition of the QuestHint class.
+    @file
+    @brief Definition of the QuestHint class.
 */
 
@@ -44,18 +43,17 @@
 #include "QuestItem.h"
 
-namespace questHintStatus
-{
-
-    //! The status of the hint.
-    enum Enum
-    {
-        inactive,
-        active
-    };
-
-}
-
 namespace orxonox
 {
+    namespace questHintStatus
+    {
+
+        //! The state of the hint.
+        enum Enum
+        {
+            inactive,
+            active
+        };
+
+    }
 
     /**
@@ -96,5 +94,5 @@
         private:
             Quest* quest_; //!< The Quest the QuestHint belongs to.
-            std::map<const PlayerInfo*, questHintStatus::Enum> playerStatus_; //!< List of the status for each player, with the Player-pointer as key.
+            std::map<const PlayerInfo*, questHintStatus::Enum> playerStatus_; //!< List of the states for each player, with the Player-pointer as key.
 
     };
Index: code/trunk/src/orxonox/objects/quest/QuestItem.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestItem.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/QuestItem.cc	(revision 2662)
@@ -28,7 +28,6 @@
  
 /**
-    @file QuestItem.cc
-    @brief
-    Implementation of the QuestItem class.
+    @file
+    @brief Implementation of the QuestItem class.
 */
 
@@ -40,6 +39,6 @@
 #include "QuestDescription.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     /**
     @brief
@@ -99,8 +98,6 @@
     @return
         Returns true if the string is likely to be of the required form.
-    @todo
-        Clarify form, more vigorous checks.
     */
-    bool QuestItem::isId(const std::string & id)
+    /*static*/ bool QuestItem::isId(const std::string & id)
     {
         return id.size() >= 32;
Index: code/trunk/src/orxonox/objects/quest/QuestItem.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestItem.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/QuestItem.h	(revision 2662)
@@ -28,9 +28,7 @@
  
 /**
-    @file QuestItem.h
-    @brief
-    Definition of the QuestItem class.
-    
-    The QuestItem is the parent class of Quest and QuestHint.
+    @file
+    @brief Definition of the QuestItem class.
+        The QuestItem is the parent class of Quest and QuestHint.
 */
 
@@ -46,7 +44,6 @@
 #include "core/XMLPort.h"
 
-namespace orxonox {
-
-
+namespace orxonox
+{
     /**
     @brief
@@ -67,12 +64,13 @@
             /**
             @brief Returns the id of this QuestItem.
-        @return Returns the id of the QuestItem.
+            @return Returns the id of the QuestItem.
             */
             inline const std::string & getId(void) const
                 { return this->id_; }
-        /**
-        @brief Returns the QuestDescription of the QuestItem.
-        @return Returns a pointer to the QuestDescription object of the QuestItem.
-        */
+            
+            /**
+            @brief Returns the QuestDescription of the QuestItem.
+            @return Returns a pointer to the QuestDescription object of the QuestItem.
+            */
             inline const QuestDescription* getDescription(void) const
                 { return this->description_; }
Index: code/trunk/src/orxonox/objects/quest/QuestListener.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestListener.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/quest/QuestListener.cc	(revision 2662)
@@ -0,0 +1,204 @@
+/*
+ *   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:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the QuestListener class.
+*/
+
+#include "OrxonoxStableHeaders.h"
+#include "QuestListener.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "util/Exception.h"
+
+#include "Quest.h"
+#include "QuestManager.h"
+
+namespace orxonox
+{
+    CreateFactory(QuestListener);
+
+    /**
+    @brief
+        Constructor. Registers the object and initializes variables.
+    */
+    QuestListener::QuestListener(BaseObject* creator) : BaseObject(creator)
+    {
+        RegisterObject(QuestListener);
+        
+        this->mode_ = questListenerMode::all;
+        this->quest_ = NULL;
+    }
+    
+    /**
+    @brief
+        Destructor.
+    */
+    QuestListener::~QuestListener()
+    {
+    }
+    
+    /**
+    @brief
+        Method for creating a Quest object through XML.
+    */
+    void QuestListener::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(QuestListener, XMLPort, xmlelement, mode);
+
+        XMLPortParam(QuestListener, "questId", setQuestId, getQuestId, xmlelement, mode);
+        XMLPortParam(QuestListener, "mode", setMode, getMode, xmlelement, mode);
+
+        this->quest_->addListener(this); //!< Adds the QuestListener to the Quests list of listeners.
+        
+        COUT(3) << "QuestListener created for quest: {" << this->quest_->getId() << "} with mode '" << this->getMode() << "'." << std::endl;
+    }
+    
+    /**
+    @brief
+        Makes all QuestListener in the list aware that a certain status change has occured and executes them if the status change affects them.
+    @param listeners
+        The list of QuestListeners that have to be made aware of the status change.
+    @param status
+        The status that has changed. Can be 'start' (if the Quest was started), 'complete' (if the Quest was completed) or 'fail' (if the Quest was failed).
+    */
+    /* static */ void QuestListener::advertiseStatusChange(std::list<QuestListener*> & listeners, const std::string & status)
+    {
+        for (std::list<QuestListener*>::iterator it = listeners.begin(); it != listeners.end(); ++it) //!< Iterate through all QuestListeners
+        {
+            QuestListener* listener = *it;
+            if(listener->getMode() == status || listener->getMode() == "all") //!< Check whether the status change affects the give QuestListener.
+            {
+                listener->execute();
+            }
+        }
+    }
+    
+    /**
+    @brief
+        Sets the questId of the Quest the QuestListener reacts to.
+    @param id
+        The questId of the Quest the QUestListener reacts to.
+    @return
+        Returns true if successful.
+    */
+    bool QuestListener::setQuestId(const std::string & id)
+    {
+        this->quest_ = QuestManager::findQuest(id); //!< Find the Quest corresponding to the given questId.
+        
+        if(this->quest_ == NULL) //!< If there is no such Quest.
+        {
+            ThrowException(Argument, "This is bad! The QuestListener has not found a Quest with a corresponding id..");
+            return false;
+        }
+        
+        return true;
+    }
+    
+    /**
+    @brief
+        Sets the mode of the QuestListener.
+    @param mode
+        The mode to be set. Can be eighter 'all', 'start', 'fail' or 'complete'.
+    @return
+        Returns true if successful.
+    */
+    bool QuestListener::setMode(const std::string & mode)
+    {
+        if(mode == "all")
+        {
+            this->mode_ = questListenerMode::all;
+        }
+        else if(mode == "start")
+        {
+            this->mode_ = questListenerMode::start;
+        }
+        else if(mode == "fail")
+        {
+            this->mode_ = questListenerMode::fail;
+        }
+        else if(mode == "complete")
+        {
+            this->mode_ = questListenerMode::complete;
+        }
+        else
+        {
+            COUT(2) << "QuestListener with invalid mode '" << mode << "' created. Mode set to 'all'." << std::endl;
+        this->mode_ = questListenerMode::all;
+        return false;
+        }
+        
+        return true;
+    }
+    
+    /**
+    @brief
+        Get the mode of the QuestListener.
+    @return
+        Return the mode of the QuestListener. Can be eighter 'all', 'start', 'fail' or 'complete'.
+    */
+    const std::string QuestListener::getMode(void)
+    {
+        if(this->mode_ == questListenerMode::all)
+        {
+            return "all";
+        }
+        else if(this->mode_ == questListenerMode::start)
+        {
+            return "start";
+        }
+        else if(this->mode_ == questListenerMode::fail)
+        {
+            return "fail";
+        }
+        else if(this->mode_ == questListenerMode::complete)
+        {
+            return "complete";
+        }
+        else
+        {
+            COUT(1) << "An unforseen, never to happen, Error has occured. This is impossible!" << std::endl;
+        return "";
+        }
+    }
+
+    /**
+    @brief
+        Executes the QuestListener, resp. fires an Event.
+    @return
+        Returns true if successful.
+    */
+    bool QuestListener::execute()
+    {
+        this->fireEvent(true);
+        return true;
+    }
+
+}
Index: code/trunk/src/orxonox/objects/quest/QuestListener.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestListener.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/quest/QuestListener.h	(revision 2662)
@@ -0,0 +1,111 @@
+/*
+ *   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:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the QuestListener class.
+*/
+
+#ifndef _QuestListener_H__
+#define _QuestListener_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <string>
+#include <list>
+
+#include "core/BaseObject.h"
+
+#include "Quest.h"
+
+namespace orxonox
+{
+    namespace questListenerMode
+    {
+
+        //! The mode of the QuestListener.
+        enum Enum
+        {
+            all,
+            start,
+            fail,
+            complete
+        };
+
+    }
+
+    /**
+    @brief
+        Provides a way to react to the starting, completing and failing of Quests.
+        
+        The XML representation goes as follows:
+        You can use the QuestListener as if it were a Trigger or EventListener, that fires an Event when the status (depending on the set mode) of the given Quest changes.
+        
+        <BaseObject> // The object that should react to the status change of a Quest.
+            <events>
+                <function> // Where function is the method of the object that schould be executed. Normally this would be visibility or activity.
+                    <QuestListener questId="someQuestId" mode="someMode" /> // Where someQuestId is the identifier for the Quest the QuestListener is reacting to, and someMode is the kind of status change the QUestListener reacts to (all, start, complete or fail).
+                </function>
+            </events>
+        </BaseObject>
+    @author
+    Damian 'Mozork' Frick
+    */
+    class _OrxonoxExport QuestListener : public BaseObject
+    {
+    public:
+        QuestListener(BaseObject* creator);
+        virtual ~QuestListener();
+        
+        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestListener object through XML.
+        
+        static void advertiseStatusChange(std::list<QuestListener*> & listeners, const std::string & status); //!< Makes all QuestListener in the list aware that a certain status change has occured.
+        
+        bool setQuestId(const std::string & id); //!< Sets the questId of the Quest the QuestListener reacts to.
+        bool setMode(const std::string & mode); //!< Sets the mode of the QuestListener.
+        
+        const std::string getMode(void); //!< Get the mode of the QuestListener.
+        
+        /**
+        @brief Get the questId of the Quest the QuestListener reacts to.
+        @return Returns the questId of the Quest the QuestListener reacts to.
+        */
+        inline const std::string & getQuestId(void)
+                { return this->quest_->getId(); }
+        
+        bool execute(void); //!< Executes the QuestListener, resp. fires an Event.
+        
+    private:
+        questListenerMode::Enum mode_; //!< The mode of the QuestListener.
+        Quest* quest_; //!< A pointer to the Quest the QuestListener is reacting to.
+    
+    };
+
+}
+
+#endif /* _QuestListener_H__ */
Index: code/trunk/src/orxonox/objects/quest/QuestManager.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestManager.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/QuestManager.cc	(revision 2662)
@@ -28,7 +28,6 @@
 
 /**
-    @file QuestManager.cc
-    @brief
-    Implementation of the QuestManager class.
+    @file
+    @brief Implementation of the QuestManager class.
 */
 
@@ -42,6 +41,6 @@
 #include "QuestHint.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     //! All Quests registered by their id's.
     std::map<std::string, Quest*> QuestManager::questMap_s;
@@ -76,5 +75,5 @@
         Returns true if successful, false if not.
     */
-    bool QuestManager::registerQuest(Quest* quest)
+    /*static*/ bool QuestManager::registerQuest(Quest* quest)
     {
         if(quest == NULL) //!< Doh! Just as if there were actual quests behind NULL-pointers.
@@ -108,5 +107,5 @@
         Returns true if successful, false if not.
     */
-    bool QuestManager::registerHint(QuestHint* hint)
+    /*static*/ bool QuestManager::registerHint(QuestHint* hint)
     {
         if(hint == NULL) //!< Still not liking NULL-pointers.
@@ -142,5 +141,5 @@
         Throws an exception if the given questId is invalid.
     */
-    Quest* QuestManager::findQuest(const std::string & questId)
+    /*static*/ Quest* QuestManager::findQuest(const std::string & questId)
     {
         if(!QuestItem::isId(questId)) //!< Check vor validity of the given id.
@@ -176,5 +175,5 @@
         Throws an exception if the given hintId is invalid.
     */
-    QuestHint* QuestManager::findHint(const std::string & hintId)
+    /*static*/ QuestHint* QuestManager::findHint(const std::string & hintId)
     {
         if(!QuestItem::isId(hintId)) //!< Check vor validity of the given id.
Index: code/trunk/src/orxonox/objects/quest/QuestManager.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestManager.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/QuestManager.h	(revision 2662)
@@ -28,7 +28,6 @@
 
 /**
-    @file QuestManager.h
-    @brief
-    Definition of the QuestManager class.
+    @file
+    @brief Definition of the QuestManager class.
 */
 
@@ -43,6 +42,6 @@
 #include "core/BaseObject.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     /**
     @brief
Index: code/trunk/src/orxonox/objects/quest/Rewardable.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/Rewardable.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/Rewardable.cc	(revision 2662)
@@ -28,7 +28,6 @@
 
 /**
-    @file Rewardable.cc
-    @brief
-    Implementation of the Rewardable class.
+    @file
+    @brief Implementation of the Rewardable class.
 */
 
@@ -38,6 +37,6 @@
 #include "core/CoreIncludes.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     /**
     @brief
Index: code/trunk/src/orxonox/objects/quest/Rewardable.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/Rewardable.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/quest/Rewardable.h	(revision 2662)
@@ -28,7 +28,6 @@
 
 /**
-    @file Rewardable.h
-    @brief
-    Definition of the Rewardable class.
+    @file
+    @brief Definition of the Rewardable class.
 */
 
@@ -40,6 +39,6 @@
 #include "core/BaseObject.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     /**
     @brief
@@ -52,5 +51,4 @@
     class _OrxonoxExport Rewardable : public BaseObject
     {
-
         public:
             Rewardable(BaseObject* creator);
@@ -61,10 +59,10 @@
                 Method to transcribe a rewardable object to the player.
                 Must be implemented by every class inheriting from Rewardable.
-        @param player
+            @param player
                 A pointer to the ControllableEntity, do whatever you want with it.
-        @return
+            @return
                 Return true if successful.
             */
-            virtual bool reward(PlayerInfo* player) = 0; //!<
+            virtual bool reward(PlayerInfo* player) = 0;
 
     };
Index: code/trunk/src/orxonox/objects/weaponSystem/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/CMakeLists.txt	(revision 2262)
+++ code/trunk/src/orxonox/objects/weaponSystem/CMakeLists.txt	(revision 2662)
@@ -2,4 +2,5 @@
   Munition.cc
   Weapon.cc
+  WeaponPack.cc
   WeaponSet.cc
   WeaponSlot.cc
@@ -7,7 +8,7 @@
 )
 
-#ADD_SOURCE_DIRECTORY(SRC_FILES munitions)
-#ADD_SOURCE_DIRECTORY(SRC_FILES projectiles)
-#ADD_SOURCE_DIRECTORY(SRC_FILES weapons)
+ADD_SOURCE_DIRECTORY(SRC_FILES munitions)
+ADD_SOURCE_DIRECTORY(SRC_FILES projectiles)
+ADD_SOURCE_DIRECTORY(SRC_FILES weapons)
 
 ADD_SOURCE_FILES(SRC_FILES)
Index: code/trunk/src/orxonox/objects/weaponSystem/Munition.cc
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/Munition.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/weaponSystem/Munition.cc	(revision 2662)
@@ -37,4 +37,6 @@
 namespace orxonox
 {
+    CreateFactory(Munition);
+
     Munition::Munition(BaseObject* creator) : BaseObject(creator)
     {
@@ -46,7 +48,73 @@
     }
 
+    unsigned int Munition::bullets()
+    {
+        if (this->bullets_ > 0)
+            return bullets_;
+        else
+            return 0;
+    }
+
+    unsigned int Munition::magazines()
+    {
+        if (this->magazines_ > 0)
+            return magazines_;
+        else
+            return 0;
+    }
+
+    void Munition::setMaxBullets(unsigned int amount)
+    { this->maxBullets_ = amount; }
+
+    void Munition::setMaxMagazines(unsigned int amount)
+    { this->maxMagazines_ = amount; }
+
+    void Munition::removeBullets(unsigned int amount)
+    {
+        if ( this->bullets_ != 0 )
+            this->bullets_ = this->bullets_ - amount;
+    }
+
+    void Munition::removeMagazines(unsigned int amount)
+    {
+        if ( this->magazines_ != 0 )
+            this->magazines_ = this->magazines_ - amount;
+    }
+
+    void Munition::addBullets(unsigned int amount)
+    {
+        if ( this->bullets_ == this->maxBullets_ )
+        {
+            //cannot add bullets to actual magazine
+        }
+        else
+            this->bullets_ = this->bullets_ + amount;
+    }
+
+    void Munition::addMagazines(unsigned int amount)
+    {
+        if ( this->magazines_ == this->maxMagazines_ )
+        {
+            //no more capacity for another magazine
+        }
+        else
+            this->magazines_ = this->magazines_ + amount;
+    }
+
+
+    void Munition::fillBullets()
+    {
+//COUT(0) << "Munition::fillBullets maxBullets_=" << this->maxBullets_ << std::endl;
+        this->bullets_ = this->maxBullets_;
+    }
+
+    void Munition::fillMagazines()
+    {
+        this->magazines_ = this->maxMagazines_;
+    }
+
     void Munition::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
-
+        SUPER(Munition, XMLPort, xmlelement, mode);
     }
 
Index: code/trunk/src/orxonox/objects/weaponSystem/Munition.h
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/Munition.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/weaponSystem/Munition.h	(revision 2662)
@@ -34,4 +34,6 @@
 #include "core/BaseObject.h"
 
+#include "Weapon.h"
+
 
 namespace orxonox
@@ -45,8 +47,25 @@
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
 
+            void setMaxBullets(unsigned int amount);
+            void setMaxMagazines(unsigned int amount);
+
+            void fillBullets();
+            void fillMagazines();
+
+            unsigned int bullets();
+            unsigned int magazines();
+
+            void removeBullets(unsigned int k);
+            void removeMagazines(unsigned int k);
+            void addBullets(unsigned int k);
+            void addMagazines(unsigned int k);
 
         private:
 
-
+        protected:
+            unsigned int bullets_;
+            unsigned int magazines_;
+            unsigned int maxBullets_;
+            unsigned int maxMagazines_;
     };
 }
Index: code/trunk/src/orxonox/objects/weaponSystem/Weapon.cc
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/Weapon.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/weaponSystem/Weapon.cc	(revision 2662)
@@ -37,11 +37,19 @@
 namespace orxonox
 {
-    Weapon::Weapon(BaseObject* creator) : BaseObject(creator)
+    CreateFactory(Weapon);
+
+    Weapon::Weapon(BaseObject* creator) : StaticEntity(creator)
     {
         RegisterObject(Weapon);
+        this->bulletReadyToShoot_ = true;
+        this->magazineReadyToShoot_ = true;
+        this->parentWeaponSystem_ = 0;
+        this->attachedToWeaponSlot_ = 0;
+        this->munition_ = 0;
+        this->bulletLoadingTime_ = 0;
+        this->magazineLoadingTime_ = 0;
+        this->bReloading_ = false;
 
-        this->loadingTime_ = 0;
-        this->munition_ = 0;
-
+        this->setObjectMode(0x0);
     }
 
@@ -50,17 +58,139 @@
     }
 
-    void Weapon::addMunition()
+
+    void Weapon::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
+        SUPER(Weapon, XMLPort, xmlelement, mode);
+        XMLPortParam(Weapon, "munitionType", setMunitionType, getMunitionType, xmlelement, mode);
+        XMLPortParam(Weapon, "bulletLoadingTime", setBulletLoadingTime, getBulletLoadingTime, xmlelement, mode);
+        XMLPortParam(Weapon, "magazineLoadingTime", setMagazineLoadingTime, getMagazineLoadingTime, xmlelement, mode);
+    }
+
+    void Weapon::setWeapon()
+    {
+        this->munition_->fillBullets();
+        this->munition_->fillMagazines();
+    }
+
+
+    void Weapon::fire()
+    {
+//COUT(0) << "LaserGun::fire, this=" << this << std::endl;
+        if ( this->bulletReadyToShoot_ && this->magazineReadyToShoot_ && !this->bReloading_)
+        {
+//COUT(0) << "LaserGun::fire - ready to shoot" << std::endl;
+//COUT(0) << "LaserGun::fire - bullets" << this->munition_->bullets() << std::endl;
+            this->bulletReadyToShoot_ = false;
+            if ( this->munition_->bullets() > 0)
+            {
+                //shoot
+                this->takeBullets();
+                this->createProjectile();
+            }
+            //if there are no bullets, but magazines
+            else if ( this->munition_->magazines() > 0 && this->munition_->bullets() == 0 )
+            {
+//COUT(0) << "LaserGun::fire - no bullets" << std::endl;
+                this->takeMagazines();
+            }
+            else
+            {
+//COUT(0) << "LaserGun::fire - no magazines" << std::endl;
+                //actions
+            }
+        }
+        else
+        {
+//COUT(0) << "LaserGun::fire - weapon not reloaded - bullets remaining:" << this->munition_->bullets() << std::endl;
+            //actions
+        }
 
     }
 
-    void Weapon::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+
+    void Weapon::bulletTimer(float bulletLoadingTime)
     {
-
+//COUT(0) << "Weapon::bulletTimer started" << std::endl;
+        this->bReloading_ = true;
+        this->bulletReloadTimer_.setTimer( bulletLoadingTime , false , this , createExecutor(createFunctor(&Weapon::bulletReloaded)));
+    }
+    void Weapon::magazineTimer(float magazineLoadingTime)
+    {
+//COUT(0) << "Weapon::magazineTimer started" << std::endl;
+        this->bReloading_ = true;
+        this->magazineReloadTimer_.setTimer( magazineLoadingTime , false , this , createExecutor(createFunctor(&Weapon::magazineReloaded)));
     }
 
-    void Weapon::fire()
+    void Weapon::bulletReloaded()
     {
+        this->bReloading_ = false;
+        this->bulletReadyToShoot_ = true;
+    }
 
+    void Weapon::magazineReloaded()
+    {
+        this->bReloading_ = false;
+        this->munition_->fillBullets();
+        this->magazineReadyToShoot_ = true;
+        this->bulletReadyToShoot_ = true;
     }
+
+
+    void Weapon::attachNeededMunition(std::string munitionName)
+    {
+//COUT(0) << "Weapon::attachNeededMunition, parentWeaponSystem=" << this->parentWeaponSystem_ << std::endl;
+        //if munition type already exists attach it, else create a new one of this type and attach it to the weapon and to the WeaponSystem
+        if (this->parentWeaponSystem_)
+        {
+//COUT(0) << "Weapon::attachNeededMunition " << munitionName << std::endl;
+            Munition* munition = this->parentWeaponSystem_->getMunitionType(munitionName);
+            if ( munition )
+                this->munition_ = munition;
+            else
+            {
+                //create new munition with identifier
+//COUT(0) << "Weapon::attachNeededMunition, create new Munition of Type " << munitionName << std::endl;
+                this->munitionIdentifier_ = ClassByString(munitionName);
+                this->munition_ = this->munitionIdentifier_.fabricate(this);
+                this->parentWeaponSystem_->setNewMunition(munitionName, this->munition_);
+            }
+        }
+    }
+
+
+     /*get and set functions
+     *
+     */
+
+    void Weapon::setMunitionType(std::string munitionType)
+    {   this->munitionType_ = munitionType; }
+
+    const std::string Weapon::getMunitionType()
+    {   return this->munitionType_;  }
+
+    void Weapon::setBulletLoadingTime(float loadingTime)
+    {   this->bulletLoadingTime_ = loadingTime; }
+
+    const float Weapon::getBulletLoadingTime()
+    {   return this->bulletLoadingTime_;  }
+
+    void Weapon::setMagazineLoadingTime(float loadingTime)
+    {   this->magazineLoadingTime_ = loadingTime; }
+
+    const float Weapon::getMagazineLoadingTime()
+    {   return this->magazineLoadingTime_;  }
+
+
+    Munition * Weapon::getAttachedMunition(std::string munitionType)
+    {
+//COUT(0) << "Weapon::getAttachedMunition, parentWeaponSystem_="<< this->parentWeaponSystem_ << std::endl;
+        this->munition_ = this->parentWeaponSystem_->getMunitionType(munitionType);
+//COUT(0) << "Weapon::getAttachedMunition, munition_="<< this->munition_ << std::endl;
+        return this->munition_;
+    }
+
+    void Weapon::takeBullets() { };
+    void Weapon::createProjectile() { };
+    void Weapon::takeMagazines() { };
+
 }
Index: code/trunk/src/orxonox/objects/weaponSystem/Weapon.h
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/Weapon.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/weaponSystem/Weapon.h	(revision 2662)
@@ -33,9 +33,16 @@
 
 #include "core/BaseObject.h"
+#include "tools/BillboardSet.h"
+#include "tools/Timer.h"
+#include "core/Identifier.h"
 
+#include "WeaponSystem.h"
+#include "Munition.h"
+
+#include "objects/worldentities/StaticEntity.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport Weapon : public BaseObject
+    class _OrxonoxExport Weapon : public StaticEntity
     {
         public:
@@ -45,13 +52,55 @@
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
 
-            void addMunition();
             virtual void fire();
+            void attachNeededMunition(std::string munitionType);
+            Munition * getAttachedMunition(std::string munitiontype);
+
+            //reloading
+            void bulletTimer(float bulletLoadingTime);
+            void magazineTimer(float magazineLoadingTime);
+            void bulletReloaded();
+            void magazineReloaded();
+
+            virtual void setMunitionType(std::string munitionType);
+            virtual const std::string getMunitionType();
+            virtual void setBulletLoadingTime(float loadingTime);
+            virtual const float getBulletLoadingTime();
+            virtual void setMagazineLoadingTime(float loadingTime);
+            virtual const float getMagazineLoadingTime();
+
+            virtual void takeBullets();
+            virtual void takeMagazines();
+            virtual void createProjectile();
+
+            inline void setParentWeaponSystem(WeaponSystem *parentWeaponSystem)
+                { this->parentWeaponSystem_=parentWeaponSystem; };
+            inline WeaponSystem * getParentWeaponSystem()
+                { return this->parentWeaponSystem_; };
+
+            inline void setAttachedToWeaponSlot(WeaponSlot * wSlot)
+                { this->attachedToWeaponSlot_ = wSlot; }
+            inline WeaponSlot * getAttachedToWeaponSlot()
+                { return this->attachedToWeaponSlot_; }
+
+            virtual void setWeapon();
 
         private:
-            int loadingTime_;
-            Munition *munition_;
 
+        protected:
+            bool bReloading_;
+            bool bulletReadyToShoot_;
+            bool magazineReadyToShoot_;
+            float bulletLoadingTime_;
+            float magazineLoadingTime_;
+            std::string munitionType_;
 
+            WeaponSlot * attachedToWeaponSlot_;
+            Munition * munition_;
+            WeaponSystem * parentWeaponSystem_;
 
+            SubclassIdentifier<Munition> munitionIdentifier_;
+
+            Timer<Weapon> bulletReloadTimer_;
+            Timer<Weapon> magazineReloadTimer_;
     };
 }
Index: code/trunk/src/orxonox/objects/weaponSystem/WeaponPack.cc
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/WeaponPack.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/weaponSystem/WeaponPack.cc	(revision 2662)
@@ -0,0 +1,125 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Martin Polak
+ *   Co-authors:
+ *      ... *
+ */
+
+#include "OrxonoxStableHeaders.h"
+
+#include <vector>
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "util/Debug.h"
+
+#include "WeaponPack.h"
+#include "objects/worldentities/pawns/Pawn.h"
+
+namespace orxonox
+{
+    CreateFactory(WeaponPack);
+
+    WeaponPack::WeaponPack(BaseObject* creator) : BaseObject(creator)
+    {
+        RegisterObject(WeaponPack);
+
+        this->parentWeaponSystem_ = 0;
+        this->firemode_ = 0;
+
+    }
+
+    WeaponPack::~WeaponPack()
+    {
+    }
+
+    int WeaponPack::getSize()
+    {
+        return this->weapons_.size();
+    }
+
+    void WeaponPack::fire()
+    {
+        for (int i=0; i < (int) this->weapons_.size(); i++)
+        {
+//COUT(0) << "WeaponPack::fire (attached from WeaponSet)  from Weapon: "<< i << std::endl;
+            this->weapons_[i]->getAttachedToWeaponSlot()->fire();
+        }
+    }
+
+    Weapon * WeaponPack::getWeaponPointer(unsigned int n)
+    {
+        return this->weapons_[n];
+    }
+
+    void WeaponPack::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(WeaponPack, XMLPort, xmlelement, mode);
+
+        XMLPortObject(WeaponPack, Weapon, "", addWeapon, getWeapon, xmlelement, mode);
+        XMLPortParam(WeaponPack, "firemode", setFireMode, getFireMode, xmlelement, mode);
+    }
+
+    void WeaponPack::setFireMode(unsigned int firemode)
+    {
+//COUT(0) << "WeaponPack::setFireMode " << std::endl;
+        this->firemode_ = firemode;
+    }
+
+    unsigned int WeaponPack::getFireMode()
+    {
+        return this->firemode_;
+    }
+
+    void WeaponPack::addWeapon(Weapon * weapon)
+    {
+//COUT(0) << "WeaponPack::addWeapon:" << weapon << "   munition " << weapon->getMunitionType() << std::endl;
+        this->weapons_.push_back(weapon);
+    }
+
+    const Weapon * WeaponPack::getWeapon(unsigned int index)
+    {
+        return weapons_[index];
+    }
+
+    void WeaponPack::setParentWeaponSystemToAllWeapons(WeaponSystem * weaponSystem)
+    {
+        for (int i=0; i < (int) this->weapons_.size(); i++)
+        {
+            this->weapons_[i]->setParentWeaponSystem(weaponSystem);
+        }
+
+    }
+
+    void WeaponPack::attachNeededMunitionToAllWeapons()
+    {
+        for (int i=0; i < (int) this->weapons_.size(); i++)
+        {
+            this->weapons_[i]->attachNeededMunition(weapons_[i]->getMunitionType());
+            //hack!
+            this->weapons_[i]->setWeapon();
+        }
+
+    }
+
+}
Index: code/trunk/src/orxonox/objects/weaponSystem/WeaponPack.h
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/WeaponPack.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/weaponSystem/WeaponPack.h	(revision 2662)
@@ -0,0 +1,77 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Martin Polak
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+
+#ifndef _WeaponPack_H__
+#define _WeaponPack_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "core/BaseObject.h"
+
+#include "Weapon.h"
+
+
+namespace orxonox
+{
+    class _OrxonoxExport WeaponPack : public BaseObject
+    {
+        public:
+            WeaponPack(BaseObject* creator);
+            virtual ~WeaponPack();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            void fire();
+
+            Weapon * getWeaponPointer(unsigned int n);
+            int getSize();
+
+            void setFireMode(unsigned int firemode);
+            unsigned int getFireMode();
+
+            void addWeapon(Weapon * weapon);
+            const Weapon * getWeapon(unsigned int index);
+
+            //functions needed for creating Pointer to the right objects (-->Pawn.cc)
+            void setParentWeaponSystemToAllWeapons(WeaponSystem * weaponSystem);
+            void attachNeededMunitionToAllWeapons();
+
+            inline void setParentWeaponSystem(WeaponSystem *parentWeaponSystem)
+                { parentWeaponSystem_=parentWeaponSystem; }
+            inline WeaponSystem * getParentWeaponSystem()
+                { return parentWeaponSystem_; }
+
+        private:
+            std::vector<Weapon *> weapons_;
+            WeaponSystem *parentWeaponSystem_;
+            unsigned int firemode_;
+    };
+}
+
+#endif /* _WeaponPack_H__ */
Index: code/trunk/src/orxonox/objects/weaponSystem/WeaponSet.cc
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/WeaponSet.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/weaponSystem/WeaponSet.cc	(revision 2662)
@@ -33,9 +33,13 @@
 #include "core/XMLPort.h"
 #include "util/Debug.h"
+#include "objects/worldentities/pawns/Pawn.h"
 
 #include "WeaponSet.h"
+#include "WeaponPack.h"
 
 namespace orxonox
 {
+    CreateFactory(WeaponSet);
+
     WeaponSet::WeaponSet(BaseObject* creator, int k) : BaseObject(creator)
     {
@@ -43,9 +47,5 @@
 
         this->parentWeaponSystem_ = 0;
-
-        for (int i=0;i<k;i++)
-        {
-            attachWeaponSlot(new WeaponSlot(this));
-        }
+        this->attachedWeaponPack_ = 0;
     }
 
@@ -54,32 +54,64 @@
     }
 
-    //Vorwärtsdeklaration
-    WeaponSystem * parentWeaponSystem_;
+    void WeaponSet::attachWeaponPack(WeaponPack *wPack)
+    {
+//COUT(0) << "WeaponSet::attachWeaponPack" << std::endl;
+//COUT(0) << "........ parentWeaponSystem_=" << this->parentWeaponSystem_ << std::endl;
+//COUT(0) << "........ this->parentWeaponSystem_->getWeaponSlotSize()" << this->parentWeaponSystem_->getWeaponSlotSize() << std::endl;
+//COUT(0) << "........ wPack->getSize()" << wPack->getSize() << std::endl;
+        if ( this->parentWeaponSystem_->getWeaponSlotSize()>0 && wPack->getSize()>0 && ( wPack->getSize() <= this->parentWeaponSystem_->getWeaponSlotSize() ) )
+        {
+//COUT(0) << "WeaponSet::attachWeaponPack after if" << std::endl;
+            this->attachedWeaponPack_ = wPack;
+            int wPackWeapon = 0;    //WeaponCounter for Attaching
+            //should be possible to choose which slot to use
+            for (  int i=0; i < wPack->getSize() ; i++  )
+            {
+                //at the moment this function only works for one weaponPack in the entire WeaponSystem...
+                if ( this->parentWeaponSystem_->getWeaponSlotPointer(i)->getAttachedWeapon() == 0 && this->parentWeaponSystem_->getWeaponSlotPointer(i) != 0) //if slot not full
+                {
+//COUT(0) << "WeaponSet::attachWeaponPack attaching Weapon" << std::endl;
+                    this->setWeaponSlots_.push_back( this->parentWeaponSystem_->getWeaponSlotPointer(i) );
+                    this->parentWeaponSystem_->getWeaponSlotPointer(i)->attachWeapon( wPack->getWeaponPointer(wPackWeapon) );
+                    this->parentWeaponSystem_->getParentPawn()->attach( wPack->getWeaponPointer(wPackWeapon) );
+                    wPackWeapon++;
+                }
+                else
+                {
+                    for (int k=0; k < this->parentWeaponSystem_->getWeaponSlotSize(); k++)
+                    {
+                        if ( this->parentWeaponSystem_->getWeaponSlotPointer(k)->getAttachedWeapon() == 0 )
+                        {
+//COUT(0) << "WeaponSet::attachWeaponPack mode 2 k="<< k << std::endl;
+                            this->setWeaponSlots_.push_back( this->parentWeaponSystem_->getWeaponSlotPointer(k) );
+                            this->parentWeaponSystem_->getWeaponSlotPointer(k)->attachWeapon( wPack->getWeaponPointer(wPackWeapon) );
+                            this->parentWeaponSystem_->getParentPawn()->attach( wPack->getWeaponPointer(wPackWeapon) );
+                            wPackWeapon++;
+                        }
+                    }
+                }
+            }
+        }
+    }
 
-    void WeaponSet::attachWeaponSlot(WeaponSlot *wSlot)
-    {
-        this->weaponSlots_.push_back(wSlot);
-    }
 
     void WeaponSet::fire()
     {
-        for (int i=0; i < (int) this->weaponSlots_.size(); i++)
-        {
-            this->weaponSlots_[i]->fire();
-        }
+        //fires all WeaponSlots available for this weaponSet attached from the WeaponPack
+//COUT(0) << "WeaponSet::fire from Pack: " << this->attachedWeaponPack_ << std::endl;
+        if (this->attachedWeaponPack_)
+            this->attachedWeaponPack_->fire();
     }
 
-    WeaponSlot * WeaponSet::getWeaponSlotPointer(unsigned int n)
-    {
-        if (n < this->weaponSlots_.size())
-            return this->weaponSlots_[n];
-        else
-            return 0;
-    }
+    void WeaponSet::setFireMode(const unsigned int firemode)
+    {   this->firemode_ = firemode; }
 
+    const unsigned int WeaponSet::getFireMode() const
+    {   return this->firemode_; }
 
     void WeaponSet::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
-
+        SUPER(WeaponSet, XMLPort, xmlelement, mode);
+        XMLPortParam(WeaponSet, "firemode", setFireMode, getFireMode, xmlelement, mode);
     }
 
Index: code/trunk/src/orxonox/objects/weaponSystem/WeaponSet.h
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/WeaponSet.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/weaponSystem/WeaponSet.h	(revision 2662)
@@ -48,7 +48,9 @@
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
 
-            void attachWeaponSlot(WeaponSlot *wSlot);
+            void attachWeaponPack(WeaponPack *wPack);
             void fire();
-            WeaponSlot * getWeaponSlotPointer(unsigned int n);
+
+            void setFireMode(const unsigned int firemode);
+            const unsigned int getFireMode() const;
 
             inline void setParentWeaponSystem(WeaponSystem *parentWeaponSystem)
@@ -58,6 +60,8 @@
 
         private:
-            std::vector<WeaponSlot *> weaponSlots_;
             WeaponSystem *parentWeaponSystem_;
+            std::vector<WeaponSlot *> setWeaponSlots_;
+            unsigned int firemode_;
+            WeaponPack * attachedWeaponPack_;
     };
 }
Index: code/trunk/src/orxonox/objects/weaponSystem/WeaponSlot.cc
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/WeaponSlot.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/weaponSystem/WeaponSlot.cc	(revision 2662)
@@ -36,15 +36,15 @@
 
 
-
 namespace orxonox
 {
-    WeaponSlot::WeaponSlot(BaseObject* creator) : BaseObject(creator)
+    CreateFactory(WeaponSlot);
+
+    WeaponSlot::WeaponSlot(BaseObject* creator) : StaticEntity(creator)
     {
         RegisterObject(WeaponSlot);
 
         this->unlimitedAmmo_ = false;
-
         this->attachedWeapon_ = 0;
-        this->parentWeaponSet_ = 0;
+        this->setObjectMode(0x0);
     }
 
@@ -53,8 +53,4 @@
     }
 
-    void WeaponSlot::attachWeapon(Weapon *weaponName)
-    {
-
-    }
 
     /*sets the munition type
@@ -67,12 +63,29 @@
     }
 
+
     void WeaponSlot::fire()
     {
+        if ( this->attachedWeapon_ )
+//COUT(0) << "WeaponSlot::fire" << std::endl;
+        this->attachedWeapon_->fire();
+    }
 
-    }
 
     void WeaponSlot::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
+        SUPER(WeaponSlot, XMLPort, xmlelement, mode);
+    }
 
+    void WeaponSlot::attachWeapon(Weapon *weapon)
+    {
+        this->attachedWeapon_ = weapon;
+        weapon->setAttachedToWeaponSlot(this);
+//COUT(0) << "WeaponSlot::attachWeapon position=" << this->getWorldPosition() << std::endl;
+        weapon->setPosition(this->getPosition());
+    }
+
+    Weapon * WeaponSlot::getAttachedWeapon() const
+    {
+        return this->attachedWeapon_;
     }
 }
Index: code/trunk/src/orxonox/objects/weaponSystem/WeaponSlot.h
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/WeaponSlot.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/weaponSystem/WeaponSlot.h	(revision 2662)
@@ -32,13 +32,10 @@
 #include "OrxonoxPrereqs.h"
 
-#include "core/BaseObject.h"
-
-
 #include "Weapon.h"
-
+#include "objects/worldentities/StaticEntity.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport WeaponSlot : public BaseObject
+    class _OrxonoxExport WeaponSlot : public StaticEntity
     {
         public:
@@ -48,13 +45,13 @@
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
 
-            void attachWeapon(Weapon *weaponName);
+            void attachWeapon(Weapon *weapon);
+            Weapon * getAttachedWeapon() const;
             void setAmmoType(bool isUnlimited);
             void fire();
 
-            inline void setParentWeaponSet(WeaponSet *parentWeaponSet)
-                { parentWeaponSet_=parentWeaponSet; }
-            inline WeaponSet * getParentWeaponSet()
-                { return parentWeaponSet_; }
-
+            inline void setParentWeaponSystem(WeaponSystem *parentWeaponSystem)
+                { parentWeaponSystem_=parentWeaponSystem; }
+            inline WeaponSystem * getParentWeaponSystem()
+                { return parentWeaponSystem_; }
 
 
@@ -63,5 +60,5 @@
             bool unlimitedAmmo_;
 
-            WeaponSet *parentWeaponSet_;
+            WeaponSystem *parentWeaponSystem_;
     };
 }
Index: code/trunk/src/orxonox/objects/weaponSystem/WeaponSystem.cc
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/WeaponSystem.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/weaponSystem/WeaponSystem.cc	(revision 2662)
@@ -37,4 +37,5 @@
 #include "WeaponSystem.h"
 
+
 /* WEAPONSYSTEM
  * creates the WeaponSystem and the ability to use weapons and munition
@@ -45,4 +46,6 @@
 namespace orxonox
 {
+    CreateFactory(WeaponSystem);
+
     WeaponSystem::WeaponSystem(BaseObject* creator) : BaseObject(creator)
     {
@@ -50,5 +53,5 @@
 
         this->activeWeaponSet_ = 0;
-        this->parentSpaceShip_ = 0;
+        this->parentPawn_ = 0;
     }
 
@@ -57,11 +60,41 @@
     }
 
-    //creates empty weaponSet
+    void WeaponSystem::attachWeaponPack(WeaponPack *wPack, unsigned int firemode)
+    {
+        if (firemode < this->weaponSets_.size())
+            this->weaponSets_[firemode]->attachWeaponPack(wPack);
+        this->weaponPacks_.push_back(wPack);
+    }
+
+    void WeaponSystem::attachWeaponSlot(WeaponSlot *wSlot)
+    {
+        wSlot->setParentWeaponSystem(this);
+        this->weaponSlots_.push_back(wSlot);
+    }
+
     void WeaponSystem::attachWeaponSet(WeaponSet *wSet)
     {
+        wSet->setParentWeaponSystem(this);
         this->weaponSets_.push_back(wSet);
-        wSet->setParentWeaponSystem(this);
     }
 
+    void WeaponSystem::setNewMunition(std::string munitionType, Munition * munitionToAdd)
+    {
+        this->munitionSet_[munitionType] = munitionToAdd;
+    }
+
+    //returns the Pointer to the munitionType
+    Munition * WeaponSystem::getMunitionType(std::string munitionType)
+    {
+//COUT(0) << "WeaponSystem::getMunitionType " << munitionType << std::endl;
+        std::map<std::string, Munition *>::const_iterator it = this->munitionSet_.find(munitionType);
+        if (it != this->munitionSet_.end())
+            return it->second;
+        else
+            return 0;
+    }
+
+
+/*
     //the first weaponSet is at n=0
     void WeaponSystem::setActiveWeaponSet(unsigned int n)
@@ -69,19 +102,33 @@
         if (n < this->weaponSets_.size())
             this->activeWeaponSet_ = this->weaponSets_[n];
+        else
+            this->activeWeaponSet_ = this->weaponSets_[0];
+    }
+*/
+
+
+    //n is the n'th weaponSet, starting with zero
+    //SpaceShip.cc only needs to have the keybinding to a specific Set-number n
+    void WeaponSystem::fire(WeaponMode::Enum n)
+    {
+        int set = 0;
+        switch (n)
+        {
+            case WeaponMode::fire:
+                set = 0;
+                break;
+            case WeaponMode::altFire:
+                set = 1;
+                break;
+            case WeaponMode::altFire2:
+                set = 2;
+                break;
+        }
+//COUT(0) << "WeaponSystem::fire" << std::endl;
+        if (set < (int)this->weaponSets_.size())
+//COUT(0) << "WeaponSystem::fire - after if" << std::endl;
+            this->weaponSets_[set]->fire();
     }
 
-    //n is the n'th weaponSet, starting with zero
-    //Spaceship.cc only needs to have the keybinding to a specific Set-number n
-    void WeaponSystem::fire(unsigned int n)
-    {
-        if (n < this->weaponSets_.size())
-            this->weaponSets_[n]->fire();
-    }
-
-    void WeaponSystem::fire()
-    {
-        if (this->activeWeaponSet_)
-            this->activeWeaponSet_->fire();
-    }
 
     WeaponSet * WeaponSystem::getWeaponSetPointer(unsigned int n)
@@ -93,7 +140,23 @@
     }
 
+    WeaponSlot * WeaponSystem::getWeaponSlotPointer(unsigned int n)
+    {
+        if (n < this->weaponSlots_.size())
+            return this->weaponSlots_[n];
+        else
+            return 0;
+    }
+
+    WeaponPack * WeaponSystem::getWeaponPackPointer(unsigned int n)
+    {
+        if (n < this->weaponPacks_.size())
+            return this->weaponPacks_[n];
+        else
+            return 0;
+    }
+
     void WeaponSystem::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
-
+        SUPER(WeaponSystem, XMLPort, xmlelement, mode);
     }
 
Index: code/trunk/src/orxonox/objects/weaponSystem/WeaponSystem.h
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/WeaponSystem.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/weaponSystem/WeaponSystem.h	(revision 2662)
@@ -36,7 +36,9 @@
 
 #include "WeaponSet.h"
+#include "WeaponPack.h"
 
 namespace orxonox
 {
+
     class _OrxonoxExport WeaponSystem : public BaseObject
     {
@@ -47,21 +49,31 @@
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
 
+            void attachWeaponSlot(WeaponSlot *wSlot);
             void attachWeaponSet(WeaponSet *wSet);
-            void fire();
-            void fire(unsigned int n);
-            void setActiveWeaponSet(unsigned int n);
+            //void fire();
+            void fire(WeaponMode::Enum fireMode);
+            //void setActiveWeaponSet(unsigned int n);
+            void attachWeaponPack(WeaponPack * wPack, unsigned int firemode);
             WeaponSet * getWeaponSetPointer(unsigned int n);
+            WeaponSlot * getWeaponSlotPointer(unsigned int n);
+            WeaponPack * getWeaponPackPointer(unsigned int n);
+            void setNewMunition(std::string munitionType, Munition * munitionToAdd);
+            Munition * getMunitionType(std::string munitionType);
 
-            inline void setParentSpaceShip(SpaceShip *parentSpaceShip)
-                { parentSpaceShip_=parentSpaceShip; }
-            inline SpaceShip * getParentSpaceShip()
-                { return parentSpaceShip_; }
+            inline void setParentPawn(Pawn *parentPawn)
+                { parentPawn_=parentPawn; }
+            inline Pawn * getParentPawn()
+                { return parentPawn_; }
 
+            inline int getWeaponSlotSize()
+                { return this->weaponSlots_.size(); }
 
         private:
             std::vector<WeaponSet *> weaponSets_;
+            std::vector<WeaponSlot *> weaponSlots_;
+            std::vector<WeaponPack *> weaponPacks_;
+            std::map<std::string, Munition *> munitionSet_;
             WeaponSet *activeWeaponSet_;
-
-            SpaceShip *parentSpaceShip_;
+            Pawn *parentPawn_;
     };
 }
Index: code/trunk/src/orxonox/objects/weaponSystem/munitions/LaserGunMunition.cc
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/munitions/LaserGunMunition.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/weaponSystem/munitions/LaserGunMunition.cc	(revision 2662)
@@ -37,7 +37,12 @@
 namespace orxonox
 {
-    LaserGunMunition::LaserGunMunition(BaseObject* creator) : BaseObject(creator)
+    CreateFactory(LaserGunMunition);
+
+    LaserGunMunition::LaserGunMunition(BaseObject* creator) : Munition(creator)
     {
         RegisterObject(LaserGunMunition);
+
+        this->maxBullets_ = 40;
+        this->maxMagazines_ = 100;
     }
 
Index: code/trunk/src/orxonox/objects/weaponSystem/munitions/LaserGunMunition.h
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/munitions/LaserGunMunition.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/weaponSystem/munitions/LaserGunMunition.h	(revision 2662)
@@ -33,9 +33,9 @@
 
 #include "core/BaseObject.h"
-
+#include "../Munition.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport LaserGunMunition : public BaseObject
+    class _OrxonoxExport LaserGunMunition : public Munition
     {
         public:
@@ -47,8 +47,4 @@
 
         private:
-            int bullets_;
-            int magazines_;
-            int maxBullets_;
-            int maxMagazines_;
 
 
Index: code/trunk/src/orxonox/objects/weaponSystem/projectiles/BillboardProjectile.cc
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/projectiles/BillboardProjectile.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/weaponSystem/projectiles/BillboardProjectile.cc	(revision 2662)
@@ -30,7 +30,9 @@
 #include "BillboardProjectile.h"
 
-#include <OgreBillboard.h>
+#include <OgreBillboardSet.h>
 
+#include "core/Core.h"
 #include "core/CoreIncludes.h"
+#include "objects/Scene.h"
 
 namespace orxonox
@@ -38,22 +40,27 @@
     CreateFactory(BillboardProjectile);
 
-    BillboardProjectile::BillboardProjectile(BaseObject* creator, Weapon* owner) : Projectile(creator, owner)
+    BillboardProjectile::BillboardProjectile(BaseObject* creator) : Projectile(creator)
     {
         RegisterObject(BillboardProjectile);
 
-        this->billboard_.setBillboardSet("Examples/Flare", ColourValue(1.0, 1.0, 0.5), 1);
-        this->attachObject(this->billboard_.getBillboardSet());
-        this->scale(0.5);
+        if (Core::showsGraphics())
+        {
+            assert(this->getScene()->getSceneManager()); // getScene() was already checked by WorldEntity
+            this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(0.5, 0.5, 0.7, 0.8), 1);
+            this->attachOgreObject(this->billboard_.getBillboardSet());
+        }
+
+        this->setScale(0.2);
     }
 
     BillboardProjectile::~BillboardProjectile()
     {
-        if (this->isInitialized() && this->owner_)
-            this->detachObject(this->billboard_.getBillboardSet());
+        if (this->isInitialized() && Core::showsGraphics() && this->billboard_.getBillboardSet())
+            this->detachOgreObject(this->billboard_.getBillboardSet());
     }
 
     void BillboardProjectile::setColour(const ColourValue& colour)
     {
-        this->billboard_.getBillboardSet()->getBillboard(0)->setColour(colour);
+        this->billboard_.setColour(colour);
     }
 
@@ -61,4 +68,5 @@
     {
         SUPER(BillboardProjectile, changedVisibility);
+
         this->billboard_.setVisible(this->isVisible());
     }
Index: code/trunk/src/orxonox/objects/weaponSystem/projectiles/BillboardProjectile.h
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/projectiles/BillboardProjectile.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/weaponSystem/projectiles/BillboardProjectile.h	(revision 2662)
@@ -41,5 +41,5 @@
     {
         public:
-            BillboardProjectile(BaseObject* creator, Weapon* owner = 0);
+            BillboardProjectile(BaseObject* creator);
             virtual ~BillboardProjectile();
 
Index: code/trunk/src/orxonox/objects/weaponSystem/projectiles/ParticleProjectile.cc
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/projectiles/ParticleProjectile.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/weaponSystem/projectiles/ParticleProjectile.cc	(revision 2662)
@@ -30,7 +30,11 @@
 #include "ParticleProjectile.h"
 
-#include "SpaceShip.h"
+#include <OgreParticleSystem.h>
+#include <OgreParticleEmitter.h>
+
+#include "core/Core.h"
 #include "core/CoreIncludes.h"
 #include "core/ConfigValueIncludes.h"
+#include "objects/Scene.h"
 
 namespace orxonox
@@ -38,20 +42,18 @@
     CreateFactory(ParticleProjectile);
 
-    ParticleProjectile::ParticleProjectile(BaseObject* creator, Weapon* owner) : BillboardProjectile(creator, owner)
+    ParticleProjectile::ParticleProjectile(BaseObject* creator) : BillboardProjectile(creator)
     {
         RegisterObject(ParticleProjectile);
 
-        this->particles_ = new ParticleInterface("Orxonox/shot2", LODParticle::normal);
-        this->particles_->addToSceneNode(this->getNode());
-        this->particles_->setKeepParticlesInLocalSpace(true);
-        if (this->owner_)
+        if (Core::showsGraphics())
         {
+            this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/shot3_small", LODParticle::normal);
+            this->attachOgreObject(this->particles_->getParticleSystem());
+            this->particles_->setKeepParticlesInLocalSpace(0);
+
+            this->particles_->getAllEmitters()->setDirection(-WorldEntity::FRONT);
         }
-//        else
-//        {
-//            this->particles_ = 0;
-//        }
-
-        this->setConfigValues();
+        else
+            this->particles_ = 0;
     }
 
@@ -59,10 +61,8 @@
     {
         if (this->isInitialized() && this->particles_)
+        {
+            this->detachOgreObject(this->particles_->getParticleSystem());
             delete this->particles_;
-    }
-
-    void ParticleProjectile::setConfigValues()
-    {
-        SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second").callback((Projectile*)this, &ParticleProjectile::speedChanged);
+        }
     }
 
@@ -70,12 +70,7 @@
     {
         SUPER(ParticleProjectile, changedVisibility);
-        this->particles_->setEnabled(this->isVisible());
-    }
 
-    bool ParticleProjectile::create(){
-      if(!Projectile::create())
-        return false;
-      this->particles_->getAllEmitters()->setDirection(-this->getOrientation()*Vector3(1,0,0));
-      return true;
+        if (this->particles_)
+            this->particles_->setEnabled(this->isVisible());
     }
 }
Index: code/trunk/src/orxonox/objects/weaponSystem/projectiles/ParticleProjectile.h
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/projectiles/ParticleProjectile.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/weaponSystem/projectiles/ParticleProjectile.h	(revision 2662)
@@ -41,10 +41,7 @@
     {
         public:
-            ParticleProjectile(BaseObject* creator, Weapon* owner = 0);
+            ParticleProjectile(BaseObject* creator);
             virtual ~ParticleProjectile();
             virtual void changedVisibility();
-            void setConfigValues();
-
-            virtual bool create();
 
         private:
Index: code/trunk/src/orxonox/objects/weaponSystem/projectiles/Projectile.cc
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/projectiles/Projectile.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/weaponSystem/projectiles/Projectile.cc	(revision 2662)
@@ -40,30 +40,31 @@
 #include "objects/worldentities/Model.h"
 #include "objects/worldentities/ParticleSpawner.h"
-#include "Settings.h"
+#include "objects/collisionshapes/SphereCollisionShape.h"
+#include "core/Core.h"
 
 namespace orxonox
 {
-    float Projectile::speed_s = 5000;
-
-    Projectile::Projectile(BaseObject* creator, Weapon* owner) : MovableEntity(creator), owner_(owner)
+    Projectile::Projectile(BaseObject* creator) : MovableEntity(creator)
     {
         RegisterObject(Projectile);
 
         this->setConfigValues();
-        this->explosionTemplateName_ = "Orxonox/explosion3";
-        this->smokeTemplateName_ = "Orxonox/smoke4";
+        this->bDestroy_ = false;
+        this->owner_ = 0;
 
-        this->setStatic(false);
-        this->translate(Vector3(55, 0, 0), Ogre::Node::TS_LOCAL);
+        // Get notification about collisions
 
-        if (this->owner_)
+        if (Core::isMaster())
         {
-            this->setOrientation(this->owner_->getOrientation());
-            this->setPosition(this->owner_->getPosition());
-            this->setVelocity(this->owner_->getInitialDir() * this->speed_);
+            this->enableCollisionCallback();
+
+            this->setCollisionType(Kinematic);
+
+            SphereCollisionShape* shape = new SphereCollisionShape(this);
+            shape->setRadius(10);
+            this->attachCollisionShape(shape);
+
+            this->destroyTimer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&Projectile::destroyObject)));
         }
-
-        if(!orxonox::Settings::isClient()) //only if not on client
-          this->destroyTimer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&Projectile::destroyObject)));
     }
 
@@ -76,13 +77,6 @@
         SetConfigValue(damage_, 15.0).description("The damage caused by the projectile");
         SetConfigValue(lifetime_, 4.0).description("The time in seconds a projectile stays alive");
-        SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second").callback(this, &Projectile::speedChanged);
     }
 
-    void Projectile::speedChanged()
-    {
-        Projectile::speed_s = this->speed_;
-        if (this->owner_)
-            this->setVelocity(this->owner_->getInitialDir() * this->speed_);
-    }
 
     void Projectile::tick(float dt)
@@ -93,35 +87,51 @@
             return;
 
-        float radius;
-        for (ObjectList<Model>::iterator it = ObjectList<Model>::begin(); it; ++it)
-        {
-//            if ((*it) != this->owner_)
-            {
-                radius = it->getScale3D().x * 3.0;
-
-                if (this->getPosition().squaredDistance(it->getPosition()) <= (radius*radius))
-                {
-                    // hit
-                    ParticleSpawner* explosion = new ParticleSpawner(this->explosionTemplateName_, LODParticle::low, 2.0);
-                    explosion->setPosition(this->getPosition());
-                    explosion->create();
-                    ParticleSpawner* smoke = new ParticleSpawner(this->smokeTemplateName_, LODParticle::normal, 2.0, 0.0);
-                    smoke->setPosition(this->getPosition());
-//                    smoke->getParticleInterface()->setSpeedFactor(3.0);
-                    smoke->create();
-                    delete this;
-                    return;
-                }
-            }
-        }
+        if (this->bDestroy_)
+            delete this;
     }
 
     void Projectile::destroyObject()
     {
-        delete this;
+        if (Core::isMaster())
+            delete this;
     }
 
-    bool Projectile::create(){
-      return WorldEntity::create();
+    bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
+    {
+        if (!this->bDestroy_ && Core::isMaster())
+        {
+            this->bDestroy_ = true;
+
+            if (this->owner_)
+            {
+                {
+                    ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
+                    effect->setPosition(this->getPosition());
+                    effect->setOrientation(this->getOrientation());
+                    effect->setDestroyAfterLife(true);
+                    effect->setSource("Orxonox/explosion3");
+                    effect->setLifetime(2.0f);
+                }
+                {
+                    ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
+                    effect->setPosition(this->getPosition());
+                    effect->setOrientation(this->getOrientation());
+                    effect->setDestroyAfterLife(true);
+                    effect->setSource("Orxonox/smoke4");
+                    effect->setLifetime(3.0f);
+                }
+            }
+
+            Pawn* victim = dynamic_cast<Pawn*>(otherObject);
+            if (victim)
+                victim->damage(this->damage_, this->owner_);
+        }
+        return false;
+    }
+
+    void Projectile::destroyedPawn(Pawn* pawn)
+    {
+        if (this->owner_ == pawn)
+            this->owner_ = 0;
     }
 }
Index: code/trunk/src/orxonox/objects/weaponSystem/projectiles/Projectile.h
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/projectiles/Projectile.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/weaponSystem/projectiles/Projectile.h	(revision 2662)
@@ -33,35 +33,32 @@
 
 #include "objects/worldentities/MovableEntity.h"
+#include "objects/worldentities/pawns/Pawn.h"
 #include "tools/Timer.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport Projectile : public MovableEntity
+    class _OrxonoxExport Projectile : public MovableEntity, public PawnListener
     {
         public:
+            Projectile(BaseObject* creator);
             virtual ~Projectile();
+
             void setConfigValues();
-            void speedChanged();
             void destroyObject();
+
             virtual void tick(float dt);
+            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
+            virtual void destroyedPawn(Pawn* pawn);
 
-            virtual bool create();
-
-            static float getSpeed()
-                { return Projectile::speed_s; }
-
-        protected:
-            Projectile(BaseObject* creator, Weapon* owner = 0);
-            SpaceShip* owner_;
+            inline void setOwner(Pawn* owner)
+                { this->owner_ = owner; }
+            inline Pawn* getOwner() const
+                { return this->owner_; }
 
         private:
-            std::string explosionTemplateName_;
-            std::string smokeTemplateName_;
-        protected:
-            static float speed_s;
-            float speed_;
-        private:
+            Pawn* owner_;
             float lifetime_;
             float damage_;
+            bool bDestroy_;
             Timer<Projectile> destroyTimer_;
     };
Index: code/trunk/src/orxonox/objects/weaponSystem/weapons/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/weapons/CMakeLists.txt	(revision 2262)
+++ code/trunk/src/orxonox/objects/weaponSystem/weapons/CMakeLists.txt	(revision 2662)
@@ -1,5 +1,6 @@
 SET( SRC_FILES
+  Fusion.cc
   LaserGun.cc
-  Missile.cc
+#  Missile.cc
 )
 
Index: code/trunk/src/orxonox/objects/weaponSystem/weapons/Fusion.cc
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/weapons/Fusion.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/weaponSystem/weapons/Fusion.cc	(revision 2662)
@@ -0,0 +1,77 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Martin Polak
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "util/Debug.h"
+
+#include "Fusion.h"
+
+
+namespace orxonox
+{
+    CreateFactory(Fusion);
+
+    Fusion::Fusion(BaseObject* creator) : Weapon(creator)
+    {
+        RegisterObject(Fusion);
+
+        this->speed_ = 1250;
+
+    }
+
+    Fusion::~Fusion()
+    {
+    }
+
+    void Fusion::takeBullets()
+    {
+//COUT(0) << "Fusion::takeBullets" << std::endl;
+        this->munition_->removeBullets(1);
+        this->bulletTimer(this->bulletLoadingTime_);
+    }
+
+    void Fusion::takeMagazines()
+    {
+        this->munition_->removeMagazines(1);
+        this->magazineTimer(this->magazineLoadingTime_);
+    }
+
+    void Fusion::createProjectile()
+    {
+//COUT(0) << "Fusion::createProjectile" << std::endl;
+        BillboardProjectile* projectile = new ParticleProjectile(this);
+        projectile->setOrientation(this->getWorldOrientation());
+        projectile->setPosition(this->getWorldPosition());
+        projectile->setVelocity(this->getWorldOrientation() * WorldEntity::FRONT * this->speed_);
+        projectile->setOwner(this->getParentWeaponSystem()->getParentPawn());
+    }
+}
Index: code/trunk/src/orxonox/objects/weaponSystem/weapons/Fusion.h
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/weapons/Fusion.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/weaponSystem/weapons/Fusion.h	(revision 2662)
@@ -0,0 +1,60 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Martin Polak
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Fusion_H__
+#define _Fusion_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "core/BaseObject.h"
+
+#include "../munitions/LaserGunMunition.h"
+#include "util/Math.h"
+#include "../Weapon.h"
+#include "../projectiles/BillboardProjectile.h"
+#include "../projectiles/ParticleProjectile.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport Fusion : public Weapon
+    {
+        public:
+            Fusion(BaseObject* creator);
+            virtual ~Fusion();
+
+            virtual void takeBullets();
+            virtual void takeMagazines();
+            virtual void createProjectile();
+
+        private:
+            float speed_;
+
+    };
+}
+
+#endif /* _Fusion_H__ */
Index: code/trunk/src/orxonox/objects/weaponSystem/weapons/LaserGun.cc
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/weapons/LaserGun.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/weaponSystem/weapons/LaserGun.cc	(revision 2662)
@@ -34,12 +34,17 @@
 #include "util/Debug.h"
 
+#include "LaserGun.h"
+
 
 namespace orxonox
 {
+    CreateFactory(LaserGun);
+
     LaserGun::LaserGun(BaseObject* creator) : Weapon(creator)
     {
         RegisterObject(LaserGun);
 
-        projectileColor_ = ColourValue(1.0, 1.0, 0.5)
+        this->speed_ = 1250;
+
     }
 
@@ -48,30 +53,25 @@
     }
 
-    LaserGun::fire()
+    void LaserGun::takeBullets()
     {
-            BillboardProjectile* projectile = new ParticleProjectile(this);
-            projectile->setColour(this->projectileColor_);
-            projectile->create();
-            if (projectile->getClassID() == 0)
-            {
-              COUT(3) << "generated projectile with classid 0" <<  std::endl; // TODO: remove this output
-            }
-
-            projectile->setObjectMode(0x3);
+//COUT(0) << "LaserGun::takeBullets" << std::endl;
+        this->munition_->removeBullets(1);
+        this->bulletTimer(this->bulletLoadingTime_);
     }
 
-    LaserGun::addMunition()
+    void LaserGun::takeMagazines()
     {
-        //this->munition_ = ;
+        this->munition_->removeMagazines(1);
+        this->magazineTimer(this->magazineLoadingTime_);
     }
 
-    void LaserGun::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    void LaserGun::createProjectile()
     {
-
-    }
-
-    ColorValue LaserGun::getProjectileColor()
-    {
-        return projectileColor_;
+//COUT(0) << "LaserGun::createProjectile" << std::endl;
+        BillboardProjectile* projectile = new ParticleProjectile(this);
+        projectile->setOrientation(this->getWorldOrientation());
+        projectile->setPosition(this->getWorldPosition());
+        projectile->setVelocity(this->getWorldOrientation() * WorldEntity::FRONT * this->speed_);
+        projectile->setOwner(this->getParentWeaponSystem()->getParentPawn());
     }
 }
Index: code/trunk/src/orxonox/objects/weaponSystem/weapons/LaserGun.h
===================================================================
--- code/trunk/src/orxonox/objects/weaponSystem/weapons/LaserGun.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/weaponSystem/weapons/LaserGun.h	(revision 2662)
@@ -34,7 +34,9 @@
 #include "core/BaseObject.h"
 
-#include "LaserGunMunition.h"
-#include "tools/BillboardSet.h"
+#include "../munitions/LaserGunMunition.h"
 #include "util/Math.h"
+#include "../Weapon.h"
+#include "../projectiles/BillboardProjectile.h"
+#include "../projectiles/ParticleProjectile.h"
 
 namespace orxonox
@@ -46,12 +48,10 @@
             virtual ~LaserGun();
 
-            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
-            ColourValue LaserGun::getProjectileColour();
+            virtual void takeBullets();
+            virtual void takeMagazines();
+            virtual void createProjectile();
 
         private:
-            ColorValue projectileColor_;
-
-
+            float speed_;
 
     };
Index: code/trunk/src/orxonox/objects/worldentities/Backlight.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Backlight.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/Backlight.cc	(revision 2662)
@@ -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(this->node_);
+            }
+        }
+
         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/trunk/src/orxonox/objects/worldentities/Backlight.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Backlight.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/Backlight.h	(revision 2662)
@@ -31,44 +31,70 @@
 
 #include "OrxonoxPrereqs.h"
-
-#include "PositionableEntity.h"
-#include "tools/BillboardSet.h"
+#include "FadingBillboard.h"
+#include "gamestates/GSRoot.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport Backlight : public PositionableEntity
+    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/trunk/src/orxonox/objects/worldentities/Billboard.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Billboard.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/Billboard.cc	(revision 2662)
@@ -30,6 +30,9 @@
 #include "Billboard.h"
 
+#include <OgreBillboardSet.h>
+
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
+#include "core/Core.h"
 #include "objects/Scene.h"
 
@@ -38,7 +41,10 @@
     CreateFactory(Billboard);
 
-    Billboard::Billboard(BaseObject* creator) : PositionableEntity(creator)
+    Billboard::Billboard(BaseObject* creator) : StaticEntity(creator)
     {
         RegisterObject(Billboard);
+
+        this->material_ = "";
+        this->colour_ = ColourValue::White;
 
         this->registerVariables();
@@ -50,5 +56,5 @@
         {
             if (this->isInitialized() && this->billboard_.getBillboardSet())
-                this->getNode()->detachObject(this->billboard_.getName());
+                this->detachOgreObject(this->billboard_.getBillboardSet());
         }
     }
@@ -64,17 +70,20 @@
     void Billboard::registerVariables()
     {
-        REGISTERSTRING(this->material_, direction::toclient, new NetworkCallback<Billboard>(this, &Billboard::changedMaterial));
-        REGISTERDATA  (this->colour_,   direction::toclient, new NetworkCallback<Billboard>(this, &Billboard::changedColour));
+        registerVariable(this->material_, variableDirection::toclient, new NetworkCallback<Billboard>(this, &Billboard::changedMaterial));
+        registerVariable(this->colour_,   variableDirection::toclient, new NetworkCallback<Billboard>(this, &Billboard::changedColour));
     }
 
     void Billboard::changedMaterial()
     {
+        if (this->material_ == "")
+            return;
+
         if (!this->billboard_.getBillboardSet())
         {
-            if (this->getScene() && this->getScene()->getSceneManager())
+            if (this->getScene() && Core::showsGraphics())
             {
                 this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1);
                 if (this->billboard_.getBillboardSet())
-                    this->getNode()->attachObject(this->billboard_.getBillboardSet());
+                     this->attachOgreObject(this->billboard_.getBillboardSet());
                 this->billboard_.setVisible(this->isVisible());
             }
@@ -88,11 +97,13 @@
         if (!this->billboard_.getBillboardSet())
         {
-            if (this->getScene() && this->getScene()->getSceneManager())
+/*
+            if (this->getScene() && Core::showsGraphics() && (this->material_ != ""))
             {
                 this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1);
                 if (this->billboard_.getBillboardSet())
-                    this->getNode()->attachObject(this->billboard_.getBillboardSet());
+                    this->attachOgreObject(this->billboard_.getBillboardSet());
                 this->billboard_.setVisible(this->isVisible());
             }
+*/
         }
         else
Index: code/trunk/src/orxonox/objects/worldentities/Billboard.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Billboard.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/Billboard.h	(revision 2662)
@@ -31,5 +31,5 @@
 
 #include "OrxonoxPrereqs.h"
-#include "PositionableEntity.h"
+#include "StaticEntity.h"
 #include "util/Math.h"
 #include "tools/BillboardSet.h"
@@ -37,5 +37,5 @@
 namespace orxonox
 {
-    class _OrxonoxExport Billboard : public PositionableEntity
+    class _OrxonoxExport Billboard : public StaticEntity
     {
         public:
@@ -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/trunk/src/orxonox/objects/worldentities/BlinkingBillboard.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/BlinkingBillboard.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/BlinkingBillboard.cc	(revision 2662)
@@ -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/trunk/src/orxonox/objects/worldentities/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/CMakeLists.txt	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/CMakeLists.txt	(revision 2662)
@@ -1,17 +1,22 @@
 SET( SRC_FILES
   WorldEntity.cc
-  PositionableEntity.cc
+  StaticEntity.cc
   MovableEntity.cc
+  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
-#  Backlight.cc
+  Planet.cc
+  SpawnPoint.cc
 )
 
Index: code/trunk/src/orxonox/objects/worldentities/Camera.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Camera.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/Camera.cc	(revision 2662)
@@ -36,5 +36,4 @@
 #include <OgreSceneManager.h>
 #include <OgreSceneNode.h>
-#include <OgreViewport.h>
 
 #include "util/Exception.h"
@@ -48,13 +47,19 @@
     CreateFactory(Camera);
 
-    Camera::Camera(BaseObject* creator) : PositionableEntity(creator)
+    Camera::Camera(BaseObject* creator) : StaticEntity(creator)
     {
         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->getNode()->attachObject(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->getWorldPosition() - this->cameraNode_->getWorldPosition();
+            this->cameraNode_->translate(coeff * offset);
+
+            this->cameraNode_->setOrientation(Quaternion::Slerp(coeff, this->cameraNode_->getWorldOrientation(), this->getWorldOrientation(), true));
+            //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/trunk/src/orxonox/objects/worldentities/Camera.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Camera.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/Camera.h	(revision 2662)
@@ -33,10 +33,10 @@
 
 #include <OgrePrerequisites.h>
-#include "objects/worldentities/PositionableEntity.h"
+#include "objects/worldentities/StaticEntity.h"
 #include "objects/Tickable.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport Camera : public PositionableEntity, public Tickable
+    class _OrxonoxExport Camera : public StaticEntity, public Tickable
     {
         friend class CameraManager;
@@ -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/trunk/src/orxonox/objects/worldentities/CameraPosition.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/CameraPosition.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/CameraPosition.cc	(revision 2662)
@@ -38,9 +38,10 @@
     CreateFactory(CameraPosition);
 
-    CameraPosition::CameraPosition(BaseObject* creator) : PositionableEntity(creator)
+    CameraPosition::CameraPosition(BaseObject* creator) : StaticEntity(creator)
     {
         RegisterObject(CameraPosition);
 
         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/trunk/src/orxonox/objects/worldentities/CameraPosition.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/CameraPosition.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/CameraPosition.h	(revision 2662)
@@ -32,9 +32,9 @@
 #include "OrxonoxPrereqs.h"
 
-#include "objects/worldentities/PositionableEntity.h"
+#include "objects/worldentities/StaticEntity.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport CameraPosition : public PositionableEntity
+    class _OrxonoxExport CameraPosition : public StaticEntity
     {
         public:
@@ -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/trunk/src/orxonox/objects/worldentities/ControllableEntity.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/ControllableEntity.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/ControllableEntity.cc	(revision 2662)
@@ -23,5 +23,5 @@
  *      Fabian 'x3n' Landau
  *   Co-authors:
- *      ...
+ *      Reto Grieder
  *
  */
@@ -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"
 
@@ -44,9 +49,11 @@
     CreateFactory(ControllableEntity);
 
-    ControllableEntity::ControllableEntity(BaseObject* creator) : WorldEntity(creator)
+    ControllableEntity::ControllableEntity(BaseObject* creator) : MobileEntity(creator)
     {
         RegisterObject(ControllableEntity);
 
-        this->bControlled_ = false;
+        this->bHasLocalController_ = false;
+        this->bHasHumanController_ = false;
+
         this->server_overwrite_ = 0;
         this->client_overwrite_ = 0;
@@ -56,15 +63,24 @@
         this->camera_ = 0;
         this->bDestroyWhenPlayerLeft_ = false;
-
-        this->velocity_ = Vector3::ZERO;
-        this->acceleration_ = Vector3::ZERO;
-
-        this->server_position_ = Vector3::ZERO;
-        this->client_position_ = Vector3::ZERO;
-        this->server_velocity_ = Vector3::ZERO;
-        this->client_velocity_ = Vector3::ZERO;
-        this->server_orientation_ = Quaternion::IDENTITY;
-        this->client_orientation_ = Quaternion::IDENTITY;
-
+        this->cameraPositionRootNode_ = this->node_->createChildSceneNode();
+        this->bMouseLook_ = false;
+        this->mouseLookSpeed_ = 200;
+
+        this->gtinfo_ = 0;
+        this->gtinfoID_ = OBJECTID_UNKNOWN;
+        this->changedGametype();
+
+        this->server_position_         = Vector3::ZERO;
+        this->client_position_         = Vector3::ZERO;
+        this->server_linear_velocity_  = Vector3::ZERO;
+        this->client_linear_velocity_  = Vector3::ZERO;
+        this->server_orientation_      = Quaternion::IDENTITY;
+        this->client_orientation_      = Quaternion::IDENTITY;
+        this->server_angular_velocity_ = Vector3::ZERO;
+        this->client_angular_velocity_ = Vector3::ZERO;
+
+
+        this->setConfigValues();
+        this->setPriority( priority::very_high );
         this->registerVariables();
     }
@@ -74,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_)
@@ -83,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());
         }
     }
@@ -98,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);
     }
@@ -141,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);
     }
 
@@ -156,14 +229,15 @@
         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(direction::bidirectional);
+                this->setObjectMode(objectDirection::bidirectional);
             }
         }
@@ -172,11 +246,12 @@
     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->setObjectMode(direction::toclient);
+        this->bHasLocalController_ = false;
+        this->bHasHumanController_ = false;
+        this->setObjectMode(objectDirection::toclient);
 
         if (this->bDestroyWhenPlayerLeft_)
@@ -195,52 +270,80 @@
     }
 
-    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;
+        }
     }
 
     void ControllableEntity::tick(float dt)
     {
+        MobileEntity::tick(dt);
+
         if (this->isActive())
         {
-            this->velocity_ += (dt * this->acceleration_);
-            this->node_->translate(dt * this->velocity_, Ogre::Node::TS_LOCAL);
-
-            if (Core::isMaster())
+            // Check whether Bullet doesn't do the physics for us
+            if (!this->isDynamic())
             {
-                this->server_velocity_ = this->velocity_;
-                this->server_position_ = this->node_->getPosition();
+                if (Core::isMaster())
+                {
+                    this->server_position_ = this->getPosition();
+                    this->server_orientation_ = this->getOrientation();
+                    this->server_linear_velocity_ = this->getVelocity();
+                    this->server_angular_velocity_ = this->getAngularVelocity();
+                }
+                else if (this->bHasLocalController_)
+                {
+                    this->client_position_ = this->getPosition();
+                    this->client_orientation_ = this->getOrientation();
+                    this->client_linear_velocity_ = this->getVelocity();
+                    this->client_angular_velocity_ = this->getAngularVelocity();
+                }
             }
-            else if (this->bControlled_)
-            {
-//                COUT(2) << "setting client position" << endl;
-                this->client_velocity_ = this->velocity_;
-                this->client_position_ = this->node_->getPosition();
-            }
         }
     }
@@ -248,46 +351,56 @@
     void ControllableEntity::registerVariables()
     {
-        REGISTERSTRING(this->cameraPositionTemplate_, direction::toclient);
-
-        REGISTERDATA(this->client_overwrite_,   direction::toserver);
-        
-        REGISTERDATA(this->server_position_,    direction::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerPosition));
-        REGISTERDATA(this->server_velocity_,    direction::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerVelocity));
-        REGISTERDATA(this->server_orientation_, direction::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerOrientation));
-        REGISTERDATA(this->server_overwrite_,   direction::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processOverwrite));
-
-        REGISTERDATA(this->client_position_,    direction::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientPosition));
-        REGISTERDATA(this->client_velocity_,    direction::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientVelocity));
-        REGISTERDATA(this->client_orientation_, direction::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientOrientation));
-
-
-        REGISTERDATA(this->playerID_, direction::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::networkcallback_changedplayerID));
+        registerVariable(this->cameraPositionTemplate_,  variableDirection::toclient);
+        registerVariable(this->hudtemplate_,             variableDirection::toclient);
+
+        registerVariable(this->server_position_,         variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerPosition));
+        registerVariable(this->server_linear_velocity_,  variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerLinearVelocity));
+        registerVariable(this->server_orientation_,      variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerOrientation));
+        registerVariable(this->server_angular_velocity_, variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerAngularVelocity));
+
+        registerVariable(this->server_overwrite_,        variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processOverwrite));
+        registerVariable(this->client_overwrite_,        variableDirection::toserver);
+
+        registerVariable(this->client_position_,         variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientPosition));
+        registerVariable(this->client_linear_velocity_,  variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientLinearVelocity));
+        registerVariable(this->client_orientation_,      variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientOrientation));
+        registerVariable(this->client_angular_velocity_, variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientAngularVelocity));
+
+        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_)
-            this->node_->setPosition(this->server_position_);
-    }
-
-    void ControllableEntity::processServerVelocity()
-    {
-        if (!this->bControlled_)
-            this->velocity_ = this->server_velocity_;
+        if (!this->bHasLocalController_)
+            MobileEntity::setPosition(this->server_position_);
+    }
+
+    void ControllableEntity::processServerLinearVelocity()
+    {
+        if (!this->bHasLocalController_)
+            MobileEntity::setVelocity(this->server_linear_velocity_);
     }
 
     void ControllableEntity::processServerOrientation()
     {
-        if (!this->bControlled_)
-            this->node_->setOrientation(this->server_orientation_);
+        if (!this->bHasLocalController_)
+            MobileEntity::setOrientation(this->server_orientation_);
+    }
+
+    void ControllableEntity::processServerAngularVelocity()
+    {
+        if (!this->bHasLocalController_)
+            MobileEntity::setAngularVelocity(this->server_angular_velocity_);
     }
 
     void ControllableEntity::processOverwrite()
     {
-        if (this->bControlled_)
+        if (this->bHasLocalController_)
         {
             this->setPosition(this->server_position_);
-            this->setVelocity(this->server_velocity_);
             this->setOrientation(this->server_orientation_);
+            this->setVelocity(this->server_linear_velocity_);
+            this->setAngularVelocity(this->server_angular_velocity_);
 
             this->client_overwrite_ = this->server_overwrite_;
@@ -299,18 +412,15 @@
         if (this->server_overwrite_ == this->client_overwrite_)
         {
-//            COUT(2) << "callback: setting client position" << endl;
-            this->node_->setPosition(this->client_position_);
-            this->server_position_ = this->client_position_;
-        }
-//        else
-//          COUT(2) << "callback: not setting client position" << endl;
-    }
-
-    void ControllableEntity::processClientVelocity()
+            MobileEntity::setPosition(this->client_position_);
+            this->server_position_ = this->getPosition();
+        }
+    }
+
+    void ControllableEntity::processClientLinearVelocity()
     {
         if (this->server_overwrite_ == this->client_overwrite_)
         {
-            this->velocity_ = this->client_velocity_;
-            this->server_velocity_ = this->client_velocity_;
+            MobileEntity::setVelocity(this->client_linear_velocity_);
+            this->server_linear_velocity_ = this->getVelocity();
         }
     }
@@ -320,9 +430,17 @@
         if (this->server_overwrite_ == this->client_overwrite_)
         {
-            this->node_->setOrientation(this->client_orientation_);
-            this->server_orientation_ = this->client_orientation_;
-        }
-    }
-
+            MobileEntity::setOrientation(this->client_orientation_);
+            this->server_orientation_ = this->getOrientation();
+        }
+    }
+
+    void ControllableEntity::processClientAngularVelocity()
+    {
+        if (this->server_overwrite_ == this->client_overwrite_)
+        {
+            MobileEntity::setAngularVelocity(this->client_angular_velocity_);
+            this->server_angular_velocity_ = this->getAngularVelocity();
+        }
+    }
 
     void ControllableEntity::setPosition(const Vector3& position)
@@ -330,12 +448,27 @@
         if (Core::isMaster())
         {
-            this->node_->setPosition(position);
-            this->server_position_ = position;
+            MobileEntity::setPosition(position);
+            this->server_position_ = this->getPosition();
             ++this->server_overwrite_;
         }
-        else if (this->bControlled_)
-        {
-            this->node_->setPosition(position);
-            this->client_position_ = position;
+        else if (this->bHasLocalController_)
+        {
+            MobileEntity::setPosition(position);
+            this->client_position_ = this->getPosition();
+        }
+    }
+
+    void ControllableEntity::setOrientation(const Quaternion& orientation)
+    {
+        if (Core::isMaster())
+        {
+            MobileEntity::setOrientation(orientation);
+            this->server_orientation_ = this->getOrientation();
+            ++this->server_overwrite_;
+        }
+        else if (this->bHasLocalController_)
+        {
+            MobileEntity::setOrientation(orientation);
+            this->client_orientation_ = this->getOrientation();
         }
     }
@@ -345,132 +478,46 @@
         if (Core::isMaster())
         {
-            this->velocity_ = velocity;
-            this->server_velocity_ = velocity;
+            MobileEntity::setVelocity(velocity);
+            this->server_linear_velocity_ = this->getVelocity();
             ++this->server_overwrite_;
         }
-        else if (this->bControlled_)
-        {
-            this->velocity_ = velocity;
-            this->client_velocity_ = velocity;
-        }
-    }
-
-    void ControllableEntity::translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo)
+        else if (this->bHasLocalController_)
+        {
+            MobileEntity::setVelocity(velocity);
+            this->client_linear_velocity_ = this->getVelocity();
+        }
+    }
+
+    void ControllableEntity::setAngularVelocity(const Vector3& velocity)
     {
         if (Core::isMaster())
         {
-            this->node_->translate(distance, relativeTo);
-            this->server_position_ = this->node_->getPosition();
+            MobileEntity::setAngularVelocity(velocity);
+            this->server_angular_velocity_ = this->getAngularVelocity();
             ++this->server_overwrite_;
         }
-        else if (this->bControlled_)
-        {
-            this->node_->translate(distance, relativeTo);
-            this->client_position_ = this->node_->getPosition();
-        }
-    }
-
-    void ControllableEntity::setOrientation(const Quaternion& orientation)
-    {
+        else if (this->bHasLocalController_)
+        {
+            MobileEntity::setAngularVelocity(velocity);
+            this->client_angular_velocity_ = this->getAngularVelocity();
+        }
+    }
+
+    void ControllableEntity::setWorldTransform(const btTransform& worldTrans)
+    {
+        MobileEntity::setWorldTransform(worldTrans);
         if (Core::isMaster())
         {
-            this->node_->setOrientation(orientation);
-            this->server_orientation_ = orientation;
-            ++this->server_overwrite_;
-        }
-        else if (this->bControlled_)
-        {
-            this->node_->setOrientation(orientation);
-            this->client_orientation_ = orientation;
-        }
-    }
-
-    void ControllableEntity::rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo)
-    {
-        if (Core::isMaster())
-        {
-            this->node_->rotate(rotation, relativeTo);
-            this->server_orientation_ = this->node_->getOrientation();
-            ++this->server_overwrite_;
-        }
-        else if (this->bControlled_)
-        {
-            this->node_->rotate(rotation, relativeTo);
-            this->client_orientation_ = this->node_->getOrientation();
-        }
-    }
-
-    void ControllableEntity::yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
-    {
-        if (Core::isMaster())
-        {
-            this->node_->yaw(angle, relativeTo);
-            this->server_orientation_ = this->node_->getOrientation();
-            ++this->server_overwrite_;
-        }
-        else if (this->bControlled_)
-        {
-            this->node_->yaw(angle, relativeTo);
-            this->client_orientation_ = this->node_->getOrientation();
-        }
-    }
-
-    void ControllableEntity::pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
-    {
-        if (Core::isMaster())
-        {
-            this->node_->pitch(angle, relativeTo);
-            this->server_orientation_ = this->node_->getOrientation();
-            ++this->server_overwrite_;
-        }
-        else if (this->bControlled_)
-        {
-            this->node_->pitch(angle, relativeTo);
-            this->client_orientation_ = this->node_->getOrientation();
-        }
-    }
-
-    void ControllableEntity::roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
-    {
-        if (Core::isMaster())
-        {
-            this->node_->roll(angle, relativeTo);
-            this->server_orientation_ = this->node_->getOrientation();
-            ++this->server_overwrite_;
-        }
-        else if (this->bControlled_)
-        {
-            this->node_->roll(angle, relativeTo);
-            this->client_orientation_ = this->node_->getOrientation();
-        }
-    }
-
-    void ControllableEntity::lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector)
-    {
-        if (Core::isMaster())
-        {
-            this->node_->lookAt(target, relativeTo, localDirectionVector);
-            this->server_orientation_ = this->node_->getOrientation();
-            ++this->server_overwrite_;
-        }
-        else if (this->bControlled_)
-        {
-            this->node_->lookAt(target, relativeTo, localDirectionVector);
-            this->client_orientation_ = this->node_->getOrientation();
-        }
-    }
-
-    void ControllableEntity::setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector)
-    {
-        if (Core::isMaster())
-        {
-            this->node_->setDirection(direction, relativeTo, localDirectionVector);
-            this->server_orientation_ = this->node_->getOrientation();
-            ++this->server_overwrite_;
-        }
-        else if (this->bControlled_)
-        {
-            this->node_->setDirection(direction, relativeTo, localDirectionVector);
-            this->client_orientation_ = this->node_->getOrientation();
+            this->server_position_ = this->getPosition();
+            this->server_orientation_ = this->getOrientation();
+            this->server_linear_velocity_ = this->getVelocity();
+            this->server_angular_velocity_ = this->getAngularVelocity();
+        }
+        else if (this->bHasLocalController_)
+        {
+            this->client_position_ = this->getPosition();
+            this->client_orientation_ = this->getOrientation();
+            this->client_linear_velocity_ = this->getVelocity();
+            this->client_angular_velocity_ = this->getAngularVelocity();
         }
     }
Index: code/trunk/src/orxonox/objects/worldentities/ControllableEntity.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/ControllableEntity.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/ControllableEntity.h	(revision 2662)
@@ -23,5 +23,5 @@
  *      Fabian 'x3n' Landau
  *   Co-authors:
- *      ...
+ *      Reto Grieder
  *
  */
@@ -32,10 +32,10 @@
 #include "OrxonoxPrereqs.h"
 
-#include "WorldEntity.h"
-#include "objects/Tickable.h"
+#include "MobileEntity.h"
+#include "objects/weaponSystem/WeaponSystem.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport ControllableEntity : public WorldEntity, public Tickable
+    class _OrxonoxExport ControllableEntity : public MobileEntity
     {
         public:
@@ -46,4 +46,7 @@
             virtual void tick(float dt);
             void registerVariables();
+            void setConfigValues();
+
+            virtual void changedGametype();
 
             virtual void setPlayer(PlayerInfo* player);
@@ -61,50 +64,34 @@
             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);
 
-            virtual void fire() {}
-            virtual void altFire() {}
+            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(WeaponMode::Enum fireMode) {}
+            virtual void altFire(WeaponMode::Enum fireMode) {}
+
+            virtual void boost() {}
             virtual void greet() {}
             virtual void use() {}
+            virtual void dropItems() {}
             virtual void switchCamera();
+            virtual void mouseLook();
 
-            inline const Vector3& getVelocity() const
-                { return this->velocity_; }
-            inline const Vector3& getAcceleration() const
-                { return this->acceleration_; }
             inline const std::string& getHudTemplate() const
                 { return this->hudtemplate_; }
-
-            using WorldEntity::setPosition;
-            using WorldEntity::translate;
-            using WorldEntity::setOrientation;
-            using WorldEntity::rotate;
-            using WorldEntity::yaw;
-            using WorldEntity::pitch;
-            using WorldEntity::roll;
-            using WorldEntity::lookAt;
-            using WorldEntity::setDirection;
-
-            void setPosition(const Vector3& position);
-            void translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
-            void setOrientation(const Quaternion& orientation);
-            void rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
-            void yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
-            void pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
-            void roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
-            void lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
-            void setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
-
-            void setVelocity(const Vector3& velocity);
-            inline void setVelocity(float x, float y, float z)
-                { this->velocity_.x = x; this->velocity_.y = y; this->velocity_.z = z; }
-
-            inline void setAcceleration(const Vector3& acceleration)
-                { this->acceleration_ = acceleration; }
-            inline void setAcceleration(float x, float y, float z)
-                { this->acceleration_.x = x; this->acceleration_.y = y; this->acceleration_.z = z; }
 
             inline Camera* getCamera() const
@@ -123,15 +110,33 @@
                 { return this->cameraPositionTemplate_; }
 
+            using WorldEntity::setPosition;
+            using WorldEntity::setOrientation;
+            using MobileEntity::setVelocity;
+            using MobileEntity::setAngularVelocity;
+
+            void setPosition(const Vector3& position);
+            void setOrientation(const Quaternion& orientation);
+            void setVelocity(const Vector3& velocity);
+            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_; }
-
-            Vector3 acceleration_;
 
         private:
@@ -140,35 +145,50 @@
 
             void processServerPosition();
-            void processServerVelocity();
+            void processServerLinearVelocity();
             void processServerOrientation();
+            void processServerAngularVelocity();
 
             void processClientPosition();
-            void processClientVelocity();
+            void processClientLinearVelocity();
             void processClientOrientation();
+            void processClientAngularVelocity();
 
             void networkcallback_changedplayerID();
+            void networkcallback_changedgtinfoID();
+
+            // Bullet btMotionState related
+            void setWorldTransform(const btTransform& worldTrans);
 
             unsigned int server_overwrite_;
             unsigned int client_overwrite_;
 
-            Vector3 velocity_;
+            bool bHasLocalController_;
+            bool bHasHumanController_;
+            bool bDestroyWhenPlayerLeft_;
 
-            bool bControlled_;
             Vector3 server_position_;
             Vector3 client_position_;
-            Vector3 server_velocity_;
-            Vector3 client_velocity_;
+            Vector3 server_linear_velocity_;
+            Vector3 client_linear_velocity_;
             Quaternion server_orientation_;
             Quaternion client_orientation_;
+            Vector3 server_angular_velocity_;
+            Vector3 client_angular_velocity_;
 
             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/trunk/src/orxonox/objects/worldentities/ExplosionChunk.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/ExplosionChunk.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/worldentities/ExplosionChunk.cc	(revision 2662)
@@ -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() || !Core::showsGraphics() || !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/trunk/src/orxonox/objects/worldentities/ExplosionChunk.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/ExplosionChunk.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/worldentities/ExplosionChunk.h	(revision 2662)
@@ -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/trunk/src/orxonox/objects/worldentities/FadingBillboard.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/FadingBillboard.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/worldentities/FadingBillboard.cc	(revision 2662)
@@ -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/trunk/src/orxonox/objects/worldentities/FadingBillboard.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/FadingBillboard.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/worldentities/FadingBillboard.h	(revision 2662)
@@ -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/trunk/src/orxonox/objects/worldentities/Light.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Light.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/Light.cc	(revision 2662)
@@ -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,15 +44,37 @@
 namespace orxonox
 {
-    unsigned int Light::lightCounter_s = 0;
-
     CreateFactory(Light);
 
-    Light::Light(BaseObject* creator) : PositionableEntity(creator)
+    Light::Light(BaseObject* creator) : StaticEntity(creator)
     {
         RegisterObject(Light);
 
-        if (this->getScene() && this->getScene()->getSceneManager())
-        this->light_ = this->getScene()->getSceneManager()->createLight("Light" + convertToString(Light::lightCounter_s++));
-        this->getNode()->attachObject(this->light_);
+        this->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()
     {
-        REGISTERDATA(this->type_, direction::toclient, new NetworkCallback<Light>(this, &Light::changedType));
-        REGISTERDATA(this->light_->getDiffuseColour(), direction::toclient);
-        REGISTERDATA(this->light_->getSpecularColour(), direction::toclient);
-        REGISTERDATA(this->light_->getDirection(), direction::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/trunk/src/orxonox/objects/worldentities/Light.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Light.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/Light.h	(revision 2662)
@@ -31,5 +31,5 @@
 
 #include "OrxonoxPrereqs.h"
-#include "PositionableEntity.h"
+#include "StaticEntity.h"
 
 #include <string>
@@ -40,5 +40,5 @@
 namespace orxonox
 {
-    class _OrxonoxExport Light : public PositionableEntity
+    class _OrxonoxExport Light : public StaticEntity
     {
         public:
@@ -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/trunk/src/orxonox/objects/worldentities/MobileEntity.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/MobileEntity.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/worldentities/MobileEntity.cc	(revision 2662)
@@ -0,0 +1,206 @@
+/*
+ *   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:
+ *      Reto Grieder
+ *   Co-authors:
+ *      Martin Stypinski
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "MobileEntity.h"
+
+#include <OgreSceneNode.h>
+#include "BulletDynamics/Dynamics/btRigidBody.h"
+
+#include "util/Debug.h"
+#include "util/MathConvert.h"
+#include "util/Exception.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include "objects/Scene.h"
+
+namespace orxonox
+{
+    MobileEntity::MobileEntity(BaseObject* creator) : WorldEntity(creator)
+    {
+        RegisterObject(MobileEntity);
+
+        this->linearAcceleration_  = Vector3::ZERO;
+        this->linearVelocity_      = Vector3::ZERO;
+        this->angularAcceleration_ = Vector3::ZERO;
+        this->angularVelocity_     = Vector3::ZERO;
+
+        this->registerVariables();
+    }
+
+    MobileEntity::~MobileEntity()
+    {
+    }
+
+    void MobileEntity::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(MobileEntity, XMLPort, xmlelement, mode);
+
+        XMLPortParamTemplate(MobileEntity, "velocity",     setVelocity,     getVelocity,     xmlelement, mode, const Vector3&);
+
+        Vector3 rotationAxis(this->getRotationAxis());
+        Degree rotationRate = this->getRotationRate();
+        XMLPortParamVariable(MobileEntity, "rotationaxis", rotationAxis, xmlelement, mode);
+        XMLPortParamVariable(MobileEntity, "rotationrate", rotationRate, xmlelement, mode);
+        if (mode == XMLPort::LoadObject)
+        {
+            if (rotationAxis == Vector3::ZERO)
+                this->setAngularVelocity(Vector3::ZERO);
+            else
+                this->setAngularVelocity(rotationAxis.normalisedCopy() * rotationRate.valueRadians());
+        }
+    }
+
+    void MobileEntity::tick(float dt)
+    {
+        if (this->isActive())
+        {
+            // Check whether Bullet doesn't do the physics for us
+            if (!this->isDynamic())
+            {
+                // Linear part
+                this->linearVelocity_.x += this->linearAcceleration_.x * dt;
+                this->linearVelocity_.y += this->linearAcceleration_.y * dt;
+                this->linearVelocity_.z += this->linearAcceleration_.z * dt;
+                this->node_->translate(this->linearVelocity_ * dt);
+
+                // Angular part
+                // Note: angularVelocity_ is a Quaternion with w = 0 while angularAcceleration_ is a Vector3
+                this->angularVelocity_.x += angularAcceleration_.x * dt;
+                this->angularVelocity_.y += angularAcceleration_.y * dt;
+                this->angularVelocity_.z += angularAcceleration_.z * dt;
+                // Calculate new orientation with quaternion derivative. This is about 30% faster than with angle/axis method.
+                float mult = dt * 0.5;
+                // TODO: this could be optimized by writing it out. The calls currently create 4 new Quaternions!
+                Quaternion newOrientation(0.0f, this->angularVelocity_.x * mult, this->angularVelocity_.y * mult, this->angularVelocity_.z * mult);
+                newOrientation = this->node_->getOrientation() + newOrientation * this->node_->getOrientation();
+                newOrientation.normalise();
+                this->node_->setOrientation(newOrientation);
+            }
+        }
+    }
+
+    void MobileEntity::setPosition(const Vector3& position)
+    {
+        if (this->isDynamic())
+        {
+            btTransform transf = this->physicalBody_->getWorldTransform();
+            transf.setOrigin(btVector3(position.x, position.y, position.z));
+            this->physicalBody_->setWorldTransform(transf);
+        }
+
+        this->node_->setPosition(position);
+    }
+
+    void MobileEntity::setOrientation(const Quaternion& orientation)
+    {
+        if (this->isDynamic())
+        {
+            btTransform transf = this->physicalBody_->getWorldTransform();
+            transf.setRotation(btQuaternion(orientation.x, orientation.y, orientation.z, orientation.w));
+            this->physicalBody_->setWorldTransform(transf);
+        }
+
+        this->node_->setOrientation(orientation);
+    }
+
+    void MobileEntity::setVelocity(const Vector3& velocity)
+    {
+        if (this->isDynamic())
+            this->physicalBody_->setLinearVelocity(btVector3(velocity.x, velocity.y, velocity.z));
+
+        this->linearVelocity_ = velocity;
+    }
+
+    void MobileEntity::setAngularVelocity(const Vector3& velocity)
+    {
+        if (this->isDynamic())
+            this->physicalBody_->setAngularVelocity(btVector3(velocity.x, velocity.y, velocity.z));
+
+        this->angularVelocity_ = velocity;
+    }
+
+    void MobileEntity::setAcceleration(const Vector3& acceleration)
+    {
+        if (this->isDynamic())
+            this->physicalBody_->applyCentralForce(btVector3(acceleration.x * this->getMass(), acceleration.y * this->getMass(), acceleration.z * this->getMass()));
+
+        this->linearAcceleration_ = acceleration;
+    }
+
+    void MobileEntity::setAngularAcceleration(const Vector3& acceleration)
+    {
+        if (this->isDynamic())
+        {
+            btVector3 inertia(btVector3(1, 1, 1) / this->physicalBody_->getInvInertiaDiagLocal());
+            this->physicalBody_->applyTorque(btVector3(acceleration.x, acceleration.y, acceleration.z) * inertia);
+        }
+
+        this->angularAcceleration_ = acceleration;
+    }
+
+    bool MobileEntity::isCollisionTypeLegal(WorldEntity::CollisionType type) const
+    {
+        if (type == WorldEntity::Static)
+        {
+            CCOUT(1) << "Error: Cannot tell a MobileEntity to have static collision type! Ignoring." << std::endl;
+            assert(false); // Only in debug mode
+            return false;
+        }
+        else
+            return true;
+    }
+
+    void MobileEntity::setWorldTransform(const btTransform& worldTrans)
+    {
+        // We use a dynamic body. So we translate our node accordingly.
+        this->node_->setPosition(Vector3(worldTrans.getOrigin().x(), worldTrans.getOrigin().y(), worldTrans.getOrigin().z()));
+        this->node_->setOrientation(Quaternion(worldTrans.getRotation().w(), worldTrans.getRotation().x(), worldTrans.getRotation().y(), worldTrans.getRotation().z()));
+        this->linearVelocity_.x = this->physicalBody_->getLinearVelocity().x();
+        this->linearVelocity_.y = this->physicalBody_->getLinearVelocity().y();
+        this->linearVelocity_.z = this->physicalBody_->getLinearVelocity().z();
+        this->angularVelocity_.x = this->physicalBody_->getAngularVelocity().x();
+        this->angularVelocity_.y = this->physicalBody_->getAngularVelocity().y();
+        this->angularVelocity_.z = this->physicalBody_->getAngularVelocity().z();
+    }
+
+    void MobileEntity::getWorldTransform(btTransform& worldTrans) const
+    {
+        // We use a kinematic body
+        worldTrans.setOrigin(btVector3(node_->getPosition().x, node_->getPosition().y, node_->getPosition().z));
+        worldTrans.setRotation(btQuaternion(node_->getOrientation().x, node_->getOrientation().y, node_->getOrientation().z, node_->getOrientation().w));
+        if (this->isDynamic())
+        {
+            // This function gets called only once for dynamic objects to set the initial conditions
+            // We have to set the velocities too.
+            this->physicalBody_->setLinearVelocity(btVector3(linearVelocity_.x, linearVelocity_.y, linearVelocity_.z));
+            this->physicalBody_->setAngularVelocity(btVector3(angularVelocity_.x, angularVelocity_.y, angularVelocity_.z));
+        }
+    }
+}
Index: code/trunk/src/orxonox/objects/worldentities/MobileEntity.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/MobileEntity.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/worldentities/MobileEntity.h	(revision 2662)
@@ -0,0 +1,102 @@
+/*
+ *   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:
+ *      Reto Grieder
+ *   Co-authors:
+ *      Martin Stypinski
+ *
+ */
+
+#ifndef _MobileEntity_H__
+#define _MobileEntity_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "WorldEntity.h"
+#include "objects/Tickable.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport MobileEntity : public WorldEntity, public Tickable
+    {
+        public:
+            MobileEntity(BaseObject* creator);
+            virtual ~MobileEntity();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            virtual void tick(float dt);
+
+            virtual void setPosition(const Vector3& position);
+            virtual void setOrientation(const Quaternion& orientation);
+
+            virtual void setVelocity(const Vector3& velocity);
+            inline void setVelocity(float x, float y, float z)
+                { this->setVelocity(Vector3(x, y, z)); }
+            inline const Vector3& getVelocity() const
+                { return this->linearVelocity_; }
+            inline Vector3 getLocalVelocity() const
+                { return (this->getOrientation().Inverse() * this->getVelocity()); }
+
+            virtual void setAngularVelocity(const Vector3& velocity);
+            inline void setAngularVelocity(float x, float y, float z)
+                { this->setAngularVelocity(Vector3(x, y, z)); }
+            inline const Vector3& getAngularVelocity() const
+                { return this->linearAcceleration_; }
+
+            void setAcceleration(const Vector3& acceleration);
+            inline void setAcceleration(float x, float y, float z)
+                { this->setAcceleration(Vector3(x, y, z)); }
+            inline const Vector3& getAcceleration() const
+                { return this->linearAcceleration_; }
+
+            void setAngularAcceleration(const Vector3& acceleration);
+            inline void setAngularAcceleration(float x, float y, float z)
+                { this->setAngularAcceleration(Vector3(x, y, z)); }
+            inline const Vector3& getAngularAcceleration() const
+                { return this->angularAcceleration_; }
+
+            inline void setRotationRate(Degree rate)
+                { this->setAngularVelocity(this->getAngularVelocity().normalisedCopy() * rate.valueRadians()); }
+            inline Degree getRotationRate() const
+                { return Degree(this->getAngularVelocity().length()); }
+
+            inline void setRotationAxis(const Vector3& axis)
+                { this->setAngularVelocity(axis * this->getAngularVelocity().length()); }
+            inline Vector3 getRotationAxis() const
+                { return this->getAngularVelocity().normalisedCopy(); }
+
+        protected:
+            // Bullet btMotionState related
+            virtual void setWorldTransform(const btTransform& worldTrans);
+            void getWorldTransform(btTransform& worldTrans) const;
+
+            Vector3 linearAcceleration_;
+            Vector3 linearVelocity_;
+            Vector3 angularAcceleration_;
+            Vector3 angularVelocity_;
+
+        private:
+            virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const;
+    };
+}
+
+#endif /* _MobileEntity_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/Model.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Model.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/Model.cc	(revision 2662)
@@ -29,4 +29,5 @@
 #include "OrxonoxStableHeaders.h"
 
+#include <OgreEntity.h>
 #include "Model.h"
 #include "core/CoreIncludes.h"
@@ -38,7 +39,9 @@
     CreateFactory(Model);
 
-    Model::Model(BaseObject* creator) : PositionableEntity(creator)
+    Model::Model(BaseObject* creator) : StaticEntity(creator)
     {
         RegisterObject(Model);
+
+        this->bCastShadows_ = true;
 
         this->registerVariables();
@@ -48,5 +51,5 @@
     {
         if (this->isInitialized() && this->mesh_.getEntity())
-            this->getNode()->detachObject(this->mesh_.getEntity());
+            this->detachOgreObject(this->mesh_.getEntity());
     }
 
@@ -61,20 +64,23 @@
     void Model::registerVariables()
     {
-        REGISTERSTRING(this->meshSrc_,    direction::toclient, new NetworkCallback<Model>(this, &Model::changedMesh));
-        REGISTERDATA(this->bCastShadows_, direction::toclient, new NetworkCallback<Model>(this, &Model::changedShadows));
+        registerVariable(this->meshSrc_,    variableDirection::toclient, new NetworkCallback<Model>(this, &Model::changedMesh));
+        registerVariable(this->bCastShadows_, variableDirection::toclient, new NetworkCallback<Model>(this, &Model::changedShadows));
     }
 
     void Model::changedMesh()
     {
-        if (this->mesh_.getEntity())
-            this->getNode()->detachObject(this->mesh_.getEntity());
+        if (Core::showsGraphics())
+        {
+            if (this->mesh_.getEntity())
+                this->detachOgreObject(this->mesh_.getEntity());
 
-        this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_);
+            this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_);
 
-        if (this->mesh_.getEntity())
-        {
-            this->getNode()->attachObject(this->mesh_.getEntity());
-            this->mesh_.getEntity()->setCastShadows(this->bCastShadows_);
-            this->mesh_.setVisible(this->isVisible());
+            if (this->mesh_.getEntity())
+            {
+                this->attachOgreObject(this->mesh_.getEntity());
+                this->mesh_.getEntity()->setCastShadows(this->bCastShadows_);
+                this->mesh_.setVisible(this->isVisible());
+            }
         }
     }
Index: code/trunk/src/orxonox/objects/worldentities/Model.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Model.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/Model.h	(revision 2662)
@@ -31,10 +31,10 @@
 
 #include "OrxonoxPrereqs.h"
-#include "PositionableEntity.h"
+#include "StaticEntity.h"
 #include "tools/Mesh.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport Model : public PositionableEntity
+    class _OrxonoxExport Model : public StaticEntity
     {
         public:
@@ -70,3 +70,3 @@
 }
 
-#endif /* _PositionableEntity_H__ */
+#endif /* _Model_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/MovableEntity.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/MovableEntity.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/MovableEntity.cc	(revision 2662)
@@ -22,4 +22,5 @@
  *   Author:
  *      Fabian 'x3n' Landau
+ *      Reto Grieder
  *   Co-authors:
  *      ...
@@ -33,24 +34,23 @@
 #include "core/XMLPort.h"
 #include "core/Executor.h"
-#include "tools/Timer.h"
+#include "core/Core.h"
 
 namespace orxonox
 {
     static const float MAX_RESYNCHRONIZE_TIME = 3.0f;
+    static const float CONTINUOUS_SYNCHRONIZATION_TIME = 10.0f;
 
     CreateFactory(MovableEntity);
 
-    MovableEntity::MovableEntity(BaseObject* creator) : WorldEntity(creator)
+    MovableEntity::MovableEntity(BaseObject* creator) : MobileEntity(creator)
     {
         RegisterObject(MovableEntity);
 
-        this->velocity_ = Vector3::ZERO;
-        this->acceleration_ = Vector3::ZERO;
-        this->rotationAxis_ = Vector3::ZERO;
-        this->rotationRate_ = 0;
-        this->momentum_ = 0;
+        this->overwrite_position_    = Vector3::ZERO;
+        this->overwrite_orientation_ = Quaternion::IDENTITY;
 
-        this->overwrite_position_ = Vector3::ZERO;
-        this->overwrite_orientation_ = Quaternion::IDENTITY;
+        this->continuousResynchroTimer_ = 0;
+
+        this->setPriority(priority::low);
 
         this->registerVariables();
@@ -59,4 +59,7 @@
     MovableEntity::~MovableEntity()
     {
+        if (this->isInitialized())
+            if (this->continuousResynchroTimer_)
+                delete this->continuousResynchroTimer_;
     }
 
@@ -64,51 +67,18 @@
     {
         SUPER(MovableEntity, XMLPort, xmlelement, mode);
-
-        XMLPortParamTemplate(MovableEntity, "velocity", setVelocity, getVelocity, xmlelement, mode, const Vector3&);
-        XMLPortParamTemplate(MovableEntity, "rotationaxis", setRotationAxis, getRotationAxis, xmlelement, mode, const Vector3&);
-        XMLPortParamTemplate(MovableEntity, "rotationrate", setRotationRate, getRotationRate, xmlelement, mode, const Degree&);
-    }
-
-    void MovableEntity::tick(float dt)
-    {
-        if (this->isActive())
-        {
-            this->velocity_ += (dt * this->acceleration_);
-            this->node_->translate(dt * this->velocity_);
-
-            this->rotationRate_ += (dt * this->momentum_);
-            this->node_->rotate(this->rotationAxis_, this->rotationRate_  * dt);
-        }
     }
 
     void MovableEntity::registerVariables()
     {
-        REGISTERDATA(this->velocity_.x, direction::toclient);
-        REGISTERDATA(this->velocity_.y, direction::toclient);
-        REGISTERDATA(this->velocity_.z, direction::toclient);
+        registerVariable(this->linearVelocity_,        variableDirection::toclient, new NetworkCallback<MovableEntity>(this, &MovableEntity::processLinearVelocity));
+        registerVariable(this->angularVelocity_,       variableDirection::toclient, new NetworkCallback<MovableEntity>(this, &MovableEntity::processAngularVelocity));
 
-        REGISTERDATA(this->rotationAxis_.x, direction::toclient);
-        REGISTERDATA(this->rotationAxis_.y, direction::toclient);
-        REGISTERDATA(this->rotationAxis_.z, direction::toclient);
-
-        REGISTERDATA(this->rotationRate_, direction::toclient);
-
-        REGISTERDATA(this->overwrite_position_,    direction::toclient, new NetworkCallback<MovableEntity>(this, &MovableEntity::overwritePosition));
-        REGISTERDATA(this->overwrite_orientation_, direction::toclient, new NetworkCallback<MovableEntity>(this, &MovableEntity::overwriteOrientation));
-    }
-
-    void MovableEntity::overwritePosition()
-    {
-        this->node_->setPosition(this->overwrite_position_);
-    }
-
-    void MovableEntity::overwriteOrientation()
-    {
-        this->node_->setOrientation(this->overwrite_orientation_);
+        registerVariable(this->overwrite_position_,    variableDirection::toclient, new NetworkCallback<MovableEntity>(this, &MovableEntity::overwritePosition));
+        registerVariable(this->overwrite_orientation_, variableDirection::toclient, new NetworkCallback<MovableEntity>(this, &MovableEntity::overwriteOrientation));
     }
 
     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)));
     }
 
@@ -119,60 +89,13 @@
     void MovableEntity::resynchronize()
     {
+        if (Core::isMaster() && !this->continuousResynchroTimer_)
+        {
+            // Resynchronise every few seconds because we only work with velocities (no positions)
+            continuousResynchroTimer_ = new Timer<MovableEntity>(CONTINUOUS_SYNCHRONIZATION_TIME + rnd(-1, 1),
+                true, this, createExecutor(createFunctor(&MovableEntity::resynchronize)), false);
+        }
+
         this->overwrite_position_ = this->getPosition();
         this->overwrite_orientation_ = this->getOrientation();
     }
-
-    void MovableEntity::setPosition(const Vector3& position)
-    {
-        this->node_->setPosition(position);
-        this->overwrite_position_ = this->node_->getPosition();
-    }
-
-    void MovableEntity::translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo)
-    {
-        this->node_->translate(distance, relativeTo);
-        this->overwrite_position_ = this->node_->getPosition();
-    }
-
-    void MovableEntity::setOrientation(const Quaternion& orientation)
-    {
-        this->node_->setOrientation(orientation);
-        this->overwrite_orientation_ = this->node_->getOrientation();
-    }
-
-    void MovableEntity::rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo)
-    {
-        this->node_->rotate(rotation, relativeTo);
-        this->overwrite_orientation_ = this->node_->getOrientation();
-    }
-
-    void MovableEntity::yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
-    {
-        this->node_->yaw(angle, relativeTo);
-        this->overwrite_orientation_ = this->node_->getOrientation();
-    }
-
-    void MovableEntity::pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
-    {
-        this->node_->pitch(angle, relativeTo);
-        this->overwrite_orientation_ = this->node_->getOrientation();
-    }
-
-    void MovableEntity::roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
-    {
-        this->node_->roll(angle, relativeTo);
-        this->overwrite_orientation_ = this->node_->getOrientation();
-    }
-
-    void MovableEntity::lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector)
-    {
-        this->node_->lookAt(target, relativeTo, localDirectionVector);
-        this->overwrite_orientation_ = this->node_->getOrientation();
-    }
-
-    void MovableEntity::setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector)
-    {
-        this->node_->setDirection(direction, relativeTo, localDirectionVector);
-        this->overwrite_orientation_ = this->node_->getOrientation();
-    }
 }
Index: code/trunk/src/orxonox/objects/worldentities/MovableEntity.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/MovableEntity.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/MovableEntity.h	(revision 2662)
@@ -22,4 +22,5 @@
  *   Author:
  *      Fabian 'x3n' Landau
+ *      Reto Grieder
  *   Co-authors:
  *      ...
@@ -32,11 +33,11 @@
 #include "OrxonoxPrereqs.h"
 
-#include "WorldEntity.h"
-#include "objects/Tickable.h"
+#include "MobileEntity.h"
 #include "network/ClientConnectionListener.h"
+#include "tools/Timer.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport MovableEntity : public WorldEntity, public Tickable, public ClientConnectionListener
+    class _OrxonoxExport MovableEntity : public MobileEntity, public ClientConnectionListener
     {
         public:
@@ -45,61 +46,13 @@
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-            virtual void tick(float dt);
             void registerVariables();
 
             using WorldEntity::setPosition;
-            using WorldEntity::translate;
             using WorldEntity::setOrientation;
-            using WorldEntity::rotate;
-            using WorldEntity::yaw;
-            using WorldEntity::pitch;
-            using WorldEntity::roll;
-            using WorldEntity::lookAt;
-            using WorldEntity::setDirection;
 
-            void setPosition(const Vector3& position);
-            void translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
-            void setOrientation(const Quaternion& orientation);
-            void rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
-            void yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
-            void pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
-            void roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
-            void lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
-            void setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
-
-            inline void setVelocity(const Vector3& velocity)
-                { this->velocity_ = velocity; }
-            inline void setVelocity(float x, float y, float z)
-                { this->velocity_.x = x; this->velocity_.y = y; this->velocity_.z = z; }
-            inline const Vector3& getVelocity() const
-                { return this->velocity_; }
-
-            inline void setAcceleration(const Vector3& acceleration)
-                { this->acceleration_ = acceleration; }
-            inline void setAcceleration(float x, float y, float z)
-                { this->acceleration_.x = x; this->acceleration_.y = y; this->acceleration_.z = z; }
-            inline const Vector3& getAcceleration() const
-                { return this->acceleration_; }
-
-            inline void setRotationAxis(const Vector3& axis)
-                { this->rotationAxis_ = axis; this->rotationAxis_.normalise(); }
-            inline void setRotationAxis(float x, float y, float z)
-                { this->rotationAxis_.x = x; this->rotationAxis_.y = y; this->rotationAxis_.z = z; rotationAxis_.normalise(); }
-            inline const Vector3& getRotationAxis() const
-                { return this->rotationAxis_; }
-
-            inline void setRotationRate(const Degree& angle)
-                { this->rotationRate_ = angle; }
-            inline void setRotationRate(const Radian& angle)
-                { this->rotationRate_ = angle; }
-            inline const Degree& getRotationRate() const
-                { return this->rotationRate_; }
-
-            inline void setMomentum(const Degree& angle)
-                { this->momentum_ = angle; }
-            inline void setMomentum(const Radian& angle)
-                { this->momentum_ = angle; }
-            inline const Degree& getMomentum() const
-                { return this->momentum_; }
+            inline void setPosition(const Vector3& position)
+                { MobileEntity::setPosition(position); this->overwrite_position_ = this->getPosition(); }
+            inline void setOrientation(const Quaternion& orientation)
+                { MobileEntity::setOrientation(orientation); this->overwrite_orientation_ = this->getOrientation(); }
 
         private:
@@ -108,15 +61,19 @@
             void resynchronize();
 
-            void overwritePosition();
-            void overwriteOrientation();
+            inline void processLinearVelocity()
+                { this->setVelocity(this->linearVelocity_); }
+            inline void processAngularVelocity()
+                { this->setAngularVelocity(this->angularVelocity_); }
 
-            Vector3 velocity_;
-            Vector3 acceleration_;
-            Vector3 rotationAxis_;
-            Degree rotationRate_;
-            Degree momentum_;
+            inline void overwritePosition()
+                { this->setPosition(this->overwrite_position_); }
+            inline void overwriteOrientation()
+                { this->setOrientation(this->overwrite_orientation_); }
 
-            Vector3 overwrite_position_;
+            Vector3    overwrite_position_;
             Quaternion overwrite_orientation_;
+
+            Timer<MovableEntity> resynchronizeTimer_;
+            Timer<MovableEntity>* continuousResynchroTimer_;
     };
 }
Index: code/trunk/src/orxonox/objects/worldentities/ParticleEmitter.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/ParticleEmitter.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/ParticleEmitter.cc	(revision 2662)
@@ -33,6 +33,7 @@
 
 #include "OrxonoxStableHeaders.h"
+#include "ParticleEmitter.h"
 
-#include "ParticleEmitter.h"
+#include <OgreParticleSystem.h>
 
 #include "tools/ParticleInterface.h"
@@ -46,10 +47,10 @@
     CreateFactory(ParticleEmitter);
 
-    ParticleEmitter::ParticleEmitter(BaseObject* creator) : PositionableEntity(creator)
+    ParticleEmitter::ParticleEmitter(BaseObject* creator) : StaticEntity(creator)
     {
         RegisterObject(ParticleEmitter);
 
-        if (!this->getScene() || !this->getScene()->getSceneManager())
-            ThrowException(AbortLoading, "Can't create Camera, no scene or no scene manager given.");
+        if (Core::showsGraphics() && (!this->getScene() || !this->getScene()->getSceneManager()))
+            ThrowException(AbortLoading, "Can't create ParticleEmitter, no scene or no scene manager given.");
 
         this->particles_ = 0;
@@ -62,5 +63,8 @@
     {
         if (this->isInitialized() && this->particles_)
+        {
+            this->detachOgreObject(this->particles_->getParticleSystem());
             delete this->particles_;
+        }
     }
 
@@ -75,6 +79,6 @@
     void ParticleEmitter::registerVariables()
     {
-        REGISTERSTRING(this->source_, direction::toclient, new NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::sourceChanged));
-        REGISTERDATA  (this->LOD_,    direction::toclient, new NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::LODchanged));
+        registerVariable(this->source_, variableDirection::toclient, new NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::sourceChanged));
+        registerVariable((int&)(this->LOD_),    variableDirection::toclient, new NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::LODchanged));
     }
 
@@ -98,12 +102,15 @@
     {
         if (this->particles_)
+        {
             delete this->particles_;
+            this->particles_ = 0;
+        }
 
-        if (this->getScene() && this->getScene()->getSceneManager())
+        if (Core::showsGraphics() && this->getScene() && this->getScene()->getSceneManager())
         {
             try
             {
                 this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), this->source_, this->LOD_);
-                this->particles_->addToSceneNode(this->getNode());
+                this->attachOgreObject(this->particles_->getParticleSystem());
                 this->particles_->setVisible(this->isVisible());
                 this->particles_->setEnabled(this->isActive());
@@ -115,6 +122,4 @@
             }
         }
-        else
-            this->particles_ = 0;
     }
 
Index: code/trunk/src/orxonox/objects/worldentities/ParticleEmitter.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/ParticleEmitter.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/ParticleEmitter.h	(revision 2662)
@@ -31,9 +31,9 @@
 
 #include "OrxonoxPrereqs.h"
-#include "PositionableEntity.h"
+#include "StaticEntity.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport ParticleEmitter : public PositionableEntity
+    class _OrxonoxExport ParticleEmitter : public StaticEntity
     {
         public:
Index: code/trunk/src/orxonox/objects/worldentities/Planet.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Planet.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/worldentities/Planet.cc	(revision 2662)
@@ -0,0 +1,173 @@
+/*
+ *   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:
+ *      Marian Runo
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Planet.h"
+
+#include <math.h>
+
+#include <OgreEntity.h>
+#include <OgreBillboardSet.h>
+#include <OgreHardwareVertexBuffer.h>
+#include <OgreMeshManager.h>
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "objects/Scene.h"
+#include "CameraManager.h"
+#include "Camera.h"
+#include "GraphicsEngine.h"
+
+namespace orxonox
+{
+    CreateFactory(Planet);    
+
+    /**
+     * @brief Constructor
+     */
+    Planet::Planet(BaseObject* creator): MovableEntity(creator)
+    {
+        RegisterObject(Planet);
+        this->registerVariables();
+    }
+
+    /**
+     * @brief Destructor
+     */
+    Planet::~Planet()
+    {
+        if (this->isInitialized() && this->mesh_.getEntity())
+            this->detachOgreObject(this->mesh_.getEntity());
+    }    
+
+    void Planet::tick(float dt)
+    {
+        if(!this->isVisible())
+            return;
+
+        Camera* activeCamera = CameraManager::getInstance().getActiveCamera();
+        if(activeCamera)
+        {
+            Real distance = this->getPosition().distance( activeCamera->getWorldPosition() );
+            //             COUT(2) << distance << std::endl;
+            Real planetRadius = this->getScale();
+
+            Real newScale = 2 * distance / sqrt(distance*distance - planetRadius*planetRadius);
+            Real tempTest = newScale*(1+Real(this->atmosphereSize)/Real(this->imageSize));
+            newScale = tempTest;
+
+            this->billboard_.getBillboardSet()->setDefaultDimensions(newScale, newScale);
+        }
+
+        SUPER(Planet, tick, dt);
+    }
+
+    void Planet::init()
+    {
+        Real scaleFactor = this->getScale();
+
+        this->distList.push_back(10.0*scaleFactor);
+        this->distList.push_back(19.0*scaleFactor);
+        this->distList.push_back(27.0*scaleFactor);
+        this->distList.push_back(34.0*scaleFactor);
+        this->distList.push_back(40.0*scaleFactor);
+        this->distList.push_back(45.0*scaleFactor);
+        this->distList.push_back(49.0*scaleFactor);
+        this->distList.push_back(52.0*scaleFactor);
+        this->distList.push_back(54.0*scaleFactor);
+        this->distList.push_back(55.0*scaleFactor);
+
+        Real reductionValue = 0.2;
+
+        this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, reductionValue);
+        billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->atmosphere_, Vector3(0,0,0));
+
+        this->attachOgreObject(this->billboard_.getBillboardSet());    
+        this->billboard_.getBillboardSet()->setUseAccurateFacing(true);
+        this->setCastShadows(true);
+        this->billboard_.getBillboardSet()->setRenderQueueGroup(this->mesh_.getEntity()->getRenderQueueGroup());
+        this->mesh_.setCastShadows(true);
+    }
+
+    void Planet::changedMesh()
+    {
+        if (this->mesh_.getEntity())
+            this->detachOgreObject(this->mesh_.getEntity());
+
+        this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_);
+
+        if (this->mesh_.getEntity())
+        {
+            this->attachOgreObject(this->mesh_.getEntity());
+            this->mesh_.getEntity()->setCastShadows(this->bCastShadows_);
+            this->mesh_.setVisible(this->isVisible());
+        }
+        this->init();
+    }
+
+    void Planet::changedShadows()
+    {
+        this->mesh_.setCastShadows(this->bCastShadows_);
+    }
+
+    /**
+        @brief XML loading and saving.
+        @param xmlelement The XML-element
+        @param loading Loading (true) or saving (false)
+        @return The XML-element
+    */
+    void Planet::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(Planet, XMLPort, xmlelement, mode);
+
+        XMLPortParam(Planet, "atmosphere", setAtmosphere, getAtmosphere, xmlelement, mode).defaultValues("planet/Atmosphere");
+        XMLPortParam(Planet, "atmospheresize", setAtmosphereSize, getAtmosphereSize, xmlelement,mode);     
+        XMLPortParam(Planet, "imagesize", setImageSize, getImageSize, xmlelement,mode);         
+        XMLPortParam(Planet, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
+        XMLPortParam(Planet, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true);
+    }
+
+    void Planet::registerVariables()
+    {
+        registerVariable(this->atmosphere_, variableDirection::toclient);
+        registerVariable(this->meshSrc_, variableDirection::toclient, new NetworkCallback<Planet>(this, &Planet::changedMesh));
+        registerVariable(this->bCastShadows_, variableDirection::toclient, new NetworkCallback<Planet>(this, &Planet::changedShadows));
+        registerVariable(this->atmosphereSize, variableDirection::toclient);
+        registerVariable(this->imageSize, variableDirection::toclient);
+    }
+
+    void Planet::changedVisibility()
+    {
+        SUPER(Planet, changedVisibility);
+        if (this->isInitialized())
+        {
+            this->mesh_.setVisible(this->isVisible());
+            this->billboard_.setVisible(this->isVisible());
+        }
+    }
+}
Index: code/trunk/src/orxonox/objects/worldentities/Planet.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Planet.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/worldentities/Planet.h	(revision 2662)
@@ -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:
+ *      Marian Runo
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Planet_H__
+#define _Planet_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <OgreMesh.h>
+
+#include "tools/BillboardSet.h"
+#include "tools/Mesh.h"
+#include "MovableEntity.h"
+#include "objects/Tickable.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport Planet : public MovableEntity
+    {
+        public:
+            Planet(BaseObject* creator);
+            
+            virtual ~Planet();
+            
+            void init();
+            virtual void tick(float dt);
+            
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            
+            virtual void changedVisibility();
+            
+            inline void setMeshSource(const std::string& meshname)
+                { this->meshSrc_ = meshname; this->changedMesh(); }
+                
+            inline const std::string& getMeshSource() const
+                { return this->meshSrc_; }
+
+            inline void setCastShadows(bool bCastShadows)
+                { this->bCastShadows_ = bCastShadows; this->changedShadows(); }
+                
+            inline bool getCastShadows() const
+                { return this->bCastShadows_; }            
+            
+            inline const std::string& getMesh() const{
+                return this->meshSrc_;
+            }
+            
+            inline void setAtmosphereSize(Real size){
+                this->atmosphereSize = size;
+            }
+            
+            inline Real getAtmosphereSize(){
+                return this->atmosphereSize;
+            }
+            
+            inline void setAtmosphere(const std::string& atmosphere){
+                this->atmosphere_ = atmosphere;
+            }
+            
+            inline const std::string& getAtmosphere(){
+                return this->atmosphere_;
+            }
+            
+            inline void setImageSize(Real size){
+                this->imageSize = size;
+            }
+            
+            inline Real getImageSize(){
+                return this->imageSize;
+            }
+
+        protected:
+            void registerVariables();
+
+        private:
+        
+            void changedMesh();
+            void changedShadows();
+            
+            std::string meshSrc_;
+            std::string atmosphere_;
+            Mesh mesh_;
+            Real atmosphereSize;
+            Real imageSize;
+            Ogre::Mesh::LodDistanceList distList;
+            BillboardSet billboard_;
+            bool bCastShadows_;
+
+    };
+}
+
+#endif
+
Index: code/trunk/src/orxonox/objects/worldentities/PositionableEntity.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/PositionableEntity.cc	(revision 2262)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "PositionableEntity.h"
-#include "core/CoreIncludes.h"
-
-namespace orxonox
-{
-    CreateFactory(PositionableEntity);
-
-    PositionableEntity::PositionableEntity(BaseObject* creator) : WorldEntity(creator)
-    {
-        RegisterObject(PositionableEntity);
-
-        this->registerVariables();
-    }
-
-    PositionableEntity::~PositionableEntity()
-    {
-    }
-
-    void PositionableEntity::registerVariables()
-    {
-        REGISTERDATA(this->getPosition().x, direction::toclient);
-        REGISTERDATA(this->getPosition().y, direction::toclient);
-        REGISTERDATA(this->getPosition().z, direction::toclient);
-
-        REGISTERDATA(this->getOrientation().w, direction::toclient);
-        REGISTERDATA(this->getOrientation().x, direction::toclient);
-        REGISTERDATA(this->getOrientation().y, direction::toclient);
-        REGISTERDATA(this->getOrientation().z, direction::toclient);
-    }
-}
Index: code/trunk/src/orxonox/objects/worldentities/PositionableEntity.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/PositionableEntity.h	(revision 2262)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _PositionableEntity_H__
-#define _PositionableEntity_H__
-
-#include "OrxonoxPrereqs.h"
-#include "WorldEntity.h"
-
-namespace orxonox
-{
-    class _OrxonoxExport PositionableEntity : public WorldEntity
-    {
-        public:
-            PositionableEntity(BaseObject* creator);
-            virtual ~PositionableEntity();
-
-            void registerVariables();
-
-            using WorldEntity::setPosition;
-            using WorldEntity::translate;
-            using WorldEntity::setOrientation;
-            using WorldEntity::rotate;
-            using WorldEntity::yaw;
-            using WorldEntity::pitch;
-            using WorldEntity::roll;
-            using WorldEntity::lookAt;
-            using WorldEntity::setDirection;
-
-            inline void setPosition(const Vector3& position)
-                { this->node_->setPosition(position); }
-            inline void translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
-                { this->node_->translate(distance, relativeTo); }
-            inline void setOrientation(const Quaternion& orientation)
-                { this->node_->setOrientation(orientation); }
-            inline void rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
-                { this->node_->rotate(rotation, relativeTo); }
-            inline void yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
-                { this->node_->yaw(angle, relativeTo); }
-            inline void pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
-                { this->node_->pitch(angle, relativeTo); }
-            inline void roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
-                { this->node_->roll(angle, relativeTo); }
-            inline void lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z)
-                { this->node_->lookAt(target, relativeTo, localDirectionVector); }
-            inline void setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z)
-                { this->node_->setDirection(direction, relativeTo, localDirectionVector); }
-    };
-}
-
-#endif /* _PositionableEntity_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/SpawnPoint.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/SpawnPoint.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/SpawnPoint.cc	(revision 2662)
@@ -38,5 +38,5 @@
     CreateFactory(SpawnPoint);
 
-    SpawnPoint::SpawnPoint(BaseObject* creator) : PositionableEntity(creator)
+    SpawnPoint::SpawnPoint(BaseObject* creator) : StaticEntity(creator)
     {
         RegisterObject(SpawnPoint);
Index: code/trunk/src/orxonox/objects/worldentities/SpawnPoint.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/SpawnPoint.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/SpawnPoint.h	(revision 2662)
@@ -34,10 +34,10 @@
 #include "core/Identifier.h"
 #include "core/Template.h"
-#include "PositionableEntity.h"
 #include "objects/worldentities/pawns/Pawn.h"
+#include "objects/worldentities/StaticEntity.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport SpawnPoint : public PositionableEntity
+    class _OrxonoxExport SpawnPoint : public StaticEntity
     {
         public:
Index: code/trunk/src/orxonox/objects/worldentities/StaticEntity.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/StaticEntity.cc	(revision 2662)
+++ code/trunk/src/orxonox/objects/worldentities/StaticEntity.cc	(revision 2662)
@@ -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
+ *      Reto Grieder (physics)
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "StaticEntity.h"
+
+#include <OgreSceneNode.h>
+#include "BulletDynamics/Dynamics/btRigidBody.h"
+
+#include "util/Exception.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+    CreateFactory(StaticEntity);
+
+    StaticEntity::StaticEntity(BaseObject* creator) : WorldEntity(creator)
+    {
+        RegisterObject(StaticEntity);
+        
+        this->setPriority(priority::very_low);
+
+        this->registerVariables();
+    }
+
+    StaticEntity::~StaticEntity()
+    {
+    }
+
+    void StaticEntity::registerVariables()
+    {
+        registerVariable(this->getPosition(),    variableDirection::toclient, new NetworkCallback<StaticEntity>(this, &StaticEntity::positionChanged));
+        registerVariable(this->getOrientation(), variableDirection::toclient, new NetworkCallback<StaticEntity>(this, &StaticEntity::orientationChanged));
+    }
+
+
+    void StaticEntity::setPosition(const Vector3& position)
+    {
+        if (this->addedToPhysicalWorld())
+        {
+            CCOUT(2) << "Warning: Attempting to change the position of a StaticEntity at physics run time. Ignoring change." << std::endl;
+            return;
+        }
+        if (this->isStatic())
+        {
+            btTransform transf = this->physicalBody_->getWorldTransform();
+            transf.setOrigin(btVector3(position.x, position.y, position.z));
+            this->physicalBody_->setWorldTransform(transf);
+        }
+
+        this->node_->setPosition(position);
+    }
+
+    void StaticEntity::setOrientation(const Quaternion& orientation)
+    {
+        if (this->addedToPhysicalWorld())
+        {
+            CCOUT(2) << "Warning: Attempting to change the orientation of a StaticEntity at physics run time. Ignoring change." << std::endl;
+            return;
+        }
+        if (this->isStatic())
+        {
+            btTransform transf = this->physicalBody_->getWorldTransform();
+            transf.setRotation(btQuaternion(orientation.x, orientation.y, orientation.z, orientation.w));
+            this->physicalBody_->setWorldTransform(transf);
+        }
+
+        this->node_->setOrientation(orientation);
+    }
+
+    bool StaticEntity::isCollisionTypeLegal(WorldEntity::CollisionType type) const
+    {
+        if (type == WorldEntity::Kinematic || type == WorldEntity::Dynamic)
+        {
+            CCOUT(1) << "Error: Cannot tell a StaticEntity to have kinematic or dynamic collision type! Ignoring." << std::endl;
+            assert(false); // Only in debug mode
+            return false;
+        }
+        else
+            return true;
+    }
+
+    void StaticEntity::setWorldTransform(const btTransform& worldTrans)
+    {
+        OrxAssert(false, "Setting world transform of a StaticEntity, which is CF_STATIC!");
+    }
+
+    void StaticEntity::getWorldTransform(btTransform& worldTrans) const
+    {
+        worldTrans.setOrigin(btVector3(node_->getPosition().x, node_->getPosition().y, node_->getPosition().z));
+        worldTrans.setRotation(btQuaternion(node_->getOrientation().x, node_->getOrientation().y, node_->getOrientation().z, node_->getOrientation().w));
+    }
+}
Index: code/trunk/src/orxonox/objects/worldentities/StaticEntity.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/StaticEntity.h	(revision 2662)
+++ code/trunk/src/orxonox/objects/worldentities/StaticEntity.h	(revision 2662)
@@ -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
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _StaticEntity_H__
+#define _StaticEntity_H__
+
+#include "OrxonoxPrereqs.h"
+#include "WorldEntity.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport StaticEntity : public WorldEntity
+    {
+        public:
+            StaticEntity(BaseObject* creator);
+            virtual ~StaticEntity();
+
+            void registerVariables();
+
+            using WorldEntity::setPosition;
+            using WorldEntity::setOrientation;
+
+            void setPosition(const Vector3& position);
+            void setOrientation(const Quaternion& orientation);
+
+        private:
+            bool isCollisionTypeLegal(CollisionType type) const;
+
+            // network callbacks
+            inline void positionChanged()
+                { this->setPosition(this->getPosition()); }
+            inline void orientationChanged()
+                { this->setOrientation(this->getOrientation()); }
+
+            // Bullet btMotionState related
+            void setWorldTransform(const btTransform& worldTrans);
+            void getWorldTransform(btTransform& worldTrans) const;
+    };
+}
+
+#endif /* _StaticEntity_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/WorldEntity.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/WorldEntity.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/WorldEntity.cc	(revision 2662)
@@ -22,4 +22,5 @@
  *   Author:
  *      Fabian 'x3n' Landau
+ *      Reto Grieder (physics)
  *   Co-authors:
  *      ...
@@ -31,12 +32,15 @@
 
 #include <cassert>
+#include <OgreSceneNode.h>
 #include <OgreSceneManager.h>
-
+#include "BulletDynamics/Dynamics/btRigidBody.h"
+
+#include "util/Exception.h"
+#include "util/Convert.h"
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
-#include "util/Convert.h"
-#include "util/Exception.h"
 
 #include "objects/Scene.h"
+#include "objects/collisionshapes/WorldEntityCollisionShape.h"
 
 namespace orxonox
@@ -49,4 +53,9 @@
     const Vector3 WorldEntity::UP    = Vector3::UNIT_Y;
 
+    /**
+    @brief
+        Creates a new WorldEntity that may immediately be used.
+        All the default values are being set here.
+    */
     WorldEntity::WorldEntity(BaseObject* creator) : BaseObject(creator), Synchronisable(creator)
     {
@@ -64,14 +73,53 @@
         this->node_->setOrientation(Quaternion::IDENTITY);
 
+
+        // Default behaviour does not include physics
+        this->physicalBody_   = 0;
+        this->bPhysicsActive_ = false;
+        this->bPhysicsActiveSynchronised_    = false;
+        this->bPhysicsActiveBeforeAttaching_ = false;
+        this->collisionShape_ = new WorldEntityCollisionShape(this);
+        this->collisionType_             = None;
+        this->collisionTypeSynchronised_ = None;
+        this->mass_           = 0;
+        this->childrenMass_   = 0;
+        // Using bullet default values
+        this->restitution_    = 0;
+        this->angularFactor_  = 1;
+        this->linearDamping_  = 0;
+        this->angularDamping_ = 0;
+        this->friction_       = 0.5;
+        this->bCollisionCallbackActive_ = false;
+        this->bCollisionResponseActive_ = true;
+
         this->registerVariables();
     }
 
+    /**
+    @brief
+        Destroys the WorldEntity AND ALL its children with it.
+    */
     WorldEntity::~WorldEntity()
     {
         if (this->isInitialized())
         {
+            if (this->parent_)
+                this->detachFromParent();
+
+            for (std::set<WorldEntity*>::const_iterator it = this->children_.begin(); it != this->children_.end(); )
+                delete (*(it++));
+
+            if (this->physicalBody_)
+            {
+                this->deactivatePhysics();
+                delete this->physicalBody_;
+            }
+            delete this->collisionShape_;
+
             this->node_->detachAllObjects();
-            if (this->getScene()->getSceneManager())
-                this->getScene()->getSceneManager()->destroySceneNode(this->node_->getName());
+            this->node_->removeAllChildren();
+
+            OrxAssert(this->getScene()->getSceneManager(), "No SceneManager defined in a WorldEntity.");
+            this->getScene()->getSceneManager()->destroySceneNode(this->node_->getName());
         }
     }
@@ -81,30 +129,64 @@
         SUPER(WorldEntity, XMLPort, xmlelement, mode);
 
-        XMLPortParamTemplate(WorldEntity, "position", setPosition, getPosition, xmlelement, mode, const Vector3&);
+        XMLPortParamTemplate(WorldEntity, "position",    setPosition,    getPosition,    xmlelement, mode, const Vector3&);
         XMLPortParamTemplate(WorldEntity, "orientation", setOrientation, getOrientation, xmlelement, mode, const Quaternion&);
-        XMLPortParamLoadOnly(WorldEntity, "lookat", lookAt_xmlport, xmlelement, mode);
-        XMLPortParamLoadOnly(WorldEntity, "direction", setDirection_xmlport, xmlelement, mode);
-        XMLPortParamLoadOnly(WorldEntity, "yaw", yaw_xmlport, xmlelement, mode);
-        XMLPortParamLoadOnly(WorldEntity, "pitch", pitch_xmlport, xmlelement, mode);
-        XMLPortParamLoadOnly(WorldEntity, "roll", roll_xmlport, xmlelement, mode);
-        XMLPortParamTemplate(WorldEntity, "scale3D", setScale3D, getScale3D, xmlelement, mode, const Vector3&);
-        XMLPortParam(WorldEntity, "scale", setScale, getScale, xmlelement, mode);
-
+        XMLPortParamTemplate(WorldEntity, "scale3D",     setScale3D,     getScale3D,     xmlelement, mode, const Vector3&);
+        XMLPortParam        (WorldEntity, "scale",       setScale,       getScale,       xmlelement, mode);
+        XMLPortParamLoadOnly(WorldEntity, "lookat",      lookAt_xmlport,       xmlelement, mode);
+        XMLPortParamLoadOnly(WorldEntity, "direction",   setDirection_xmlport, xmlelement, mode);
+        XMLPortParamLoadOnly(WorldEntity, "yaw",         yaw_xmlport,          xmlelement, mode);
+        XMLPortParamLoadOnly(WorldEntity, "pitch",       pitch_xmlport,        xmlelement, mode);
+        XMLPortParamLoadOnly(WorldEntity, "roll",        roll_xmlport,         xmlelement, mode);
+
+        // Physics
+        XMLPortParam(WorldEntity, "collisionType",     setCollisionTypeStr,  getCollisionTypeStr,  xmlelement, mode);
+        XMLPortParam(WorldEntity, "collisionResponse", setCollisionResponse, hasCollisionResponse, xmlelement, mode);
+        XMLPortParam(WorldEntity, "mass",              setMass,              getMass,              xmlelement, mode);
+        XMLPortParam(WorldEntity, "restitution",       setRestitution,       getRestitution,       xmlelement, mode);
+        XMLPortParam(WorldEntity, "angularFactor",     setAngularFactor,     getAngularFactor,     xmlelement, mode);
+        XMLPortParam(WorldEntity, "linearDamping",     setLinearDamping,     getLinearDamping,     xmlelement, mode);
+        XMLPortParam(WorldEntity, "angularDamping",    setAngularDamping,    getAngularDamping,    xmlelement, mode);
+        XMLPortParam(WorldEntity, "friction",          setFriction,          getFriction,          xmlelement, mode);
+
+        // Other attached WorldEntities
         XMLPortObject(WorldEntity, WorldEntity, "attached", attach, getAttachedObject, xmlelement, mode);
+        // Attached collision shapes
+        XMLPortObject(WorldEntity, CollisionShape, "collisionShapes", attachCollisionShape, getAttachedCollisionShape, xmlelement, mode);
     }
 
     void WorldEntity::registerVariables()
     {
-        REGISTERDATA(this->bActive_,  direction::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::changedActivity));
-        REGISTERDATA(this->bVisible_, direction::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::changedVisibility));
-
-        REGISTERDATA(this->getScale3D().x, direction::toclient);
-        REGISTERDATA(this->getScale3D().y, direction::toclient);
-        REGISTERDATA(this->getScale3D().z, direction::toclient);
-
-        REGISTERDATA(this->parentID_, direction::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::updateParent));
-    }
-
-    void WorldEntity::updateParent()
+        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));
+
+        registerVariable(this->getScale3D(),    variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::scaleChanged));
+
+        // Physics stuff
+        registerVariable(this->mass_,           variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::massChanged));
+        registerVariable(this->restitution_,    variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::restitutionChanged));
+        registerVariable(this->angularFactor_,  variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::angularFactorChanged));
+        registerVariable(this->linearDamping_,  variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::linearDampingChanged));
+        registerVariable(this->angularDamping_, variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::angularDampingChanged));
+        registerVariable(this->friction_,       variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::frictionChanged));
+        registerVariable(this->bCollisionCallbackActive_,
+                                                variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::collisionCallbackActivityChanged));
+        registerVariable(this->bCollisionResponseActive_,
+                                                variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::collisionResponseActivityChanged));
+        registerVariable((int&)this->collisionTypeSynchronised_,
+                                                variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::collisionTypeChanged));
+        registerVariable(this->bPhysicsActiveSynchronised_,
+                                                variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::physicsActivityChanged));
+
+        // Attach to parent if necessary
+        registerVariable(this->parentID_,       variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::parentChanged));
+    }
+
+    /**
+    @brief
+        Network function that object this instance to its correct parent.
+    */
+    void WorldEntity::parentChanged()
     {
         if (this->parentID_ != OBJECTID_UNKNOWN)
@@ -116,32 +198,227 @@
     }
 
+    /**
+    @brief
+        Attaches this object to a parent SceneNode.
+    @Remarks
+        Only use this method if you know exactly what you're doing!
+        Normally, attaching works internally by attaching WE's.
+    */
+    void WorldEntity::attachToNode(Ogre::SceneNode* node)
+    {
+        Ogre::Node* parent = this->node_->getParent();
+        if (parent)
+            parent->removeChild(this->node_);
+        node->addChild(this->node_);
+    }
+
+    /**
+    @brief
+        Detaches this object from a parent SceneNode.
+    @Remarks
+        Only use this method if you know exactly what you're doing!
+        Normally, attaching works internally by attaching WE's.
+    */
+    void WorldEntity::detachFromNode(Ogre::SceneNode* node)
+    {
+        node->removeChild(this->node_);
+//        this->getScene()->getRootSceneNode()->addChild(this->node_);
+    }
+
+    /**
+    @brief
+        Network callback for the collision type. Only change the type if it was valid.
+    */
+    void WorldEntity::collisionTypeChanged()
+    {
+        if (this->collisionTypeSynchronised_ != Dynamic &&
+            this->collisionTypeSynchronised_ != Kinematic &&
+            this->collisionTypeSynchronised_ != Static &&
+            this->collisionTypeSynchronised_ != None)
+        {
+            CCOUT(1) << "Error when collsion Type was received over network. Unknown enum value:" << this->collisionTypeSynchronised_ << std::endl;
+        }
+        else if (this->collisionTypeSynchronised_ != collisionType_)
+        {
+            if (this->parent_)
+                CCOUT(2) << "Warning: Network connection tried to set the collision type of an attached WE. Ignoring." << std::endl;
+            else
+                this->setCollisionType(this->collisionTypeSynchronised_);
+        }
+    }
+
+    //! Network callback for this->bPhysicsActive_
+    void WorldEntity::physicsActivityChanged()
+    {
+        if (this->bPhysicsActiveSynchronised_)
+            this->activatePhysics();
+        else
+            this->deactivatePhysics();
+    }
+
+    //! Function sets whether Bullet should issue a callback on collisions
+    void WorldEntity::collisionCallbackActivityChanged()
+    {
+        if (this->hasPhysics())
+        {
+            if (this->bCollisionCallbackActive_)
+                this->physicalBody_->setCollisionFlags(this->physicalBody_->getCollisionFlags() |
+                    btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
+            else
+                this->physicalBody_->setCollisionFlags(this->physicalBody_->getCollisionFlags() &
+                    ~btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
+        }
+    }
+
+    //! Function sets whether Bullet should react itself to a collision
+    void WorldEntity::collisionResponseActivityChanged()
+    {
+        if (this->hasPhysics())
+        {
+            if (this->bCollisionResponseActive_)
+                this->physicalBody_->setCollisionFlags(this->physicalBody_->getCollisionFlags() &
+                    ~btCollisionObject::CF_NO_CONTACT_RESPONSE);
+            else
+                this->physicalBody_->setCollisionFlags(this->physicalBody_->getCollisionFlags() |
+                    btCollisionObject::CF_NO_CONTACT_RESPONSE);
+        }
+    }
+
+    /**
+    @brief
+        Attaches a child WorldEntity to this object. This calls notifyBeingAttached()
+        of the child WE.
+    @Note
+        The collision shape of the child object gets attached nevertheless. That also means
+        that you can change the collision shape of the child and it correctly cascadeds the changes to this instance.
+        Be aware of this implication: When implementing attaching of kinematic objects to others, you have to change
+        this behaviour because you then might not want to merge the collision shapes.
+    */
     void WorldEntity::attach(WorldEntity* object)
     {
-        if (object->getParent())
-            object->detachFromParent();
-        else
-        {
-            Ogre::Node* parent = object->node_->getParent();
-            if (parent)
-                parent->removeChild(object->node_);
-        }
-
-        this->node_->addChild(object->node_);
+        if (object == this)
+        {
+            COUT(2) << "Warning: Can't attach a WorldEntity to itself." << std::endl;
+            return;
+        }
+
+        if (!object->notifyBeingAttached(this))
+            return;
+
+        this->attachNode(object->node_);
         this->children_.insert(object);
-        object->parent_ = this;
-        object->parentID_ = this->getObjectID();
-    }
-
+
+        this->attachCollisionShape(object->collisionShape_);
+        // mass
+        this->childrenMass_ += object->getMass();
+        recalculateMassProps();
+    }
+
+    /**
+    @brief
+        Function gets called when this object is being attached to a new parent.
+
+        This operation is only allowed if the collision types "like" each other.
+        - You cannot a attach a non physical object to a physical one.
+        - Dynamic object can NOT be attached at all.
+        - It is also not possible to attach a kinematic to a dynamic one.
+        - Attaching of kinematic objects otherwise is not yet supported.
+    */
+    bool WorldEntity::notifyBeingAttached(WorldEntity* newParent)
+    {
+        // check first whether attaching is even allowed
+        if (this->hasPhysics())
+        {
+            if (!newParent->hasPhysics())
+            {
+                COUT(2) << "Warning: Cannot attach a physical object to a non physical one." << std::endl;
+                return false;
+            }
+            else if (this->isDynamic())
+            {
+                COUT(2) << "Warning: Cannot attach a dynamic object to a WorldEntity." << std::endl;
+                return false;
+            }
+            else if (this->isKinematic() && newParent->isDynamic())
+            {
+                COUT(2) << "Warning: Cannot attach a kinematic object to a dynamic one." << std::endl;
+                return false;
+            }
+            else if (this->isKinematic())
+            {
+                COUT(2) << "Warning: Cannot attach a kinematic object to a static or kinematic one: Not yet implemented." << std::endl;
+                return false;
+            }
+        }
+
+        if (this->isPhysicsActive())
+            this->bPhysicsActiveBeforeAttaching_ = true;
+        this->deactivatePhysics();
+
+        if (this->parent_)
+            this->detachFromParent();
+
+        this->parent_ = newParent;
+        this->parentID_ = newParent->getObjectID();
+
+        // apply transform to collision shape
+        this->collisionShape_->setPosition(this->getPosition());
+        this->collisionShape_->setOrientation(this->getOrientation());
+        // TODO: Scale
+        
+        return true;
+    }
+
+    /**
+    @brief
+        Detaches a child WorldEntity from this instance.
+    */
     void WorldEntity::detach(WorldEntity* object)
     {
-        this->node_->removeChild(object->node_);
+        if (this->children_.find(object) == this->children_.end())
+        {
+            CCOUT(2) << "Warning: Cannot detach an object that is not a child." << std::endl;
+            return;
+        }
+
+        // collision shapes
+        this->detachCollisionShape(object->collisionShape_);
+
+        // mass
+        if (object->getMass() > 0.0f)
+        {
+            this->childrenMass_ -= object->getMass();
+            recalculateMassProps();
+        }
+
+        this->detachNode(object->node_);
         this->children_.erase(object);
-        object->parent_ = 0;
-        object->parentID_ = OBJECTID_UNKNOWN;
-
-//        this->getScene()->getRootSceneNode()->addChild(object->node_);
-    }
-
-    WorldEntity* WorldEntity::getAttachedObject(unsigned int index) const
+
+        object->notifyDetached();
+    }
+
+    /**
+    @brief
+        Function gets called when the object has been detached from its parent.
+    */
+    void WorldEntity::notifyDetached()
+    {
+        this->parent_ = 0;
+        this->parentID_ = OBJECTID_UNKNOWN;
+
+        // reset orientation of the collisionShape (cannot be set within a WE usually)
+        this->collisionShape_->setPosition(Vector3::ZERO);
+        this->collisionShape_->setOrientation(Quaternion::IDENTITY);
+        // TODO: Scale
+
+        if (this->bPhysicsActiveBeforeAttaching_)
+        {
+            this->activatePhysics();
+            this->bPhysicsActiveBeforeAttaching_ = false;
+        }
+    }
+
+    //! Returns an attached object (merely for XMLPort).
+    WorldEntity* WorldEntity::getAttachedObject(unsigned int index)
     {
         unsigned int i = 0;
@@ -154,3 +431,472 @@
         return 0;
     }
+
+    //! Attaches an Ogre::SceneNode to this WorldEntity.
+    void WorldEntity::attachNode(Ogre::SceneNode* node)
+    {
+        Ogre::Node* parent = node->getParent();
+        if (parent)
+            parent->removeChild(node);
+        this->node_->addChild(node);
+    }
+
+    //! Detaches an Ogre::SceneNode from this WorldEntity.
+    void WorldEntity::detachNode(Ogre::SceneNode* node)
+    {
+        this->node_->removeChild(node);
+//        this->getScene()->getRootSceneNode()->addChild(node);
+    }
+
+    //! Attaches an Ogre::MovableObject to this WorldEntity.
+    void WorldEntity::attachOgreObject(Ogre::MovableObject* object)
+    {
+        this->node_->attachObject(object);
+    }
+
+    //! Detaches an Ogre::MovableObject from this WorldEntity.
+    void WorldEntity::detachOgreObject(Ogre::MovableObject* object)
+    {
+        this->node_->detachObject(object);
+    }
+
+    //! Detaches an Ogre::MovableObject (by string) from this WorldEntity.
+    Ogre::MovableObject* WorldEntity::detachOgreObject(const Ogre::String& name)
+    {
+        return this->node_->detachObject(name);
+    }
+
+    //! Attaches a collision Shape to this object (delegated to the internal CompoundCollisionShape)
+    void WorldEntity::attachCollisionShape(CollisionShape* shape)
+    {
+        this->collisionShape_->attach(shape);
+        // Note: this->collisionShape_ already notifies us of any changes.
+    }
+
+    //! Detaches a collision Shape from this object (delegated to the internal CompoundCollisionShape)
+    void WorldEntity::detachCollisionShape(CollisionShape* shape)
+    {
+        // Note: The collision shapes may not be detached with this function!
+        this->collisionShape_->detach(shape);
+        // Note: this->collisionShape_ already notifies us of any changes.
+    }
+
+    //! Returns an attached collision Shape of this object (delegated to the internal CompoundCollisionShape)
+    CollisionShape* WorldEntity::getAttachedCollisionShape(unsigned int index)
+    {
+        return this->collisionShape_->getAttachedShape(index);
+    }
+
+    // Note: These functions are placed in WorldEntity.h as inline functions for the release build.
+#ifndef _NDEBUG
+    const Vector3& WorldEntity::getPosition() const
+    {
+        return this->node_->getPosition();
+    }
+
+    const Quaternion& WorldEntity::getOrientation() const
+    {
+        return this->node_->getOrientation();
+    }
+
+    const Vector3& WorldEntity::getScale3D() const
+    {
+        return this->node_->getScale();
+    }
+#endif
+
+    //! Returns the position relative to the root space
+    const Vector3& WorldEntity::getWorldPosition() const
+    {
+        return this->node_->_getDerivedPosition();
+    }
+
+    //! Returns the orientation relative to the root space
+    const Quaternion& WorldEntity::getWorldOrientation() const
+    {
+        return this->node_->_getDerivedOrientation();
+    }
+
+    //! Returns the scaling applied relative to the root space in 3 coordinates
+    const Vector3& WorldEntity::getWorldScale3D() const
+    {
+        return this->node_->_getDerivedScale();
+    }
+
+    /**
+    @brief
+        Returns the scaling applied relative to the root space in 3 coordinates
+    @return
+        Returns the scaling if it is uniform, 1.0f otherwise.
+    */
+    float WorldEntity::getWorldScale() const
+    {
+        Vector3 scale = this->getWorldScale3D();
+        return (scale.x == scale.y && scale.x == scale.z) ? scale.x : 1;
+    }
+
+    /**
+    @brief
+        Sets the three dimensional scaling of this object.
+    @Note
+        Scaling physical objects has not yet been implemented and is therefore forbidden.
+    */
+    void WorldEntity::setScale3D(const Vector3& scale)
+    {
+/*
+HACK HACK HACK
+        if (bScalePhysics && this->hasPhysics() && scale != Vector3::UNIT_SCALE)
+        {
+            CCOUT(2) << "Warning: Cannot set the scale of a physical object: Not yet implemented. Ignoring scaling." << std::endl;
+            return;
+        }
+HACK HACK HACK
+*/
+        this->node_->setScale(scale);
+
+        this->changedScale();
+    }
+
+    /**
+    @brief
+        Translates this WorldEntity by a vector.
+    @param relativeTo
+        @see TransformSpace::Enum
+    */
+    void WorldEntity::translate(const Vector3& distance, TransformSpace::Enum relativeTo)
+    {
+        switch (relativeTo)
+        {
+        case TransformSpace::Local:
+            // position is relative to parent so transform downwards
+            this->setPosition(this->getPosition() + this->getOrientation() * distance);
+            break;
+        case TransformSpace::Parent:
+            this->setPosition(this->getPosition() + distance);
+            break;
+        case TransformSpace::World:
+            // position is relative to parent so transform upwards
+            if (this->node_->getParent())
+                setPosition(getPosition() + (node_->getParent()->_getDerivedOrientation().Inverse() * distance)
+                    / node_->getParent()->_getDerivedScale());
+            else
+                this->setPosition(this->getPosition() + distance);
+            break;
+        }
+    }
+
+    /**
+    @brief
+        Rotates this WorldEntity by a quaternion.
+    @param relativeTo
+        @see TransformSpace::Enum
+    */
+    void WorldEntity::rotate(const Quaternion& rotation, TransformSpace::Enum relativeTo)
+    {
+        switch(relativeTo)
+        {
+        case TransformSpace::Local:
+            this->setOrientation(this->getOrientation() * rotation);
+            break;
+        case TransformSpace::Parent:
+            // Rotations are normally relative to local axes, transform up
+            this->setOrientation(rotation * this->getOrientation());
+            break;
+        case TransformSpace::World:
+            // Rotations are normally relative to local axes, transform up
+            this->setOrientation(this->getOrientation() * this->getWorldOrientation().Inverse()
+                * rotation * this->getWorldOrientation());
+            break;
+        }
+    }
+
+    /**
+    @brief
+        Makes this WorldEntity look a specific target location.
+    @param relativeTo
+        @see TransformSpace::Enum
+    @param localDirectionVector
+        The vector which normally describes the natural direction of the object, usually -Z.
+    */
+    void WorldEntity::lookAt(const Vector3& target, TransformSpace::Enum relativeTo, const Vector3& localDirectionVector)
+    {
+        Vector3 origin;
+        switch (relativeTo)
+        {
+        case TransformSpace::Local:
+            origin = Vector3::ZERO;
+            break;
+        case TransformSpace::Parent:
+            origin = this->getPosition();
+            break;
+        case TransformSpace::World:
+            origin = this->getWorldPosition();
+            break;
+        }
+        this->setDirection(target - origin, relativeTo, localDirectionVector);
+    }
+
+    /**
+    @brief
+        Makes this WorldEntity look in specific direction.
+    @param relativeTo
+        @see TransformSpace::Enum
+    @param localDirectionVector
+        The vector which normally describes the natural direction of the object, usually -Z.
+    */
+    void WorldEntity::setDirection(const Vector3& direction, TransformSpace::Enum relativeTo, const Vector3& localDirectionVector)
+    {
+        Quaternion savedOrientation(this->getOrientation());
+        Ogre::Node::TransformSpace ogreRelativeTo;
+        switch (relativeTo)
+        {
+        case TransformSpace::Local:
+            ogreRelativeTo = Ogre::Node::TS_LOCAL; break;
+        case TransformSpace::Parent:
+            ogreRelativeTo = Ogre::Node::TS_PARENT; break;
+        case TransformSpace::World:
+            ogreRelativeTo = Ogre::Node::TS_WORLD; break;
+        }
+        this->node_->setDirection(direction, ogreRelativeTo, localDirectionVector);
+        Quaternion newOrientation(this->node_->getOrientation());
+        this->node_->setOrientation(savedOrientation);
+        this->setOrientation(newOrientation);
+    }
+
+    //! Activates physics if the CollisionType is not None.
+    void WorldEntity::activatePhysics()
+    {
+        if (this->isActive() && this->hasPhysics() && !this->isPhysicsActive() && !this->parent_)
+        {
+            this->getScene()->addPhysicalObject(this);
+            this->bPhysicsActive_ = true;
+            this->bPhysicsActiveSynchronised_ = true;
+        }
+    }
+
+    //! Deactivates physics but the CollisionType does not change.
+    void WorldEntity::deactivatePhysics()
+    {
+        if (this->isPhysicsActive())
+        {
+            this->getScene()->removePhysicalObject(this);
+            this->bPhysicsActive_ = false;
+            this->bPhysicsActiveSynchronised_ = false;
+        }
+    }
+
+    //! Tells whether the object has already been added to the Bullet physics World.
+    bool WorldEntity::addedToPhysicalWorld() const
+    {
+        return this->physicalBody_ && this->physicalBody_->isInWorld();
+    }
+
+    /**
+    @brief
+        Sets the CollisionType. This alters the object significantly! @see CollisionType.
+    @Note
+        Operation does not work on attached WorldEntities.
+    */
+    void WorldEntity::setCollisionType(CollisionType type)
+    {
+        if (this->collisionType_ == type)
+            return;
+
+        // If we are already attached to a parent, this would be a bad idea..
+        if (this->parent_)
+        {
+            CCOUT(2) << "Warning: Cannot set the collision type of a WorldEntity with a parent." << std::endl;
+            return;
+        }
+
+        // Check for type legality. Could be StaticEntity or MobileEntity.
+        if (!this->isCollisionTypeLegal(type))
+            return;
+
+        if (this->isPhysicsActive())
+            this->deactivatePhysics();
+
+        bool bReactivatePhysics = true;
+        if (this->hasPhysics() && !this->isPhysicsActive())
+            bReactivatePhysics = false;
+
+        // Check whether we have to create or destroy.
+        if (type != None && this->collisionType_ == None)
+        {
+/*
+HACK HACK HACK
+            // Check whether there was some scaling applied.
+            if (!this->node_->getScale().positionEquals(Vector3(1, 1, 1), 0.001))
+            {
+                CCOUT(2) << "Warning: Cannot create a physical body if there is scaling applied to the node: Not yet implemented." << std::endl;
+                return;
+            }
+HACK HACK HACK
+*/
+            // Create new rigid body
+            btRigidBody::btRigidBodyConstructionInfo bodyConstructionInfo(0, this, this->collisionShape_->getCollisionShape());
+            this->physicalBody_ = new btRigidBody(bodyConstructionInfo);
+            this->physicalBody_->setUserPointer(this);
+            this->physicalBody_->setActivationState(DISABLE_DEACTIVATION);
+        }
+        else if (type == None && this->collisionType_ != None)
+        {
+            // Destroy rigid body
+            assert(this->physicalBody_);
+            deactivatePhysics();
+            delete this->physicalBody_;
+            this->physicalBody_ = 0;
+            this->collisionType_ = None;
+            this->collisionTypeSynchronised_ = None;
+            return;
+        }
+
+        // Change type
+        switch (type)
+        {
+        case Dynamic:
+            this->physicalBody_->setCollisionFlags(this->physicalBody_->getCollisionFlags() & !(btCollisionObject::CF_STATIC_OBJECT | btCollisionObject::CF_KINEMATIC_OBJECT));
+            break;
+        case Kinematic:
+            this->physicalBody_->setCollisionFlags(this->physicalBody_->getCollisionFlags() & !btCollisionObject::CF_STATIC_OBJECT | btCollisionObject::CF_KINEMATIC_OBJECT);
+            break;
+        case Static:
+            this->physicalBody_->setCollisionFlags(this->physicalBody_->getCollisionFlags() & !btCollisionObject::CF_KINEMATIC_OBJECT | btCollisionObject::CF_STATIC_OBJECT);
+            break;
+        case None:
+            assert(false); // Doesn't happen
+            return;
+        }
+        this->collisionType_ = type;
+        this->collisionTypeSynchronised_ = type;
+
+        // update mass and inertia tensor
+        recalculateMassProps();
+        internalSetPhysicsProps();
+        collisionCallbackActivityChanged();
+        collisionResponseActivityChanged();
+        if (bReactivatePhysics)
+            activatePhysics();
+    }
+
+    //! Sets the CollisionType by string (used for the XMLPort)
+    void WorldEntity::setCollisionTypeStr(const std::string& typeStr)
+    {
+        std::string typeStrLower = getLowercase(typeStr);
+        CollisionType type;
+        if (typeStrLower == "dynamic")
+            type = Dynamic;
+        else if (typeStrLower == "static")
+            type = Static;
+        else if (typeStrLower == "kinematic")
+            type = Kinematic;
+        else if (typeStrLower == "none")
+            type = None;
+        else
+            ThrowException(ParseError, std::string("Attempting to set an unknown collision type: '") + typeStr + "'.");
+        this->setCollisionType(type);
+    }
+
+    //! Gets the CollisionType by string (used for the XMLPort)
+    std::string WorldEntity::getCollisionTypeStr() const
+    {
+        switch (this->getCollisionType())
+        {
+            case Dynamic:
+                return "dynamic";
+            case Kinematic:
+                return "kinematic";
+            case Static:
+                return "static";
+            case None:
+                return "none";
+            default:
+                assert(false);
+                return "";
+        }
+    }
+
+    /**
+    @brief
+        Recalculates the accumulated child mass and calls recalculateMassProps()
+        and notifies the parent of the change.
+    @Note
+        Called by a child WE
+    */
+    void WorldEntity::notifyChildMassChanged()
+    {
+        // Note: CollisionShape changes of a child get handled over the internal CompoundCollisionShape already
+        // Recalculate mass
+        this->childrenMass_ = 0.0f;
+        for (std::set<WorldEntity*>::const_iterator it = this->children_.begin(); it != this->children_.end(); ++it)
+            this->childrenMass_ += (*it)->getMass();
+        recalculateMassProps();
+        // Notify parent WE
+        if (this->parent_)
+            parent_->notifyChildMassChanged();
+    }
+
+    /**
+    @brief
+        Undertakes the necessary steps to change the collision shape in Bullet, even at runtime.
+    @Note
+        - called by this->collisionShape_
+        - May have a REALLY big overhead when called continuously at runtime, because then we need
+          to remove the physical body from Bullet and add it again.
+    */
+    void WorldEntity::notifyCollisionShapeChanged()
+    {
+        if (hasPhysics())
+        {
+            // Bullet doesn't like sudden changes of the collision shape, so we remove and add it again
+            if (this->addedToPhysicalWorld())
+            {
+                this->deactivatePhysics();
+                this->physicalBody_->setCollisionShape(this->collisionShape_->getCollisionShape());
+                this->activatePhysics();
+            }
+            else
+                this->physicalBody_->setCollisionShape(this->collisionShape_->getCollisionShape());
+        }
+        recalculateMassProps();
+    }
+
+    //! Updates all mass dependent parameters (mass, inertia tensor and child mass)
+    void WorldEntity::recalculateMassProps()
+    {
+        // Store local inertia for faster access. Evaluates to (0,0,0) if there is no collision shape.
+        float totalMass = this->mass_ + this->childrenMass_;
+        this->collisionShape_->calculateLocalInertia(totalMass, this->localInertia_);
+        if (this->hasPhysics())
+        {
+            if (this->isStatic())
+            {
+                // Just set everything to zero
+                this->physicalBody_->setMassProps(0.0f, btVector3(0, 0, 0));
+            }
+            else if ((this->mass_ + this->childrenMass_) == 0.0f)
+            {
+                // Use default values to avoid very large or very small values
+                CCOUT(4) << "Warning: Setting the internal physical mass to 1.0 because mass_ is 0.0" << std::endl;
+                btVector3 inertia(0, 0, 0);
+                this->collisionShape_->calculateLocalInertia(1.0f, inertia);
+                this->physicalBody_->setMassProps(1.0f, inertia);
+            }
+            else
+            {
+                this->physicalBody_->setMassProps(totalMass, this->localInertia_);
+            }
+        }
+    }
+
+    //! Copies our own parameters for restitution, angular factor, dampings and friction to the bullet rigid body.
+    void WorldEntity::internalSetPhysicsProps()
+    {
+        if (this->hasPhysics())
+        {
+            this->physicalBody_->setRestitution(this->restitution_);
+            this->physicalBody_->setAngularFactor(this->angularFactor_);
+            this->physicalBody_->setDamping(this->linearDamping_, this->angularDamping_);
+            this->physicalBody_->setFriction(this->friction_);
+        }
+    }
 }
Index: code/trunk/src/orxonox/objects/worldentities/WorldEntity.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/WorldEntity.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/WorldEntity.h	(revision 2662)
@@ -22,4 +22,5 @@
  *   Author:
  *      Fabian 'x3n' Landau
+ *      Reto Grieder (physics)
  *   Co-authors:
  *      ...
@@ -32,16 +33,45 @@
 #include "OrxonoxPrereqs.h"
 
-#define OGRE_FORCE_ANGLE_TYPES
-
+#ifdef _NDEBUG
 #include <OgreSceneNode.h>
-
-#include "network/Synchronisable.h"
+#else
+#include <OgrePrerequisites.h>
+#endif
+#include "LinearMath/btMotionState.h"
+
+#include "util/Math.h"
 #include "core/BaseObject.h"
-#include "util/Math.h"
+#include "network/synchronisable/Synchronisable.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport WorldEntity : public BaseObject, public Synchronisable
+    /**
+    @brief
+        The WorldEntity represents everything that can be put in a Scene at a certain location.
+
+        It is supposed to be the base class of everything you would call an 'object' in a Scene.
+        The class itself is abstract which means you cannot use it directly. You may use StaticEntity
+        as the simplest derivative or (derived from MobileEntity) MovableEntity and ControllableEntity
+        as more advanced ones.
+
+        The basic task of the WorldEntity is provide a location, a direction and a scaling and the possibility
+        to create an entire hierarchy of derivated objects.
+        It is also the basis for the physics interface to the Bullet physics engine.
+        Every WorldEntity can have a specific collision type: @see CollisionType
+        This would then imply that every scene object could have any collision type. To limit this, you can always
+        override this->isCollisionTypeLegal(CollisionType). Return false if the collision type is not supported
+        for a specific object.
+        There is also support for attaching WorldEntities with physics to each other. Currently, the collision shape
+        of both objects simply get merged into one larger shape (for static collision type).
+        The phyiscal body that is internally stored and administrated has the following supported properties:
+        - Restitution, angular factor, linear damping, angular damping, fricition, mass and collision shape.
+        You can get more information at the corresponding set function.
+
+        Collision shapes: These are controlled by the internal WorldEntityCollisionShape. @see WorldEntityCollisionShape.
+    */
+    class _OrxonoxExport WorldEntity : public BaseObject, public Synchronisable, public btMotionState
     {
+        friend class Scene;
+
         public:
             WorldEntity(BaseObject* creator);
@@ -51,5 +81,5 @@
             void registerVariables();
 
-            inline Ogre::SceneNode* getNode() const
+            inline const Ogre::SceneNode* getNode() const
                 { return this->node_; }
 
@@ -64,12 +94,13 @@
             inline void setPosition(float x, float y, float z)
                 { this->setPosition(Vector3(x, y, z)); }
-            inline const Vector3& getPosition() const
-                { return this->node_->getPosition(); }
-            inline const Vector3& getWorldPosition() const
-                { return this->node_->getWorldPosition(); }
-
-            virtual void translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0;
-            inline void translate(float x, float y, float z, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
+            const Vector3& getPosition() const;
+            const Vector3& getWorldPosition() const;
+
+            void translate(const Vector3& distance, TransformSpace::Enum relativeTo = TransformSpace::Parent);
+            inline void translate(float x, float y, float z, TransformSpace::Enum 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;
@@ -80,54 +111,53 @@
             inline void setOrientation(const Vector3& axis, const Degree& angle)
                 { this->setOrientation(Quaternion(angle, axis)); }
-            inline const Quaternion& getOrientation() const
-                { return this->node_->getOrientation(); }
-            inline const Quaternion& getWorldOrientation() const
-                { return this->node_->getWorldOrientation(); }
-
-            virtual void rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0;
-            inline void rotate(const Vector3& axis, const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
+            const Quaternion& getOrientation() const;
+            const Quaternion& getWorldOrientation() const;
+
+            void rotate(const Quaternion& rotation, TransformSpace::Enum relativeTo = TransformSpace::Local);
+            inline void rotate(const Vector3& axis, const Degree& angle, TransformSpace::Enum relativeTo = TransformSpace::Local)
                 { this->rotate(Quaternion(angle, axis), relativeTo); }
-            inline void rotate(const Vector3& axis, const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
-                { this->rotate(Quaternion(angle, axis), relativeTo); }
-
-            virtual void yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0;
-            inline void yaw(const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
-                { this->yaw(Degree(angle), relativeTo); }
-            virtual void pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0;
-            inline void pitch(const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
-                { this->pitch(Degree(angle), relativeTo); }
-            virtual void roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0;
-            inline void roll(const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
-                { this->roll(Degree(angle), relativeTo); }
-
-            virtual void lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z) = 0;
-            virtual void setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z) = 0;
-            inline void setDirection(float x, float y, float z, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z)
+
+            inline void yaw(const Degree& angle, TransformSpace::Enum relativeTo = TransformSpace::Local)
+                { this->rotate(Quaternion(angle, Vector3::UNIT_Y), relativeTo); }
+            inline void pitch(const Degree& angle, TransformSpace::Enum relativeTo = TransformSpace::Local)
+                { this->rotate(Quaternion(angle, Vector3::UNIT_X), relativeTo); }
+            inline void roll(const Degree& angle, TransformSpace::Enum relativeTo = TransformSpace::Local)
+                { this->rotate(Quaternion(angle, Vector3::UNIT_Z), relativeTo); }
+
+            void lookAt(const Vector3& target, TransformSpace::Enum relativeTo = TransformSpace::Parent, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
+            void setDirection(const Vector3& direction, TransformSpace::Enum relativeTo = TransformSpace::Local, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
+            inline void setDirection(float x, float y, float z, TransformSpace::Enum relativeTo = TransformSpace::Local, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z)
                 { this->setDirection(Vector3(x, y, z), relativeTo, localDirectionVector); }
 
-            inline void setScale3D(const Vector3& scale)
-                { this->node_->setScale(scale); }
+            virtual void setScale3D(const Vector3& scale);
             inline void setScale3D(float x, float y, float z)
-                { this->node_->setScale(x, y, z); }
-            inline const Vector3& getScale3D(void) const
-                { return this->node_->getScale(); }
+                { this->setScale3D(Vector3(x, y, z)); }
+            const Vector3& getScale3D(void) const;
+            const Vector3& getWorldScale3D() const;
 
             inline void setScale(float scale)
-                { this->node_->setScale(scale, scale, 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)
-                { this->node_->scale(scale); }
+                { this->setScale3D(this->getScale3D() * scale); }
             inline void scale3D(float x, float y, float z)
-                { this->node_->scale(x, y, z); }
+                { this->scale3D(Vector3(x, y, z)); }
             inline void scale(float scale)
-                { this->node_->scale(scale, scale, scale); }
+                { this->scale3D(scale, scale, scale); }
+
+            virtual void changedScale() {}
 
             void attach(WorldEntity* object);
             void detach(WorldEntity* object);
-            WorldEntity* getAttachedObject(unsigned int index) const;
+            WorldEntity* getAttachedObject(unsigned int index);
             inline const std::set<WorldEntity*>& getAttachedObjects() const
                 { return this->children_; }
+
+            void attachOgreObject(Ogre::MovableObject* object);
+            void detachOgreObject(Ogre::MovableObject* object);
+            Ogre::MovableObject* detachOgreObject(const Ogre::String& name);
 
             inline void attachToParent(WorldEntity* parent)
@@ -138,10 +168,15 @@
                 { 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();
+
         protected:
             Ogre::SceneNode* node_;
 
         private:
-            void updateParent();
-
             inline void lookAt_xmlport(const Vector3& target)
                 { this->lookAt(target); }
@@ -155,8 +190,243 @@
                 { this->roll(angle); }
 
+            // network callbacks
+            void parentChanged();
+            inline void scaleChanged()
+                { this->setScale3D(this->getScale3D()); }
+
             WorldEntity* parent_;
             unsigned int parentID_;
             std::set<WorldEntity*> children_;
+
+
+        /////////////
+        // Physics //
+        /////////////
+
+        public:
+            /**
+            @brief
+                Denotes the possible types of physical objects in a Scene.
+
+                Dynamic:   The object is influenced by its physical environment, like for instance little ball.
+                Kinematic: The object can only influence other dynamic objects. It's movement is coordinated by your own saying.
+                Static:    Like kinematic but the object is not allowed to move during the simulation.
+                None:      The object has no physics at all.
+            */
+            enum CollisionType
+            {
+                Dynamic,
+                Kinematic,
+                Static,
+                None
+            };
+
+            //! Tells whether the object has any connection to the Bullet physics engine. If hasPhysics() is false, the object may still have a velocity.
+            bool hasPhysics()       const { return getCollisionType() != None     ; }
+            //! @see CollisionType
+            bool isStatic()         const { return getCollisionType() == Static   ; }
+            //! @see CollisionType
+            bool isKinematic()      const { return getCollisionType() == Kinematic; }
+            //! @see CollisionType
+            bool isDynamic()        const { return getCollisionType() == Dynamic  ; }
+            //! Tells whether physics has been activated (you can temporarily deactivate it)
+            bool isPhysicsActive()  const { return this->bPhysicsActive_; }
+            bool addedToPhysicalWorld() const;
+
+            void activatePhysics();
+            void deactivatePhysics();
+
+            //! Returns the CollisionType. @see CollisionType.
+            inline CollisionType getCollisionType() const
+                { return this->collisionType_; }
+            void setCollisionType(CollisionType type);
+
+            void setCollisionTypeStr(const std::string& type);
+            std::string getCollisionTypeStr() const;
+
+            //! Sets the mass of this object. Note that the total mass may be influenced by attached objects!
+            inline void setMass(float mass)
+                { this->mass_ = mass; recalculateMassProps(); }
+            //! Returns the mass of this object without its children.
+            inline float getMass() const
+                { return this->mass_; }
+
+            //! Returns the total mass of this object with all its attached children.
+            inline float getTotalMass() const
+                { return this->mass_ + this->childrenMass_; }
+
+            /**
+            @brief
+                Returns the diagonal elements of the inertia tensor when calculated in local coordinates.
+            @Note
+                The local inertia tensor cannot be set, but is calculated by Bullet according to the collisionShape.
+                With compound collision shapes, an approximation is used.
+            */
+            inline const btVector3& getLocalInertia() const
+                { return this->localInertia_; }
+
+            /**
+            @brief
+                Sets how much reaction is applied in a collision.
+                
+                Consider two equal spheres colliding with equal velocities:
+                Restitution 1 means that both spheres simply reverse their velocity (no loss of energy)
+                Restitution 0 means that both spheres will immediately stop moving
+                (maximum loss of energy without violating of the preservation of momentum)
+            */
+            inline void setRestitution(float restitution)
+                { this->restitution_ = restitution; internalSetPhysicsProps(); }
+            //! Returns the restitution parameter. @see setRestitution.
+            inline float getRestitution() const
+                { return this->restitution_; }
+
+            /**
+            @brief
+                Sets an artificial parameter that tells how much torque is applied when you apply a non-central force.
+
+                Normally the angular factor is 1, which means it's physically 'correct'. Howerver if you have a player
+                character that should not rotate when hit sideways, you can set the angular factor to 0.
+            */
+            inline void setAngularFactor(float angularFactor)
+                { this->angularFactor_ = angularFactor; internalSetPhysicsProps(); }
+            //! Returns the angular factor. @see setAngularFactor.
+            inline float getAngularFactor() const
+                { return this->angularFactor_; }
+
+            //! Applies a mass independent damping. Velocities will simply diminish exponentially.
+            inline void setLinearDamping(float linearDamping)
+                { this->linearDamping_ = linearDamping; internalSetPhysicsProps(); }
+            //! Returns the linear damping. @see setLinearDamping.
+            inline float getLinearDamping() const
+                { return this->linearDamping_; }
+
+            //! Applies a tensor independent rotation damping. Angular velocities will simply diminish exponentially.
+            inline void setAngularDamping(float angularDamping)
+                { this->angularDamping_ = angularDamping; internalSetPhysicsProps(); }
+            //! Returns the angular damping. @see setAngularDamping.
+            inline float getAngularDamping() const
+                { return this->angularDamping_; }
+
+            //! Applies friction to the object. Friction occurs when two objects collide.
+            inline void setFriction(float friction)
+                { this->friction_ = friction; internalSetPhysicsProps(); }
+            //! Returns the amount of friction applied to the object.
+            inline float getFriction() const
+                { return this->friction_; }
+
+            void attachCollisionShape(CollisionShape* shape);
+            void detachCollisionShape(CollisionShape* shape);
+            CollisionShape* getAttachedCollisionShape(unsigned int index);
+
+            void notifyCollisionShapeChanged();
+            void notifyChildMassChanged();
+
+            /**
+            @brief
+                Virtual function that gets called when this object collides with another.
+            @param otherObject
+                The object this one has collided into.
+            @pram contactPoint
+                Contact point provided by Bullet. Holds more information and can me modified. See return value.
+            @Return
+                Returning false means that no modification to the contactPoint has been made. Return true otherwise!
+            @Note
+                Condition is that enableCollisionCallback() was called.
+            */
+            virtual inline bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
+                { return false; } /* With false, Bullet assumes no modification to the collision objects. */
+
+            //! Enables the collidesAgainst(.) function. The object doesn't respond to collision otherwise!
+            inline void enableCollisionCallback()
+                { this->bCollisionCallbackActive_ = true; this->collisionCallbackActivityChanged(); }
+            //! Disables the collidesAgainst(.) function. @see enableCollisionCallback()
+            inline void disableCollisionCallback()
+                { this->bCollisionCallbackActive_ = false; this->collisionCallbackActivityChanged(); }
+            //! Tells whether there could be a collision callback via collidesAgainst(.)
+            inline bool isCollisionCallbackActive() const
+                { return this->bCollisionCallbackActive_; }
+
+            //! Enables or disables collision response (default is of course on)
+            inline void setCollisionResponse(bool value)
+                { this->bCollisionResponseActive_ = value; this->collisionResponseActivityChanged(); }
+            //! Tells whether there could be a collision response
+            inline bool hasCollisionResponse()
+                { return this->bCollisionResponseActive_; }
+
+        protected:
+            /**
+            @brief
+                Function checks whether the requested collision type is legal to this object.
+
+                You can override this function in a derived class to constrain the collision to e.g. None or Dynamic.
+                A projectile may not prove very useful if there is no physical body. Simply set the CollisionType
+                in its constructor and override this method. But be careful that a derived classe's virtual functions
+                don't yet exist in the constructor if a base class.
+            */
+            virtual bool isCollisionTypeLegal(CollisionType type) const = 0;
+
+            btRigidBody*  physicalBody_; //!< Bullet rigid body. Everything physical is applied to this instance.
+
+        private:
+            void recalculateMassProps();
+            void internalSetPhysicsProps();
+
+            bool notifyBeingAttached(WorldEntity* newParent);
+            void notifyDetached();
+
+            // network callbacks
+            void collisionTypeChanged();
+            void physicsActivityChanged();
+            void collisionCallbackActivityChanged();
+            void collisionResponseActivityChanged();
+            //! Network callback workaround to call a function when the value changes.
+            inline void massChanged()
+                { this->setMass(this->mass_); }
+            //! Network callback workaround to call a function when the value changes.
+            inline void restitutionChanged()
+                { this->setRestitution(this->restitution_); }
+            //! Network callback workaround to call a function when the value changes.
+            inline void angularFactorChanged()
+                { this->setAngularFactor(this->angularFactor_); }
+            //! Network callback workaround to call a function when the value changes.
+            inline void linearDampingChanged()
+                { this->setLinearDamping(this->linearDamping_); }
+            //! Network callback workaround to call a function when the value changes.
+            inline void angularDampingChanged()
+                { this->setAngularDamping(this->angularDamping_); }
+            //! Network callback workaround to call a function when the value changes.
+            inline void frictionChanged()
+                { this->setFriction(this->friction_); }
+
+            CollisionType                collisionType_;                 //!< @see setCollisionType
+            CollisionType                collisionTypeSynchronised_;     //!< Network synchronised variable for collisionType_
+            bool                         bPhysicsActive_;                //!< @see isPhysicsActive
+            bool                         bPhysicsActiveSynchronised_;    //!< Network synchronised variable for bPhysicsActive_
+            //! When attaching objects hierarchically this variable tells this object (as child) whether physics was activated before attaching (because the deactivate physics while being attached).
+            bool                         bPhysicsActiveBeforeAttaching_;
+            WorldEntityCollisionShape*   collisionShape_;                //!< Attached collision shapes go here
+            btScalar                     mass_;                          //!< @see setMass
+            btVector3                    localInertia_;                  //!< @see getLocalInertia
+            btScalar                     restitution_;                   //!< @see setRestitution
+            btScalar                     angularFactor_;                 //!< @see setAngularFactor
+            btScalar                     linearDamping_;                 //!< @see setLinearDamping
+            btScalar                     angularDamping_;                //!< @see setAngularDamping
+            btScalar                     friction_;                      //!< @see setFriction
+            btScalar                     childrenMass_;                  //!< Sum of all the children's masses
+            bool                         bCollisionCallbackActive_;      //!< @see enableCollisionCallback
+            bool                         bCollisionResponseActive_;      //!< Tells whether the object should respond to collisions
     };
+
+    // Inline heavily used functions for release builds. In debug, we better avoid including OgreSceneNode here.
+#ifdef _NDEBUG
+    inline const Vector3& WorldEntity::getPosition() const
+        { return this->node_->getPosition(); }
+    inline const Quaternion& WorldEntity::getOrientation() const
+        { return this->node_->getrOrientation(); }
+    inline const Vector3& WorldEntity::getScale3D(void) const
+        { return this->node_->getScale(); }
+#endif
+
+    SUPER_FUNCTION(5, WorldEntity, changedScale, false);
 }
 
Index: code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc	(revision 2662)
@@ -30,10 +30,13 @@
 #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 +48,8 @@
         RegisterObject(Pawn);
 
-        this->bAlive_ = false;
+        PawnManager::touch();
+        this->bAlive_ = true;
+        this->fire_ = 0x0;
+        this->firehack_ = 0x0;
 
         this->health_ = 0;
@@ -52,13 +58,19 @@
 
         this->lastHitOriginator_ = 0;
-        this->weaponSystem_ = 0;
-
-        /*
-        //WeaponSystem
-        weaponSystem_ = new WeaponSystem();
-        WeaponSet * weaponSet1 = new WeaponSet(1);
-        this->weaponSystem_->attachWeaponSet(weaponSet1);
-        this->weaponSystem_->getWeaponSetPointer(0)->getWeaponSlotPointer(0)->setAmmoType(true);
-        */
+
+        this->spawnparticleduration_ = 3.0f;
+
+        this->getPickUp().setPlayer(this);
+
+        if (Core::isMaster())
+        {
+            this->weaponSystem_ = new WeaponSystem(this);
+            this->weaponSystem_->setParentPawn(this);
+        }
+        else
+            this->weaponSystem_ = 0;
+
+        this->setRadarObjectColour(ColourValue::Red);
+        this->setRadarObjectShape(RadarViewable::Dot);
 
         this->registerVariables();
@@ -67,4 +79,12 @@
     Pawn::~Pawn()
     {
+        if (this->isInitialized())
+        {
+            for (ObjectList<PawnListener>::iterator it = ObjectList<PawnListener>::begin(); it != ObjectList<PawnListener>::end(); ++it)
+                it->destroyedPawn(this);
+
+            if (this->weaponSystem_)
+                delete this->weaponSystem_;
+        }
     }
 
@@ -73,13 +93,22 @@
         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);
+
+        XMLPortObject(Pawn, WeaponSlot, "weaponslots", setWeaponSlot, getWeaponSlot, xmlelement, mode);
+        XMLPortObject(Pawn, WeaponSet, "weaponsets", setWeaponSet, getWeaponSet, xmlelement, mode);
+        XMLPortObject(Pawn, WeaponPack, "weapons", setWeaponPack, getWeaponPack, xmlelement, mode);
     }
 
     void Pawn::registerVariables()
     {
-        REGISTERDATA(this->bAlive_, direction::toclient);
-        REGISTERDATA(this->health_, direction::toclient);
+        registerVariable(this->bAlive_,        variableDirection::toclient);
+        registerVariable(this->health_,        variableDirection::toclient);
+        registerVariable(this->initialHealth_, variableDirection::toclient);
+        registerVariable(this->fire_,          variableDirection::toserver);
     }
 
@@ -87,4 +116,16 @@
     {
         SUPER(Pawn, tick, dt);
+
+        if (this->weaponSystem_)
+        {
+            if (this->fire_ & WeaponMode::fire)
+                this->weaponSystem_->fire(WeaponMode::fire);
+            if (this->fire_ & WeaponMode::altFire)
+                this->weaponSystem_->fire(WeaponMode::altFire);
+            if (this->fire_ & WeaponMode::altFire2)
+                this->weaponSystem_->fire(WeaponMode::altFire2);
+        }
+        this->fire_ = this->firehack_;
+        this->firehack_ = 0x0;
 
         if (this->health_ <= 0)
@@ -119,26 +160,73 @@
     }
 
-    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
-    }
-
-    void Pawn::fire()
-    {
-        if (this->weaponSystem_)
-            this->weaponSystem_->fire();
+        {
+            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());
+
+        }
+    }
+
+    void Pawn::fire(WeaponMode::Enum fireMode)
+    {
+        this->firehack_ |= fireMode;
     }
 
@@ -146,5 +234,68 @@
     {
         this->setHealth(this->initialHealth_);
-        this->spawn();
+        if (Core::isMaster())
+            this->spawneffect();
+    }
+
+    void Pawn::dropItems()
+    {
+	pickUp.eraseAll();
+    }
+
+    void Pawn::setWeaponSlot(WeaponSlot * wSlot)
+    {
+        this->attach(wSlot);
+        if (this->weaponSystem_)
+            this->weaponSystem_->attachWeaponSlot(wSlot);
+    }
+
+    WeaponSlot * Pawn::getWeaponSlot(unsigned int index) const
+    {
+        if (this->weaponSystem_)
+            return this->weaponSystem_->getWeaponSlotPointer(index);
+        else
+            return 0;
+    }
+
+    void Pawn::setWeaponPack(WeaponPack * wPack)
+    {
+        if (this->weaponSystem_)
+        {
+            wPack->setParentWeaponSystem(this->weaponSystem_);
+            wPack->setParentWeaponSystemToAllWeapons(this->weaponSystem_);
+            this->weaponSystem_->attachWeaponPack( wPack,wPack->getFireMode() );
+            wPack->attachNeededMunitionToAllWeapons();
+        }
+    }
+
+    WeaponPack * Pawn::getWeaponPack(unsigned int firemode) const
+    {
+        if (this->weaponSystem_)
+            return this->weaponSystem_->getWeaponPackPointer(firemode);
+        else
+            return 0;
+    }
+
+    void Pawn::setWeaponSet(WeaponSet * wSet)
+    {
+        if (this->weaponSystem_)
+            this->weaponSystem_->attachWeaponSet(wSet);
+    }
+
+    WeaponSet * Pawn::getWeaponSet(unsigned int index) const
+    {
+        if (this->weaponSystem_)
+            return this->weaponSystem_->getWeaponSetPointer(index);
+        else
+            return 0;
+    }
+
+
+    ///////////////////
+    // Pawn Listener //
+    ///////////////////
+    PawnListener::PawnListener()
+    {
+        RegisterRootObject(PawnListener);
     }
 }
Index: code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.h	(revision 2662)
@@ -31,10 +31,12 @@
 
 #include "OrxonoxPrereqs.h"
-
+#include "objects/pickup/ShipEquipment.h"
 #include "objects/worldentities/ControllableEntity.h"
+#include "objects/RadarViewable.h"
+#include "objects/weaponSystem/WeaponSystem.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport Pawn : public ControllableEntity
+    class _OrxonoxExport Pawn : public ControllableEntity, public RadarViewable
     {
         public:
@@ -54,5 +56,5 @@
             inline void removeHealth(float health)
                 { this->setHealth(this->health_ - health); }
-            inline float getHealht() const
+            inline float getHealth() const
                 { return this->health_; }
 
@@ -74,13 +76,45 @@
             virtual void kill();
 
-            virtual void fire();
-
+            virtual void fire(WeaponMode::Enum fireMode);
             virtual void postSpawn();
 
+            void setWeaponSlot(WeaponSlot * wSlot);
+            WeaponSlot * getWeaponSlot(unsigned int index) const;
+            void setWeaponPack(WeaponPack * wPack);
+            WeaponPack * getWeaponPack(unsigned int firemode) const;
+            void setWeaponSet(WeaponSet * wSet);
+            WeaponSet * getWeaponSet(unsigned int index) const;
+
+            inline const WorldEntity* getWorldEntity() const
+                { return const_cast<Pawn*>(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_; }
+
+            inline ShipEquipment& getPickUp()
+                {return this->pickUp;}
+
+            virtual void dropItems();
+
         protected:
-            virtual void spawn();
             virtual void death();
+            virtual void deatheffect();
+            virtual void spawneffect();
 
+            ShipEquipment pickUp;
             bool bAlive_;
+
 
             float health_;
@@ -91,4 +125,22 @@
 
             WeaponSystem* weaponSystem_;
+            unsigned int fire_;
+            unsigned int firehack_;
+
+            std::string spawnparticlesource_;
+            float spawnparticleduration_;
+            unsigned int numexplosionchunks_;
+    };
+
+    class _OrxonoxExport PawnListener : virtual public OrxonoxClass
+    {
+        friend class Pawn;
+
+        public:
+            PawnListener();
+            virtual ~PawnListener() {}
+
+        protected:
+            virtual void destroyedPawn(Pawn* pawn) = 0;
     };
 }
Index: code/trunk/src/orxonox/objects/worldentities/pawns/SpaceShip.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/pawns/SpaceShip.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/pawns/SpaceShip.cc	(revision 2662)
@@ -30,11 +30,17 @@
 #include "SpaceShip.h"
 
+#include "BulletDynamics/Dynamics/btRigidBody.h"
+
+#include "util/Math.h"
+#include "util/Exception.h"
 #include "core/CoreIncludes.h"
 #include "core/ConfigValueIncludes.h"
+#include "core/Template.h"
 #include "core/XMLPort.h"
-#include "util/Math.h"
+#include "objects/items/Engine.h"
 
 namespace orxonox
 {
+    const float orientationGain = 100;
     CreateFactory(SpaceShip);
 
@@ -43,20 +49,25 @@
         RegisterObject(SpaceShip);
 
-        this->zeroDegree_ = 0;
-
-        this->maxSpeed_ = 0;
-        this->maxSecondarySpeed_ = 0;
-        this->maxRotation_ = 0;
-        this->translationAcceleration_ = 0;
-        this->rotationAcceleration_ = 0;
-        this->translationDamping_ = 0;
-
-        this->yawRotation_ = 0;
-        this->pitchRotation_ = 0;
-        this->rollRotation_ = 0;
+        this->primaryThrust_  = 100;
+        this->auxilaryThrust_ =  30;
+        this->rotationThrust_ =  10;
+
+        this->localLinearAcceleration_.setValue(0, 0, 0);
+        this->localAngularAcceleration_.setValue(0, 0, 0);
+        this->bBoost_ = false;
+        this->bPermanentBoost_ = false;
+        this->steering_ = Vector3::ZERO;
+        this->engine_ = 0;
+
 
         this->bInvertYAxis_ = false;
 
         this->setDestroyWhenPlayerLeft(true);
+
+        // SpaceShip is always a physical object per default
+        // Be aware of this call: The collision type legality check will not reach derived classes!
+        this->setCollisionType(WorldEntity::Dynamic);
+        // Get notification about collisions
+        this->enableCollisionCallback();
 
         this->setConfigValues();
@@ -66,4 +77,6 @@
     SpaceShip::~SpaceShip()
     {
+        if (this->isInitialized() && this->engine_)
+            delete this->engine_;
     }
 
@@ -72,20 +85,15 @@
         SUPER(SpaceShip, XMLPort, xmlelement, mode);
 
-        XMLPortParam(SpaceShip, "maxspeed",          setMaxSpeed,          getMaxSpeed,          xmlelement, mode);
-        XMLPortParam(SpaceShip, "maxsecondaryspeed", setMaxSecondarySpeed, getMaxSecondarySpeed, xmlelement, mode);
-        XMLPortParam(SpaceShip, "maxrotation",       setMaxRotation,       getMaxRotation,       xmlelement, mode);
-        XMLPortParam(SpaceShip, "transacc",          setTransAcc,          getTransAcc,          xmlelement, mode);
-        XMLPortParam(SpaceShip, "rotacc",            setRotAcc,            getRotAcc,            xmlelement, mode);
-        XMLPortParam(SpaceShip, "transdamp",         setTransDamp,         getTransDamp,         xmlelement, mode);
+        XMLPortParam(SpaceShip, "engine",            setEngineTemplate,    getEngineTemplate,    xmlelement, mode);
+        XMLPortParamVariable(SpaceShip, "primaryThrust",  primaryThrust_,  xmlelement, mode);
+        XMLPortParamVariable(SpaceShip, "auxilaryThrust", auxilaryThrust_, xmlelement, mode);
+        XMLPortParamVariable(SpaceShip, "rotationThrust", rotationThrust_, xmlelement, mode);
     }
 
     void SpaceShip::registerVariables()
     {
-        REGISTERDATA(this->maxSpeed_,                direction::toclient);
-        REGISTERDATA(this->maxSecondarySpeed_,       direction::toclient);
-        REGISTERDATA(this->maxRotation_,             direction::toclient);
-        REGISTERDATA(this->translationAcceleration_, direction::toclient);
-        REGISTERDATA(this->rotationAcceleration_,    direction::toclient);
-        REGISTERDATA(this->translationDamping_,      direction::toclient);
+        registerVariable(this->primaryThrust_,  variableDirection::toclient);
+        registerVariable(this->auxilaryThrust_, variableDirection::toclient);
+        registerVariable(this->rotationThrust_, variableDirection::toclient);
     }
 
@@ -95,119 +103,123 @@
     }
 
+    bool SpaceShip::isCollisionTypeLegal(WorldEntity::CollisionType type) const
+    {
+        if (type != WorldEntity::Dynamic)
+        {
+            CCOUT(1) << "Error: Cannot tell a SpaceShip not to be dynamic! Ignoring." << std::endl;
+            assert(false); // Only in debug mode
+            return false;
+        }
+        else
+            return true;
+    }
+
     void SpaceShip::tick(float dt)
     {
-        if (this->isLocallyControlled())
+        SUPER(SpaceShip, tick, dt);
+
+        if (this->hasLocalController())
         {
-            // #####################################
-            // ############# STEERING ##############
-            // #####################################
-
-            Vector3 velocity = this->getVelocity();
-            if (velocity.x > this->maxSecondarySpeed_)
-                velocity.x = this->maxSecondarySpeed_;
-            if (velocity.x < -this->maxSecondarySpeed_)
-                velocity.x = -this->maxSecondarySpeed_;
-            if (velocity.y > this->maxSecondarySpeed_)
-                velocity.y = this->maxSecondarySpeed_;
-            if (velocity.y < -this->maxSecondarySpeed_)
-                velocity.y = -this->maxSecondarySpeed_;
-            if (velocity.z > this->maxSecondarySpeed_)
-                velocity.z = this->maxSecondarySpeed_;
-            if (velocity.z < -this->maxSpeed_)
-                velocity.z = -this->maxSpeed_;
-
-            // normalize velocity and acceleration
-            for (size_t dimension = 0; dimension < 3; ++dimension)
+/*
+            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())
             {
-                if (this->acceleration_[dimension] == 0)
+                this->localAngularAcceleration_ *= this->getLocalInertia() * this->rotationThrust_;
+                this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * this->localAngularAcceleration_);
+                this->localAngularAcceleration_.setValue(0, 0, 0);
+            }
+        }
+    }
+
+    void SpaceShip::moveFrontBack(const Vector2& value)
+    {
+        this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() - value.x);
+        this->steering_.z = -value.x;
+    }
+
+    void SpaceShip::moveRightLeft(const Vector2& value)
+    {
+        this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() + value.x);
+        this->steering_.x = value.x;
+    }
+
+    void SpaceShip::moveUpDown(const Vector2& value)
+    {
+        this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() + value.x);
+        this->steering_.y = value.x;
+    }
+
+    void SpaceShip::rotateYaw(const Vector2& value)
+    {
+        this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() - value.x);
+
+        Pawn::rotateYaw(value);
+    }
+
+    void SpaceShip::rotatePitch(const Vector2& value)
+    {
+        this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x);
+
+        Pawn::rotatePitch(value);
+    }
+
+    void SpaceShip::rotateRoll(const Vector2& value)
+    {
+        this->localAngularAcceleration_.setZ(this->localAngularAcceleration_.z() + value.x);
+
+        Pawn::rotateRoll(value);
+    }
+
+    void SpaceShip::fire()
+    {
+    }
+
+    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)
                 {
-                    if (velocity[dimension] > 0)
+                    BaseObject* object = identifier->fabricate(this);
+                    this->engine_ = dynamic_cast<Engine*>(object);
+
+                    if (this->engine_)
                     {
-                        velocity[dimension] -= (this->translationDamping_ * dt);
-                        if (velocity[dimension] < 0)
-                            velocity[dimension] = 0;
+                        this->engine_->addTemplate(temp);
+                        this->engine_->addToSpaceShip(this);
                     }
-                    else if (velocity[dimension] < 0)
+                    else
                     {
-                        velocity[dimension] += (this->translationDamping_ * dt);
-                        if (velocity[dimension] > 0)
-                            velocity[dimension] = 0;
+                        delete object;
                     }
                 }
             }
-
-            this->setVelocity(velocity);
         }
-
-
-        SUPER(SpaceShip, tick, dt);
-
-
-        if (this->isLocallyControlled())
-        {
-            this->yaw(this->yawRotation_ * dt);
-            if (this->bInvertYAxis_)
-                this->pitch(Degree(-this->pitchRotation_ * dt));
-            else
-                this->pitch(Degree( this->pitchRotation_ * dt));
-            this->roll(this->rollRotation_ * dt);
-
-            this->acceleration_.x = 0;
-            this->acceleration_.y = 0;
-            this->acceleration_.z = 0;
-
-            this->yawRotation_   = this->zeroDegree_;
-            this->pitchRotation_ = this->zeroDegree_;
-            this->rollRotation_  = this->zeroDegree_;
-        }
-    }
-
-    void SpaceShip::moveFrontBack(const Vector2& value)
-    {
-        this->acceleration_.z = -this->translationAcceleration_ * value.x;
-    }
-
-    void SpaceShip::moveRightLeft(const Vector2& value)
-    {
-        this->acceleration_.x = this->translationAcceleration_ * value.x;
-    }
-
-    void SpaceShip::moveUpDown(const Vector2& value)
-    {
-        this->acceleration_.y = this->translationAcceleration_ * value.x;
-    }
-
-    void SpaceShip::rotateYaw(const Vector2& value)
-    {
-        Degree temp = value.x * value.x * sgn(value.x) * this->rotationAcceleration_;
-        if (temp > this->maxRotation_)
-            temp = this->maxRotation_;
-        if (temp < -this->maxRotation_)
-            temp = -this->maxRotation_;
-        this->yawRotation_ = Degree(temp);
-    }
-
-    void SpaceShip::rotatePitch(const Vector2& value)
-    {
-        Degree temp = value.x * value.x * sgn(value.x) * this->rotationAcceleration_;
-        if (temp > this->maxRotation_)
-            temp = this->maxRotation_;
-        if (temp < -this->maxRotation_)
-            temp = -this->maxRotation_;
-        this->pitchRotation_ = Degree(temp);
-    }
-
-    void SpaceShip::rotateRoll(const Vector2& value)
-    {
-        Degree temp = value.x * value.x * sgn(value.x) * this->rotationAcceleration_;
-        if (temp > this->maxRotation_)
-            temp = this->maxRotation_;
-        if (temp < -this->maxRotation_)
-            temp = -this->maxRotation_;
-        this->rollRotation_ = Degree(temp);
-    }
-
-    void SpaceShip::fire()
-    {
+    }
+
+    void SpaceShip::setEngine(Engine* engine)
+    {
+        this->engine_ = engine;
+        if (engine && engine->getShip() != this)
+            engine->addToSpaceShip(this);
     }
 }
Index: code/trunk/src/orxonox/objects/worldentities/pawns/SpaceShip.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/pawns/SpaceShip.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/pawns/SpaceShip.h	(revision 2662)
@@ -32,4 +32,6 @@
 #include "OrxonoxPrereqs.h"
 
+#include "LinearMath/btVector3.h"
+
 #include "Pawn.h"
 
@@ -56,46 +58,50 @@
 
             virtual void fire();
+            virtual void boost();
 
-            void setMaxSpeed(float value)
-                { this->maxSpeed_ = value; }
-            void setMaxSecondarySpeed(float value)
-                { this->maxSecondarySpeed_ = value; }
-            void setMaxRotation(const Degree& value)
-                { this->maxRotation_ = value; }
-            void setTransAcc(float value)
-                { this->translationAcceleration_ = value; }
-            void setRotAcc(const Degree& value)
-                { this->rotationAcceleration_ = value; }
-            void setTransDamp(float value)
-                { this->translationDamping_ = value; }
+            void setEngine(Engine* engine);
+            inline Engine* getEngine() const
+                { return this->engine_; }
 
-            inline float getMaxSpeed() const
-                { return this->maxSpeed_; }
-            inline float getMaxSecondarySpeed() const
-                { return this->maxSecondarySpeed_; }
-            inline float getMaxRotation() const
-                { return this->maxRotation_.valueDegrees(); }
-            inline float getTransAcc() const
-                { return this->translationAcceleration_; }
-            inline float getRotAcc() const
-                { return this->rotationAcceleration_.valueDegrees(); }
-            inline float getTransDamp() const
-                { return this->translationDamping_; }
+            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_; }
+
+            inline void setPermanentBoost(bool bPermanent)
+                { this->bPermanentBoost_ = bPermanent; }
+            inline bool getPermanentBoost() const
+                { return this->bPermanentBoost_; }
 
         protected:
             bool bInvertYAxis_;
 
-            float maxSpeed_;
-            float maxSecondarySpeed_;
-            float translationAcceleration_;
-            float translationDamping_;
+            bool bBoost_;
+            bool bPermanentBoost_;
+            Vector3 steering_;
+            float primaryThrust_;
+            float auxilaryThrust_;
+            float rotationThrust_;
+            btVector3 localLinearAcceleration_;
+            btVector3 localAngularAcceleration_;
 
-            Degree maxRotation_;
-            Degree rotationAcceleration_;
+        private:
+            virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const;
 
-            Degree zeroDegree_;
-            Degree pitchRotation_;
-            Degree yawRotation_;
-            Degree rollRotation_;
+        private:
+            void loadEngineTemplate();
+
+            std::string enginetemplate_;
+            Engine* engine_;
     };
 }
Index: code/trunk/src/orxonox/objects/worldentities/pawns/Spectator.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/pawns/Spectator.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/pawns/Spectator.cc	(revision 2662)
@@ -30,5 +30,8 @@
 #include "Spectator.h"
 
+#include <OgreBillboardSet.h>
+
 #include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
 #include "core/Core.h"
 #include "objects/worldentities/Model.h"
@@ -49,23 +52,28 @@
         RegisterObject(Spectator);
 
-        this->speed_ = 100;
-        this->rotationSpeed_ = 3;
+        this->speed_ = 200;
 
         this->yaw_ = 0;
         this->pitch_ = 0;
         this->roll_ = 0;
+        this->localVelocity_ = Vector3::ZERO;
         this->setHudTemplate("spectatorhud");
-        this->hudmode_ = 0;
+        this->greetingFlare_ = 0;
 
         this->setDestroyWhenPlayerLeft(true);
 
-        this->greetingFlare_ = new BillboardSet();
-        this->greetingFlare_->setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(1.0, 1.0, 0.8), Vector3(0, 20, 0), 1);
-        if (this->greetingFlare_->getBillboardSet())
-            this->getNode()->attachObject(this->greetingFlare_->getBillboardSet());
-        this->greetingFlare_->setVisible(false);
+        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);
+            if (this->greetingFlare_->getBillboardSet())
+                this->attachOgreObject(this->greetingFlare_->getBillboardSet());
+            this->greetingFlare_->setVisible(false);
+        }
+
         this->bGreetingFlareVisible_ = false;
         this->bGreeting_ = false;
 
+        this->setConfigValues();
         this->registerVariables();
     }
@@ -78,5 +86,6 @@
             {
                 if (this->greetingFlare_->getBillboardSet())
-                    this->getNode()->detachObject(this->greetingFlare_->getBillboardSet());
+                    this->detachOgreObject(this->greetingFlare_->getBillboardSet());
+
                 delete this->greetingFlare_;
             }
@@ -84,9 +93,13 @@
     }
 
+    void Spectator::setConfigValues()
+    {
+        SetConfigValue(speed_, 200.0f);
+    }
+
     void Spectator::registerVariables()
     {
-        REGISTERDATA(this->bGreetingFlareVisible_, direction::toclient, new NetworkCallback<Spectator>(this, &Spectator::changedFlareVisibility));
-        REGISTERDATA(this->bGreeting_,             direction::toserver, new NetworkCallback<Spectator>(this, &Spectator::changedGreeting));
-        REGISTERDATA(this->hudmode_,               direction::toclient);
+        registerVariable(this->bGreetingFlareVisible_, variableDirection::toclient, new NetworkCallback<Spectator>(this, &Spectator::changedFlareVisibility));
+        registerVariable(this->bGreeting_,             variableDirection::toserver, new NetworkCallback<Spectator>(this, &Spectator::changedGreeting));
     }
 
@@ -99,20 +112,33 @@
     void Spectator::changedFlareVisibility()
     {
-        this->greetingFlare_->setVisible(this->bGreetingFlareVisible_);
+	if ( this->greetingFlare_ )
+            this->greetingFlare_->setVisible(this->bGreetingFlareVisible_);
     }
 
     void Spectator::tick(float dt)
     {
-        this->updateHUD();
-
-        if (this->isLocallyControlled())
-        {
-            Vector3 velocity = this->getVelocity();
-            velocity.normalise();
-            this->setVelocity(velocity * this->speed_);
-
-            this->yaw(Radian(this->yaw_ * this->rotationSpeed_));
-            this->pitch(Radian(this->pitch_ * this->rotationSpeed_));
-            this->roll(Radian(this->roll_ * this->rotationSpeed_));
+        if (this->hasLocalController())
+        {
+            float localSpeedSquared = this->localVelocity_.squaredLength();
+            float localSpeed;
+            if (localSpeedSquared > 1.0)
+                localSpeed = this->speed_ / sqrtf(localSpeedSquared);
+            else
+                localSpeed = this->speed_;
+
+            this->localVelocity_.x *= localSpeed;
+            this->localVelocity_.y *= localSpeed;
+            this->localVelocity_.z *= localSpeed;
+            this->setVelocity(this->getOrientation() * this->localVelocity_);
+            this->localVelocity_.x = 0;
+            this->localVelocity_.y = 0;
+            this->localVelocity_.z = 0;
+
+            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;
@@ -120,9 +146,4 @@
 
         SUPER(Spectator, tick, dt);
-
-        if (this->isLocallyControlled())
-        {
-            this->setVelocity(Vector3::ZERO);
-        }
     }
 
@@ -131,45 +152,49 @@
         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();
     }
 
     void Spectator::moveFrontBack(const Vector2& value)
     {
-        this->setVelocity(this->getVelocity() + value.y * this->speed_ * WorldEntity::FRONT);
+        this->localVelocity_.z -= value.x;
     }
 
     void Spectator::moveRightLeft(const Vector2& value)
     {
-        this->setVelocity(this->getVelocity() + value.y * this->speed_ * WorldEntity::RIGHT);
+        this->localVelocity_.x += value.x;
     }
 
     void Spectator::moveUpDown(const Vector2& value)
     {
-        this->setVelocity(this->getVelocity() + value.y * this->speed_ * WorldEntity::UP);
+        this->localVelocity_.y += value.x;
     }
 
     void Spectator::rotateYaw(const Vector2& value)
     {
-        this->yaw_ = value.y;
+        this->yaw_ -= value.y;
+
+        ControllableEntity::rotateYaw(value);
     }
 
     void Spectator::rotatePitch(const Vector2& value)
     {
-        this->pitch_ = value.y;
+        this->pitch_ += value.y;
+
+        ControllableEntity::rotatePitch(value);
     }
 
     void Spectator::rotateRoll(const Vector2& value)
     {
-        this->roll_ = value.y;
-    }
-
-    void Spectator::fire()
+        this->roll_ += value.y;
+
+        ControllableEntity::rotateRoll(value);
+    }
+
+    void Spectator::fire(WeaponMode::Enum fireMode)
     {
         if (this->getPlayer())
@@ -187,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/trunk/src/orxonox/objects/worldentities/pawns/Spectator.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/pawns/Spectator.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/pawns/Spectator.h	(revision 2662)
@@ -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);
@@ -56,5 +57,5 @@
             virtual void rotateRoll(const Vector2& value);
 
-            virtual void fire();
+            virtual void fire(WeaponMode::Enum fireMode);
             virtual void greet();
 
@@ -62,5 +63,4 @@
             void changedGreeting();
             void changedFlareVisibility();
-            void updateHUD();
 
             BillboardSet* greetingFlare_;
@@ -69,5 +69,4 @@
 
             float speed_;
-            float rotationSpeed_;
 
             float yaw_;
@@ -75,5 +74,5 @@
             float roll_;
 
-            int hudmode_;
+            Vector3 localVelocity_;
     };
 }
Index: code/trunk/src/orxonox/objects/worldentities/triggers/PlayerTrigger.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/PlayerTrigger.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/PlayerTrigger.cc	(revision 2662)
@@ -28,7 +28,7 @@
 
 /**
-    @file PlayerTrigger.cc
+    @file
     @brief
-	Implementation of the PlayerTrigger class.
+    Implementation of the PlayerTrigger class.
 */
 
@@ -38,6 +38,6 @@
 #include "core/CoreIncludes.h"
 
-namespace orxonox {
-
+namespace orxonox
+{
     /**
     @brief
@@ -47,9 +47,9 @@
     {
         RegisterObject(PlayerTrigger);
-        
+
         this->player_ = NULL;
         this->isForPlayer_ = true;
     }
-    
+
     /**
     @brief
@@ -66,6 +66,5 @@
     void PlayerTrigger::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
-	SUPER(PlayerTrigger, XMLPort, xmlelement, mode);
+        SUPER(PlayerTrigger, XMLPort, xmlelement, mode);
     }
-
 }
Index: code/trunk/src/orxonox/objects/worldentities/triggers/PlayerTrigger.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/PlayerTrigger.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/PlayerTrigger.h	(revision 2662)
@@ -28,7 +28,7 @@
 
 /**
-    @file PlayerTrigger.h
+    @file
     @brief
-	Definition of the PlayerTrigger class.
+    Definition of the PlayerTrigger class.
 */
 
@@ -40,6 +40,6 @@
 #include "Trigger.h"
 
-namespace orxonox {
-    
+namespace orxonox
+{
     /**
     @brief
@@ -50,33 +50,33 @@
     class _OrxonoxExport PlayerTrigger : public Trigger
     {
-	public:
-	    PlayerTrigger(BaseObject* creator);
-	    virtual ~PlayerTrigger();
-	    
-            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a PlayerTrigger object through XML.
+    public:
+        PlayerTrigger(BaseObject* creator);
+        virtual ~PlayerTrigger();
+        
+        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a PlayerTrigger object through XML.
+        
+        /**
+        @brief Returns the player that triggered the PlayerTrigger.
+        @return Returns a pointer to the ControllableEntity that triggered the PlayerTrigger.
+        */
+        inline ControllableEntity* getTriggeringPlayer(void) const
+            { return this->player_; }
+        
+        /**
+        @brief Checks whether the PlayerTrigger normally returns a ControllableEntity.
+        @return Returns true if the PlayerTrigger normally returns a ControllableEntity.
+        */
+        inline bool isForPlayer(void) const
+           { return this->isForPlayer_; }
             
-            /**
-            @brief Returns the player that triggered the PlayerTrigger.
-            @return Returns a pointer to the ControllableEntity that triggered the PlayerTrigger.
-            */
-            inline ControllableEntity* getTriggeringPlayer(void) const
-                { return this->player_; }
-	    
-	    /**
-	    @brief Checks whether the PlayerTrigger normally returns a ControllableEntity.
-	    @return Returns true if the PlayerTrigger normally returns a ControllableEntity.
-	    */
-	    inline bool isForPlayer(void) const
-	       { return this->isForPlayer_; }
-            
-	protected:
-	    virtual bool isTriggered(TriggerMode mode) = 0;
-	    
-	    /**
-	    @brief Set the player that triggered the PlayerTrigger. This is normally done by classes inheriting vom PlayerTrigger.
-	    @param player A pointer to the ControllableEntity that triggered the PlayerTrigger.
-	    */
-	    inline void setTriggeringPlayer(ControllableEntity* player)
-	       { this->player_ = player; }
+    protected:
+        virtual bool isTriggered(TriggerMode mode) = 0;
+        
+        /**
+        @brief Set the player that triggered the PlayerTrigger. This is normally done by classes inheriting vom PlayerTrigger.
+        @param player A pointer to the ControllableEntity that triggered the PlayerTrigger.
+        */
+        inline void setTriggeringPlayer(ControllableEntity* player)
+           { this->player_ = player; }
 
             /**
@@ -84,11 +84,11 @@
             @param isForPlayer Should be true when the PlayerTrigger schould be set to normally be triggered by ControllableEntities, false if not.
             */
-	    inline void setForPlayer(bool isForPlayer)
-	       { this->isForPlayer_ = isForPlayer; }
-	    
-	private:
-	    ControllableEntity* player_; //!< The player that triggered the PlayerTrigger.
-	    bool isForPlayer_; //!< Is true when the PlayerTrigger schould be set to normally be triggered by ControllableEntities.
-	
+        inline void setForPlayer(bool isForPlayer)
+           { this->isForPlayer_ = isForPlayer; }
+        
+    private:
+        ControllableEntity* player_; //!< The player that triggered the PlayerTrigger.
+        bool isForPlayer_; //!< Is true when the PlayerTrigger schould be set to normally be triggered by ControllableEntities.
+    
     };
 
Index: code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.cc	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.cc	(revision 2662)
@@ -31,8 +31,10 @@
 
 #include <OgreBillboard.h>
+#include <OgreBillboardSet.h>
 #include "util/Debug.h"
 #include "core/CoreIncludes.h"
 #include "core/ConsoleCommand.h"
 #include "core/XMLPort.h"
+#include "core/Core.h"
 #include "objects/Scene.h"
 
@@ -44,5 +46,5 @@
   CreateFactory(Trigger);
 
-  Trigger::Trigger(BaseObject* creator) : PositionableEntity(creator)
+  Trigger::Trigger(BaseObject* creator) : StaticEntity(creator)
   {
     RegisterObject(Trigger);
@@ -65,5 +67,5 @@
 //    this->bUpdating_ = false;
 
-    if (this->getScene() && this->getScene()->getSceneManager())
+    if (this->getScene() && Core::showsGraphics())
     {
       this->debugBillboard_.setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1);
@@ -71,5 +73,5 @@
 
       if (this->debugBillboard_.getBillboardSet())
-        this->getNode()->attachObject(this->debugBillboard_.getBillboardSet());
+          this->attachOgreObject(this->debugBillboard_.getBillboardSet());
     }
 
@@ -106,4 +108,6 @@
     if (!this->BaseObject::isActive())
         return;
+
+    SUPER(Trigger, tick, dt);
 
     bool newTriggered = this->isTriggered() ^ this->bInvertMode_;
Index: code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.h	(revision 2262)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.h	(revision 2662)
@@ -36,5 +36,5 @@
 
 #include "objects/Tickable.h"
-#include "objects/worldentities/PositionableEntity.h"
+#include "objects/worldentities/StaticEntity.h"
 #include "tools/BillboardSet.h"
 
@@ -48,5 +48,5 @@
   };
 
-  class _OrxonoxExport Trigger : public PositionableEntity, public Tickable
+  class _OrxonoxExport Trigger : public StaticEntity, public Tickable
   {
     public:
Index: code/trunk/src/orxonox/overlays/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/overlays/CMakeLists.txt	(revision 2262)
+++ code/trunk/src/orxonox/overlays/CMakeLists.txt	(revision 2662)
@@ -8,4 +8,6 @@
 ADD_SOURCE_DIRECTORY(SRC_FILES debug)
 ADD_SOURCE_DIRECTORY(SRC_FILES hud)
+ADD_SOURCE_DIRECTORY(SRC_FILES notifications)
+ADD_SOURCE_DIRECTORY(SRC_FILES stats)
 
 ADD_SOURCE_FILES(SRC_FILES)
Index: code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc
===================================================================
--- code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc	(revision 2262)
+++ code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc	(revision 2662)
@@ -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
@@ -92,5 +88,5 @@
         setPosition(Vector2(0.0f, 0.0f));
         setRotation(Degree(0.0));
-        setAspectCorrection(true);
+        setAspectCorrection(false);
         setBackgroundMaterial("");
     }
@@ -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/trunk/src/orxonox/overlays/OrxonoxOverlay.h
===================================================================
--- code/trunk/src/orxonox/overlays/OrxonoxOverlay.h	(revision 2262)
+++ code/trunk/src/orxonox/overlays/OrxonoxOverlay.h	(revision 2662)
@@ -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/trunk/src/orxonox/overlays/OverlayGroup.cc
===================================================================
--- code/trunk/src/orxonox/overlays/OverlayGroup.cc	(revision 2262)
+++ code/trunk/src/orxonox/overlays/OverlayGroup.cc	(revision 2662)
@@ -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/trunk/src/orxonox/overlays/OverlayGroup.h
===================================================================
--- code/trunk/src/orxonox/overlays/OverlayGroup.h	(revision 2262)
+++ code/trunk/src/orxonox/overlays/OverlayGroup.h	(revision 2662)
@@ -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 scale_;                                         //!< Current scale (independent of the elements).
         Vector2 scroll_;                                        //!< Current scrolling offset.
+        ControllableEntity* owner_;                             //!< The owner of this OverlayGroup
     };
 }
Index: code/trunk/src/orxonox/overlays/OverlayText.cc
===================================================================
--- code/trunk/src/orxonox/overlays/OverlayText.cc	(revision 2262)
+++ code/trunk/src/orxonox/overlays/OverlayText.cc	(revision 2662)
@@ -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/trunk/src/orxonox/overlays/OverlayText.h
===================================================================
--- code/trunk/src/orxonox/overlays/OverlayText.h	(revision 2262)
+++ code/trunk/src/orxonox/overlays/OverlayText.h	(revision 2662)
@@ -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/trunk/src/orxonox/overlays/debug/DebugFPSText.cc
===================================================================
--- code/trunk/src/orxonox/overlays/debug/DebugFPSText.cc	(revision 2262)
+++ code/trunk/src/orxonox/overlays/debug/DebugFPSText.cc	(revision 2662)
@@ -49,4 +49,6 @@
     void DebugFPSText::tick(float dt)
     {
+        SUPER(DebugFPSText, tick, dt);
+
         float fps = GraphicsEngine::getInstance().getAverageFramesPerSecond();
         this->setCaption(convertToString(fps));
Index: code/trunk/src/orxonox/overlays/debug/DebugRTRText.cc
===================================================================
--- code/trunk/src/orxonox/overlays/debug/DebugRTRText.cc	(revision 2262)
+++ code/trunk/src/orxonox/overlays/debug/DebugRTRText.cc	(revision 2662)
@@ -49,4 +49,6 @@
     void DebugRTRText::tick(float dt)
     {
+        SUPER(DebugRTRText, tick, dt);
+
         float rtr = GraphicsEngine::getInstance().getAverageTickTime();
         this->setCaption(convertToString(rtr));
Index: code/trunk/src/orxonox/overlays/hud/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/overlays/hud/CMakeLists.txt	(revision 2262)
+++ code/trunk/src/orxonox/overlays/hud/CMakeLists.txt	(revision 2662)
@@ -4,5 +4,7 @@
   HUDRadar.cc
   HUDSpeedBar.cc
+  HUDHealthBar.cc
   ChatOverlay.cc
+  GametypeStatus.cc
 )
 
Index: code/trunk/src/orxonox/overlays/hud/GametypeStatus.cc
===================================================================
--- code/trunk/src/orxonox/overlays/hud/GametypeStatus.cc	(revision 2662)
+++ code/trunk/src/orxonox/overlays/hud/GametypeStatus.cc	(revision 2662)
@@ -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/trunk/src/orxonox/overlays/hud/GametypeStatus.h
===================================================================
--- code/trunk/src/orxonox/overlays/hud/GametypeStatus.h	(revision 2662)
+++ code/trunk/src/orxonox/overlays/hud/GametypeStatus.h	(revision 2662)
@@ -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/trunk/src/orxonox/overlays/hud/HUDBar.cc
===================================================================
--- code/trunk/src/orxonox/overlays/hud/HUDBar.cc	(revision 2262)
+++ code/trunk/src/orxonox/overlays/hud/HUDBar.cc	(revision 2662)
@@ -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/trunk/src/orxonox/overlays/hud/HUDBar.h
===================================================================
--- code/trunk/src/orxonox/overlays/hud/HUDBar.h	(revision 2262)
+++ code/trunk/src/orxonox/overlays/hud/HUDBar.h	(revision 2662)
@@ -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/trunk/src/orxonox/overlays/hud/HUDHealthBar.cc
===================================================================
--- code/trunk/src/orxonox/overlays/hud/HUDHealthBar.cc	(revision 2662)
+++ code/trunk/src/orxonox/overlays/hud/HUDHealthBar.cc	(revision 2662)
@@ -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/trunk/src/orxonox/overlays/hud/HUDHealthBar.h
===================================================================
--- code/trunk/src/orxonox/overlays/hud/HUDHealthBar.h	(revision 2662)
+++ code/trunk/src/orxonox/overlays/hud/HUDHealthBar.h	(revision 2662)
@@ -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/trunk/src/orxonox/overlays/hud/HUDNavigation.cc
===================================================================
--- code/trunk/src/orxonox/overlays/hud/HUDNavigation.cc	(revision 2262)
+++ code/trunk/src/orxonox/overlays/hud/HUDNavigation.cc	(revision 2662)
@@ -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/trunk/src/orxonox/overlays/hud/HUDRadar.cc
===================================================================
--- code/trunk/src/orxonox/overlays/hud/HUDRadar.cc	(revision 2262)
+++ code/trunk/src/orxonox/overlays/hud/HUDRadar.cc	(revision 2662)
@@ -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/trunk/src/orxonox/overlays/hud/HUDRadar.h
===================================================================
--- code/trunk/src/orxonox/overlays/hud/HUDRadar.h	(revision 2262)
+++ code/trunk/src/orxonox/overlays/hud/HUDRadar.h	(revision 2662)
@@ -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/trunk/src/orxonox/overlays/hud/HUDSpeedBar.cc
===================================================================
--- code/trunk/src/orxonox/overlays/hud/HUDSpeedBar.cc	(revision 2262)
+++ code/trunk/src/orxonox/overlays/hud/HUDSpeedBar.cc	(revision 2662)
@@ -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/trunk/src/orxonox/overlays/hud/HUDSpeedBar.h
===================================================================
--- code/trunk/src/orxonox/overlays/hud/HUDSpeedBar.h	(revision 2262)
+++ code/trunk/src/orxonox/overlays/hud/HUDSpeedBar.h	(revision 2662)
@@ -45,4 +45,8 @@
 
         virtual void tick(float dt);
+        virtual void changedOwner();
+
+    private:
+        SpaceShip* owner_;
     };
 }
Index: code/trunk/src/orxonox/overlays/notifications/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/overlays/notifications/CMakeLists.txt	(revision 2662)
+++ code/trunk/src/orxonox/overlays/notifications/CMakeLists.txt	(revision 2662)
@@ -0,0 +1,7 @@
+SET( SRC_FILES
+  Notification.cc
+  NotificationManager.cc
+  NotificationQueue.cc
+)
+
+ADD_SOURCE_FILES(SRC_FILES)
Index: code/trunk/src/orxonox/overlays/notifications/Notification.cc
===================================================================
--- code/trunk/src/orxonox/overlays/notifications/Notification.cc	(revision 2662)
+++ code/trunk/src/orxonox/overlays/notifications/Notification.cc	(revision 2662)
@@ -0,0 +1,102 @@
+/*
+ *   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 thes
+ *   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:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Notification.h"
+
+#include "core/CoreIncludes.h"
+
+#include "NotificationManager.h"
+
+namespace orxonox
+{
+    Notification::Notification(BaseObject* creator) : BaseObject(creator)
+    {
+        RegisterObject(Notification);
+    }
+    
+    Notification::Notification(BaseObject* creator, const std::string & message, const std::string & title, float time) : BaseObject(creator)
+    {
+        this->title_ = title;
+        this->message_ = message;
+        if(time > 0)
+            this->displayTime_ = time;
+    }
+    
+    Notification::~Notification()
+    {
+    }
+    
+    void Notification::initialize(void)
+    {
+        RegisterObject(Notification);
+        
+        this->title_ = "";
+        this->message_ = "";
+        this->displayTime_ = NOTIFICATION_DISPLAY_TIME;
+        this->sent_ = false;
+    }
+    
+    bool Notification::send(void)
+    {
+        bool successful = NotificationManager::insertNotification(this);
+        if(successful)
+            this->sent_ = true;
+        return successful;
+    }
+    
+    bool Notification::setTitle(const std::string & title)
+    {
+        if(this->isSent())
+            return false;
+        this->title_ = title;
+        return true;
+    }
+    
+    bool Notification::setMessage(const std::string & message)
+    {
+        if(this->isSent())
+            return false;
+        this->message_ = message;
+        return true;
+    }
+    
+    bool Notification::setDisplayTime(float time)
+    {
+        if(this->isSent())
+        {
+            return false;
+        }
+        if(time > 0)
+        {
+            this->displayTime_ = time;
+            return true;
+        }
+        return false;
+    }
+}
Index: code/trunk/src/orxonox/overlays/notifications/Notification.h
===================================================================
--- code/trunk/src/orxonox/overlays/notifications/Notification.h	(revision 2662)
+++ code/trunk/src/orxonox/overlays/notifications/Notification.h	(revision 2662)
@@ -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:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Notification_H__
+#define _Notification_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <string>
+
+#include "core/BaseObject.h"
+
+namespace orxonox
+{
+    static const float NOTIFICATION_DISPLAY_TIME = 4.0;
+
+    /**
+    @brief
+        This is rather temporary, so don't start relying on it, some better version will come soon but the Interface will not likely be the same.
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _OrxonoxExport Notification : public BaseObject
+    {
+    public:
+        Notification(BaseObject* creator);
+        Notification(BaseObject* creator, const std::string & message, const std::string & title = "", float time = NOTIFICATION_DISPLAY_TIME);
+        virtual ~Notification();
+        
+        bool send(void);
+        
+        inline bool isSent(void) const
+            { return this->sent_; }
+        inline const std::string & getTitle(void) const
+            { return this->title_; }
+        inline const std::string & getMessage(void) const
+            { return this->message_; }
+        inline const float getDisplayTime(void) const
+            { return displayTime_; }
+        
+        bool setTitle(const std::string & title);
+        bool setMessage(const std::string & message);
+        bool setDisplayTime(float time);
+        
+    private:
+        std::string title_; //!< The title of the Notification.
+        std::string message_; //!< The Notification message.
+        float displayTime_; //!< The time duration the Notification is displayed in seconds.
+        bool sent_; //!< Whether Notification has been sent, if so it cannot be changed.
+        
+        void initialize(void);
+    };
+}
+
+#endif /* _Notification_H__ */
Index: code/trunk/src/orxonox/overlays/notifications/NotificationManager.cc
===================================================================
--- code/trunk/src/orxonox/overlays/notifications/NotificationManager.cc	(revision 2662)
+++ code/trunk/src/orxonox/overlays/notifications/NotificationManager.cc	(revision 2662)
@@ -0,0 +1,174 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "NotificationManager.h"
+
+#include "core/CoreIncludes.h"
+
+#include "Notification.h"
+
+#include "NotificationQueue.h"
+
+namespace orxonox
+{
+    std::list<NotificationContainer*> NotificationManager::notifications_s;
+
+    NotificationManager::NotificationManager(BaseObject* creator) : BaseObject(creator)
+    {
+        RegisterObject(NotificationManager);
+    }
+
+    NotificationManager::~NotificationManager()
+    {
+        //TDO: Destroy the containers
+    }
+
+    void NotificationManager::tick(float dt)
+    {
+        bool update = false;
+
+        for (std::list<NotificationContainer*>::iterator notification = notifications_s.begin(); notification != notifications_s.end(); ++notification)
+        {
+            NotificationContainer* container = *notification;
+            if(container->remainingTime == 0)
+            {
+                continue;
+            }
+            else if(container->remainingTime - dt <= 0)
+            {
+                container->remainingTime = 0;
+                update = true;
+            }
+            else
+            {
+                container->remainingTime = container->remainingTime -dt;
+            }
+        }
+
+        if(update)
+            updateQueue();
+    }
+
+    bool NotificationManager::insertNotification(Notification* notification)
+    {
+        if(notification == NULL)
+            return false;
+
+        NotificationContainer* container = new NotificationContainer;
+        container->notification = notification;
+        container->remainingTime = notification->getDisplayTime();
+        notifications_s.push_front(container);
+
+        updateQueue();
+
+        COUT(4) << "Notification inserted. Title: " << notification->getTitle() << std::endl;
+
+        return true;
+    }
+
+    void NotificationManager::updateQueue(void)
+    {
+        std::string text = "";
+
+        if (!NotificationQueue::queue_s)
+            return;
+
+        int i = NotificationQueue::queue_s->getLength();
+        for (std::list<NotificationContainer*>::iterator notification = notifications_s.begin(); notification != notifications_s.end() && i > 0; ++notification)
+        {
+            i--;
+            NotificationContainer* container = *notification;
+            if(container->remainingTime == 0.0)
+                continue;
+
+            text = text + "\n\n\n------------\n\n" + clipMessage(container->notification->getTitle()) + "\n\n" + clipMessage(container->notification->getMessage());
+        }
+
+        NotificationQueue::queue_s->setQueueText(text);
+    }
+
+    const std::string NotificationManager::clipMessage(const std::string & str)
+    {
+
+        std::string message = str;
+        unsigned int i = 0;
+
+        unsigned int found = message.find("\\n", i);
+        while(found != std::string::npos)
+        {
+            message.replace(found, 2, "\n");
+            i = found+2;
+            found = message.find("\\n", i);
+        }
+
+        std::string clippedMessage = "";
+        int wordLength = 0;
+        i = 0;
+        int widthLeft = NotificationQueue::queue_s->getWidth();
+        while(i < message.length())
+        {
+            while(i < message.length() && message[i] != ' ' && message[i] != '\n')
+            {
+                i++;
+                wordLength++;
+            }
+
+            if(wordLength <= widthLeft)
+            {
+                clippedMessage = clippedMessage + message.substr(i-wordLength, wordLength);
+                if(i < message.length())
+                {
+                    clippedMessage = clippedMessage + message.substr(i,1);
+                }
+                widthLeft -= (wordLength+1);
+                if(message[i] == '\n')
+                {
+                    widthLeft = NotificationQueue::queue_s->getWidth() - (wordLength+1);
+                }
+                wordLength = 0;
+                i++;
+            }
+            else
+            {
+                clippedMessage.push_back('\n');
+                clippedMessage = clippedMessage + message.substr(i-wordLength, wordLength);
+                if(i < message.length())
+                {
+                    clippedMessage = clippedMessage + message.substr(i,1);
+                }
+                widthLeft = NotificationQueue::queue_s->getWidth() - (wordLength+1);
+                i++;
+                wordLength = 0;
+            }
+        }
+
+        return clippedMessage;
+    }
+
+}
Index: code/trunk/src/orxonox/overlays/notifications/NotificationManager.h
===================================================================
--- code/trunk/src/orxonox/overlays/notifications/NotificationManager.h	(revision 2662)
+++ code/trunk/src/orxonox/overlays/notifications/NotificationManager.h	(revision 2662)
@@ -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:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _NotificationManager_H__
+#define _NotificationManager_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "core/BaseObject.h"
+
+#include <list>
+#include <string>
+
+namespace orxonox
+{
+    struct NotificationContainer
+    {
+        Notification* notification;
+        float remainingTime;
+    };
+
+    /**
+    @brief
+        
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _OrxonoxExport NotificationManager : public BaseObject
+    {
+    
+    public:
+        NotificationManager(BaseObject* creator);
+        virtual ~NotificationManager();
+        
+        static bool insertNotification(Notification* notification);
+        
+        static void tick(float dt);
+        
+    private:
+        static std::list<NotificationContainer*> notifications_s;
+        
+        static void updateQueue(void);
+        static const std::string clipMessage(const std::string & message);
+
+    };
+
+}
+
+#endif /* _NotificationManager_H__ */
Index: code/trunk/src/orxonox/overlays/notifications/NotificationQueue.cc
===================================================================
--- code/trunk/src/orxonox/overlays/notifications/NotificationQueue.cc	(revision 2662)
+++ code/trunk/src/orxonox/overlays/notifications/NotificationQueue.cc	(revision 2662)
@@ -0,0 +1,109 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "NotificationQueue.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include "NotificationManager.h"
+
+namespace orxonox
+{
+    NotificationQueue* NotificationQueue::queue_s = 0;
+
+    CreateFactory(NotificationQueue);
+
+    NotificationQueue::NotificationQueue(BaseObject* creator) : OverlayText(creator)
+    {
+        RegisterObject(NotificationQueue);
+        //TDO: Does this work?
+        if(queue_s != NULL)
+        {
+                COUT(2) << "There is now more than one NotificationQueue, this shouldn't happen, since only the first NotificationQueue will be targeted by the NotificationManager." << std::endl;
+        }
+        else
+        {
+                queue_s = this;
+        }
+
+        this->length_ = 3;
+        this->width_ = 50;
+    }
+
+    NotificationQueue::~NotificationQueue()
+    {
+
+    }
+
+    void NotificationQueue::XMLPort(Element& xmlElement, XMLPort::Mode mode)
+    {
+        SUPER(NotificationQueue, XMLPort, xmlElement, mode);
+
+        XMLPortParam(NotificationQueue, "length", setLength, getLength, xmlElement, mode);
+        XMLPortParam(NotificationQueue, "width", setWidth, getWidth, xmlElement, mode);
+    }
+
+    void NotificationQueue::tick(float dt)
+    {
+        NotificationManager::tick(dt);
+
+        update();
+    }
+
+    bool NotificationQueue::setLength(int length)
+    {
+        if(length > 0)
+        {
+            this->length_ = length;
+            return true;
+        }
+        return false;
+    }
+
+    bool NotificationQueue::setWidth(int width)
+    {
+        if(width > 0)
+        {
+            this->width_ = width;
+            return true;
+        }
+        return false;
+    }
+
+    void NotificationQueue::setQueueText(const std::string & text)
+    {
+        this->queueText_ = text;
+    }
+
+    void NotificationQueue::update(void)
+    {
+        this->text_->setCaption(queueText_);
+    }
+}
Index: code/trunk/src/orxonox/overlays/notifications/NotificationQueue.h
===================================================================
--- code/trunk/src/orxonox/overlays/notifications/NotificationQueue.h	(revision 2662)
+++ code/trunk/src/orxonox/overlays/notifications/NotificationQueue.h	(revision 2662)
@@ -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:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _NotificationOueue_H__
+#define _NotificationOueue_H__
+
+#include "OrxonoxPrereqs.h"
+#include <OgreTextAreaOverlayElement.h>
+
+#include "orxonox/overlays/OverlayText.h"
+#include "orxonox/objects/Tickable.h"
+
+#include <string>
+
+namespace orxonox
+{
+    /**
+    @brief
+
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _OrxonoxExport NotificationQueue : public OverlayText, public Tickable
+    {
+    public:
+        NotificationQueue(BaseObject* creator);
+        virtual ~NotificationQueue();
+
+        static NotificationQueue* queue_s; //TDO Singleton? oder im level.
+
+        virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
+
+        virtual void tick(float dt);
+
+        void update(void);
+
+        int getLength(void) const
+                { return this->length_; }
+        int getWidth(void) const
+                { return this->width_; }
+
+        void setQueueText(const std::string & text);
+        bool setLength(int length);
+        bool setWidth(int width);
+
+    private:
+        Ogre::UTFString queueText_;
+        int length_;
+        int width_;
+
+    };
+
+}
+
+#endif /* _NotificationOverlay_H__ */
Index: code/trunk/src/orxonox/overlays/stats/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/overlays/stats/CMakeLists.txt	(revision 2662)
+++ code/trunk/src/orxonox/overlays/stats/CMakeLists.txt	(revision 2662)
@@ -0,0 +1,8 @@
+SET( SRC_FILES
+  CreateLines.cc
+  Scoreboard.cc
+  Stats.cc
+  StatsTest.cc
+)
+
+ADD_SOURCE_FILES(SRC_FILES)
Index: code/trunk/src/orxonox/overlays/stats/CreateLines.cc
===================================================================
--- code/trunk/src/orxonox/overlays/stats/CreateLines.cc	(revision 2662)
+++ code/trunk/src/orxonox/overlays/stats/CreateLines.cc	(revision 2662)
@@ -0,0 +1,137 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Hildebrandt
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "CreateLines.h"
+
+#include <string>
+#include <OgreOverlay.h>
+#include <OgreOverlayElement.h>
+#include <OgreOverlayManager.h>
+#include <OgreOverlayContainer.h>
+
+#include "util/Convert.h"
+#include "util/Debug.h"
+#include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
+
+#include "overlays/OverlayText.h"
+#include "overlays/stats/Stats.h"
+
+namespace orxonox
+{
+    /**
+        @brief Constructor: Creates a line.
+    */
+    CreateLines::CreateLines(float leftOffset, float topOffset, float width, float height)
+    {
+        playerNameText_ = new OverlayText(0);
+        playerNameText_->setTextSize(0.04);
+        playerNameText_->setColour(ColourValue(0, 0.75, 0.2, 1));
+        playerNameText_->setPosition(Vector2(0.1, topOffset + 0.01));
+
+        scoreText_ = new OverlayText(0);
+        scoreText_->setTextSize(0.04);
+        scoreText_->setColour(ColourValue(0, 0.75, 0.2, 1));
+        scoreText_->setPosition(Vector2(0.6, topOffset + 0.01));
+
+        deathsText_ = new OverlayText(0);
+        deathsText_->setTextSize(0.04);
+        deathsText_->setColour(ColourValue(0, 0.75, 0.2, 1));
+        deathsText_->setPosition(Vector2(0.8, topOffset + 0.01));
+
+        background_ = new Stats(0);
+        background_->setPosition(Vector2(leftOffset, topOffset));
+        background_->setSize(Vector2(width, height));
+    }
+
+    CreateLines::~CreateLines()
+    {
+        delete this->playerNameText_;
+        delete this->scoreText_;
+        delete this->deathsText_;
+        delete this->background_;
+    }
+
+    void CreateLines::setPlayerName(const std::string& str)
+    {
+        this->playerNameText_->setCaption(str);
+    }
+
+    void CreateLines::setScore(const std::string& str)
+    {
+        this->scoreText_->setCaption(str);
+    }
+
+    void CreateLines::setDeaths(const std::string& str)
+    {
+        this->deathsText_->setCaption(str);
+    }
+
+    void CreateLines::setVisibility(bool visible)
+    {
+        this->scoreText_->setVisible(visible);
+        this->deathsText_->setVisible(visible);
+        this->playerNameText_->setVisible(visible);
+        this->background_->setVisible(visible);
+    }
+
+    /**
+        @brief Ensures that the number of OverlayElements is equal to numberOfColumns.
+    */
+    //void CreateLines::setNumberOfColumns(unsigned int numberOfColumns, unsigned int lineIndex) {
+
+    //    Ogre::OverlayManager* ovMan = Ogre::OverlayManager::getSingletonPtr();
+
+    //    unsigned int colIndex = 0;
+
+    //    while (textColumns_.size() < numberOfColumns)
+    //    {
+    //        Ogre::TextAreaOverlayElement* tempTextArea = static_cast<Ogre::TextAreaOverlayElement*>(ovMan->createOverlayElement("TextArea", "StatsLineTextArea" + getName() + convertToString(lineIndex) + convertToString(colIndex)));
+    //        textColumns_.push_back(tempTextArea);
+    //        this->background_->addChild(tempTextArea);
+
+    //        colIndex++;
+    //    }
+
+    //    while (textColumns_.size() > numberOfColumns)
+    //    {
+    //        this->background_->_removeChild(textColumns_.back());
+    //        ovMan->destroyOverlayElement(textColumns_.back());
+    //        textColumns_.pop_back();
+    //    }
+    //}
+
+    //void CreateLines::alignColumn(int columnIndex, float leftOffset, float topOffset)
+    //{
+    //    this->textColumns_[columnIndex]->setPosition(leftOffset, topOffset);
+    //}
+
+    //void CreateLines::setColumnText(int columnIndex, std::string columnText)
+    //{
+    //    this->textColumns_[columnIndex]->setCaption(columnText);
+    //}
+}
Index: code/trunk/src/orxonox/overlays/stats/CreateLines.h
===================================================================
--- code/trunk/src/orxonox/overlays/stats/CreateLines.h	(revision 2662)
+++ code/trunk/src/orxonox/overlays/stats/CreateLines.h	(revision 2662)
@@ -0,0 +1,72 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Hildebrandt
+ *
+ */
+
+#ifndef _CreateLines_H__
+#define _CreateLines_H__
+
+
+#include "OrxonoxPrereqs.h"
+#include <OgrePrerequisites.h>
+#include <OgreBorderPanelOverlayElement.h>
+#include <OgreTextAreaOverlayElement.h>
+
+#include "overlays/OrxonoxOverlay.h"
+#include "objects/Tickable.h"
+
+
+namespace orxonox
+{
+    class _OrxonoxExport CreateLines
+    {
+
+    public: // functions
+        CreateLines(float, float, float, float);
+        virtual ~CreateLines();
+
+        void setPlayerName(const std::string&);
+        void setScore(const std::string&);
+        void setDeaths(const std::string&);
+
+        void setVisibility(bool);
+
+        //void setNumberOfColumns(unsigned int numberOfColumns, unsigned int lineIndex);
+        //void alignColumn(int columnIndex, float leftOffset, float topOffset);
+        //void setColumnText(int columnIndex, std::string columnText);
+
+    private: // functions
+
+    private: // variables
+        //std::vector<OverlayText*> textColumns_;
+        OverlayText* playerNameText_;
+        OverlayText* scoreText_;
+        OverlayText* deathsText_;
+
+        Stats* background_;
+
+    };
+}
+
+#endif /* _CreateLines_H__ */
Index: code/trunk/src/orxonox/overlays/stats/Scoreboard.cc
===================================================================
--- code/trunk/src/orxonox/overlays/stats/Scoreboard.cc	(revision 2662)
+++ code/trunk/src/orxonox/overlays/stats/Scoreboard.cc	(revision 2662)
@@ -0,0 +1,140 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Hildebrandt
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Scoreboard.h"
+
+#include <string>
+#include <OgreOverlay.h>
+#include <OgreOverlayElement.h>
+#include <OgreOverlayManager.h>
+#include <OgreOverlayContainer.h>
+
+#include "util/Convert.h"
+#include "util/Debug.h"
+#include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
+#include "objects/gametypes/Gametype.h"
+#include "objects/infos/PlayerInfo.h"
+#include "CreateLines.h"
+
+namespace orxonox
+{
+    CreateFactory(Scoreboard);
+
+    /**
+        @brief Constructor: Creates the scoreboard.
+    */
+    Scoreboard::Scoreboard(BaseObject* creator)
+        : OrxonoxOverlay(creator)
+    {
+        RegisterObject(Scoreboard);
+    }
+
+    /**
+        @brief Initializes the lines.
+    */
+    void Scoreboard::XMLPort(Element& xmlElement, XMLPort::Mode mode)
+    {
+        SUPER(Scoreboard, XMLPort, xmlElement, mode);
+
+        COUT(0) << "XMLPort executed." << std::endl;
+    }
+
+    void Scoreboard::changedVisibility()
+    {
+        SUPER(Scoreboard, changedVisibility);
+
+        for (unsigned int i = 0; i < this->lines_.size(); ++i)
+            this->lines_[i]->setVisibility(this->isVisible());
+    }
+
+    /**
+        @brief Prints the scoreboard on the screen.
+    */
+    void Scoreboard::tick(float dt)
+    {
+        const std::map<PlayerInfo*, Player>& playerList = this->getGametype()->getPlayers();
+
+        const float topOffset  = 0.2;
+        const float leftOffset = 0.075;
+        const float distance   = 0.01;
+        const float width      = 0.85;
+        const float height     = 0.05;
+        while (playerList.size() > this->lines_.size())
+        {
+            // create new lines
+            CreateLines* lines = new CreateLines(leftOffset, topOffset + (distance + height) * lines_.size(), width, height);
+            lines->setVisibility(this->isVisible());
+            this->lines_.push_back(lines);
+        }
+        while (playerList.size() < this->lines_.size())
+        {
+            // destroy lines
+            delete this->lines_.back();
+            this->lines_.pop_back();
+        }
+
+        // update board
+
+        unsigned int index = 0;
+        for (std::map<PlayerInfo*, Player>::const_iterator it = playerList.begin(); it != playerList.end(); ++it)
+        {
+            this->lines_[index]->setPlayerName(omni_cast<std::string>(it->first->getName()));
+            this->lines_[index]->setScore(omni_cast<std::string>(it->second.frags_));
+            this->lines_[index]->setDeaths(omni_cast<std::string>(it->second.killed_));
+            index++;
+        }
+
+        //numberOfColumns = 2;
+        //numberOfLines = 3;
+        //topOffset = 0.1;
+        //lineSpacing = 0.1;
+
+        //for (unsigned int i = 0; i < this->lines_.size(); ++i)
+        //{
+        //    columnIndex = 0;
+        //    leftOffset = 0.1;
+
+        //    this->createlines_->setNumberOfColumns(numberOfColumns, i);
+
+        //    // columnText = this->getGametype()->getPlayersName();
+        //    columnText = "PlayerName";
+        //    this->createlines_->alignColumn(columnIndex, topOffset, leftOffset);
+        //    this->createlines_->setColumnText(columnIndex, columnText);
+
+        //    columnIndex++;
+        //    leftOffset = leftOffset + 0.3;
+
+        //    // columnText = this->getGametype()->getPlayersFrags();
+        //    columnText = "PlayerFrags";
+        //    this->createlines_->alignColumn(columnIndex, topOffset, leftOffset);
+        //    this->createlines_->setColumnText(columnIndex, columnText);
+
+        //    topOffset = topOffset + lineSpacing;
+        //}
+    }
+}
Index: code/trunk/src/orxonox/overlays/stats/Scoreboard.h
===================================================================
--- code/trunk/src/orxonox/overlays/stats/Scoreboard.h	(revision 2662)
+++ code/trunk/src/orxonox/overlays/stats/Scoreboard.h	(revision 2662)
@@ -0,0 +1,76 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Hildebrandt
+ *
+ */
+
+#ifndef _Scoreboard_H__
+#define _Scoreboard_H__
+
+
+#include "OrxonoxPrereqs.h"
+#include <OgrePrerequisites.h>
+#include <OgreBorderPanelOverlayElement.h>
+#include <OgreTextAreaOverlayElement.h>
+
+#include "overlays/OrxonoxOverlay.h"
+#include "objects/Tickable.h"
+
+
+namespace orxonox
+{
+    class _OrxonoxExport Scoreboard : public OrxonoxOverlay, public Tickable
+    {
+
+    public: // functions
+        Scoreboard(BaseObject* creator);
+        virtual ~Scoreboard() {}
+
+        virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
+        virtual void tick(float dt);
+
+        inline void setCreateLines(CreateLines* cl)
+            { this->createlines_ = cl; }
+        inline CreateLines* getCreateLines() const
+            { return this->createlines_; }
+
+        virtual void changedVisibility();
+
+    private: // functions
+        void printLines();
+
+    private: // variables
+        std::vector<CreateLines*> lines_;
+
+        unsigned int numberOfColumns;
+        unsigned int numberOfLines;
+        unsigned int columnIndex;
+        float topOffset;
+        float leftOffset;
+        float lineSpacing;
+        std::string columnText;
+        CreateLines* createlines_;
+    };
+}
+
+#endif /* _Scoreboard_H__ */
Index: code/trunk/src/orxonox/overlays/stats/Stats.cc
===================================================================
--- code/trunk/src/orxonox/overlays/stats/Stats.cc	(revision 2662)
+++ code/trunk/src/orxonox/overlays/stats/Stats.cc	(revision 2662)
@@ -0,0 +1,122 @@
+/*
+ *   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:
+ *      Felix Schulthess
+ *   Co-authors:
+ *      Fabian 'x3n' Landau, Benjamin Hildebrandt
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Stats.h"
+
+#include <string>
+#include <OgreOverlay.h>
+#include <OgreOverlayElement.h>
+#include <OgreOverlayManager.h>
+#include <OgreOverlayContainer.h>
+
+#include "util/Convert.h"
+#include "util/Debug.h"
+#include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
+
+namespace orxonox
+{
+    CreateFactory(Stats);
+
+    /**
+        @brief Constructor: Creates and initializes the Stats panel.
+    */
+    Stats::Stats(BaseObject* creator)
+        : OrxonoxOverlay(creator)
+        , statsOverlayNoise_(0)
+        , statsOverlayBorder_(0)
+    {
+        RegisterObject(Stats);
+
+        this->setConfigValues();
+
+        // create overlay and elements
+        Ogre::OverlayManager* ovMan = Ogre::OverlayManager::getSingletonPtr();
+
+        // create BorderPanel
+        this->statsOverlayBorder_ = static_cast<Ogre::BorderPanelOverlayElement*>(ovMan->createOverlayElement("BorderPanel", "StatsBorderPanel" + getUniqueNumberString()));
+        //this->statsOverlayBorder_->setMaterialName("StatsCenter");
+        this->statsOverlayBorder_->setBorderSize(0.003, 16 * 0.003);
+        this->statsOverlayBorder_->setBorderMaterialName("StatsBorder");
+        this->statsOverlayBorder_->setTopBorderUV(0.49, 0.0, 0.51, 0.5);
+        this->statsOverlayBorder_->setTopLeftBorderUV(0.0, 0.0, 0.5, 0.5);
+        this->statsOverlayBorder_->setTopRightBorderUV(0.5, 0.0, 1.0, 0.5);
+        this->statsOverlayBorder_->setLeftBorderUV(0.0, 0.49, 0.5, 0.51);
+        this->statsOverlayBorder_->setRightBorderUV(0.5, 0.49, 1.0, 0.5);
+        this->statsOverlayBorder_->setBottomBorderUV(0.49, 0.5, 0.51, 1.0);
+        this->statsOverlayBorder_->setBottomLeftBorderUV(0.0, 0.5, 0.5, 1.0);
+        this->statsOverlayBorder_->setBottomRightBorderUV(0.5, 0.5, 1.0, 1.0);
+
+        background_->addChild(statsOverlayBorder_);
+
+        // create noise
+        //this->statsOverlayNoise_ = static_cast<Ogre::PanelOverlayElement*>(ovMan->createOverlayElement("Panel", "StatsNoise" + getUniqueNumberString()));
+        //this->statsOverlayNoise_->setPosition(0,0);
+        //this->statsOverlayNoise_->setMaterialName("StatsNoiseSmall");
+        // comment following line to disable noise
+        //background_->addChild(this->statsOverlayNoise_);
+    }
+
+    Stats::~Stats()
+    {
+        if (this->isInitialized())
+        {
+            Ogre::OverlayManager* ovMan = Ogre::OverlayManager::getSingletonPtr();
+            ovMan->destroyOverlayElement(this->statsOverlayBorder_);
+            //ovMan->destroyOverlayElement(this->statsOverlayNoise_);
+        }
+    }
+
+    /**
+        @brief Sets the config values, describing the size of the Stats panel.
+    */
+    void Stats::setConfigValues()
+    {
+        SetConfigValue(noiseSize_, 1.0f);
+    }
+
+    /**
+        @brief Initializes the Stats panel.
+    */
+    void Stats::XMLPort(Element& xmlElement, XMLPort::Mode mode)
+    {
+        OrxonoxOverlay::XMLPort(xmlElement, mode);
+    }
+
+    void Stats::tick(float dt)
+    {
+        // SUPER(Stats, tick, dt);
+
+            // this creates a flickering effect (extracts exactly 80% of the texture at a random location)
+            //float uRand = (rand() & 1023) / 1023.0f * 0.2f;
+            //float vRand = (rand() & 1023) / 1023.0f * 0.2f;
+            //this->statsOverlayNoise_->setUV(uRand, vRand, 7.5f + uRand, 7.5f + vRand);
+    }
+
+}
Index: code/trunk/src/orxonox/overlays/stats/Stats.h
===================================================================
--- code/trunk/src/orxonox/overlays/stats/Stats.h	(revision 2662)
+++ code/trunk/src/orxonox/overlays/stats/Stats.h	(revision 2662)
@@ -0,0 +1,63 @@
+/*
+ *   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:
+ *      Felix Schulthess
+ *   Co-authors:
+ *      Fabian 'x3n' Landau, Benjamin Hildebrandt
+ *
+ */
+
+#ifndef _Stats_H__
+#define _Stats_H__
+
+
+#include "OrxonoxPrereqs.h"
+#include <OgrePrerequisites.h>
+#include <OgreBorderPanelOverlayElement.h>
+#include <OgreTextAreaOverlayElement.h>
+
+#include "overlays/OrxonoxOverlay.h"
+#include "objects/Tickable.h"
+
+
+namespace orxonox
+{
+    class _OrxonoxExport Stats : public OrxonoxOverlay, public Tickable
+    {
+    public: // functions
+        Stats(BaseObject* creator);
+        virtual ~Stats();
+
+        void setConfigValues();
+
+        virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
+
+        virtual void tick(float dt);
+
+    private: // variables
+        Ogre::PanelOverlayElement* statsOverlayNoise_;
+        Ogre::BorderPanelOverlayElement* statsOverlayBorder_;
+        float noiseSize_;
+    };
+}
+
+#endif /* _Stats_H__ */
Index: code/trunk/src/orxonox/overlays/stats/StatsTest.cc
===================================================================
--- code/trunk/src/orxonox/overlays/stats/StatsTest.cc	(revision 2662)
+++ code/trunk/src/orxonox/overlays/stats/StatsTest.cc	(revision 2662)
@@ -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:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "StatsTest.h"
+
+#include <OgreTextAreaOverlayElement.h>
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+    CreateFactory(StatsTest);
+
+    StatsTest::StatsTest(BaseObject* creator)
+        : OrxonoxOverlay(creator)
+    {
+        RegisterObject(StatsTest);
+    }
+
+    StatsTest::~StatsTest()
+    {
+    }
+
+    void StatsTest::tick(float dt)
+    {
+    }
+}
Index: code/trunk/src/orxonox/overlays/stats/StatsTest.h
===================================================================
--- code/trunk/src/orxonox/overlays/stats/StatsTest.h	(revision 2662)
+++ code/trunk/src/orxonox/overlays/stats/StatsTest.h	(revision 2662)
@@ -0,0 +1,48 @@
+/*
+ *   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:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _StatsTest_H__
+#define _StatsTest_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "overlays/OrxonoxOverlay.h"
+#include "objects/Tickable.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport StatsTest : public OrxonoxOverlay, public Tickable
+    {
+    public:
+        StatsTest(BaseObject* creator);
+        ~StatsTest();
+
+        virtual void tick(float dt);
+    };
+}
+#endif /* _StatsTest_H__ */
Index: code/trunk/src/orxonox/tools/BillboardSet.cc
===================================================================
--- code/trunk/src/orxonox/tools/BillboardSet.cc	(revision 2262)
+++ code/trunk/src/orxonox/tools/BillboardSet.cc	(revision 2662)
@@ -34,4 +34,5 @@
 
 #include <OgreSceneManager.h>
+#include <OgreBillboardSet.h>
 #include <OgreBillboard.h>
 
Index: code/trunk/src/orxonox/tools/BillboardSet.h
===================================================================
--- code/trunk/src/orxonox/tools/BillboardSet.h	(revision 2262)
+++ code/trunk/src/orxonox/tools/BillboardSet.h	(revision 2662)
@@ -33,5 +33,5 @@
 
 #include <string>
-#include <OgreBillboardSet.h>
+#include <OgrePrerequisites.h>
 
 #include "util/Math.h"
@@ -52,4 +52,6 @@
             inline Ogre::BillboardSet* getBillboardSet()
                 { return this->billboardSet_; }
+            inline Ogre::SceneManager* getSceneManager()
+                { return this->scenemanager_; }
 
             const std::string& getName() const;
Index: code/trunk/src/orxonox/tools/BulletConversions.h
===================================================================
--- code/trunk/src/orxonox/tools/BulletConversions.h	(revision 2662)
+++ code/trunk/src/orxonox/tools/BulletConversions.h	(revision 2662)
@@ -0,0 +1,96 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _BulletConversions_H__
+#define _BulletConversions_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "util/Convert.h"
+#include "util/Math.h"
+#include "LinearMath/btQuaternion.h"
+#include "LinearMath/btVector3.h"
+
+namespace orxonox
+{
+    // Vector3 to btVector3
+    template <>
+    struct ConverterExplicit<orxonox::Vector3, btVector3>
+    {
+        static bool convert(btVector3* output, const orxonox::Vector3& input)
+        {
+            output->setX(input.x);
+            output->setY(input.y);
+            output->setZ(input.z);
+            return true;
+        }
+    };
+
+    // btVector3 to Vector3
+    template <>
+    struct ConverterExplicit<btVector3, orxonox::Vector3>
+    {
+        static bool convert(orxonox::Vector3* output, const btVector3& input)
+        {
+            output->x = input.x();
+            output->y = input.y();
+            output->z = input.z();
+            return true;
+        }
+    };
+
+    // Quaternion to btQuaternion
+    template <>
+    struct ConverterExplicit<orxonox::Quaternion, btQuaternion>
+    {
+        static bool convert(btQuaternion* output, const orxonox::Quaternion& input)
+        {
+            output->setW(input.w);
+            output->setX(input.x);
+            output->setY(input.y);
+            output->setZ(input.z);
+            return true;
+        }
+    };
+
+    // btQuaternion to Vector3
+    template <>
+    struct ConverterExplicit<btQuaternion, orxonox::Quaternion>
+    {
+        static bool convert(orxonox::Quaternion* output, const btQuaternion& input)
+        {
+            output->w = input.w();
+            output->x = input.x();
+            output->y = input.y();
+            output->z = input.z();
+            return true;
+        }
+    };
+}
+
+#endif /* _BulletConversions_H__ */
Index: code/trunk/src/orxonox/tools/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/tools/CMakeLists.txt	(revision 2262)
+++ code/trunk/src/orxonox/tools/CMakeLists.txt	(revision 2662)
@@ -3,4 +3,5 @@
   Mesh.cc
   ParticleInterface.cc
+  Shader.cc
   TextureGenerator.cc
   Timer.cc
Index: code/trunk/src/orxonox/tools/Mesh.cc
===================================================================
--- code/trunk/src/orxonox/tools/Mesh.cc	(revision 2262)
+++ code/trunk/src/orxonox/tools/Mesh.cc	(revision 2662)
@@ -31,4 +31,5 @@
 
 #include <sstream>
+#include <OgreEntity.h>
 #include <OgreSceneManager.h>
 #include <cassert>
Index: code/trunk/src/orxonox/tools/Mesh.h
===================================================================
--- code/trunk/src/orxonox/tools/Mesh.h	(revision 2262)
+++ code/trunk/src/orxonox/tools/Mesh.h	(revision 2662)
@@ -33,5 +33,5 @@
 
 #include <string>
-#include <OgreEntity.h>
+#include <OgrePrerequisites.h>
 
 namespace orxonox
Index: code/trunk/src/orxonox/tools/ParticleInterface.cc
===================================================================
--- code/trunk/src/orxonox/tools/ParticleInterface.cc	(revision 2262)
+++ code/trunk/src/orxonox/tools/ParticleInterface.cc	(revision 2662)
@@ -52,10 +52,9 @@
     ParticleInterface::ParticleInterface(Ogre::SceneManager* scenemanager, const std::string& templateName, LODParticle::LOD detaillevel)
     {
-        RegisterRootObject(ParticleInterface);
+        RegisterObject(ParticleInterface);
 
         assert(scenemanager);
 
         this->scenemanager_ = scenemanager;
-        this->sceneNode_ = 0;
         this->particleSystem_ = 0;
 
@@ -63,4 +62,5 @@
         this->bVisible_ = true;
         this->bAllowedByLOD_ = true;
+        this->speedFactor_ = 1.0f;
 
         if (Core::showsGraphics())
@@ -69,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 (...)
@@ -87,28 +86,5 @@
         {
             this->particleSystem_->removeAllEmitters();
-            this->detachFromSceneNode();
             this->scenemanager_->destroyParticleSystem(this->particleSystem_);
-        }
-    }
-
-    void ParticleInterface::addToSceneNode(Ogre::SceneNode* sceneNode)
-    {
-        if (this->sceneNode_)
-            this->detachFromSceneNode();
-
-        if (this->particleSystem_)
-        {
-            this->sceneNode_ = sceneNode;
-            this->sceneNode_->attachObject(this->particleSystem_);
-        }
-    }
-
-    void ParticleInterface::detachFromSceneNode()
-    {
-        if (this->sceneNode_)
-        {
-            if (this->particleSystem_)
-                this->sceneNode_->detachObject(this->particleSystem_);
-            this->sceneNode_ = 0;
         }
     }
@@ -224,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/trunk/src/orxonox/tools/ParticleInterface.h
===================================================================
--- code/trunk/src/orxonox/tools/ParticleInterface.h	(revision 2262)
+++ code/trunk/src/orxonox/tools/ParticleInterface.h	(revision 2662)
@@ -33,8 +33,9 @@
 
 #include <string>
-#include <OgreParticleEmitter.h>
+#include <OgrePrerequisites.h>
 
 #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:
@@ -53,7 +54,4 @@
             inline Ogre::ParticleSystem* getParticleSystem() const
                 { return this->particleSystem_; }
-
-            void addToSceneNode(Ogre::SceneNode* sceneNode);
-            void detachFromSceneNode();
 
             Ogre::ParticleEmitter* createNewEmitter();
@@ -69,5 +67,6 @@
             unsigned int getNumAffectors() const;
 
-            float getSpeedFactor() const;
+            inline float getSpeedFactor() const
+                { return this->speedFactor_; }
             void setSpeedFactor(float factor);
             bool getKeepParticlesInLocalSpace() const;
@@ -90,4 +89,7 @@
                 { return ParticleInterface::currentParticleInterface_s; }
 
+        protected:
+            virtual void changedTimeFactor(float factor_new, float factor_old);
+
         private:
             void updateVisibility();
@@ -96,5 +98,4 @@
             static unsigned int       counter_s;
 
-            Ogre::SceneNode*          sceneNode_;
             Ogre::ParticleSystem*     particleSystem_;
             bool                      bVisible_;
@@ -102,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/trunk/src/orxonox/tools/Shader.cc
===================================================================
--- code/trunk/src/orxonox/tools/Shader.cc	(revision 2662)
+++ code/trunk/src/orxonox/tools/Shader.cc	(revision 2662)
@@ -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/trunk/src/orxonox/tools/Shader.h
===================================================================
--- code/trunk/src/orxonox/tools/Shader.h	(revision 2662)
+++ code/trunk/src/orxonox/tools/Shader.h	(revision 2662)
@@ -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/trunk/src/orxonox/tools/Timer.cc
===================================================================
--- code/trunk/src/orxonox/tools/Timer.cc	(revision 2262)
+++ code/trunk/src/orxonox/tools/Timer.cc	(revision 2662)
@@ -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/trunk/src/orxonox/tools/Timer.h
===================================================================
--- code/trunk/src/orxonox/tools/Timer.h	(revision 2262)
+++ code/trunk/src/orxonox/tools/Timer.h	(revision 2662)
@@ -62,5 +62,7 @@
 
 #include "OrxonoxPrereqs.h"
+#include "core/Executor.h"
 #include "core/OrxonoxClass.h"
+#include "gamestates/GSRoot.h"
 
 namespace orxonox
@@ -72,5 +74,5 @@
 
     //! TimerBase is the parent of the Timer class.
-    class _OrxonoxExport TimerBase : public OrxonoxClass
+    class _OrxonoxExport TimerBase : public TimeFactorListener
     {
         public:
@@ -159,5 +161,5 @@
                 this->bLoop_ = bLoop;
                 executor->setObject(object);
-                this->executor_ = (Executor*)executor;
+                this->executor_ = static_cast<Executor*>(executor);
                 this->bActive_ = true;
 
@@ -197,5 +199,5 @@
                 this->setInterval(interval);
                 this->bLoop_ = bLoop;
-                this->executor_ = (Executor*)executor;
+                this->executor_ = executor;
                 this->bActive_ = true;
 
Index: code/trunk/src/orxonox/tools/WindowEventListener.h
===================================================================
--- code/trunk/src/orxonox/tools/WindowEventListener.h	(revision 2262)
+++ code/trunk/src/orxonox/tools/WindowEventListener.h	(revision 2662)
@@ -41,7 +41,7 @@
     class _OrxonoxExport WindowEventListener : virtual public OrxonoxClass
     {
-    public:
-        WindowEventListener();
-        virtual ~WindowEventListener() { }
+        public:
+            WindowEventListener();
+            virtual ~WindowEventListener() { }
 
             /** Window has moved position */
