Index: code/trunk/src/orxonox/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/CMakeLists.txt	(revision 1407)
+++ code/trunk/src/orxonox/CMakeLists.txt	(revision 1502)
@@ -9,4 +9,5 @@
   hud/RadarOverlayElement.cc
   hud/RadarObject.cc
+  hud/Navigation.cc
   particle/ParticleInterface.cc
   tolua/tolua_bind.cc
@@ -24,6 +25,8 @@
   objects/NPC.cc
   objects/Projectile.cc
+  objects/RotatingProjectile.cc
   objects/Skybox.cc
   objects/SpaceShip.cc
+  objects/SpaceShipAI.cc
   objects/WorldEntity.cc
 
Index: code/trunk/src/orxonox/GraphicsEngine.cc
===================================================================
--- code/trunk/src/orxonox/GraphicsEngine.cc	(revision 1407)
+++ code/trunk/src/orxonox/GraphicsEngine.cc	(revision 1502)
@@ -45,8 +45,13 @@
 #include "core/Debug.h"
 #include "core/CommandExecutor.h"
-
+#include "core/TclBind.h"
+#include "console/InGameConsole.h"
+
+#include "core/ConsoleCommand.h"
+#include <OgreSceneManager.h>
+#include <OgreCompositorManager.h>
+#include <OgreViewport.h>
 
 namespace orxonox {
-
   /**
     @brief Returns the singleton instance and creates it the first time.
@@ -83,4 +88,6 @@
     SetConfigValue(ogreLogLevelNormal_  , 4).description("Corresponding orxonox debug level for ogre Normal");
     SetConfigValue(ogreLogLevelCritical_, 2).description("Corresponding orxonox debug level for ogre Critical");
+
+    TclBind::getInstance().setDataPath(this->dataPath_);
   }
 
@@ -137,5 +144,7 @@
 #endif
 
-/*    // create a logManager
+// TODO: LogManager doesn't work on specific systems. The why is unknown yet.
+#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
+    // create a logManager
     // note: If there's already a logManager, Ogre will complain by a failed assertation.
     // but that shouldn't happen, since this is the first time to create a logManager..
@@ -148,13 +157,24 @@
       myLog = logger->createLog("ogre.log", true, false, true);
     else
-          myLog = logger->createLog(this->ogreLogfile_, true, false, false);
+      myLog = logger->createLog(this->ogreLogfile_, true, false, false);
     CCOUT(4) << "Ogre Log created" << std::endl;
 
     myLog->setLogDetail(Ogre::LL_BOREME);
-    myLog->addListener(this);*/
+    myLog->addListener(this);
+#endif
 
     // Root will detect that we've already created a Log
     CCOUT(4) << "Creating Ogre Root..." << std::endl;
-    root_ = new Ogre::Root(plugin_filename);
+
+    root_ = new Ogre::Root(plugin_filename, "ogre.cfg", this->ogreLogfile_);
+
+#if ORXONOX_PLATFORM != ORXONOX_PLATFORM_WIN32
+    // tame the ogre ouput so we don't get all the mess in the console
+    Ogre::Log* defaultLog = Ogre::LogManager::getSingleton().getDefaultLog();
+    defaultLog->setDebugOutputEnabled(false);
+    defaultLog->setLogDetail(Ogre::LL_BOREME);
+    defaultLog->addListener(this);
+#endif
+
     CCOUT(4) << "Creating Ogre Root done" << std::endl;
 
@@ -241,5 +261,5 @@
   bool GraphicsEngine::createNewScene()
   {
-    CCOUT(4) << "Creating new SceneManager" << std::endl;
+    CCOUT(4) << "Creating new SceneManager..." << std::endl;
     if (scene_)
     {
@@ -291,4 +311,16 @@
     else
       return 0;
+  }
+
+  /**
+    @brief Returns the window aspect ratio height/width.
+    @return The ratio
+  */
+  float GraphicsEngine::getWindowAspectRatio() const
+  {
+    if (this->renderWindow_)
+        return (float)this->renderWindow_->getHeight() / (float)this->renderWindow_->getWidth();
+    else
+        return 1.0f;
   }
 
@@ -345,4 +377,5 @@
     int h = rw->getHeight();
     InputManager::setWindowExtents(w, h);
+    InGameConsole::getInstance().resize();
   }
 
@@ -365,3 +398,36 @@
     CommandExecutor::execute("exit", false);
   }
+
+  //HACK!!
+  /*SetConsoleCommandShortcut(GraphicsEngine, CompositorBloomOn).setAccessLevel(AccessLevel::User);
+  SetConsoleCommandShortcut(GraphicsEngine, CompositorMotionBlurOn).setAccessLevel(AccessLevel::User);
+  SetConsoleCommandShortcut(GraphicsEngine, CompositorBloomOff).setAccessLevel(AccessLevel::User);
+  SetConsoleCommandShortcut(GraphicsEngine, CompositorMotionBlurOff).setAccessLevel(AccessLevel::User);
+  void GraphicsEngine::CompositorBloomOn()
+  {
+    Ogre::SceneManager* mSceneMgr = GraphicsEngine::getSingleton().getSceneManager();
+    Ogre::Viewport* mViewport = mSceneMgr->getCurrentViewport();
+    Ogre::CompositorManager::getSingleton().addCompositor(mViewport, "Bloom");
+    Ogre::CompositorManager::getSingleton().setCompositorEnabled(mViewport, "Bloom", true);
+  }
+  void GraphicsEngine::CompositorBloomOff()
+  {
+    Ogre::SceneManager* mSceneMgr = GraphicsEngine::getSingleton().getSceneManager();
+    Ogre::Viewport* mViewport = mSceneMgr->getCurrentViewport();
+    Ogre::CompositorManager::getSingleton().setCompositorEnabled(mViewport, "Bloom", false);
+  }
+
+  void GraphicsEngine::CompositorMotionBlurOn()
+  {
+    Ogre::SceneManager* mSceneMgr = GraphicsEngine::getSingleton().getSceneManager();
+    Ogre::Viewport* mViewport = mSceneMgr->getCurrentViewport();
+    Ogre::CompositorManager::getSingleton().addCompositor(mViewport, "MotionBlur");
+    Ogre::CompositorManager::getSingleton().setCompositorEnabled(mViewport, "MotionBlur", true);
+  }
+  void GraphicsEngine::CompositorMotionBlurOff()
+  {
+    Ogre::SceneManager* mSceneMgr = GraphicsEngine::getSingleton().getSceneManager();
+    Ogre::Viewport* mViewport = mSceneMgr->getCurrentViewport();
+    Ogre::CompositorManager::getSingleton().setCompositorEnabled(mViewport, "MotionBlur", false);
+  }*/
 }
Index: code/trunk/src/orxonox/GraphicsEngine.h
===================================================================
--- code/trunk/src/orxonox/GraphicsEngine.h	(revision 1407)
+++ code/trunk/src/orxonox/GraphicsEngine.h	(revision 1502)
@@ -72,4 +72,7 @@
             int getWindowWidth() const;
             int getWindowHeight() const;
+            float getWindowAspectRatio() const;
+            float getAverageFPS() const
+            { if (renderWindow_) return this->renderWindow_->getAverageFPS(); else return 0.0f; }
 
             void windowMoved       (Ogre::RenderWindow* rw);
@@ -80,4 +83,11 @@
             static GraphicsEngine& getSingleton();
             static GraphicsEngine* getSingletonPtr() { return &getSingleton(); }
+
+            //HACK!!!
+            //void static CompositorBloomOn();
+            //void static CompositorBloomOff();
+            //void static CompositorMotionBlurOn();
+            //void static CompositorMotionBlurOff();
+
 
         private:
Index: code/trunk/src/orxonox/Main.cc
===================================================================
--- code/trunk/src/orxonox/Main.cc	(revision 1407)
+++ code/trunk/src/orxonox/Main.cc	(revision 1502)
@@ -36,5 +36,5 @@
 #include <exception>
 
-#include "OrxonoxPlatform.h"
+#include "util/OrxonoxPlatform.h"
 #include "core/SignalHandler.h"
 #include "Orxonox.h"
Index: code/trunk/src/orxonox/Orxonox.cc
===================================================================
--- code/trunk/src/orxonox/Orxonox.cc	(revision 1407)
+++ code/trunk/src/orxonox/Orxonox.cc	(revision 1502)
@@ -51,5 +51,4 @@
 //#include "util/Sleep.h"
 #include "util/ArgReader.h"
-#include "util/ExprParser.h"
 
 // core
@@ -57,8 +56,6 @@
 #include "core/ConsoleCommand.h"
 #include "core/Debug.h"
-#include "core/Factory.h"
 #include "core/Loader.h"
 #include "core/Tickable.h"
-#include "core/InputBuffer.h"
 #include "core/InputManager.h"
 #include "core/TclBind.h"
@@ -72,7 +69,8 @@
 
 // objects and tools
-#include "tools/Timer.h"
 #include "hud/HUD.h"
-#include "console/InGameConsole.h"
+#include <Ogre.h>
+
+#include "GraphicsEngine.h"
 
 // FIXME: is this really file scope?
@@ -83,71 +81,7 @@
 namespace orxonox
 {
-  ConsoleCommandShortcut(Orxonox, exit, AccessLevel::None).setKeybindMode(KeybindMode::OnPress);
-  ConsoleCommandShortcut(Orxonox, slomo, AccessLevel::Offline).setDefaultValue(0, 1.0)
-    .setAxisParamIndex(0).setIsAxisRelative(false);
-  ConsoleCommandShortcut(Orxonox, setTimeFactor, AccessLevel::Offline).setDefaultValue(0, 1.0);
-  ConsoleCommandShortcut(Orxonox, activateConsole, AccessLevel::None);
-  class Testconsole : public InputBufferListener
-  {
-    public:
-      Testconsole(InputBuffer* ib) : ib_(ib) {}
-      void listen() const
-      {
-        std::cout << "> " << this->ib_->get() << std::endl;
-      }
-      void execute() const
-      {
-        std::cout << ">> " << this->ib_->get() << std::endl;
-        if (!CommandExecutor::execute(this->ib_->get()))
-          std::cout << "Error" << std::endl;
-        this->ib_->clear();
-      }
-      void hintandcomplete() const
-      {
-        std::cout << CommandExecutor::hint(this->ib_->get()) << std::endl;
-        this->ib_->set(CommandExecutor::complete(this->ib_->get()));
-      }
-      void clear() const
-      {
-        this->ib_->clear();
-      }
-      void removeLast() const
-      {
-        this->ib_->removeLast();
-      }
-      void exit() const
-      {
-        InputManager::setInputState(InputManager::IS_NORMAL);
-      }
-
-    private:
-      InputBuffer* ib_;
-  };
-
-  class Calculator
-  {
-  public:
-    static float calculate(const std::string& calculation)
-    {
-      ExprParser expr(calculation);
-      if (expr.getSuccess())
-      {
-        if (expr.getResult() == 42.0)
-          std::cout << "Greetings from the restaurant at the end of the universe." << std::endl;
-        // FIXME: insert modifier to display in full precision
-        std::cout << "Result is: " << expr.getResult() << std::endl;
-        if (expr.getRemains() != "")
-          std::cout << "Warning: Expression could not be parsed to the end! Remains: '"
-              << expr.getRemains() << "'" << std::endl;
-        return expr.getResult();
-      }
-      else
-      {
-        std::cout << "Cannot calculate expression: Parse error" << std::endl;
-        return 0;
-      }
-    }
-  };
-  ConsoleCommandShortcut(Calculator, calculate, AccessLevel::None);
+  SetConsoleCommandShortcut(Orxonox, exit).setKeybindMode(KeybindMode::OnPress);
+  SetConsoleCommandShortcut(Orxonox, slomo).setAccessLevel(AccessLevel::Offline).setDefaultValue(0, 1.0).setAxisParamIndex(0).setIsAxisRelative(false);
+  SetConsoleCommandShortcut(Orxonox, setTimeFactor).setAccessLevel(AccessLevel::Offline).setDefaultValue(0, 1.0);
 
   /**
@@ -165,10 +99,10 @@
     // turn on frame smoothing by setting a value different from 0
     frameSmoothingTime_(0.0f),
-    orxonoxConsole_(0),
     orxonoxHUD_(0),
     bAbort_(false),
     timefactor_(1.0f),
     mode_(STANDALONE),
-    serverIp_("")
+    serverIp_(""),
+    serverPort_(NETWORK_PORT)
   {
   }
@@ -180,6 +114,6 @@
   {
     // keep in mind: the order of deletion is very important!
-    if (this->orxonoxHUD_)
-      delete this->orxonoxHUD_;
+//    if (this->orxonoxHUD_)
+//      delete this->orxonoxHUD_;
     Loader::close();
     InputManager::destroy();
@@ -244,4 +178,5 @@
     ar.checkArgument("data", dataPath, false);
     ar.checkArgument("ip", serverIp_, false);
+    ar.checkArgument("port", serverPort_, false);
     if(ar.errorHandling())
       return false;
@@ -251,4 +186,6 @@
     else if (mode == "server")
       mode_ = SERVER;
+    else if (mode == "dedicated")
+      mode_ = DEDICATED;
     else
     {
@@ -265,5 +202,4 @@
     // procedure until the GUI is identical
 
-    TclBind::getInstance().setDataPath(dataPath);
     ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox.ini");
     Factory::createClassHierarchy();
@@ -281,32 +217,38 @@
   bool Orxonox::start()
   {
-    //if (mode == DEDICATED)
-    // do something else
-    //else
-
-    if (!ogre_->loadRenderer())    // creates the render window
-      return false;
-
-    // Calls the InputManager which sets up the input devices.
-    // The render window width and height are used to set up the mouse movement.
-    if (!InputManager::initialise(ogre_->getWindowHandle(),
-          ogre_->getWindowWidth(), ogre_->getWindowHeight(), true, true, true))
-      return false;
-
-    // TODO: Spread this so that this call only initialises things needed for the GUI
-    if (!ogre_->initialiseResources())
-      return false;
-
-    // TOOD: load the GUI here
-    // set InputManager to GUI mode
-    InputManager::setInputState(InputManager::IS_GUI);
-    // TODO: run GUI here
-
-    // The following lines depend very much on the GUI output, so they're probably misplaced here..
-
-    InputManager::setInputState(InputManager::IS_NONE);
-
-    if (!loadPlayground())
-      return false;
+    if (mode_ == DEDICATED)
+    {
+      // do something else
+    }
+    else
+    { // not dedicated server
+      if (!ogre_->loadRenderer())    // creates the render window
+        return false;
+
+      // Calls the InputManager which sets up the input devices.
+      // The render window width and height are used to set up the mouse movement.
+      if (!InputManager::initialise(ogre_->getWindowHandle(),
+            ogre_->getWindowWidth(), ogre_->getWindowHeight(), true, true, true))
+        return false;
+
+      // TODO: Spread this so that this call only initialises things needed for the GUI
+      if (!ogre_->initialiseResources())
+        return false;
+
+      // TOOD: load the GUI here
+      // set InputManager to GUI mode
+      InputManager::setInputState(InputManager::IS_GUI);
+      // TODO: run GUI here
+
+      // The following lines depend very much on the GUI output, so they're probably misplaced here..
+
+      InputManager::setInputState(InputManager::IS_NONE);
+
+      // create Ogre SceneManager
+      ogre_->createNewScene();
+
+      if (!loadPlayground())
+        return false;
+    }
 
     switch (mode_)
@@ -320,4 +262,8 @@
         return false;
       break;
+    case DEDICATED:
+      if (!serverLoad())
+        return false;
+      break;
     default:
       if (!standaloneLoad())
@@ -336,7 +282,5 @@
   bool Orxonox::loadPlayground()
   {
-    ogre_->createNewScene();
-
-	  // Init audio
+    // Init audio
     //auMan_ = new audio::AudioManager();
     //auMan_->ambientAdd("a1");
@@ -348,25 +292,5 @@
     // Load the HUD
     COUT(3) << "Orxonox: Loading HUD..." << std::endl;
-    orxonoxHUD_ = new HUD(1);
-
-    COUT(3) << "Orxonox: Loading Console..." << std::endl;
-    InputBuffer* ib = dynamic_cast<InputBuffer*>(InputManager::getKeyHandler("buffer"));
-    /*
-    Testconsole* console = new Testconsole(ib);
-    ib->registerListener(console, &Testconsole::listen, true);
-    ib->registerListener(console, &Testconsole::execute, '\r', false);
-    ib->registerListener(console, &Testconsole::hintandcomplete, '\t', true);
-    ib->registerListener(console, &Testconsole::clear, '§', true);
-    ib->registerListener(console, &Testconsole::removeLast, '\b', true);
-    ib->registerListener(console, &Testconsole::exit, (char)0x1B, true);
-    */
-    orxonoxConsole_ = new InGameConsole(ib);
-    ib->registerListener(orxonoxConsole_, &InGameConsole::listen, true);
-    ib->registerListener(orxonoxConsole_, &InGameConsole::execute, '\r', false);
-    ib->registerListener(orxonoxConsole_, &InGameConsole::hintandcomplete, '\t', true);
-    ib->registerListener(orxonoxConsole_, &InGameConsole::clear, '§', true);
-    ib->registerListener(orxonoxConsole_, &InGameConsole::removeLast, '\b', true);
-    ib->registerListener(orxonoxConsole_, &InGameConsole::exit, (char)0x1B, true);
-
+    orxonoxHUD_ = &HUD::getSingleton();
     return true;
   }
@@ -379,5 +303,5 @@
     COUT(2) << "Loading level in server mode" << std::endl;
 
-    server_g = new network::Server();
+    server_g = new network::Server(serverPort_);
 
     if (!loadScene())
@@ -399,7 +323,9 @@
       client_g = network::Client::createSingleton();
     else
-      client_g = network::Client::createSingleton(serverIp_, NETWORK_PORT);
-
-    client_g->establishConnection();
+
+      client_g = network::Client::createSingleton(serverIp_, serverPort_);
+
+    if(!client_g->establishConnection())
+      return false;
     client_g->tick(0);
 
@@ -427,5 +353,15 @@
     Level* startlevel = new Level("levels/sample.oxw");
     Loader::open(startlevel);
-
+    
+    // HACK: shader stuff for presentation
+    /*Ogre::SceneManager* mSceneMgr = GraphicsEngine::getSingleton().getSceneManager();
+    mSceneMgr->setAmbientLight(ColourValue(0.4,0.4,0.4));
+    Ogre::Light* dirlight = mSceneMgr->createLight("Light1");
+
+    dirlight->setType(Ogre::Light::LT_DIRECTIONAL);
+    dirlight->setDirection(Vector3( 0, 1, 5 ));
+    dirlight->setDiffuseColour(ColourValue(0.6, 0.6, 0.4));
+    dirlight->setSpecularColour(ColourValue(1.0, 1.0, 1.0));*/
+    
     return true;
   }
@@ -453,11 +389,8 @@
     // Contains the times of recently fired events
     // eventTimes[4] is the list for the times required for the fps counter
-    std::deque<unsigned long> eventTimes[4];
+    std::deque<unsigned long> eventTimes[3];
     // Clear event times
-    for (int i = 0; i < 4; ++i)
+    for (int i = 0; i < 3; ++i)
       eventTimes[i].clear();
-    // fill the fps time list with zeros
-    for (int i = 0; i < 50; i++)
-      eventTimes[3].push_back(0);
 
     // use the ogre timer class to measure time.
@@ -466,15 +399,19 @@
     timer_->reset();
 
+    float renderTime = 0.0f;
+    float frameTime = 0.0f;
+    clock_t time = 0;
+
+    //Ogre::SceneManager* mSceneMgr = GraphicsEngine::getSingleton().getSceneManager();
+    //Ogre::Viewport* mViewport = mSceneMgr->getCurrentViewport();
+    
+    //Ogre::CompositorManager::getSingleton().addCompositor(mViewport, "Bloom");
+    //Ogre::CompositorManager::getSingleton().addCompositor(mViewport, "MotionBlur");
+
     COUT(3) << "Orxonox: Starting the main loop." << std::endl;
-	  while (!bAbort_)
-	  {
-		  // Pump messages in all registered RenderWindows
-      // This calls the WindowEventListener objects.
-      Ogre::WindowEventUtilities::messagePump();
-
+    while (!bAbort_)
+    {
       // get current time
       unsigned long now = timer_->getMilliseconds();
-      eventTimes[3].push_back(now);
-      eventTimes[3].erase(eventTimes[3].begin());
 
       // create an event to pass to the frameStarted method in ogre
@@ -482,18 +419,21 @@
       evt.timeSinceLastEvent = calculateEventTime(now, eventTimes[0]);
       evt.timeSinceLastFrame = calculateEventTime(now, eventTimes[1]);
+      frameTime += evt.timeSinceLastFrame;
 
       // show the current time in the HUD
-//      orxonoxHUD_->setTime((int)now, 0);
-//      orxonoxHUD_->setRocket2(ogreRoot.getCurrentFrameNumber());
-      if (eventTimes[3].back() - eventTimes[3].front() != 0)
-//        orxonoxHUD_->setRocket1((int)(50000.0f/(eventTimes[3].back() - eventTimes[3].front())));
-
-      // Iterate through all Tickables and call their tick(dt) function
+      // HUD::getSingleton().setTime(now);
+      if (mode_ != DEDICATED && frameTime > 0.4f)
+      {
+        HUD::getSingleton().setRenderTimeRatio(renderTime / frameTime);
+        frameTime = 0.0f;
+        renderTime = 0.0f;
+      }
+
+      // Call those objects that need the real time
+      for (Iterator<TickableReal> it = ObjectList<TickableReal>::start(); it; ++it)
+        it->tick((float)evt.timeSinceLastFrame);
+      // Call the scene objects
       for (Iterator<Tickable> it = ObjectList<Tickable>::start(); it; ++it)
         it->tick((float)evt.timeSinceLastFrame * this->timefactor_);
-      // Iterate through all TickableReals and call their tick(dt) function
-      for (Iterator<TickableReal> it = ObjectList<TickableReal>::start(); it; ++it)
-        it->tick((float)evt.timeSinceLastFrame);
-      orxonoxConsole_->tick((float)evt.timeSinceLastFrame);
 
       // don't forget to call _fireFrameStarted in ogre to make sure
@@ -501,23 +441,35 @@
       ogreRoot._fireFrameStarted(evt);
 
-      // server still renders at the moment
-      //if (mode_ != SERVER)
-      ogreRoot._updateAllRenderTargets(); // only render in non-server mode
-
       // get current time
       now = timer_->getMilliseconds();
+      calculateEventTime(now, eventTimes[2]);
+
+      if (mode_ != DEDICATED)
+      {
+        // Pump messages in all registered RenderWindows
+        // This calls the WindowEventListener objects.
+        Ogre::WindowEventUtilities::messagePump();
+
+        // render
+        ogreRoot._updateAllRenderTargets();
+      }
+
+      // get current time
+      now = timer_->getMilliseconds();
 
       // create an event to pass to the frameEnded method in ogre
       evt.timeSinceLastEvent = calculateEventTime(now, eventTimes[0]);
-      evt.timeSinceLastFrame = calculateEventTime(now, eventTimes[2]);
+      renderTime += calculateEventTime(now, eventTimes[2]);
 
       // again, just to be sure ogre works fine
       ogreRoot._fireFrameEnded(evt);
-	  }
-
-    if(mode_==CLIENT)
+      //msleep(200);
+    }
+
+    if (mode_ == CLIENT)
       network::Client::getSingleton()->closeConnection();
-    else if(mode_==SERVER)
+    else if (mode_ == SERVER)
       server_g->close();
+
     return true;
   }
@@ -560,12 +512,3 @@
     return (float)(times.back() - times.front()) / ((times.size() - 1) * 1000);
   }
-
-  /**
-   * Static function that shows the console in game mode.
-   */
-  void Orxonox::activateConsole()
-  {
-    // currently, the console shows itself when feeded with input.
-    InputManager::setInputState(InputManager::IS_CONSOLE);
-  }
 }
Index: code/trunk/src/orxonox/Orxonox.h
===================================================================
--- code/trunk/src/orxonox/Orxonox.h	(revision 1407)
+++ code/trunk/src/orxonox/Orxonox.h	(revision 1502)
@@ -50,5 +50,6 @@
     SERVER,
     CLIENT,
-    STANDALONE
+    STANDALONE,
+    DEDICATED
   };
 
@@ -70,5 +71,4 @@
       static inline float getTimeFactor() { return Orxonox::getSingleton()->timefactor_; }
       static inline void exit() { Orxonox::getSingleton()->abortRequest(); }
-      static inline void activateConsole();
 
    private:
@@ -97,5 +97,4 @@
       // TODO: make this a config-value by creating a config class for orxonox
       float                 frameSmoothingTime_;
-      InGameConsole*        orxonoxConsole_;
       HUD*                  orxonoxHUD_;
       bool                  bAbort_;        //!< aborts the render loop if true
@@ -105,4 +104,5 @@
       gameMode              mode_;
       std::string           serverIp_;
+      int                   serverPort_;
 
       static Orxonox *singletonRef_s;
Index: code/trunk/src/orxonox/OrxonoxPlatform.h
===================================================================
--- code/trunk/src/orxonox/OrxonoxPlatform.h	(revision 1407)
+++ 	(revision )
@@ -1,274 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      ...
- *   Co-authors:
- *      Reto Grieder
- *
- */
-
-/**
- @file
- @brief Various constants for compiler, architecture and platform. It's a mere
-        copy of the file found in the Ogre source code (OgrePlatform.h).
- */
-
-#ifndef _OrxonoxPlatform_H__
-#define _OrxonoxPlatform_H__
-
-namespace orxonox {
-/* Initial platform/compiler-related stuff to set.
-*/
-#define ORXONOX_PLATFORM_WIN32 1
-#define ORXONOX_PLATFORM_LINUX 2
-#define ORXONOX_PLATFORM_APPLE 3
-
-#define ORXONOX_COMPILER_MSVC 1
-#define ORXONOX_COMPILER_GNUC 2
-#define ORXONOX_COMPILER_BORL 3
-
-#define ORXONOX_ENDIAN_LITTLE 1
-#define ORXONOX_ENDIAN_BIG 2
-
-#define ORXONOX_ARCHITECTURE_32 1
-#define ORXONOX_ARCHITECTURE_64 2
-
-/* Finds the compiler type and version.
-*/
-#if defined( _MSC_VER )
-#  define ORXONOX_COMPILER ORXONOX_COMPILER_MSVC
-#  define ORXONOX_COMP_VER _MSC_VER
-
-#elif defined( __GNUC__ )
-#  define ORXONOX_COMPILER ORXONOX_COMPILER_GNUC
-#  define ORXONOX_COMP_VER (((__GNUC__)*100) + \
-        (__GNUC_MINOR__*10) + \
-        __GNUC_PATCHLEVEL__)
-
-#elif defined( __BORLANDC__ )
-#  define ORXONOX_COMPILER ORXONOX_COMPILER_BORL
-#  define ORXONOX_COMP_VER __BCPLUSPLUS__
-
-#else
-#  pragma error "No known compiler. Abort! Abort!"
-
-#endif
-
-/* See if we can use __forceinline or if we need to use __inline instead */
-#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
-#  if ORXONOX_COMP_VER >= 1200
-#    define FORCEINLINE __forceinline
-#  endif
-#elif defined(__MINGW32__)
-#  if !defined(FORCEINLINE)
-#    define FORCEINLINE __inline
-#  endif
-#else
-#  define FORCEINLINE __inline
-#endif
-
-/* Finds the current platform */
-
-#if defined( __WIN32__ ) || defined( _WIN32 )
-#  define ORXONOX_PLATFORM ORXONOX_PLATFORM_WIN32
-
-#elif defined( __APPLE_CC__)
-#  define ORXONOX_PLATFORM ORXONOX_PLATFORM_APPLE
-
-#else
-#  define ORXONOX_PLATFORM ORXONOX_PLATFORM_LINUX
-#endif
-
-    /* Find the arch type */
-#if defined(__x86_64__) || defined(_M_X64) || defined(__powerpc64__) || defined(__alpha__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__)
-#  define ORXONOX_ARCH_TYPE ORXONOX_ARCHITECTURE_64
-#else
-#  define ORXONOX_ARCH_TYPE ORXONOX_ARCHITECTURE_32
-#endif
-
-// For generating compiler warnings - should work on any compiler
-// As a side note, if you start your message with 'Warning: ', the MSVC
-// IDE actually does catch a warning :)
-// FIXME: Try this on linux box. Doesn't work with msvc
-//#define ORXONOX_QUOTE_INPLACE(x) # x
-//#define ORXONOX_QUOTE(x) ORXONOX_QUOTE_INPLACE(x)
-//#define ORXONOX_WARN( x )  message( __FILE__ "(" QUOTE( __LINE__ ) ") : " x "\n" )
-
-//----------------------------------------------------------------------------
-// Windows Settings
-#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
-
-// Win32 compilers use _DEBUG for specifying debug builds.
-#  ifdef _DEBUG
-#    define ORXONOX_DEBUG_MODE 1
-#  else
-#    define ORXONOX_DEBUG_MODE 0
-#  endif
-
-// Disable unicode support on MingW at the moment, poorly supported in stdlibc++
-// STLPORT fixes this though so allow if found
-// MinGW C++ Toolkit supports unicode and sets the define __MINGW32_TOOLKIT_UNICODE__ in _mingw.h
-#  if defined( __MINGW32__ ) && !defined(_STLPORT_VERSION)
-#    include<_mingw.h>
-#    if defined(__MINGW32_TOOLBOX_UNICODE__)
-#      define ORXONOX_UNICODE_SUPPORT 1
-#    else
-#      define ORXONOX_UNICODE_SUPPORT 0
-#    endif
-#  else
-#    define ORXONOX_UNICODE_SUPPORT 1
-#  endif
-
-#endif /* Platform Win32 */
-//----------------------------------------------------------------------------
-
-//----------------------------------------------------------------------------
-// Linux/Apple Settings
-#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_LINUX || ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE
-
-
-// A quick define to overcome different names for the same function
-#  define stricmp strcasecmp
-
-// Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when
-// specifying a debug build.
-// (??? this is wrong, on Linux debug builds aren't marked in any way unless
-// you mark it yourself any way you like it -- zap ???)
-#  ifdef DEBUG
-#    define ORXONOX_DEBUG_MODE 1
-#  else
-#    define ORXONOX_DEBUG_MODE 0
-#  endif
-
-/* FIXME: Check what this actually is and whether we need it or not
-#  if ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE
-#    define ORXONOX_PLATFORM_LIB "OrxonoxPlatform.bundle"
-#  else
-// ORXONOX_PLATFORM_LINUX
-#    define ORXONOX_PLATFORM_LIB "libOrxonoxPlatform.so"
-#  endif
-*/
-
-// Always enable unicode support for the moment
-// Perhaps disable in old versions of gcc if necessary
-#  define ORXONOX_UNICODE_SUPPORT 1
-
-#endif /* Patform Linux/Apple */
-
-//For apple, we always have a custom config.h file
-#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE
-#  include "config.h"
-#endif
-
-//----------------------------------------------------------------------------
-
-//----------------------------------------------------------------------------
-// Endian Settings
-// check for BIG_ENDIAN config flag, set ORXONOX_ENDIAN correctly
-#ifdef ORXONOX_CONFIG_BIG_ENDIAN
-#  define ORXONOX_ENDIAN ORXONOX_ENDIAN_BIG
-#else
-#  define ORXONOX_ENDIAN ORXONOX_ENDIAN_LITTLE
-#endif
-
-// Integer formats of fixed bit width
-// FIXME: consider 64 bit platforms!
-//typedef unsigned int uint32;
-//typedef unsigned short uint16;
-//typedef unsigned char uint8;
-// proper approach
-
-#ifdef ORXONOX_DOUBLE_PRECISION
-typedef double Real;
-#else
-typedef float Real;
-#endif
-
-
-#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
-// Turn off warnings generated by long std templates
-// This warns about truncation to 255 characters in debug/browse info
-//#   pragma warning (disable : 4786)
-
-// Turn off warnings generated by long std templates
-// This warns about truncation to 255 characters in debug/browse info
-//#   pragma warning (disable : 4503)
-
-// disable: conversion from 'double' to 'float', possible loss of data
-// disable: conversion from 'ogg_int64_t' to 'long', possible loss of data
-// This has been dealt with in base_properties of the solution since the
-// warning primarily occurs in library header files (which are mostly
-// included before OrxonoxPlatform.h is)
-//#   pragma warning (disable : 4244)
-
-// disable: "conversion from 'size_t' to 'unsigned int', possible loss of data
-//#   pragma warning (disable : 4267)
-
-// disable: "truncation from 'double' to 'float'
-//#   pragma warning (disable : 4305)
-
-// set to level 4: "<type> needs to have dll-interface to be used by clients'
-// Happens on STL member variables which are not public therefore is ok
-#   pragma warning (disable : 4251)
-
-// disable: 'MultiTypeString' : multiple assignment operators specified
-// Used in MultiType and works fine so far
-//#   pragma warning (disable : 4522)
-
-// disable: "non dll-interface class used as base for dll-interface class"
-// Happens when deriving from Singleton because bug in compiler ignores
-// template export
-//#   pragma warning (disable : 4275)
-
-// disable: "C++ Exception Specification ignored"
-// This is because MSVC 6 did not implement all the C++ exception
-// specifications in the ANSI C++ draft.
-//#   pragma warning( disable : 4290 )
-
-// disable: "no suitable definition provided for explicit template
-// instantiation request" Occurs in VC7 for no justifiable reason on all
-// #includes of Singleton
-//#   pragma warning( disable: 4661)
-
-// disable: deprecation warnings when using CRT calls in VC8
-// These show up on all C runtime lib code in VC8, disable since they clutter
-// the warnings with things we may not be able to do anything about (e.g.
-// generated code from nvparse etc). I doubt very much that these calls
-// will ever be actually removed from VC anyway, it would break too much code.
-//#	pragma warning( disable: 4996)
-
-// disable: "conditional expression constant", always occurs on
-// ORXONOX_MUTEX_CONDITIONAL when no threading enabled
-//#   pragma warning (disable : 201)
-
-
-// Define the english written operators like and, or, xor
-#include <iso646.h>
-
-#endif /* ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC */
-
-// include visual leak detector to search for memory leaks
-//#include <vld.h>
-
-} /* namespace orxonox */
-
-#endif /* _OrxonoxPlatform_H__ */
Index: code/trunk/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/trunk/src/orxonox/OrxonoxPrereqs.h	(revision 1407)
+++ code/trunk/src/orxonox/OrxonoxPrereqs.h	(revision 1502)
@@ -35,5 +35,5 @@
 #define _OrxonoxPrereqs_H__
 
-#include "OrxonoxPlatform.h"
+#include "util/OrxonoxPlatform.h"
 
 //-----------------------------------------------------------------------
@@ -74,4 +74,5 @@
   class Skybox;
   class SpaceShip;
+  class SpaceShipAI;
   class WorldEntity;
 
@@ -95,5 +96,10 @@
 
   // hud
+  class BarOverlayElement;
   class HUD;
+  class Navigation;
+  class RadarObject;
+  class RadarOverlayElement;
+
   //console
   class InGameConsole;
Index: code/trunk/src/orxonox/OrxonoxStableHeaders.h
===================================================================
--- code/trunk/src/orxonox/OrxonoxStableHeaders.h	(revision 1407)
+++ code/trunk/src/orxonox/OrxonoxStableHeaders.h	(revision 1502)
@@ -35,5 +35,5 @@
 #define _OrxonoxStableHeaders_H__
 
-#include "OrxonoxPlatform.h"
+#include "util/OrxonoxPlatform.h"
 
 #if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
@@ -109,5 +109,4 @@
 #include "network/Synchronisable.h"
 
-#include "OrxonoxPlatform.h"
 #include "OrxonoxPrereqs.h"
 #include "tools/Timer.h"
Index: code/trunk/src/orxonox/console/InGameConsole.cc
===================================================================
--- code/trunk/src/orxonox/console/InGameConsole.cc	(revision 1407)
+++ code/trunk/src/orxonox/console/InGameConsole.cc	(revision 1502)
@@ -23,5 +23,5 @@
  *      Felix Schulthess
  *   Co-authors:
- *      ...
+ *      Fabian 'x3n' Landau
  *
  */
@@ -40,243 +40,513 @@
 #include "core/Debug.h"
 #include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
 #include "core/ConsoleCommand.h"
 #include "core/InputManager.h"
+#include "util/Math.h"
 #include "GraphicsEngine.h"
 
-#define LINES 20
+#define LINES 30
+#define CHAR_WIDTH1 7.78 //34 // fix this please - determine the char-width dynamically
+#define CHAR_WIDTH2 8.28 // fix this please - determine the char-width dynamically
+#define CHAR_WIDTH3 7.80 //78 // fix this please - determine the char-width dynamically
 
 namespace orxonox
 {
+    SetConsoleCommand(InGameConsole, openConsole, true);
+    SetConsoleCommand(InGameConsole, closeConsole, true);
+
     using namespace Ogre;
 
-    const float REL_WIDTH = 0.8;
-    const float REL_HEIGHT = 0.4;
-    const float BLINK = 0.25;
-
-    InGameConsole::InGameConsole(InputBuffer* ib) :
-        windowW(0), windowH(0),
-        scroll(0), scrollTimer(0.0f),
-        cursor(0.0f),
-        active(false),
-        ib_(ib),
-        om(0),
-        consoleOverlay(0),
-        consoleOverlayContainer(0),
-        consoleOverlayNoise(0),
-        consoleOverlayBorder(0),
-        consoleOverlayTextAreas(0)
-    {
-        //RegisterObject(InGameConsole);
-        init();
-    }
-
-    InGameConsole::~InGameConsole(void){
-        for(int i=0; i<LINES; i++) delete consoleOverlayTextAreas[i];
-        delete consoleOverlayTextAreas;
-    }
-
-    void InGameConsole::listen(){
-        if(!active) activate();
-        print(convert2UTF(this->ib_->get()));
-    }
-
-    void InGameConsole::execute(){	
-        newline();
-        if (!CommandExecutor::execute(this->ib_->get())){
-            print("Error");
-            newline();
-        }
-        this->ib_->clear();
-    }
-
-    void InGameConsole::hintandcomplete(){
-        print(CommandExecutor::hint(this->ib_->get()));
-        newline();
-        this->ib_->set(CommandExecutor::complete(this->ib_->get()));
-        print(convert2UTF(this->ib_->get()));
-    }
-
-    void InGameConsole::clear(){
-        this->ib_->clear();
-    }
-
-    void InGameConsole::removeLast(){
-        this->ib_->removeLast();
-    }
-
-    void InGameConsole::exit(){
-        clear();
-        deactivate();
-        InputManager::setInputState(InputManager::IS_NORMAL);
-    }
-
-    /**
-    @brief called once by constructor
-    */
-    void InGameConsole::init(){
+    float InGameConsole::REL_WIDTH = 0.8;
+    float InGameConsole::REL_HEIGHT = 0.4;
+    float InGameConsole::BLINK = 0.5;
+
+    /**
+        @brief Constructor: Creates and initializes the InGameConsole.
+    */
+    InGameConsole::InGameConsole() :
+        om_(0), consoleOverlay_(0), consoleOverlayContainer_(0),
+        consoleOverlayNoise_(0), consoleOverlayBorder_(0), consoleOverlayTextAreas_(0)
+    {
+        RegisterObject(InGameConsole);
+
+        this->active_ = false;
+        this->cursor_ = 0.0;
+        this->cursorSymbol_ = '|';
+        this->inputWindowStart_ = 0;
+        this->numLinesShifted_ = LINES - 1;
+
+        this->init();
+        this->setConfigValues();
+
+        Shell::getInstance().addOutputLevel(true);
+    }
+
+    /**
+        @brief Destructor: Destroys the TextAreas.
+    */
+    InGameConsole::~InGameConsole(void)
+    {
+        /*for (int i = 0; i < LINES; i++)
+            if (this->consoleOverlayTextAreas_[i])
+                om_->destroyOverlayElement(this->consoleOverlayTextAreas_[i]);
+
+        if (this->consoleOverlayTextAreas_)
+            delete[] this->consoleOverlayTextAreas_;*/
+    }
+
+    /**
+        @brief Returns a reference to the only existing instance of InGameConsole.
+    */
+    InGameConsole& InGameConsole::getInstance()
+    {
+        static InGameConsole instance;
+        return instance;
+    }
+
+    /**
+        @brief Sets the config values, describing the size of the console.
+    */
+    void InGameConsole::setConfigValues()
+    {
+        SetConfigValue(REL_WIDTH, 0.8);
+        SetConfigValue(REL_HEIGHT, 0.4);
+        SetConfigValue(BLINK, 0.5);
+    }
+
+    /**
+        @brief Called if all output-lines have to be redrawn.
+    */
+    void InGameConsole::linesChanged()
+    {
+        std::list<std::string>::const_iterator it = Shell::getInstance().getNewestLineIterator();
+        int max = 0;
+        for (int i = 1; i < LINES; ++i)
+        {
+            if (it != Shell::getInstance().getEndIterator())
+            {
+                ++it;
+                max = i;
+            }
+            else
+                break;
+        }
+
+        for (int i = LINES - 1; i > max; --i)
+            this->print("", i, true);
+
+        for (int i = max; i >= 1; --i)
+        {
+            --it;
+            this->print(*it, i, true);
+        }
+    }
+
+    /**
+        @brief Called if only the last output-line has changed.
+    */
+    void InGameConsole::onlyLastLineChanged()
+    {
+        if (LINES > 1)
+            this->print(*Shell::getInstance().getNewestLineIterator(), 1);
+    }
+
+    /**
+        @brief Called if a new output-line was added.
+    */
+    void InGameConsole::lineAdded()
+    {
+        this->numLinesShifted_ = 0;
+        this->shiftLines();
+        this->onlyLastLineChanged();
+    }
+
+    /**
+        @brief Called if the text in the input-line has changed.
+    */
+    void InGameConsole::inputChanged()
+    {
+        if (LINES > 0)
+            this->print(Shell::getInstance().getInput(), 0);
+
+        if (Shell::getInstance().getInput() == "" || Shell::getInstance().getInput().size() == 0)
+            this->inputWindowStart_ = 0;
+    }
+
+    /**
+        @brief Called if the position of the cursor in the input-line has changed.
+    */
+    void InGameConsole::cursorChanged()
+    {
+        /*std::string input = Shell::getInstance().getInput();
+        input.insert(Shell::getInstance().getCursorPosition(), 1, this->cursorSymbol_);
+        if (LINES > 0)
+            this->print(input, 0);*/
+        this->setCursorPosition(Shell::getInstance().getCursorPosition() - inputWindowStart_);
+    }
+
+    /**
+        @brief Called if the console gets closed.
+    */
+    void InGameConsole::exit()
+    {
+        this->deactivate();
+    }
+
+    /**
+        @brief Called once by constructor, initializes the InGameConsole.
+    */
+    void InGameConsole::init()
+    {
         // for the beginning, don't scroll
-        scroll = 0;
-        scrollTimer = 0;
-        cursor = 0;
+        this->scroll_ = 0;
+        this->scrollTimer_ = 0;
+        this->cursor_ = 0;
 
         // create overlay and elements
-        om = &Ogre::OverlayManager::getSingleton();
+        this->om_ = &Ogre::OverlayManager::getSingleton();
 
         // create a container
-        consoleOverlayContainer = static_cast<OverlayContainer*>(om->createOverlayElement("Panel", "container"));
-        consoleOverlayContainer->setMetricsMode(Ogre::GMM_RELATIVE);
-        consoleOverlayContainer->setPosition((1-REL_WIDTH)/2, 0);
-        consoleOverlayContainer->setDimensions(REL_WIDTH, REL_HEIGHT);
+        this->consoleOverlayContainer_ = static_cast<OverlayContainer*>(this->om_->createOverlayElement("Panel", "InGameConsoleContainer"));
+        this->consoleOverlayContainer_->setMetricsMode(Ogre::GMM_RELATIVE);
+        this->consoleOverlayContainer_->setPosition((1 - InGameConsole::REL_WIDTH) / 2, 0);
+        this->consoleOverlayContainer_->setDimensions(InGameConsole::REL_WIDTH, InGameConsole::REL_HEIGHT);
 
         // create BorderPanel
-        consoleOverlayBorder = static_cast<BorderPanelOverlayElement*>(om->createOverlayElement("BorderPanel", "borderPanel"));
-        consoleOverlayBorder->setMetricsMode(Ogre::GMM_PIXELS);
-        consoleOverlayBorder->setMaterialName("ConsoleCenter");
+        this->consoleOverlayBorder_ = static_cast<BorderPanelOverlayElement*>(this->om_->createOverlayElement("BorderPanel", "InGameConsoleBorderPanel"));
+        this->consoleOverlayBorder_->setMetricsMode(Ogre::GMM_PIXELS);
+        this->consoleOverlayBorder_->setMaterialName("ConsoleCenter");
         // set parameters for border
-        consoleOverlayBorder->setBorderSize(16, 16, 0, 16);
-        consoleOverlayBorder->setBorderMaterialName("ConsoleBorder");
-        consoleOverlayBorder->setLeftBorderUV(0.0, 0.49, 0.5, 0.51);
-        consoleOverlayBorder->setRightBorderUV(0.5, 0.49, 1.0, 0.5);
-        consoleOverlayBorder->setBottomBorderUV(0.49, 0.5, 0.51, 1.0);
-        consoleOverlayBorder->setBottomLeftBorderUV(0.0, 0.5, 0.5, 1.0);
-        consoleOverlayBorder->setBottomRightBorderUV(0.5, 0.5, 1.0, 1.0);
+        this->consoleOverlayBorder_->setBorderSize(16, 16, 0, 16);
+        this->consoleOverlayBorder_->setBorderMaterialName("ConsoleBorder");
+        this->consoleOverlayBorder_->setLeftBorderUV(0.0, 0.49, 0.5, 0.51);
+        this->consoleOverlayBorder_->setRightBorderUV(0.5, 0.49, 1.0, 0.5);
+        this->consoleOverlayBorder_->setBottomBorderUV(0.49, 0.5, 0.51, 1.0);
+        this->consoleOverlayBorder_->setBottomLeftBorderUV(0.0, 0.5, 0.5, 1.0);
+        this->consoleOverlayBorder_->setBottomRightBorderUV(0.5, 0.5, 1.0, 1.0);
 
         // create the text lines
-        consoleOverlayTextAreas = new TextAreaOverlayElement*[LINES];
-        for(int i = 0; i<LINES; i++){
-            consoleOverlayTextAreas[i] = static_cast<TextAreaOverlayElement*>(om->createOverlayElement("TextArea", "textArea"+Ogre::StringConverter::toString(i)));
-            consoleOverlayTextAreas[i]->setMetricsMode(Ogre::GMM_PIXELS);
-            consoleOverlayTextAreas[i]->setFontName("Console");
-            consoleOverlayTextAreas[i]->setCharHeight(20);
-            consoleOverlayTextAreas[i]->setParameter("colour_top", "0.21 0.69 0.21");
-            consoleOverlayTextAreas[i]->setLeft(8);
-            consoleOverlayTextAreas[i]->setCaption("");
+        this->consoleOverlayTextAreas_ = new TextAreaOverlayElement*[LINES];
+        for (int i = 0; i < LINES; i++)
+        {
+            this->consoleOverlayTextAreas_[i] = static_cast<TextAreaOverlayElement*>(this->om_->createOverlayElement("TextArea", "InGameConsoleTextArea" + Ogre::StringConverter::toString(i)));
+            this->consoleOverlayTextAreas_[i]->setMetricsMode(Ogre::GMM_PIXELS);
+            this->consoleOverlayTextAreas_[i]->setFontName("Console");
+            this->consoleOverlayTextAreas_[i]->setCharHeight(18);
+            this->consoleOverlayTextAreas_[i]->setParameter("colour_top", "0.21 0.69 0.21");
+            this->consoleOverlayTextAreas_[i]->setLeft(8);
+            this->consoleOverlayTextAreas_[i]->setCaption("");
         }
 
         // create noise
-        consoleOverlayNoise = static_cast<PanelOverlayElement*>(om->createOverlayElement("Panel", "noise"));
-        consoleOverlayNoise->setMetricsMode(Ogre::GMM_PIXELS);
-        consoleOverlayNoise->setPosition(5,0);
-        consoleOverlayNoise->setMaterialName("ConsoleNoise");
-
-        consoleOverlay = om->create("Console");
-        consoleOverlay->add2D(consoleOverlayContainer);
-        consoleOverlayContainer->addChild(consoleOverlayBorder);
-//comment following line to disable noise
-        consoleOverlayContainer->addChild(consoleOverlayNoise);
-        for(int i = 0; i<LINES; i++) consoleOverlayContainer->addChild(consoleOverlayTextAreas[i]);
-        resize();
+        this->consoleOverlayNoise_ = static_cast<PanelOverlayElement*>(this->om_->createOverlayElement("Panel", "InGameConsoleNoise"));
+        this->consoleOverlayNoise_->setMetricsMode(Ogre::GMM_PIXELS);
+        this->consoleOverlayNoise_->setPosition(5,0);
+        this->consoleOverlayNoise_->setMaterialName("ConsoleNoise");
+
+        // create cursor
+        this->consoleOverlayCursor_ = static_cast<PanelOverlayElement*>(this->om_->createOverlayElement("Panel", "InGameConsoleCursor"));
+        this->consoleOverlayCursor_->setMetricsMode(Ogre::GMM_PIXELS);
+        this->consoleOverlayCursor_->setPosition(5,219);
+        this->consoleOverlayCursor_->setDimensions(1, 14);
+        this->consoleOverlayCursor_->setMaterialName("Orxonox/GreenDot");
+
+        this->consoleOverlay_ = this->om_->create("InGameConsoleConsole");
+        this->consoleOverlay_->add2D(this->consoleOverlayContainer_);
+        this->consoleOverlayContainer_->addChild(this->consoleOverlayBorder_);
+        this->consoleOverlayContainer_->addChild(this->consoleOverlayCursor_);
+        //comment following line to disable noise
+        this->consoleOverlayContainer_->addChild(this->consoleOverlayNoise_);
+        for (int i = 0; i < LINES; i++)
+            this->consoleOverlayContainer_->addChild(this->consoleOverlayTextAreas_[i]);
+
+        this->resize();
 
         // move overlay "above" the top edge of the screen
         // we take -1.2 because the border mkes the panel bigger
-        consoleOverlayContainer->setTop(-1.2*REL_HEIGHT);
+        this->consoleOverlayContainer_->setTop(-1.2 * InGameConsole::REL_HEIGHT);
         // show overlay
-        consoleOverlay->show();
-
-        COUT(3) << "Info: InGameConsole initialized" << std::endl;
-    }
-
-    /**
-    @brief used to control the actual scrolling and cursor
-    */
-    void InGameConsole::tick(float dt){
-        scrollTimer += dt;
-        if(scrollTimer >= 0.01){
-            float top = consoleOverlayContainer->getTop();
-            scrollTimer = 0;
-            if(scroll!=0){
+        this->consoleOverlay_->show();
+
+        COUT(4) << "Info: InGameConsole initialized" << std::endl;
+    }
+
+    /**
+        @brief Resizes the console elements. Call if window size changes.
+    */
+    void InGameConsole::resize()
+    {
+        this->windowW_ = GraphicsEngine::getSingleton().getWindowWidth();
+        this->windowH_ = GraphicsEngine::getSingleton().getWindowHeight();
+        this->consoleOverlayBorder_->setWidth((int) this->windowW_* InGameConsole::REL_WIDTH);
+        this->consoleOverlayBorder_->setHeight((int) this->windowH_ * InGameConsole::REL_HEIGHT);
+        this->consoleOverlayNoise_->setWidth((int) this->windowW_ * InGameConsole::REL_WIDTH - 10);
+        this->consoleOverlayNoise_->setHeight((int) this->windowH_ * InGameConsole::REL_HEIGHT - 5);
+
+        // now adjust the text lines...
+        this->desiredTextWidth_ = (int) (this->windowW_ * InGameConsole::REL_WIDTH) - 12;
+
+        if (LINES > 0)
+            this->maxCharsPerLine_ = max((unsigned int)10, (unsigned int) ((float)this->desiredTextWidth_ / CHAR_WIDTH3));
+        else
+            this->maxCharsPerLine_ = 10;
+
+        for (int i = 0; i < LINES; i++)
+        {
+            this->consoleOverlayTextAreas_[i]->setWidth(this->desiredTextWidth_);
+            this->consoleOverlayTextAreas_[i]->setTop((int) this->windowH_ * InGameConsole::REL_HEIGHT - 24 - 14*i);
+        }
+
+        this->linesChanged();
+    }
+
+    /**
+        @brief Used to control the actual scrolling and the cursor.
+    */
+    void InGameConsole::tick(float dt)
+    {
+        this->scrollTimer_ += dt;
+        if (this->scrollTimer_ >= 0.01)
+        {
+            float top = this->consoleOverlayContainer_->getTop();
+            float timePassed = scrollTimer_;
+            this->scrollTimer_ = 0;
+            if (this->scroll_ != 0)
+            {
                 // scroll
-                top = top + 0.02*scroll;
-                consoleOverlayContainer->setTop(top);
+                top = top + timePassed * this->scroll_;
+                this->consoleOverlayContainer_->setTop(top);
             }
-            if(top <= -1.2*REL_HEIGHT){
+            if (top <= -1.2 * InGameConsole::REL_HEIGHT)
+            {
                 // window has completely scrolled up
-                scroll = 0;
-                consoleOverlay->hide();
-                active = false;
+                this->scroll_ = 0;
+                this->consoleOverlay_->hide();
+                this->active_ = false;
+                Shell::getInstance().unregisterListener(this);
             }
-            if(top >= 0){
+            if (top >= 0)
+            {
                 // window has completely scrolled down
-                scroll = 0;
-                consoleOverlayContainer->setTop(0);
-                active = true;
+                this->scroll_ = 0;
+                this->consoleOverlayContainer_->setTop(0);
+                this->active_ = true;
             }
         }
 
-        cursor += dt;
-        if(cursor >= 2*BLINK) cursor = 0;
-        print(convert2UTF(this->ib_->get()));
-
-// this creates a flickering effect
-        consoleOverlayNoise->setTiling(1, rand()%5+1);
-    }
-
-    /**
-    @brief resizes the console elements. call if window size changes
-    */
-    void InGameConsole::resize(){
-        windowW = GraphicsEngine::getSingleton().getWindowWidth();
-        windowH = GraphicsEngine::getSingleton().getWindowHeight();
-        consoleOverlayBorder->setWidth((int) windowW*REL_WIDTH);
-        consoleOverlayBorder->setHeight((int) windowH*REL_HEIGHT);
-        consoleOverlayNoise->setWidth((int) windowW*REL_WIDTH - 10);
-        consoleOverlayNoise->setHeight((int) windowH*REL_HEIGHT - 5);
-        // now adjust the text lines...
-        for(int i = 0; i<LINES; i++){
-            consoleOverlayTextAreas[i]->setWidth(windowW*REL_WIDTH);
-            consoleOverlayTextAreas[i]->setTop((int)windowH*REL_HEIGHT - 24 - 16*i);
-        }
-    }
-
-    /**
-    @brief shows console
-    */
-    void InGameConsole::activate(){
-        consoleOverlay->show();
+        this->cursor_ += dt;
+        if (this->cursor_ >= InGameConsole::BLINK)
+        {
+            this->cursor_ = 0;
+            bShowCursor_ = !bShowCursor_;
+            if (bShowCursor_)
+              this->consoleOverlayCursor_->show();
+            else
+              this->consoleOverlayCursor_->hide();
+        }
+
+        /*if (this->cursor_ >= 2 * InGameConsole::BLINK)
+          this->cursor_ = 0;
+
+        if (this->cursor_ >= InGameConsole::BLINK && this->cursorSymbol_ == '|')
+        {
+            this->cursorSymbol_ = ' ';
+            this->cursorChanged();
+        }
+        else if (this->cursor_ < InGameConsole::BLINK && this->cursorSymbol_ == ' ')
+        {
+            this->cursorSymbol_ = '|';
+            this->cursorChanged();
+        }*/
+
+        // this creates a flickering effect
+        this->consoleOverlayNoise_->setTiling(1, rand() % 5 + 1);
+    }
+
+    /**
+        @brief Shows the InGameConsole.
+    */
+    void InGameConsole::activate()
+    {
+        InputManager::setInputState(InputManager::IS_CONSOLE);
+        Shell::getInstance().registerListener(this);
+        this->linesChanged();
+
+        this->consoleOverlay_->show();
         // just in case window size has changed...
-        resize();
+        this->resize();
         // scroll down
-        scroll = 1;
+        this->scroll_ = 1;
         // the rest is done by tick
     }
 
     /**
-    @brief hides console
-    */
-    void InGameConsole::deactivate(){
+    @brief Hides the InGameConsole.
+    */
+    void InGameConsole::deactivate()
+    {
         // scroll up
-        scroll = -1;
+        this->scroll_ = -1;
         // the rest is done by tick
-    }
-
-    /**
-    @brief prints string to bottom line
-    @param s string to be printed
-    */
-    void InGameConsole::print(Ogre::UTFString s){
-        if(cursor>BLINK) consoleOverlayTextAreas[0]->setCaption(">" + s);
-        else consoleOverlayTextAreas[0]->setCaption(">" + s + "_");
-    }
-
-    /**
-    @brief shifts all lines up and clears the bottom line
-    */
-    void InGameConsole::newline(){
-        Ogre::UTFString line;
-        for(int i = LINES-1; i>=1; i--){
-            line = consoleOverlayTextAreas[i-1]->getCaption();
-            // don't copy the cursor...
-            int l = line.length();
-            if(!line.empty() && line.substr(l-1) == "_") line.erase(l-1);
-            consoleOverlayTextAreas[i]->setCaption(line);
-        }
-        consoleOverlayTextAreas[0]->setCaption(">");
-    }
-
-    Ogre::UTFString InGameConsole::convert2UTF(std::string s){
+        InputManager::setInputState(InputManager::IS_NORMAL);
+    }
+
+    /**
+        @brief Activates the console.
+    */
+    void InGameConsole::openConsole()
+    {
+        InGameConsole::getInstance().activate();
+    }
+
+    /**
+        @brief Deactivates the console.
+    */
+    void InGameConsole::closeConsole()
+    {
+        InGameConsole::getInstance().deactivate();
+    }
+
+    /**
+        @brief Shifts all output lines one line up
+    */
+    void InGameConsole::shiftLines()
+    {
+        for (unsigned int i = LINES - 1; i > 1; --i)
+        {
+            this->consoleOverlayTextAreas_[i]->setCaption(this->consoleOverlayTextAreas_[i - 1]->getCaption());
+            this->consoleOverlayTextAreas_[i]->setColourTop(this->consoleOverlayTextAreas_[i - 1]->getColourTop());
+            this->consoleOverlayTextAreas_[i]->setColourBottom(this->consoleOverlayTextAreas_[i - 1]->getColourBottom());
+        }
+    }
+
+    void InGameConsole::colourLine(int colourcode, int index)
+    {
+        if (colourcode == -1)
+        {
+            this->consoleOverlayTextAreas_[index]->setColourTop   (ColourValue(0.90, 0.90, 0.90, 1.00));
+            this->consoleOverlayTextAreas_[index]->setColourBottom(ColourValue(1.00, 1.00, 1.00, 1.00));
+        }
+        else if (colourcode == 1)
+        {
+            this->consoleOverlayTextAreas_[index]->setColourTop   (ColourValue(0.95, 0.25, 0.25, 1.00));
+            this->consoleOverlayTextAreas_[index]->setColourBottom(ColourValue(1.00, 0.50, 0.50, 1.00));
+        }
+        else if (colourcode == 2)
+        {
+            this->consoleOverlayTextAreas_[index]->setColourTop   (ColourValue(0.95, 0.50, 0.20, 1.00));
+            this->consoleOverlayTextAreas_[index]->setColourBottom(ColourValue(1.00, 0.70, 0.50, 1.00));
+        }
+        else if (colourcode == 3)
+        {
+            this->consoleOverlayTextAreas_[index]->setColourTop   (ColourValue(0.50, 0.50, 0.95, 1.00));
+            this->consoleOverlayTextAreas_[index]->setColourBottom(ColourValue(0.80, 0.80, 1.00, 1.00));
+        }
+        else if (colourcode == 4)
+        {
+            this->consoleOverlayTextAreas_[index]->setColourTop   (ColourValue(0.65, 0.48, 0.44, 1.00));
+            this->consoleOverlayTextAreas_[index]->setColourBottom(ColourValue(1.00, 0.90, 0.90, 1.00));
+        }
+        else if (colourcode == 5)
+        {
+            this->consoleOverlayTextAreas_[index]->setColourTop   (ColourValue(0.40, 0.20, 0.40, 1.00));
+            this->consoleOverlayTextAreas_[index]->setColourBottom(ColourValue(0.80, 0.60, 0.80, 1.00));
+        }
+        else
+        {
+            this->consoleOverlayTextAreas_[index]->setColourTop   (ColourValue(0.21, 0.69, 0.21, 1.00));
+            this->consoleOverlayTextAreas_[index]->setColourBottom(ColourValue(0.80, 1.00, 0.80, 1.00));
+        }
+    }
+
+    void InGameConsole::setCursorPosition(int pos)
+    {
+        static std::string char1 = "bdefgilpqtzCEGIJKNOPQT5[}äü";
+        static std::string char2 = "Z4";
+
+        if (pos > (int)maxCharsPerLine_)
+          pos = maxCharsPerLine_;
+        else if (pos < 0)
+          pos = 0;
+
+        float width = 0;
+        for (int i = 0; i < pos; ++i)
+        {
+            if (char1.find(displayedText_[i]) != std::string::npos)
+                width += CHAR_WIDTH1;
+            else if (char2.find(displayedText_[i]) != std::string::npos)
+                width += CHAR_WIDTH2;
+            else
+                width += CHAR_WIDTH3;
+        }
+        this->consoleOverlayCursor_->setPosition(width + 5, this->windowH_ * InGameConsole::REL_HEIGHT - 20);
+    }
+
+    /**
+        @brief Prints string to bottom line.
+        @param s String to be printed
+    */
+    void InGameConsole::print(const std::string& text, int index, bool alwaysShift)
+    {
+        char level = 0;
+        if (text.size() > 0)
+            level = text[0];
+
+        std::string output = text;
+
+        if (level >= -1 && level <= 5)
+            output.erase(0, 1);
+
+        if (LINES > index)
+        {
+            this->colourLine(level, index);
+
+            if (index > 0)
+            {
+                unsigned int linesUsed = 1;
+                while (output.size() > this->maxCharsPerLine_)
+                {
+                    ++linesUsed;
+                    this->consoleOverlayTextAreas_[index]->setCaption(convert2UTF(output.substr(0, this->maxCharsPerLine_)));
+                    output.erase(0, this->maxCharsPerLine_);
+                    output.insert(0, 1, ' ');
+                    if (linesUsed > numLinesShifted_ || alwaysShift)
+                        this->shiftLines();
+                    this->colourLine(level, index);
+                }
+                this->consoleOverlayTextAreas_[index]->setCaption(convert2UTF(output));
+                this->displayedText_ = output;
+                this->numLinesShifted_ = linesUsed;
+            }
+            else
+            {
+                if (output.size() > this->maxCharsPerLine_)
+                {
+                    if (Shell::getInstance().getInputBuffer().getCursorPosition() < this->inputWindowStart_)
+                        this->inputWindowStart_ = Shell::getInstance().getInputBuffer().getCursorPosition();
+                    else if (Shell::getInstance().getInputBuffer().getCursorPosition() >= (this->inputWindowStart_ + this->maxCharsPerLine_ - 1))
+                        this->inputWindowStart_ = Shell::getInstance().getInputBuffer().getCursorPosition() - this->maxCharsPerLine_ + 1;
+
+                    output = output.substr(this->inputWindowStart_, this->maxCharsPerLine_);
+                }
+                else
+                  this->inputWindowStart_ = 0;
+                this->displayedText_ = output;
+                this->consoleOverlayTextAreas_[index]->setCaption(convert2UTF(output));
+            }
+        }
+    }
+
+    /**
+        @brief Converts a string into an Ogre::UTFString.
+        @param s The string to convert
+        @return The converted string
+    */
+    Ogre::UTFString InGameConsole::convert2UTF(std::string s)
+    {
         Ogre::UTFString utf;
-        int i;
         Ogre::UTFString::code_point cp;
-        for (i=0; i<(int)s.size(); ++i){
+        for (unsigned int i = 0; i < s.size(); ++i)
+        {
           cp = s[i];
           cp &= 0xFF;
Index: code/trunk/src/orxonox/console/InGameConsole.h
===================================================================
--- code/trunk/src/orxonox/console/InGameConsole.h	(revision 1407)
+++ code/trunk/src/orxonox/console/InGameConsole.h	(revision 1502)
@@ -23,5 +23,5 @@
  *      Felix Schulthess
  *   Co-authors:
- *      ...
+ *      Fabian 'x3n' Landau
  *
  */
@@ -37,44 +37,67 @@
 
 #include "core/Tickable.h"
-#include "core/InputBuffer.h"
+#include "core/Shell.h"
 
 
 namespace orxonox
 {
-    class _OrxonoxExport InGameConsole : public InputBufferListener
+    class _OrxonoxExport InGameConsole : public TickableReal, public ShellListener
     {
         public:
-            InGameConsole(InputBuffer* ib);
-            ~InGameConsole();
-            void listen();
-            void execute();
-            void hintandcomplete();
-            void clear();
-            void removeLast();
-            void exit();
-            void init();
+            static InGameConsole& getInstance();
+
+            void setConfigValues();
             void tick(float dt);
+
             void activate();
             void deactivate();
+            void resize();
+
+            static void openConsole();
+            static void closeConsole();
 
         private:
-            void resize();
-            void print(Ogre::UTFString s);
-            void newline();
-            Ogre::UTFString convert2UTF(std::string s);
+            InGameConsole();
+            InGameConsole(const InGameConsole& other);
+            ~InGameConsole();
 
-            int windowW;
-            int windowH;
-            int scroll;
-            float scrollTimer;
-            float cursor;
-            bool active;
-            InputBuffer* ib_;
-            Ogre::OverlayManager* om;
-            Ogre::Overlay* consoleOverlay;
-            Ogre::OverlayContainer* consoleOverlayContainer;
-            Ogre::PanelOverlayElement* consoleOverlayNoise;
-            Ogre::BorderPanelOverlayElement* consoleOverlayBorder;
-            Ogre::TextAreaOverlayElement** consoleOverlayTextAreas;
+            virtual void linesChanged();
+            virtual void onlyLastLineChanged();
+            virtual void lineAdded();
+            virtual void inputChanged();
+            virtual void cursorChanged();
+            virtual void exit();
+
+            void init();
+            void shiftLines();
+            void colourLine(int colourcode, int index);
+            void setCursorPosition(int pos);
+            void print(const std::string& text, int index, bool alwaysShift = false);
+            static Ogre::UTFString convert2UTF(std::string s);
+
+            static float REL_WIDTH;
+            static float REL_HEIGHT;
+            static float BLINK;
+
+            int windowW_;
+            int windowH_;
+            int desiredTextWidth_;
+            unsigned int maxCharsPerLine_;
+            unsigned int numLinesShifted_;
+            int scroll_;
+            float scrollTimer_;
+            float cursor_;
+            unsigned int inputWindowStart_;
+            char cursorSymbol_;
+            bool active_;
+            bool bShowCursor_;
+            std::string displayedText_;
+            Ogre::OverlayManager* om_;
+            Ogre::Overlay* consoleOverlay_;
+            Ogre::OverlayContainer* consoleOverlayContainer_;
+            Ogre::PanelOverlayElement* consoleOverlayNoise_;
+            Ogre::PanelOverlayElement* consoleOverlayCursor_;
+            Ogre::BorderPanelOverlayElement* consoleOverlayBorder_;
+            Ogre::TextAreaOverlayElement** consoleOverlayTextAreas_;
     };
 }
Index: code/trunk/src/orxonox/hud/BarOverlayElement.cc
===================================================================
--- code/trunk/src/orxonox/hud/BarOverlayElement.cc	(revision 1407)
+++ code/trunk/src/orxonox/hud/BarOverlayElement.cc	(revision 1502)
@@ -1,40 +1,40 @@
 /*
-*   ORXONOX - the hottest 3D action shooter ever to exist
-*
-*
-*   License notice:
-*
-*   This program is free software; you can redistribute it and/or
-*   modify it under the terms of the GNU General Public License
-*   as published by the Free Software Foundation; either version 2
-*   of the License, or (at your option) any later version.
-*
-*   This program is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with this program; if not, write to the Free Software
-*   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-*
-*   Author:
-*      Yuning Chai
-*   Co-authors:
-*      Felix Schulthess
-*
-*/
+ *   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:
+ *      Yuning Chai
+ *   Co-authors:
+ *      Felix Schulthess
+ *
+ */
 
+#include "OrxonoxStableHeaders.h"
+#include "BarOverlayElement.h"
 #include <OgreOverlayManager.h>
-#include <OgreOverlayElement.h>
-#include <OgrePanelOverlayElement.h>
 #include "GraphicsEngine.h"
-#include "BarOverlayElement.h"
 
 namespace orxonox
 {
-  using namespace Ogre;
+    using namespace Ogre;
 
-    BarOverlayElement::BarOverlayElement(const String& name):Ogre::PanelOverlayElement(name){
+    BarOverlayElement::BarOverlayElement(const String& name):PanelOverlayElement(name){
         name_ = name;
     }
@@ -42,8 +42,8 @@
     BarOverlayElement::~BarOverlayElement(){}
 
-    void BarOverlayElement::init(Real leftRel, Real topRel, Real dimRel, Ogre::OverlayContainer* container){
+    void BarOverlayElement::init(Real leftRel, Real topRel, Real dimRel, OverlayContainer* container){
         // init some values...
         container_ = container;
-        om = &Ogre::OverlayManager::getSingleton();
+        om = &OverlayManager::getSingleton();
         value_ = 0;
         color_ = 2;
@@ -53,10 +53,10 @@
         topRel_ = topRel;
         dimRel_ = dimRel;
-        
+
         // create background...
         background_ = static_cast<OverlayContainer*>(om->createOverlayElement("Panel", name_+"container"));
         background_->show();
         container_->addChild(background_);
-        background_->setMetricsMode(Ogre::GMM_PIXELS);
+        background_->setMetricsMode(GMM_PIXELS);
         background_->setMaterialName("Orxonox/BarBackground");
 
@@ -65,5 +65,5 @@
 
         show();
-        setMetricsMode(Ogre::GMM_PIXELS);
+        setMetricsMode(GMM_PIXELS);
         setMaterialName("Orxonox/Green");
         background_->addChild(this);
@@ -126,4 +126,2 @@
     }
 }
-
-
Index: code/trunk/src/orxonox/hud/BarOverlayElement.h
===================================================================
--- code/trunk/src/orxonox/hud/BarOverlayElement.h	(revision 1407)
+++ code/trunk/src/orxonox/hud/BarOverlayElement.h	(revision 1502)
@@ -1,41 +1,37 @@
 /*
-*   ORXONOX - the hottest 3D action shooter ever to exist
-*
-*
-*   License notice:
-*
-*   This program is free software; you can redistribute it and/or
-*   modify it under the terms of the GNU General Public License
-*   as published by the Free Software Foundation; either version 2
-*   of the License, or (at your option) any later version.
-*
-*   This program is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with this program; if not, write to the Free Software
-*   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-*
-*   Author:
-*      Yuning Chai
-*   Co-authors:
-*      Felix Schulthess
-*
-*/
+ *   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:
+ *      Yuning Chai
+ *   Co-authors:
+ *      Felix Schulthess
+ *
+ */
 
+#ifndef _BarOverlayElement_H__
+#define _BarOverlayElement_H__
 
-#ifndef _BAR_H__
-#define _BAR_H__
-
-#include <OgreOverlayManager.h>
-#include <OgreOverlayElement.h>
-#include <OgrePanelOverlayElement.h>
+#include "OrxonoxPrereqs.h"
 
 #include <OgrePrerequisites.h>
-#include "../OrxonoxPrereqs.h"
-
-
+#include <OgrePanelOverlayElement.h>
 
 namespace orxonox
@@ -44,37 +40,35 @@
   {
     private:
-        bool autoColor_;                    // whether bar changes color automatically
-        float value_;                       // progress of bar
-        int color_;
-        int left_;
-        int top_;
-        int width_;
-        int height_;
-        int windowW_, windowH_;
-        Ogre::Real leftRel_;
-        Ogre::Real topRel_;
-        Ogre::Real dimRel_;
-        Ogre::OverlayManager* om;           // our overlay manager
-        Ogre::OverlayContainer* container_; // our parent container to attach to
-        Ogre::OverlayContainer* background_;
-        Ogre::String name_;
+      bool autoColor_;                    // whether bar changes color automatically
+      float value_;                       // progress of bar
+      int color_;
+      int left_;
+      int top_;
+      int width_;
+      int height_;
+      int windowW_, windowH_;
+      Ogre::Real leftRel_;
+      Ogre::Real topRel_;
+      Ogre::Real dimRel_;
+      Ogre::OverlayManager* om;           // our overlay manager
+      Ogre::OverlayContainer* container_; // our parent container to attach to
+      Ogre::OverlayContainer* background_;
+      Ogre::String name_;
 
     public:
-        bool left2Right;
-        static const int RED = 0;           // predefined colors
-        static const int YELLOW = 1;
-        static const int GREEN = 2;
+      bool left2Right;
+      static const int RED = 0;           // predefined colors
+      static const int YELLOW = 1;
+      static const int GREEN = 2;
 
-        BarOverlayElement(const Ogre::String& name);
-        virtual ~BarOverlayElement();
-        void init(Real leftRel, Real topRel, Real dimRel, Ogre::OverlayContainer* container);
-        void resize();
-        void setValue(float value);
-        void setColor(int color);
-        float getValue();
-        int getBarColor();
+      BarOverlayElement(const Ogre::String& name);
+      virtual ~BarOverlayElement();
+      void init(Real leftRel, Real topRel, Real dimRel, Ogre::OverlayContainer* container);
+      void resize();
+      void setValue(float value);
+      void setColor(int color);
+      float getValue();
+      int getBarColor();
     };
 }
-#endif
-
-
+#endif /* _BarOverlayElement_H__ */
Index: code/trunk/src/orxonox/hud/HUD.cc
===================================================================
--- code/trunk/src/orxonox/hud/HUD.cc	(revision 1407)
+++ code/trunk/src/orxonox/hud/HUD.cc	(revision 1502)
@@ -1,52 +1,65 @@
 /*
-*   ORXONOX - the hottest 3D action shooter ever to exist
-*
-*
-*   License notice:
-*
-*   This program is free software; you can redistribute it and/or
-*   modify it under the terms of the GNU General Public License
-*   as published by the Free Software Foundation; either version 2
-*   of the License, or (at your option) any later version.
-*
-*   This program is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with this program; if not, write to the Free Software
-*   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-*
-*   Author:
-*      Yuning Chai
-*   Co-authors:
-*      Felix Schulthess
-*
-*/
-
+ *   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:
+ *      Yuning Chai
+ *   Co-authors:
+ *      Felix Schulthess
+ *
+ */
 
 #include "OrxonoxStableHeaders.h"
+#include "HUD.h"
+
+#include <string>
+#include <set>
 #include <OgreOverlay.h>
 #include <OgreOverlayContainer.h>
 #include <OgreOverlayManager.h>
-#include <OgreSceneNode.h>
-#include <OgreEntity.h>
 #include <OgreStringConverter.h>
+
 #include "core/Debug.h"
+#include "core/ConsoleCommand.h"
 #include "objects/SpaceShip.h"
-#include "HUD.h"
+#include "GraphicsEngine.h"
 #include "BarOverlayElement.h"
+#include "RadarObject.h"
 #include "RadarOverlayElement.h"
+#include "Navigation.h"
 #include "OverlayElementFactories.h"
 
 namespace orxonox
 {
+    SetConsoleCommandShortcut(HUD, cycleNavigationFocus).setAccessLevel(AccessLevel::User);
+    SetConsoleCommandShortcut(HUD, toggleFPS).setAccessLevel(AccessLevel::User);
+    SetConsoleCommandShortcut(HUD, toggleRenderTime).setAccessLevel(AccessLevel::User);
+
     using namespace Ogre;
 
-    HUD::HUD(int zoom){
+    HUD::HUD(){
         om = &Ogre::OverlayManager::getSingleton();
-
-		// create Factories
+        sm = GraphicsEngine::getSingleton().getSceneManager();
+        showFPS = true;
+        showRenderTime = true;
+
+        // create Factories
         BarOverlayElementFactory *barOverlayElementFactory = new BarOverlayElementFactory();
         om->addOverlayElementFactory(barOverlayElementFactory);
@@ -56,12 +69,24 @@
         orxonoxHUD = om->create("Orxonox/HUD");
         container = static_cast<Ogre::OverlayContainer*>(om->createOverlayElement("Panel", "Orxonox/HUD/container"));
-        // test
-        test = static_cast<TextAreaOverlayElement*>(om->createOverlayElement("TextArea", "test123"));
-        test->show();
-        test->setMetricsMode(Ogre::GMM_RELATIVE);
-        test->setDimensions(0.8, 0.8);
-        test->setPosition(0.02, 0.02);
-        test->setFontName("Console");
-        test->setCaption("init");
+
+        // creating text to display fps
+        fpsText = static_cast<TextAreaOverlayElement*>(om->createOverlayElement("TextArea", "fpsText"));
+        fpsText->show();
+        fpsText->setMetricsMode(Ogre::GMM_PIXELS);
+        fpsText->setDimensions(0.001, 0.001);
+        fpsText->setPosition(10, 10);
+        fpsText->setFontName("Console");
+        fpsText->setCharHeight(20);
+        fpsText->setCaption("init");
+
+        // creating text to display render time ratio
+        rTRText = static_cast<TextAreaOverlayElement*>(om->createOverlayElement("TextArea", "rTRText"));
+        rTRText->show();
+        rTRText->setMetricsMode(Ogre::GMM_PIXELS);
+        rTRText->setDimensions(0.001, 0.001);
+        rTRText->setPosition(10, 30);
+        rTRText->setFontName("Console");
+        rTRText->setCharHeight(20);
+        rTRText->setCaption("init");
 
         // create energy bar
@@ -75,5 +100,8 @@
         radar->show();
 
-		// set up screen-wide container
+        // create Navigation
+        nav = new Navigation(container);
+
+        // set up screen-wide container
         container->show();
 
@@ -85,25 +113,36 @@
         container->setHeight(1.0);
         container->setMetricsMode(Ogre::GMM_RELATIVE);
-        container->addChild(test);
+        container->addChild(fpsText);
+        container->addChild(rTRText);
+
         energyBar->init(0.01, 0.94, 0.4, container);
         energyBar->setValue(1);
+
         speedoBar->init(0.01, 0.90, 0.4, container);
+
         radar->init(0.5, 0.9, 0.2, container);
-        radar->addObject(Vector3(1500.0, 0.0, 100.0));
-        radar->addObject(Vector3(0.0, 4000.0, 0.0));
-        radar->addObject(Vector3(0.0, 0.0, 6800.0));
-        RadarOverlayElement::cycleFocus();
+        SceneNode* node;
+        node = sm->getRootSceneNode()->createChildSceneNode("tomato1", Vector3(2000.0, 0.0, 0.0));
+        addRadarObject(node);
+        node = sm->getRootSceneNode()->createChildSceneNode("tomato2", Vector3(0.0, 2000.0, 0.0));
+        addRadarObject(node);
+        node = sm->getRootSceneNode()->createChildSceneNode("tomato3", Vector3(0.0, 0.0, 2000.0));
+        addRadarObject(node);
+	node = sm->getRootSceneNode()->createChildSceneNode("station", Vector3(10000.0,16000.0,0.0));
+        addRadarObject(node, 3);
+    }
+
+    HUD::~HUD(){
+        //todo: clean up objects
     }
 
     void HUD::tick(float dt)
     {
-        int d = radar->getDist2Focus()/10;
-        if(d) test->setCaption("Distance: " + Ogre::StringConverter::toString(d));
-        else test->setCaption("");
-
         energyBar->resize();
 
-        float v = SpaceShip::instance_s->getVelocity().length();
-        float vmax = SpaceShip::instance_s->getMaxSpeed();
+        if(!SpaceShip::getLocalShip())
+          return;
+        float v = SpaceShip::getLocalShip()->getVelocity().length();
+        float vmax = SpaceShip::getLocalShip()->getMaxSpeed();
         speedoBar->setValue(v/vmax);
         speedoBar->resize();
@@ -111,7 +150,75 @@
         radar->resize();
         radar->update();
-    }
-
-    HUD::~HUD(void){
+
+        nav->update();
+
+        setFPS();
+    }
+
+    void HUD::setRenderTimeRatio(float ratio)
+    {
+        if(showRenderTime){
+            rTRText->setCaption("Render time ratio: " + Ogre::StringConverter::toString(ratio));
+        }
+        else{
+            rTRText->setCaption("");
+            return;
+        }
+    }
+
+    void HUD::setFPS(){
+        if(showFPS){
+            float fps = GraphicsEngine::getSingleton().getAverageFPS();
+            fpsText->setCaption("FPS: " + Ogre::StringConverter::toString(fps));
+        }
+        else{
+            fpsText->setCaption("");
+            return;
+        }
+    }
+
+    void HUD::addRadarObject(SceneNode* node, int colour){
+        RadarObject* obj = new RadarObject(container, node, colour);
+        roSet.insert(obj);
+//        // check if this is the first RadarObject to create
+//        if(firstRadarObject == NULL){
+//            firstRadarObject = new RadarObject(container, node, colour);
+//            lastRadarObject = firstRadarObject;
+//        }
+//        else{ // if not, append to list
+//            lastRadarObject->next = new RadarObject(container, node, colour);
+//            lastRadarObject = lastRadarObject->next;
+//        }
+    }
+
+    void HUD::removeRadarObject(Ogre::SceneNode* node){
+      COUT(3) << "blabla" << std::endl;
+        for(std::set<RadarObject*>::iterator it=roSet.begin(); it!=roSet.end(); it++){
+            if((*it)->getNode() == node) {
+                delete (*it);
+                roSet.erase(it);
+            }
+        }
+    }
+
+    /*static*/ HUD& HUD::getSingleton(){
+        static HUD theInstance;
+        return theInstance;
+    }
+
+    /*static*/ void HUD::setEnergy(float value){
+        HUD::getSingleton().energyBar->setValue(value);
+    }
+
+    /*static*/ void HUD::cycleNavigationFocus(){
+        HUD::getSingleton().nav->cycleFocus();
+    }
+
+    /*static*/ void HUD::toggleFPS(){
+        HUD::getSingleton().showFPS = !HUD::getSingleton().showFPS;
+    }
+
+    /*static*/ void HUD::toggleRenderTime(){
+        HUD::getSingleton().showRenderTime = !HUD::getSingleton().showRenderTime;
     }
 }
Index: code/trunk/src/orxonox/hud/HUD.h
===================================================================
--- code/trunk/src/orxonox/hud/HUD.h	(revision 1407)
+++ code/trunk/src/orxonox/hud/HUD.h	(revision 1502)
@@ -1,28 +1,29 @@
 /*
-*   ORXONOX - the hottest 3D action shooter ever to exist
-*
-*
-*   License notice:
-*
-*   This program is free software; you can redistribute it and/or
-*   modify it under the terms of the GNU General Public License
-*   as published by the Free Software Foundation; either version 2
-*   of the License, or (at your option) any later version.
-*
-*   This program is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with this program; if not, write to the Free Software
-*   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-*
-*   Author:
-*      Yuning Chai
-*   Co-authors:
-*      Felix Schulthess
-*
-*/
+ *   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:
+ *      Yuning Chai
+ *   Co-authors:
+ *      Felix Schulthess
+ *
+ */
 
 
@@ -30,14 +31,11 @@
 #define _HUD_H__
 
-#include <string.h>
-#include <OgreOverlayElement.h>
+#include "OrxonoxPrereqs.h"
+
+#include <OgrePrerequisites.h>
 #include <OgreTextAreaOverlayElement.h>
-#include <OgrePrerequisites.h>
-
-#include "OrxonoxPrereqs.h"
+#include <OgreSceneNode.h>
 #include "core/Tickable.h"
-#include "BarOverlayElement.h"
-#include "RadarOverlayElement.h"
-
+#include "util/Math.h"
 
 namespace orxonox
@@ -45,20 +43,39 @@
     class _OrxonoxExport HUD : public Tickable
     {
-        private:
-            Ogre::OverlayManager* om;
-            Ogre::Overlay* orxonoxHUD;
-            Ogre::OverlayContainer* container;
-            Ogre::TextAreaOverlayElement* test;
-            BarOverlayElement* energyBar;
-            BarOverlayElement* speedoBar;
-            RadarOverlayElement* radar;
+      private:
+        HUD();
+        HUD(HUD& instance);
+        ~HUD();
+        Ogre::OverlayManager* om;
+        Ogre::SceneManager* sm;
+        Ogre::Overlay* orxonoxHUD;
+        Ogre::OverlayContainer* container;
+        Ogre::TextAreaOverlayElement* fpsText;
+        Ogre::TextAreaOverlayElement* rTRText;
+        BarOverlayElement* energyBar;
+        BarOverlayElement* speedoBar;
+        RadarOverlayElement* radar;
+        Navigation* nav;
 
-        public:
-            HUD(int zoom);
-            ~HUD();
-            virtual void tick(float);
+        bool showFPS;
+        bool showRenderTime;
 
+      public:
+        virtual void tick(float);
+        void addRadarObject(Ogre::SceneNode* node, int colour = 0);
+        void removeRadarObject(Ogre::SceneNode* node);
+        void setRenderTimeRatio(float ratio);
+        void setFPS();
+
+        std::set<RadarObject*> roSet;
+
+        static HUD* instance_s;
+        static HUD& getSingleton();
+        static void setEnergy(float value);
+        static void cycleNavigationFocus();
+        static void toggleFPS();
+        static void toggleRenderTime();
     };
 }
 
-#endif
+#endif /* _HUD_H__ */
Index: code/trunk/src/orxonox/hud/Navigation.cc
===================================================================
--- code/trunk/src/orxonox/hud/Navigation.cc	(revision 1502)
+++ code/trunk/src/orxonox/hud/Navigation.cc	(revision 1502)
@@ -0,0 +1,234 @@
+/*
+ *   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:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Navigation.h"
+
+#include <OgreOverlayManager.h>
+#include <OgreStringConverter.h>
+
+#include "GraphicsEngine.h"
+// TODO: remove the SpaceShip and CameraHandler dependencies
+#include "objects/SpaceShip.h"
+#include "objects/CameraHandler.h"
+#include "RadarObject.h"
+#include "RadarOverlayElement.h"
+#include "HUD.h"
+#include "core/Debug.h"
+
+namespace orxonox
+{
+    using namespace Ogre;
+
+    Navigation::Navigation(OverlayContainer* container){
+        container_ = container;
+        focus_ = NULL;
+        init();
+    }
+
+    Navigation::Navigation(OverlayContainer* container, RadarObject* focus){
+        container_ = container;
+        focus_ = focus;
+        init();
+    }
+
+    void Navigation::init(){
+        om = &OverlayManager::getSingleton();
+        navCam_ = NULL;
+        // create nav text
+        navText_ = static_cast<TextAreaOverlayElement*>(om->createOverlayElement("TextArea", "navText"));
+        navText_->show();
+        navText_->setMetricsMode(Ogre::GMM_PIXELS);
+        navText_->setDimensions(0.001, 0.001);
+        navText_->setPosition(0.02, 0.02);
+        navText_->setFontName("Console");
+        navText_->setCharHeight(20);
+        navText_->setCaption("");
+        container_->addChild(navText_);
+
+
+        // create nav marker ...
+        navMarker_ = static_cast<PanelOverlayElement*>(om->createOverlayElement("Panel", "NavMarker"));
+        navMarker_->setMetricsMode(GMM_PIXELS);
+        navMarker_->hide();
+        navText_->hide();
+        container_->addChild(navMarker_);
+    }
+
+    void Navigation::update(){
+        if(focus_ == NULL) return;
+        navCamPos_ = SpaceShip::getLocalShip()->getPosition();
+        currentDir_ = SpaceShip::getLocalShip()->getDir();
+        currentOrth_ = SpaceShip::getLocalShip()->getOrth();
+
+        windowW_ = GraphicsEngine::getSingleton().getWindowWidth();
+        windowH_ = GraphicsEngine::getSingleton().getWindowHeight();
+        updateMarker();
+    }
+
+    void Navigation::updateMarker(){
+        // set text
+        int dist = (int) getDist2Focus()/100;
+        navText_->setCaption(Ogre::StringConverter::toString(dist));
+
+        if(navCam_ == NULL) navCam_ = SpaceShip::getLocalShip()->getCamera()->cam_;
+        Vector3 pos = focus_->getPosition();
+        // transform to screen coordinates
+        pos = navCam_->getProjectionMatrix()*navCam_->getViewMatrix()*pos;
+        float xPosRel = 0.5*pos.x+0.5;
+        float yPosRel = 1-(0.5*pos.y+0.5);
+        int xPos = (int) (xPosRel*windowW_);
+        int yPos = (int) (yPosRel*windowH_);
+        int xFromCenter = xPos-windowW_/2;
+        int yFromCenter = yPos-windowH_/2;
+        // is object in view?
+        float radius = RadarOverlayElement::calcRadius(navCamPos_, currentDir_, currentOrth_, focus_);
+        bool isRight = (currentDir_.crossProduct(currentOrth_)).dotProduct(focus_->getPosition() - navCamPos_)>0;
+        bool isAbove = currentOrth_.dotProduct(focus_->getPosition() - navCamPos_)>0;
+        bool outOfView = (xPosRel<0 || xPosRel>1 || yPosRel<0 || yPosRel>1);
+        // if object is behind us, it is out of view anyway:
+        if(!outOfView && radius>3.14/2) outOfView = true;
+
+        if(outOfView){
+            // object is not in view
+            navMarker_->setMaterialName("Orxonox/NavArrows");
+            navMarker_->setDimensions(16,16);
+            float phiUpperCorner = atan((float)(windowW_)/(float)(windowH_));
+            // from the angle we find out on which edge to draw the marker
+            // and which of the four arrows to take
+            float phiNav = atan((float) xFromCenter / (float) yFromCenter);
+
+            if(isAbove && isRight){
+                // top right quadrant
+                if(-phiNav<phiUpperCorner){
+                    //COUT(3) << "arrow up\n";
+                    navMarker_->setPosition(-tan(phiNav)*windowH_/2+windowW_/2, 0);
+                    navMarker_->setUV(0.5, 0.0, 1.0, 0.5);
+                    navText_->setLeft(navMarker_->getLeft()+navMarker_->getWidth());
+                    navText_->setTop(navMarker_->getHeight());
+                }
+                else {
+                    //COUT(3) << "arrow right\n";
+                    navMarker_->setPosition(windowW_-16, tan((3.14-2*phiNav)/2)*windowW_/2+windowH_/2);
+                    navMarker_->setUV(0.5, 0.5, 1.0, 1.0);
+                    navText_->setLeft(navMarker_->getLeft()-navMarker_->getWidth());
+                    navText_->setTop(navMarker_->getTop()+navMarker_->getHeight());
+                }
+            }
+            if(!isAbove && isRight){
+                // bottom right quadrant
+                if(phiNav<phiUpperCorner) {
+                    //COUT(3) << "arrow down\n";
+                    navMarker_->setPosition(tan(phiNav)*windowH_/2+windowW_/2, windowH_-16);
+                    navMarker_->setUV(0.0, 0.5, 0.5, 1.0);
+                    navText_->setLeft(navMarker_->getLeft()+navMarker_->getWidth());
+                    navText_->setTop(navMarker_->getTop()-navMarker_->getHeight());
+                }
+                else {
+                    //COUT(3) << "arrow right\n";
+                    navMarker_->setPosition(windowW_-16, tan((3.14-2*phiNav)/2)*windowW_/2+windowH_/2);
+                    navMarker_->setUV(0.5, 0.5, 1.0, 1.0);
+                    navText_->setLeft(navMarker_->getLeft()-navMarker_->getWidth());
+                    navText_->setTop(navMarker_->getTop()+navMarker_->getHeight());
+                }
+            }
+            if(isAbove && !isRight){
+                // top left quadrant
+                if(phiNav<phiUpperCorner){
+                    //COUT(3) << "arrow up\n";
+                    navMarker_->setPosition(-tan(phiNav)*windowH_/2+windowW_/2, 0);
+                    navMarker_->setUV(0.5, 0.0, 1.0, 0.5);
+                    navText_->setLeft(navMarker_->getLeft()+navMarker_->getWidth());
+                    navText_->setTop(navMarker_->getHeight());
+                }
+                else {
+                    //COUT(3) << "arrow left\n";
+                    navMarker_->setPosition(0, -tan((3.14-2*phiNav)/2)*windowW_/2+windowH_/2);
+                    navMarker_->setUV(0.0, 0.0, 0.5, 0.5);
+                    navText_->setLeft(navMarker_->getWidth());
+                    navText_->setTop(navMarker_->getTop()+navMarker_->getHeight());
+                }
+            }
+            if(!isAbove && !isRight){
+                // bottom left quadrant
+                if(phiNav>-phiUpperCorner) {
+                    //COUT(3) << "arrow down\n";
+                    navMarker_->setPosition(tan(phiNav)*windowH_/2+windowW_/2, windowH_-16);
+                    navMarker_->setUV(0.0, 0.5, 0.5, 1.0);
+                    navText_->setLeft(navMarker_->getLeft()+navMarker_->getWidth());
+                    navText_->setTop(navMarker_->getTop()-navMarker_->getHeight());
+                }
+                else {
+                    //COUT(3) << "arrow left\n";
+                    navMarker_->setPosition(0, -tan((3.14-2*phiNav)/2)*windowW_/2+windowH_/2);
+                    navMarker_->setUV(0.0, 0.0, 0.5, 0.5);
+                    navText_->setLeft(navMarker_->getWidth());
+                    navText_->setTop(navMarker_->getTop()+navMarker_->getHeight());
+                }
+            }
+        }
+        else{
+            // object is in view
+            navMarker_->setMaterialName("Orxonox/NavTDC");
+            navMarker_->setDimensions(24,24);
+            navMarker_->setUV(0.0, 0.0, 1.0, 1.0);
+            navMarker_->setPosition(xPos-navMarker_->getWidth()/2, yPos-navMarker_->getHeight()/2);
+            navText_->setPosition(xPos+navMarker_->getWidth()/2, yPos+navMarker_->getHeight()/2);
+        }
+    }
+
+    void Navigation::cycleFocus(){
+        if(focus_ == NULL){
+            it_ = HUD::getSingleton().roSet.begin();
+            focus_ = *it_;
+            ++it_;
+        }
+        else{
+            focus_->resetColour();
+            if(it_ != HUD::getSingleton().roSet.end()){
+                focus_ = *it_;
+                ++it_;
+            }
+            else focus_ = NULL;
+        }
+        if(focus_ == NULL){
+            navMarker_->hide();
+            navText_->hide();
+        }
+        else{
+            navMarker_->show();
+            navText_->show();
+            focus_->setColour(RadarObject::WHITE);
+        }
+    }
+
+    float Navigation::getDist2Focus(){
+        if(focus_ == NULL) return(0.0);
+        return((focus_->getPosition()-SpaceShip::getLocalShip()->getPosition()).length());
+    }
+}
Index: code/trunk/src/orxonox/hud/Navigation.h
===================================================================
--- code/trunk/src/orxonox/hud/Navigation.h	(revision 1502)
+++ code/trunk/src/orxonox/hud/Navigation.h	(revision 1502)
@@ -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:
+ *      Felix Schulthess
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Navigation_H__
+#define _Navigation_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <OgrePrerequisites.h>
+#include <OgreTextAreaOverlayElement.h>
+#include <OgrePanelOverlayElement.h>
+#include "util/Math.h"
+
+namespace orxonox
+{
+
+    class _OrxonoxExport Navigation
+    {
+      private:
+        Ogre::OverlayManager* om;				            // our one and only overlay manager
+        Ogre::OverlayContainer* container_;
+        Ogre::PanelOverlayElement* navMarker_;      // the panel used to show the arrow
+        Ogre::TextAreaOverlayElement* navText_;     // displaying distance
+        Ogre::Camera* navCam_;
+        Vector3 navCamPos_;                         // position of ship
+        Vector3 currentDir_;
+        Vector3 currentOrth_;
+        std::set<RadarObject*>::iterator it_;
+        int windowW_, windowH_;
+        void init();
+        void updateMarker();
+
+      public:
+        Navigation(Ogre::OverlayContainer* container);
+        Navigation(Ogre::OverlayContainer* container, RadarObject* focus);
+        ~Navigation();
+        RadarObject* focus_;                        // next pointer of linked list
+
+        void update();
+        void cycleFocus();
+        float getDist2Focus();
+  };
+}
+
+#endif /* _Navigation_H__ */
Index: code/trunk/src/orxonox/hud/OverlayElementFactories.h
===================================================================
--- code/trunk/src/orxonox/hud/OverlayElementFactories.h	(revision 1407)
+++ code/trunk/src/orxonox/hud/OverlayElementFactories.h	(revision 1502)
@@ -1,41 +1,45 @@
 /*
-*   ORXONOX - the hottest 3D action shooter ever to exist
-*
-*
-*   License notice:
-*
-*   This program is free software; you can redistribute it and/or
-*   modify it under the terms of the GNU General Public License
-*   as published by the Free Software Foundation; either version 2
-*   of the License, or (at your option) any later version.
-*
-*   This program is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with this program; if not, write to the Free Software
-*   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-*
-*   Author:
-*      Yuning Chai
-*   Co-authors:
-*      Felix Schulthess
-*
-*/
+ *   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:
+ *      Yuning Chai
+ *   Co-authors:
+ *      Felix Schulthess
+ *
+ */
 
-#ifndef _FACTORIES_H__
-#define _FACTORIES_H__
+#ifndef _OverlayElementFactories_H__
+#define _OverlayElementFactories_H__
 
+#include "OrxonoxPrereqs.h"
+
+#include <OgrePrerequisites.h>
 #include <OgreOverlayElement.h>
-#include <OgrePrerequisites.h>
 #include <OgreOverlayElementFactory.h>
 
 #include "BarOverlayElement.h"
+#include "RadarOverlayElement.h"
 
 namespace orxonox{
     class _OrxonoxExport BarOverlayElementFactory : public Ogre::OverlayElementFactory{
-        public:
+      public:
         Ogre::OverlayElement* createOverlayElement(const Ogre::String& instanceName){
             return new BarOverlayElement(instanceName);
@@ -48,5 +52,5 @@
 
     class _OrxonoxExport RadarOverlayElementFactory : public Ogre::OverlayElementFactory{
-        public:
+      public:
         Ogre::OverlayElement* createOverlayElement(const Ogre::String& instanceName){
             return new RadarOverlayElement(instanceName);
@@ -59,3 +63,3 @@
 }
 
-#endif
+#endif /* _OverlayElementFactories_H__ */
Index: code/trunk/src/orxonox/hud/RadarObject.cc
===================================================================
--- code/trunk/src/orxonox/hud/RadarObject.cc	(revision 1407)
+++ code/trunk/src/orxonox/hud/RadarObject.cc	(revision 1502)
@@ -1,30 +1,36 @@
 /*
-*   ORXONOX - the hottest 3D action shooter ever to exist
-*
-*
-*   License notice:
-*
-*   This program is free software; you can redistribute it and/or
-*   modify it under the terms of the GNU General Public License
-*   as published by the Free Software Foundation; either version 2
-*   of the License, or (at your option) any later version.
-*
-*   This program is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with this program; if not, write to the Free Software
-*   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-*
-*   Author:
-*      Felix Schulthess
-*   Co-authors:
-*      ...
-*
-*/
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Felix Schulthess
+ *   Co-authors:
+ *      ...
+ *
+ */
 
+#include "OrxonoxStableHeaders.h"
 #include "RadarObject.h"
+
+#include <OgreOverlayManager.h>
+#include <OgreStringConverter.h>
+#include "GraphicsEngine.h"
 
 namespace orxonox
@@ -32,27 +38,15 @@
     using namespace Ogre;
 
-	int RadarObject::count = 0;		// initialize static variable
+    int RadarObject::count = 0;		// initialize static variable
 
-	RadarObject::RadarObject(Ogre::OverlayContainer* container){
-		container_ = container;
-		pos_ = Vector3(0.0, 0.0, 0.0);
-		init();
-	}
-
-	RadarObject::RadarObject(Ogre::OverlayContainer* container, Vector3 pos){
-		container_ = container;
-		pos_ = pos;
-		init();
-	}
-
-	RadarObject::~RadarObject(){}
-
-	void RadarObject::init(){
-	    next = NULL;
-		om = &Ogre::OverlayManager::getSingleton();
-		panel_ = static_cast<PanelOverlayElement*>(om->createOverlayElement("Panel",
-			"Object"+Ogre::StringConverter::toString(count)));
-		panel_->setMaterialName("Orxonox/RedDot");
-		panel_->setDimensions(3,3);
+    RadarObject::RadarObject(OverlayContainer* container, SceneNode* node, int colour){
+        container_ = container;
+        node_ = node;
+        colour_ = colour;
+        om = &OverlayManager::getSingleton();
+        panel_ = static_cast<PanelOverlayElement*>(om->createOverlayElement("Panel",
+            "Object"+StringConverter::toString(count)));
+        setColour(colour_);
+        panel_->setDimensions(3,3);
         panel_->setMetricsMode(Ogre::GMM_PIXELS);
         panel_->show();
@@ -60,10 +54,32 @@
         count++;
         container_->addChild(panel_);
-	}
+    }
+
+    RadarObject::~RadarObject(){
+        delete panel_;
+    }
+
+    void RadarObject::setColour(int colour){
+        switch(colour){
+        case RED: panel_->setMaterialName("Orxonox/RedDot"); break;
+        case YELLOW: panel_->setMaterialName("Orxonox/YellowDot"); break;
+        case GREEN: panel_->setMaterialName("Orxonox/GreenDot"); break;
+        case BLUE: panel_->setMaterialName("Orxonox/BlueDot"); break;
+        case WHITE: panel_->setMaterialName("Orxonox/WhiteDot"); break;
+        default: panel_->setMaterialName("Orxonox/RedDot"); break;
+        }
+    }
+
+    void RadarObject::resetColour(){
+        setColour(colour_);
+    }
+
+    Vector3 RadarObject::getPosition(){
+        return node_->getPosition();
+    }
+
+    SceneNode* RadarObject::getNode(){
+        return node_;
+    }
 }
 
-/* my local clipboard...
-COUT(3) << "WWWWWWWWWWWWWWWWWWWWWWWWWWWW\n";
-COUT(3) << firstRadarObject_->radius_ << "  " << firstRadarObject_->phi_ << std::endl;
-COUT(3) << "WWWWWWWWWWWWWWWWWWWWWWWWWWWW\n";
-*/
Index: code/trunk/src/orxonox/hud/RadarObject.h
===================================================================
--- code/trunk/src/orxonox/hud/RadarObject.h	(revision 1407)
+++ code/trunk/src/orxonox/hud/RadarObject.h	(revision 1502)
@@ -1,41 +1,38 @@
 /*
-*   ORXONOX - the hottest 3D action shooter ever to exist
-*
-*
-*   License notice:
-*
-*   This program is free software; you can redistribute it and/or
-*   modify it under the terms of the GNU General Public License
-*   as published by the Free Software Foundation; either version 2
-*   of the License, or (at your option) any later version.
-*
-*   This program is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with this program; if not, write to the Free Software
-*   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-*
-*   Author:
-*      Yuning Chai
-*   Co-authors:
-*      ...
-*
-*/
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Felix Schulthess
+ *   Co-authors:
+ *      ...
+ *
+ */
 
-#ifndef _RADAR2_H__
-#define _RADAR2_H__
+#ifndef _RadarObject_H__
+#define _RadarObject_H__
 
-#include <string.h>
 #include <OgrePrerequisites.h>
-#include <OgreOverlayManager.h>
-#include <OgreOverlayElement.h>
+#include <OgreSceneNode.h>
 #include <OgrePanelOverlayElement.h>
-#include <OgreStringConverter.h>
-
-#include <util/Math.h>
-#include "../OrxonoxPrereqs.h"
+#include "OrxonoxPrereqs.h"
+#include "util/Math.h"
 
 namespace orxonox
@@ -43,24 +40,30 @@
     class _OrxonoxExport RadarObject
     {
-    	private:
-    		Ogre::OverlayManager* om;				// our one and only overlay manager
-    		void init();
+      private:
+        Ogre::OverlayManager* om;				// our one and only overlay manager
+        Ogre::SceneNode* node_;					// node of object
+        int colour_;
 
-    	public:
-    		RadarObject(Ogre::OverlayContainer* container);
-    		RadarObject(Ogre::OverlayContainer* container, Vector3 pos);
-    		~RadarObject();
+      public:
+        RadarObject(Ogre::OverlayContainer* container, Ogre::SceneNode* node, int colour = 0);
+        ~RadarObject();
+        void setColour(int colour);
+        void resetColour();
+        Vector3 getPosition();
+        Ogre::SceneNode* getNode();
 
-            bool right_;
-            int index_;                             // index number of object
-    		Vector3 pos_;							// position in space
-			Ogre::Real radius_, phi_;				// position on radar
-			Ogre::OverlayContainer* container_;
-			Ogre::PanelOverlayElement* panel_;		// the panel used to show the dot
-			RadarObject* next;                      // next pointer of linked list
+        bool right_;
+        int index_;                             // index number of object
+        Ogre::OverlayContainer* container_;
+        Ogre::PanelOverlayElement* panel_;		// the panel used to show the dot
 
-    		static int count;
-	};
+        static int count;
+        static const int RED = 0;
+        static const int YELLOW = 1;
+        static const int GREEN = 2;
+        static const int BLUE = 3;
+        static const int WHITE = 99;            // used if object got nav focus
+  };
 }
 
-#endif
+#endif /* _RadarObject_H__ */
Index: code/trunk/src/orxonox/hud/RadarOverlayElement.cc
===================================================================
--- code/trunk/src/orxonox/hud/RadarOverlayElement.cc	(revision 1407)
+++ code/trunk/src/orxonox/hud/RadarOverlayElement.cc	(revision 1502)
@@ -1,41 +1,49 @@
 /*
-*   ORXONOX - the hottest 3D action shooter ever to exist
-*
-*
-*   License notice:
-*
-*   This program is free software; you can redistribute it and/or
-*   modify it under the terms of the GNU General Public License
-*   as published by the Free Software Foundation; either version 2
-*   of the License, or (at your option) any later version.
-*
-*   This program is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with this program; if not, write to the Free Software
-*   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-*
-*   Author:
-*      Yuning Chai
-*   Co-authors:
-*      ...
-*
-*/
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Yuning Chai
+ *   Co-authors:
+ *      Felix Schulthess
+ *
+ */
 
+#include "OrxonoxStableHeaders.h"
 #include "RadarOverlayElement.h"
+
+#include <string>
+#include <OgreOverlayManager.h>
+#include <OgreStringConverter.h>
+
+#include "GraphicsEngine.h"
+#include "core/Tickable.h"
+#include "core/ConsoleCommand.h"
+#include "objects/SpaceShip.h"
+#include "RadarObject.h"
+#include "HUD.h"
 
 namespace orxonox
 {
-    ConsoleCommandShortcut(RadarOverlayElement, cycleFocus, AccessLevel::User);
-
     using namespace Ogre;
 
-    RadarOverlayElement* RadarOverlayElement::instance_s = NULL;
-
-    RadarOverlayElement::RadarOverlayElement(const String& name):Ogre::PanelOverlayElement(name){
-        RadarOverlayElement::instance_s = this;
+    RadarOverlayElement::RadarOverlayElement(const String& name):PanelOverlayElement(name){
     }
 
@@ -43,33 +51,13 @@
     }
 
-    void RadarOverlayElement::init(Real leftRel, Real topRel, Real dimRel, Ogre::OverlayContainer* container){
+    void RadarOverlayElement::init(Real leftRel, Real topRel, Real dimRel, OverlayContainer* container){
         // some initial data
-		om = &Ogre::OverlayManager::getSingleton();
+        om = &OverlayManager::getSingleton();
         dimRel_ = dimRel;
         leftRel_ = leftRel;
         topRel_ = topRel;
         container_ = container;
-        firstRadarObject_ = NULL;
-        lastRadarObject_ = NULL;
-        focus_ = NULL;
 
-        // create nav marker ...
-        navMarker_ = static_cast<PanelOverlayElement*>(om->createOverlayElement("Panel", "NavMarker"));
-        navMarker_->setMetricsMode(Ogre::GMM_PIXELS);
-        navMarker_->setMaterialName("Orxonox/NavMarker");
-        navMarker_->setDimensions(16,16);
-        navMarker_->setPosition(0,386);
-        navMarker_->hide();
-        container_->addChild(navMarker_);
-
-        // these have to fit the data in the level
-        shipPos_ = Vector3(0.0, 0.0, 0.0);
-        initialDir_ = Vector3(1.0, 0.0, 0.0);
-        currentDir_ = initialDir_;
-        initialOrth_ = Vector3(0.0, 0.0, 1.0);
-        currentOrth_ = initialOrth_;
-        plane = Plane(currentDir_, shipPos_);
-
-        setMetricsMode(Ogre::GMM_PIXELS);
+        setMetricsMode(GMM_PIXELS);
         setMaterialName("Orxonox/Radar");
         resize();
@@ -90,143 +78,57 @@
 
     void RadarOverlayElement::update() {
-        shipPos_ = SpaceShip::instance_s->getPosition();
-        currentDir_ = SpaceShip::instance_s->getOrientation()*initialDir_; 		// according to beni....
-		currentOrth_ = SpaceShip::instance_s->getOrientation()*initialOrth_;
-        plane = Plane(currentDir_, shipPos_);
-
-        RadarObject* ro = firstRadarObject_;
+        shipPos_ = SpaceShip::getLocalShip()->getPosition();
+        currentDir_ = SpaceShip::getLocalShip()->getDir();
+        currentOrth_ = SpaceShip::getLocalShip()->getOrth();
         // iterate through all RadarObjects
-		while(ro != NULL){
-		    // calc position on radar...
-            ro->radius_ = calcRadius(ro);
-            ro->phi_ = calcPhi(ro);
-            ro->right_ = calcRight(ro);
+        for(std::set<RadarObject*>::iterator it=HUD::getSingleton().roSet.begin(); it!=HUD::getSingleton().roSet.end(); it++){
+        // calc position on radar...
+            float radius = calcRadius(shipPos_, currentDir_, currentOrth_, (*it));
+            float phi = calcPhi(shipPos_, currentDir_, currentOrth_, (*it));
+            bool right = calcRight(shipPos_, currentDir_, currentOrth_, (*it));
 
             // set size to fit distance...
-            float d = (ro->pos_-shipPos_).length();
-            if(d<4000) ro->panel_->setDimensions(4,4);
-            else if(d<8000) ro->panel_->setDimensions(3,3);
-            else if(d<16000) ro->panel_->setDimensions(2,2);
-            else ro->panel_->setDimensions(1,1);
+            float d = ((*it)->getPosition()-shipPos_).length();
+            if(d<10000) (*it)->panel_->setDimensions(4,4);
+            else if(d<20000) (*it)->panel_->setDimensions(3,3);
+            else (*it)->panel_->setDimensions(2,2);
 
-            if (ro->right_){
-                ro->panel_->setPosition(sin(ro->phi_)*ro->radius_/
-                    3.5*dim_/2+dim_/2+left_-2,-cos(ro->phi_)*ro->radius_/3.5*dim_/2+dim_/2+top_-2);
+            if (right){
+                (*it)->panel_->setPosition(sin(phi)*radius/
+                    3.5*dim_/2+dim_/2+left_-2,-cos(phi)*radius/3.5*dim_/2+dim_/2+top_-2);
             }
             else {
-                ro->panel_->setPosition(-sin(ro->phi_)*ro->radius_/
-                    3.5*dim_/2+dim_/2+left_-2,-cos(ro->phi_)*ro->radius_/3.5*dim_/2+dim_/2+top_-2);
-            }
-            ro = ro->next;
-		}
-		updateNavMarker();
-    }
-
-    void RadarOverlayElement::updateNavMarker(){
-        if(focus_ == NULL) return;
-        // from the angle we find out where to draw the marker
-        // and which of the four arrows to take
-        float r1 = atan((float)(windowW_)/(float)(windowH_));
-        float phi = focus_->phi_;
-        if(focus_->right_){
-            if(phi<r1){
-                navMarker_->setPosition(tan(phi)*windowH_/2+windowW_/2, 0);
-                navMarker_->setUV(0.5, 0.0, 1.0, 0.5);
-            }
-            else if(phi>3.14-r1){
-                navMarker_->setPosition(-tan(phi)*windowH_/2+windowW_/2, windowH_-16);
-                navMarker_->setUV(0.0, 0.5, 0.5, 1.0);
-            }
-            else {
-                navMarker_->setPosition(windowW_-16, -tan((3.14-2*phi)/2)*windowW_/2+windowH_/2);
-                navMarker_->setUV(0.5, 0.5, 1.0, 1.0);
-            }
-        }
-        else{
-            if(phi<r1) {
-                navMarker_->setPosition(-tan(phi)*windowH_/2+windowW_/2, 0);
-                navMarker_->setUV(0.5, 0.0, 1.0, 0.5);
-            }
-            else if(phi>3.14-r1) {
-                navMarker_->setPosition(tan(phi)*windowH_/2+windowW_/2, windowH_-16);
-                navMarker_->setUV(0.0, 0.5, 0.5, 1.0);
-            }
-            else {
-                navMarker_->setPosition(0, -tan((3.14-2*phi)/2)*windowW_/2+windowH_/2);
-                navMarker_->setUV(0.0, 0.0, 0.5, 0.5);
+                (*it)->panel_->setPosition(-sin(phi)*radius/
+                    3.5*dim_/2+dim_/2+left_-2,-cos(phi)*radius/3.5*dim_/2+dim_/2+top_-2);
             }
         }
     }
 
-    void RadarOverlayElement::addObject(Vector3 pos){
-        if(firstRadarObject_ == NULL){
-            firstRadarObject_ = new RadarObject(container_, pos);
-            lastRadarObject_ = firstRadarObject_;
+    void RadarOverlayElement::listObjects(){
+        int i = 0;
+        COUT(3) << "List of RadarObjects:\n";
+        // iterate through all Radar Objects
+        for(std::set<RadarObject*>::iterator it=HUD::getSingleton().roSet.begin(); it!=HUD::getSingleton().roSet.end(); it++){
+            COUT(3) << i++ << ": " << (*it)->getPosition() << std::endl;
         }
-        else{
-            lastRadarObject_->next = new RadarObject(container_, pos);
-            lastRadarObject_ = lastRadarObject_->next;
-        }
-	}
+    }
 
-	void RadarOverlayElement::listObjects(){
-	    int i = 0;
-	    RadarObject* ro = firstRadarObject_;
-	    COUT(3) << "List of RadarObjects:\n";
-	    // iterate through all Radar Objects
-	    while(ro != NULL) {
-	        COUT(3) << i++ << ": " << ro->pos_ << std::endl;
-	        ro = ro->next;
-	    }
-	}
+    float RadarOverlayElement::calcRadius(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj){
+        return(acos((dir.dotProduct(obj->getPosition() - pos))/
+        ((obj->getPosition() - pos).length()*dir.length())));
+    }
 
-	float RadarOverlayElement::getDist2Focus(){
-	    if(focus_ == NULL) return(0.0);
-	    return((focus_->pos_-shipPos_).length());
-	}
+    float RadarOverlayElement::calcPhi(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj){
+        // project difference vector on our plane...
+        Vector3 proj = Plane(dir, pos).projectVector(obj->getPosition() - pos);
+        // ...and find out the angle
+        return(acos((orth.dotProduct(proj))/
+              (orth.length()*proj.length())));
+    }
 
-	float RadarOverlayElement::calcRadius(RadarObject* obj){
-	    return(acos((currentDir_.dotProduct(obj->pos_ - shipPos_))/
-			((obj->pos_ - shipPos_).length()*currentDir_.length())));
-	}
-
-	float RadarOverlayElement::calcPhi(RadarObject* obj){
-	    // project difference vector on our plane...
-	    Ogre::Vector3 proj = plane.projectVector(obj->pos_ - shipPos_);
-	    // ...and find out the angle
-	    return(acos((currentOrth_.dotProduct(proj))/
-            (currentOrth_.length()*proj.length())));
-	}
-
-	bool RadarOverlayElement::calcRight(RadarObject* obj){
-	    if((currentDir_.crossProduct(currentOrth_)).dotProduct(obj->pos_ - shipPos_) > 0)
-        	return true;
+    bool RadarOverlayElement::calcRight(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj){
+        if((dir.crossProduct(orth)).dotProduct(obj->getPosition() - pos) > 0)
+            return true;
         else return false;
-	}
-
-	/*static*/void RadarOverlayElement::cycleFocus(){
-	    if(RadarOverlayElement::instance_s == NULL) return;
-
-	    if(RadarOverlayElement::instance_s->focus_ == NULL){
-            RadarOverlayElement::instance_s->focus_ = RadarOverlayElement::instance_s->firstRadarObject_;
-	    }
-        else{
-            RadarOverlayElement::instance_s->focus_->panel_->setMaterialName("Orxonox/RedDot");
-            RadarOverlayElement::instance_s->focus_ = RadarOverlayElement::instance_s->focus_->next;
-        }
-
-        if(RadarOverlayElement::instance_s->focus_ == NULL){
-            RadarOverlayElement::instance_s->navMarker_->hide();
-        }
-        else{
-            RadarOverlayElement::instance_s->navMarker_->show();
-            RadarOverlayElement::instance_s->focus_->panel_->setMaterialName("Orxonox/WhiteDot");
-        }
-	}
+    }
 }
-
-/* my local clipboard...
-COUT(3) << "WWWWWWWWWWWWWWWWWWWWWWWWWWWW\n";
-COUT(3) << firstRadarObject_->radius_ << "  " << firstRadarObject_->phi_ << std::endl;
-COUT(3) << "WWWWWWWWWWWWWWWWWWWWWWWWWWWW\n";
-*/
Index: code/trunk/src/orxonox/hud/RadarOverlayElement.h
===================================================================
--- code/trunk/src/orxonox/hud/RadarOverlayElement.h	(revision 1407)
+++ code/trunk/src/orxonox/hud/RadarOverlayElement.h	(revision 1502)
@@ -1,47 +1,38 @@
 /*
-*   ORXONOX - the hottest 3D action shooter ever to exist
-*
-*
-*   License notice:
-*
-*   This program is free software; you can redistribute it and/or
-*   modify it under the terms of the GNU General Public License
-*   as published by the Free Software Foundation; either version 2
-*   of the License, or (at your option) any later version.
-*
-*   This program is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with this program; if not, write to the Free Software
-*   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-*
-*   Author:
-*      Yuning Chai
-*   Co-authors:
-*      ...
-*
-*/
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Yuning Chai
+ *   Co-authors:
+ *      Felix Schulthess
+ *
+ */
 
-#ifndef _RADAR_H__
-#define _RADAR_H__
+#ifndef _RadarOverlayElement_H__
+#define _RadarOverlayElement_H__
 
-#include <string.h>
-#include <OgreOverlayManager.h>
-#include <OgreStringConverter.h>
-#include <OgreOverlayElement.h>
+#include "OrxonoxPrereqs.h"
+
+#include <OgrePrerequisites.h>
 #include <OgrePanelOverlayElement.h>
-#include <OgrePrerequisites.h>
-
-#include <util/Math.h>
-#include <string.h>
-#include "core/Tickable.h"
-#include "core/ConsoleCommand.h"
-#include "objects/SpaceShip.h"
-#include "../OrxonoxPrereqs.h"
-#include "RadarObject.h"
-#include "GraphicsEngine.h"
+#include "util/Math.h"
 
 namespace orxonox
@@ -49,41 +40,28 @@
     class _OrxonoxExport RadarOverlayElement : public Ogre::PanelOverlayElement
     {
-        private:
-            Ogre::OverlayManager* om;               // our one and only overlay manager
-            Ogre::OverlayContainer* container_;     // pointer to the container we're in
-            Vector3 initialDir_;	                // direction of nose
-            Vector3 currentDir_;
-            Vector3 initialOrth_;                   // direction of normal
-            Vector3 currentOrth_;
-            Vector3 shipPos_;                       // position of ship
-            Ogre::Plane plane;                      // plane perpendicular to dir
+      private:
+        Ogre::OverlayManager* om;               // our one and only overlay manager
+        Ogre::OverlayContainer* container_;     // pointer to the container we're in
+        Vector3 currentDir_;
+        Vector3 currentOrth_;
+        Vector3 shipPos_;                       // position of ship
 
-            Ogre::Real leftRel_, topRel_, dimRel_;  // relative position/dimension
-            int left_, top_, dim_;                  // absolute position/dimension
-            int windowW_, windowH_;             	// absolute window dimensions
+        Ogre::Real leftRel_, topRel_, dimRel_;  // relative position/dimension
+        int left_, top_, dim_;                  // absolute position/dimension
+        int windowW_, windowH_;             	  // absolute window dimensions
 
-        public:
-            RadarOverlayElement(const Ogre::String& name);
-            ~RadarOverlayElement();
-            void init(Real leftRel, Real topRel, Real dimRel, Ogre::OverlayContainer* container);
-			void resize();
-            void update();
-            void updateNavMarker();
-            void addObject(Vector3 pos);
-            void listObjects();
-            float getDist2Focus();
-            float calcRadius(RadarObject* obj);
-            float calcPhi(RadarObject* obj);
-            bool calcRight(RadarObject* obj);
+      public:
+        RadarOverlayElement(const Ogre::String& name);
+        ~RadarOverlayElement();
+        void init(Real leftRel, Real topRel, Real dimRel, Ogre::OverlayContainer* container);
+        void resize();
+        void update();
+        void listObjects();
 
-            Ogre::PanelOverlayElement* navMarker_;  // marker to help navigating
-			RadarObject* firstRadarObject_;         // start of linked list
-			RadarObject* lastRadarObject_;          // end of linked list
-			RadarObject* focus_;                    // object that is focussed
-
-            static RadarOverlayElement* instance_s;
-            static void cycleFocus();
-	};
+        static float calcRadius(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj);
+        static float calcPhi(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj);
+        static bool calcRight(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj);
+  };
 }
 
-#endif
+#endif /* _RadarOverlayElement_H__ */
Index: code/trunk/src/orxonox/objects/Ambient.cc
===================================================================
--- code/trunk/src/orxonox/objects/Ambient.cc	(revision 1407)
+++ code/trunk/src/orxonox/objects/Ambient.cc	(revision 1502)
@@ -47,5 +47,5 @@
 namespace orxonox
 {
-    ConsoleCommand(Ambient, setAmbientLightTest, AccessLevel::Offline, false).setDefaultValues(ColourValue(1, 1, 1, 1));
+    SetConsoleCommand(Ambient, setAmbientLightTest, false).setDefaultValues(ColourValue(1, 1, 1, 1)).setAccessLevel(AccessLevel::Offline);
 
     CreateFactory(Ambient);
@@ -66,5 +66,5 @@
     bool Ambient::create(){
       GraphicsEngine::getSingleton().getSceneManager()->setAmbientLight(ambientLight_);
-      return true;
+      return Synchronisable::create();
     }
     
Index: code/trunk/src/orxonox/objects/Ambient.h
===================================================================
--- code/trunk/src/orxonox/objects/Ambient.h	(revision 1407)
+++ code/trunk/src/orxonox/objects/Ambient.h	(revision 1502)
@@ -47,5 +47,5 @@
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
             void setAmbientLight(const ColourValue& colour);
-            bool create();
+            virtual bool create();
             void registerAllVariables();
 
Index: code/trunk/src/orxonox/objects/Camera.cc
===================================================================
--- code/trunk/src/orxonox/objects/Camera.cc	(revision 1407)
+++ code/trunk/src/orxonox/objects/Camera.cc	(revision 1502)
@@ -60,4 +60,5 @@
   {
     CameraHandler::getInstance()->releaseFocus(this);
+    GraphicsEngine::getSingleton().getSceneManager()->getRootSceneNode()->removeAndDestroyChild(cameraNode_->getName());
   }
 
@@ -75,10 +76,15 @@
   void Camera::tick(float dt)
   {
-    if(this->positionNode_ != NULL) {
+    if (this->positionNode_ != NULL)
+    {
       // this stuff here may need some adjustments
-      Vector3 offset = this->positionNode_->getWorldPosition() - this->cameraNode_->getPosition();
-      this->cameraNode_->translate(15*dt*offset);
+      Vector3 offset = this->positionNode_->getWorldPosition() - this->cameraNode_->getWorldPosition();
+      float coeff = 15.0f * dt;
+      if (coeff > 1.0f)
+        coeff = 1.0f;
 
-      this->cameraNode_->setOrientation(Quaternion::Slerp(0.7, this->positionNode_->getWorldOrientation(), this->cameraNode_->getWorldOrientation(), false));
+      this->cameraNode_->translate(coeff * offset);
+
+      this->cameraNode_->setOrientation(Quaternion::Slerp(7.0f * dt, this->positionNode_->getWorldOrientation(), this->cameraNode_->getWorldOrientation(), false));
     }
   }
Index: code/trunk/src/orxonox/objects/Camera.h
===================================================================
--- code/trunk/src/orxonox/objects/Camera.h	(revision 1407)
+++ code/trunk/src/orxonox/objects/Camera.h	(revision 1502)
@@ -50,4 +50,6 @@
         void setTargetNode(Ogre::SceneNode* obj);
 
+        Ogre::Camera* cam_;
+
         void tick(float dt);
         void update();
@@ -63,5 +65,4 @@
         Ogre::SceneNode* cameraNode_;
         Ogre::Vector3 oldPos;
-        Ogre::Camera* cam_;
         bool bHasFocus_;
     };
Index: code/trunk/src/orxonox/objects/CameraHandler.cc
===================================================================
--- code/trunk/src/orxonox/objects/CameraHandler.cc	(revision 1407)
+++ code/trunk/src/orxonox/objects/CameraHandler.cc	(revision 1502)
@@ -26,10 +26,11 @@
  *
  */
+#include "OrxonoxStableHeaders.h"
+#include "CameraHandler.h"
+
 #include <OgreSceneManager.h>
 #include <OgreRenderWindow.h>
 
-#include "OrxonoxStableHeaders.h"
 #include "core/ObjectList.h"
-#include "CameraHandler.h"
 #include "Camera.h"
 #include "GraphicsEngine.h"
Index: code/trunk/src/orxonox/objects/Explosion.cc
===================================================================
--- code/trunk/src/orxonox/objects/Explosion.cc	(revision 1407)
+++ code/trunk/src/orxonox/objects/Explosion.cc	(revision 1502)
@@ -79,4 +79,10 @@
         }
     };
+    
+    /*bool Explosion::create(){
+      if(!WorldEntity::create())
+        return false;
+      classID=this->getIdentifier()->getNetworkID();
+    }*/
 
     void Explosion::destroyObject()
Index: code/trunk/src/orxonox/objects/Explosion.h
===================================================================
--- code/trunk/src/orxonox/objects/Explosion.h	(revision 1407)
+++ code/trunk/src/orxonox/objects/Explosion.h	(revision 1502)
@@ -43,4 +43,5 @@
             virtual ~Explosion();
             void destroyObject();
+            virtual bool create(){return WorldEntity::create();}
 
         private:
Index: code/trunk/src/orxonox/objects/Model.cc
===================================================================
--- code/trunk/src/orxonox/objects/Model.cc	(revision 1407)
+++ code/trunk/src/orxonox/objects/Model.cc	(revision 1502)
@@ -34,4 +34,10 @@
 #include "GraphicsEngine.h"
 #include "core/XMLPort.h"
+
+#include <OgreEntity.h>
+#include <OgreMesh.h>
+#include <OgreHardwareVertexBuffer.h>
+#include <OgreMeshManager.h>
+
 
 namespace orxonox
@@ -77,4 +83,26 @@
         this->mesh_.setMesh(meshSrc_);
         this->attachObject(this->mesh_.getEntity());
+
+        //HACK!!
+        /*if ((this->meshSrc_ == "assff.mesh") || (this->meshSrc_ == "ast1.mesh") || (this->meshSrc_ == "ast2.mesh") || (this->meshSrc_ == "ast3.mesh") || (this->meshSrc_ == "ast4.mesh") ||(this->meshSrc_ == "ast5.mesh") || (this->meshSrc_ == "ast6.mesh"))
+        {
+          Ogre::MeshPtr pMesh = this->mesh_.getEntity()->getMesh();
+          //set Mesh to tangentspace 
+          unsigned short src, dest;
+          if (!pMesh->suggestTangentVectorBuildParams(Ogre::VES_TANGENT, src, dest))
+          {
+            pMesh->buildTangentVectors(Ogre::VES_TANGENT, src, dest);
+          }
+          if ((this->meshSrc_ == "assff.mesh"))
+          {
+            (this->mesh_.getEntity())->setMaterialName("Assff/BumpMap");
+          }
+          else
+          {
+            (this->mesh_.getEntity())->setMaterialName("Asteroid/BumpMap");
+          }
+
+
+        }*/
         COUT(4) << "Loader (Model.cc): Created model" << std::endl;
       }
Index: code/trunk/src/orxonox/objects/Model.h
===================================================================
--- code/trunk/src/orxonox/objects/Model.h	(revision 1407)
+++ code/trunk/src/orxonox/objects/Model.h	(revision 1502)
@@ -45,5 +45,5 @@
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
             void setMesh(const std::string& meshname);
-            bool create();
+            virtual bool create();
 
         protected:
Index: code/trunk/src/orxonox/objects/NPC.cc
===================================================================
--- code/trunk/src/orxonox/objects/NPC.cc	(revision 1407)
+++ code/trunk/src/orxonox/objects/NPC.cc	(revision 1502)
@@ -67,8 +67,4 @@
   }
   
-  bool NPC::create(){
-    Model::create();
-    return true;
-  }
 
   /**
Index: code/trunk/src/orxonox/objects/NPC.h
===================================================================
--- code/trunk/src/orxonox/objects/NPC.h	(revision 1407)
+++ code/trunk/src/orxonox/objects/NPC.h	(revision 1502)
@@ -53,5 +53,5 @@
       void setValues(Vector3 location, Vector3 speed, Vector3 acceleration, bool movable);
       void registerAllVariables();
-      bool create();
+      virtual bool create(){return Model::create();}
 
     private:
Index: code/trunk/src/orxonox/objects/Projectile.cc
===================================================================
--- code/trunk/src/orxonox/objects/Projectile.cc	(revision 1407)
+++ code/trunk/src/orxonox/objects/Projectile.cc	(revision 1502)
@@ -30,4 +30,6 @@
 #include "Projectile.h"
 
+#include <OgreBillboard.h>
+
 #include "core/CoreIncludes.h"
 #include "core/Executor.h"
@@ -41,4 +43,6 @@
 {
     CreateFactory(Projectile);
+
+    float Projectile::speed_ = 0;
 
     Projectile::Projectile(SpaceShip* owner) :
@@ -63,5 +67,4 @@
 
         this->destroyTimer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&Projectile::destroyObject)));
-        this->classID = this->getIdentifier()->getNetworkID(); // TODO: remove this hack
 //        COUT(3) << this->classID << std::endl;
     }
@@ -92,5 +95,6 @@
                 if (this->getPosition().squaredDistance(it->getPosition()) <= (radius*radius))
                 {
-                    new Explosion(this);
+                    Explosion *exp = new Explosion(this);
+                    exp->create();
                     delete this;
                     return;
@@ -104,3 +108,8 @@
         delete this;
     }
+
+    void Projectile::setColour(const ColourValue& colour)
+    {
+        this->billboard_.getBillboardSet()->getBillboard(0)->setColour(colour);
+    }
 }
Index: code/trunk/src/orxonox/objects/Projectile.h
===================================================================
--- code/trunk/src/orxonox/objects/Projectile.h	(revision 1407)
+++ code/trunk/src/orxonox/objects/Projectile.h	(revision 1502)
@@ -35,4 +35,5 @@
 #include "../tools/BillboardSet.h"
 #include "../tools/Timer.h"
+#include "util/Math.h"
 
 namespace orxonox
@@ -46,9 +47,16 @@
             void destroyObject();
             virtual void tick(float dt);
+            virtual bool create(){return WorldEntity::create();}
+            void setColour(const ColourValue& colour);
+
+            static float getSpeed()
+                { return Projectile::speed_; }
+
+        protected:
+            SpaceShip* owner_;
 
         private:
-            SpaceShip* owner_;
             BillboardSet billboard_;
-            float speed_;
+            static float speed_;
             float lifetime_;
             Timer<Projectile> destroyTimer_;
Index: code/trunk/src/orxonox/objects/RotatingProjectile.cc
===================================================================
--- code/trunk/src/orxonox/objects/RotatingProjectile.cc	(revision 1502)
+++ code/trunk/src/orxonox/objects/RotatingProjectile.cc	(revision 1502)
@@ -0,0 +1,82 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "RotatingProjectile.h"
+
+#include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
+#include <OgreBillboard.h>
+
+namespace orxonox
+{
+    CreateFactory(RotatingProjectile);
+
+    RotatingProjectile::RotatingProjectile(SpaceShip* owner) : Projectile(owner)
+    {
+        RegisterObject(RotatingProjectile);
+
+        this->time_ = 0;
+
+        if (/*this->owner_*/true)
+        {
+            this->rotatingBillboard1_.setBillboardSet("Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1);
+            this->rotatingBillboard2_.setBillboardSet("Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1);
+
+            this->rotatingNode1_ = this->getNode()->createChildSceneNode(this->getName() + "rotating1", Vector3(0, 50, 0));
+            this->rotatingNode2_ = this->getNode()->createChildSceneNode(this->getName() + "rotating2", Vector3(0, -50, 0));
+            this->rotatingNode1_->attachObject(this->rotatingBillboard1_.getBillboardSet());
+            this->rotatingNode2_->attachObject(this->rotatingBillboard2_.getBillboardSet());
+            this->rotatingNode1_->scale(0.3, 0.3, 0.3);
+            this->rotatingNode2_->scale(0.3, 0.3, 0.3);
+        }
+
+        this->setConfigValues();
+    }
+
+    RotatingProjectile::~RotatingProjectile()
+    {
+    }
+
+    void RotatingProjectile::setConfigValues()
+    {
+        SetConfigValue(colour_, ColourValue(1.0, 0.0, 0.0));
+
+        this->rotatingBillboard1_.getBillboardSet()->getBillboard(0)->setColour(this->colour_);
+        this->rotatingBillboard2_.getBillboardSet()->getBillboard(0)->setColour(this->colour_);
+    }
+
+    void RotatingProjectile::tick(float dt)
+    {
+        this->time_ += dt;
+
+        this->rotatingNode1_->setPosition(0, 50 * sin(this->time_ * 20), 50 * cos(this->time_ * 20));
+        this->rotatingNode2_->setPosition(0, -50 * sin(this->time_ * 20), -50 * cos(this->time_ * 20));
+
+        Projectile::tick(dt);
+    }
+}
Index: code/trunk/src/orxonox/objects/RotatingProjectile.h
===================================================================
--- code/trunk/src/orxonox/objects/RotatingProjectile.h	(revision 1502)
+++ code/trunk/src/orxonox/objects/RotatingProjectile.h	(revision 1502)
@@ -0,0 +1,29 @@
+#ifndef _RotatingProjectile_H__
+#define _RotatingProjectile_H__
+
+#include "../OrxonoxPrereqs.h"
+#include "util/Math.h"
+#include "Projectile.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport RotatingProjectile : public Projectile/*, public network::Synchronisable*/
+    {
+        public:
+            RotatingProjectile(SpaceShip* owner = 0);
+            virtual ~RotatingProjectile();
+            void setConfigValues();
+            virtual void tick(float dt);
+            virtual bool create(){return Projectile::create();}
+
+        private:
+            ColourValue colour_;
+            BillboardSet rotatingBillboard1_;
+            BillboardSet rotatingBillboard2_;
+            Ogre::SceneNode* rotatingNode1_;
+            Ogre::SceneNode* rotatingNode2_;
+            float time_;
+    };
+}
+
+#endif /* _RotatingProjectile_H__ */
Index: code/trunk/src/orxonox/objects/Skybox.cc
===================================================================
--- code/trunk/src/orxonox/objects/Skybox.cc	(revision 1407)
+++ code/trunk/src/orxonox/objects/Skybox.cc	(revision 1502)
@@ -90,5 +90,5 @@
     bool Skybox::create(){
       this->setSkybox(skyboxSrc_);
-      return true;
+      return Synchronisable::create();
     }
     
Index: code/trunk/src/orxonox/objects/Skybox.h
===================================================================
--- code/trunk/src/orxonox/objects/Skybox.h	(revision 1407)
+++ code/trunk/src/orxonox/objects/Skybox.h	(revision 1502)
@@ -47,5 +47,5 @@
             void setSkybox(const std::string& skyboxname);
             
-            bool create();
+            virtual bool create();
             void registerAllVariables();
             void setSkyboxSrc(const std::string &src);
Index: code/trunk/src/orxonox/objects/SpaceShip.cc
===================================================================
--- code/trunk/src/orxonox/objects/SpaceShip.cc	(revision 1407)
+++ code/trunk/src/orxonox/objects/SpaceShip.cc	(revision 1502)
@@ -45,15 +45,23 @@
 #include "particle/ParticleInterface.h"
 #include "Projectile.h"
+#include "RotatingProjectile.h"
 #include "core/XMLPort.h"
 #include "core/ConsoleCommand.h"
 #include "network/Client.h"
+#include "hud/HUD.h"
 
 namespace orxonox
 {
-    ConsoleCommand(SpaceShip, setMaxSpeedTest, AccessLevel::Debug, false);
-    ConsoleCommand(SpaceShip, whereAmI, AccessLevel::User, true);
-    ConsoleCommandGeneric(test1, SpaceShip, createExecutor(createFunctor(&SpaceShip::setMaxSpeedTest), "setMaxSpeed", AccessLevel::Debug), false);
-    ConsoleCommandGeneric(test2, SpaceShip, createExecutor(createFunctor(&SpaceShip::setMaxSpeedTest), "setMaxBlubber", AccessLevel::Debug), false);
-    ConsoleCommandGeneric(test3, SpaceShip, createExecutor(createFunctor(&SpaceShip::setMaxSpeedTest), "setRofl", AccessLevel::Debug), false);
+    SetConsoleCommand(SpaceShip, setMaxSpeedTest, false).setAccessLevel(AccessLevel::Debug);
+    SetConsoleCommand(SpaceShip, whereAmI, true).setAccessLevel(AccessLevel::User);
+    SetConsoleCommand(SpaceShip, moveLongitudinal, true).setAccessLevel(AccessLevel::User).setDefaultValue(0, 1.0f).setAxisParamIndex(0).setKeybindMode(KeybindMode::OnHold);
+    SetConsoleCommand(SpaceShip, moveLateral, true).setAccessLevel(AccessLevel::User).setDefaultValue(0, 1.0f).setAxisParamIndex(0).setKeybindMode(KeybindMode::OnHold);
+    SetConsoleCommand(SpaceShip, moveYaw, true).setAccessLevel(AccessLevel::User).setDefaultValue(0, 1.0f).setAxisParamIndex(0).setKeybindMode(KeybindMode::OnHold);
+    SetConsoleCommand(SpaceShip, movePitch, true).setAccessLevel(AccessLevel::User).setDefaultValue(0, 1.0f).setAxisParamIndex(0).setKeybindMode(KeybindMode::OnHold);
+    SetConsoleCommand(SpaceShip, moveRoll, true).setAccessLevel(AccessLevel::User).setDefaultValue(0, 1.0f).setAxisParamIndex(0).setKeybindMode(KeybindMode::OnHold);
+    SetConsoleCommand(SpaceShip, fire, true).setAccessLevel(AccessLevel::User).setKeybindMode(KeybindMode::OnHold);
+    SetConsoleCommandGeneric(test1, SpaceShip, createConsoleCommand(createFunctor(&SpaceShip::setMaxSpeedTest), "setMaxSpeed"), false).setAccessLevel(AccessLevel::Debug);
+    SetConsoleCommandGeneric(test2, SpaceShip, createConsoleCommand(createFunctor(&SpaceShip::setMaxSpeedTest), "setMaxBlubber"), false).setAccessLevel(AccessLevel::Debug);
+    SetConsoleCommandGeneric(test3, SpaceShip, createConsoleCommand(createFunctor(&SpaceShip::setMaxSpeedTest), "setRofl"), false).setAccessLevel(AccessLevel::Debug);
 
     CreateFactory(SpaceShip);
@@ -64,10 +72,10 @@
       Iterator<SpaceShip> it;
       for(it = ObjectList<SpaceShip>::start(); it; ++it){
-        if((it)->server_ || ( network::Client::getSingleton() && network::Client::getSingleton()->getShipID()==it->objectID ) )
+        if( (it)->myShip_ )
           return *it;
       }
       return NULL;
     }
-    
+
     SpaceShip::SpaceShip() :
       //testvector_(0,0,0),
@@ -103,5 +111,7 @@
       mouseY_(0.0f),
       emitterRate_(0.0f),
-      server_(false)
+      myShip_(false),
+      teamNr_(0),
+      health_(100)
     {
         RegisterObject(SpaceShip);
@@ -112,4 +122,10 @@
         this->setConfigValues();
 
+        initialDir_ = Vector3(1.0, 0.0, 0.0);
+        currentDir_ = initialDir_;
+        initialOrth_ = Vector3(0.0, 0.0, 1.0);
+        currentOrth_ = initialOrth_;
+
+        this->camName_ = this->getName() + "CamNode";
 
         this->setRotationAxis(1, 0, 0);
@@ -127,7 +143,16 @@
         if (this->cam_)
           delete this->cam_;
+        if (!Identifier::isCreatingHierarchy() && !myShip_ && &HUD::getSingleton()!=NULL)
+          //remove the radar object
+          HUD::getSingleton().removeRadarObject(this->getNode());
     }
 
     bool SpaceShip::create(){
+      if(!myShip_){
+        if(network::Client::getSingleton() && objectID == network::Client::getSingleton()->getShipID())
+          myShip_=true;
+        else
+          HUD::getSingleton().addRadarObject(this->getNode(), 3);
+      }
       if(Model::create())
         this->init();
@@ -153,14 +178,4 @@
     void SpaceShip::init()
     {
-        if ((server_ || ( network::Client::getSingleton() && network::Client::getSingleton()->getShipID()==objectID ) ))
-        {
-              if (!setMouseEventCallback_)
-              {
-                  InputManager::addMouseHandler(this, "SpaceShip");
-                  //InputManager::enableMouseHandler("SpaceShip");
-                  setMouseEventCallback_ = true;
-              }
-        }
-
         // START CREATING THRUSTER
         this->tt_ = new ParticleInterface(GraphicsEngine::getSingleton().getSceneManager(),"twinthruster" + this->getName(),"Orxonox/engineglow");
@@ -200,18 +215,21 @@
         // END CREATING BLINKING LIGHTS
 
-        // START of testing crosshair
-        this->crosshairNear_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1);
-        this->crosshairFar_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1);
-
-        this->chNearNode_ = this->getNode()->createChildSceneNode(this->getName() + "near", Vector3(50.0, 0.0, 0.0));
-        this->chNearNode_->setInheritScale(false);
-        this->chFarNode_ = this->getNode()->createChildSceneNode(this->getName() + "far", Vector3(200.0, 0.0, 0.0));
-        this->chFarNode_->setInheritScale(false);
-
-        this->chNearNode_->attachObject(this->crosshairNear_.getBillboardSet());
-        this->chNearNode_->setScale(0.2, 0.2, 0.2);
-
-        this->chFarNode_->attachObject(this->crosshairFar_.getBillboardSet());
-        this->chFarNode_->setScale(0.4, 0.4, 0.4);
+        if (this->isExactlyA(Class(SpaceShip)))
+        {
+            // START of testing crosshair
+            this->crosshairNear_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1);
+            this->crosshairFar_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1);
+
+            this->chNearNode_ = this->getNode()->createChildSceneNode(this->getName() + "near", Vector3(50.0, 0.0, 0.0));
+            this->chNearNode_->setInheritScale(false);
+            this->chFarNode_ = this->getNode()->createChildSceneNode(this->getName() + "far", Vector3(200.0, 0.0, 0.0));
+            this->chFarNode_->setInheritScale(false);
+
+            this->chNearNode_->attachObject(this->crosshairNear_.getBillboardSet());
+            this->chNearNode_->setScale(0.2, 0.2, 0.2);
+
+            this->chFarNode_->attachObject(this->crosshairFar_.getBillboardSet());
+            this->chFarNode_->setScale(0.4, 0.4, 0.4);
+        }
 
         createCamera();
@@ -237,4 +255,8 @@
         CameraHandler::getInstance()->requestFocus(cam_);
 
+    }
+
+    Camera* SpaceShip::getCamera(){
+        return cam_;
     }
 
@@ -295,7 +317,9 @@
         XMLPortParamLoadOnly(SpaceShip, "transDamp", setTransDamp, xmlelement, mode);
         XMLPortParamLoadOnly(SpaceShip, "rotDamp", setRotDamp, xmlelement, mode);
-        server_=true; // TODO: this is only a hack
+        myShip_=true; // TODO: this is only a hack
+
         SpaceShip::create();
-        getFocus();
+        if (this->isExactlyA(Class(SpaceShip)))
+            getFocus();
     }
 
@@ -308,81 +332,4 @@
     }
 
-    void SpaceShip::mouseMoved(IntVector2 abs, IntVector2 rel, IntVector2 clippingSize)
-    {
-/*
-        this->mouseX += e.state.X.rel;
-        if (this->bInvertMouse_)
-            this->mouseY += e.state.Y.rel;
-        else
-            this->mouseY -= e.state.Y.rel;
-
-//        if(mouseX>maxMouseX) maxMouseX = mouseX;
-//        if(mouseX<minMouseX) minMouseX = mouseX;
-//        cout << "mouseX: " << mouseX << "\tmouseY: " << mouseY << endl;
-
-        this->moved = true;
-*/
-        if (this->bRMousePressed_)
-        {
-            this->camNode_->roll(Degree(-rel.x * 0.10));
-            this->camNode_->yaw(Degree(rel.y * 0.10));
-        }
-        else
-        {
-            float minDimension = clippingSize.y;
-            if (clippingSize.x < minDimension)
-                minDimension = clippingSize.x;
-
-            this->mouseX_ += rel.x;
-            if (this->mouseX_ < -minDimension)
-                this->mouseX_ = -minDimension;
-            if (this->mouseX_ > minDimension)
-                this->mouseX_ = minDimension;
-
-            this->mouseY_ += rel.y;
-            if (this->mouseY_ < -minDimension)
-                this->mouseY_ = -minDimension;
-            if (this->mouseY_ > minDimension)
-                this->mouseY_ = minDimension;
-
-            float xRotation = this->mouseX_ / minDimension;
-            xRotation = xRotation*xRotation * sgn(xRotation);
-            xRotation *= -this->rotationAcceleration_;
-            if (xRotation > this->maxRotation_)
-                xRotation = this->maxRotation_;
-            if (xRotation < -this->maxRotation_)
-                xRotation = -this->maxRotation_;
-            this->mouseXRotation_ = Radian(xRotation);
-
-            float yRotation = this->mouseY_ / minDimension;
-            yRotation = yRotation*yRotation * sgn(yRotation);
-            yRotation *= this->rotationAcceleration_;
-            if (yRotation > this->maxRotation_)
-                yRotation = this->maxRotation_;
-            if (yRotation < -this->maxRotation_)
-                yRotation = -this->maxRotation_;
-            this->mouseYRotation_ = Radian(yRotation);
-        }
-    }
-
-    void SpaceShip::mouseButtonPressed(MouseButton::Enum id)
-    {
-        if (id == MouseButton::Left)
-            this->bLMousePressed_ = true;
-        else if (id == MouseButton::Right)
-            this->bRMousePressed_ = true;
-    }
-
-    void SpaceShip::mouseButtonReleased(MouseButton::Enum id)
-    {
-        if (id == MouseButton::Left)
-            this->bLMousePressed_ = false;
-        else if (id == MouseButton::Right)
-        {
-            this->bRMousePressed_ = false;
-            this->camNode_->resetOrientation();
-        }
-    }
-
     std::string SpaceShip::whereAmI() {
 	return getConvertedValue<float, std::string>(SpaceShip::getLocalShip()->getPosition().x)
@@ -391,10 +338,10 @@
     }
 
-    Vector3 SpaceShip::getSPosition() {
-	return SpaceShip::getLocalShip()->getPosition();
-    }
-
-    Quaternion SpaceShip::getSOrientation() {
-	return SpaceShip::getLocalShip()->getOrientation();
+    Vector3 SpaceShip::getDir() {
+        return currentDir_;
+    }
+
+    Vector3 SpaceShip::getOrth(){
+        return currentOrth_;
     }
 
@@ -403,4 +350,7 @@
     void SpaceShip::tick(float dt)
     {
+        currentDir_ = getOrientation()*initialDir_;
+		currentOrth_ = getOrientation()*initialOrth_;
+
         if (this->cam_)
             this->cam_->tick(dt);
@@ -422,7 +372,15 @@
         if (this->bLMousePressed_ && this->timeToReload_ <= 0)
         {
-          
-            Projectile *p = new Projectile(this);
-            
+
+            Projectile *p;
+            if (this->isExactlyA(Class(SpaceShip)))
+                p = new RotatingProjectile(this);
+            else
+                p = new Projectile(this);
+            p->setColour(this->getProjectileColour());
+            p->create();
+            if(p->classID==0)
+              COUT(3) << "generated projectile with classid 0" <<  std::endl; // TODO: remove this output
+
             p->setBacksync(true);
             this->timeToReload_ = this->reloadTime_;
@@ -495,29 +453,4 @@
         }
 
-        if( (network::Client::getSingleton() &&  network::Client::getSingleton()->getShipID() == objectID) || server_ )
-        {
-          COUT(4) << "steering our ship: " << objectID << std::endl;
-          if (InputManager::isKeyDown(KeyCode::Up) || InputManager::isKeyDown(KeyCode::W))
-            this->acceleration_.x = this->translationAcceleration_;
-          else if(InputManager::isKeyDown(KeyCode::Down) || InputManager::isKeyDown(KeyCode::S))
-            this->acceleration_.x = -this->translationAcceleration_;
-          else
-            this->acceleration_.x = 0;
-
-          if (InputManager::isKeyDown(KeyCode::Right) || InputManager::isKeyDown(KeyCode::D))
-            this->acceleration_.y = -this->translationAcceleration_;
-          else if (InputManager::isKeyDown(KeyCode::Left) || InputManager::isKeyDown(KeyCode::A))
-            this->acceleration_.y = this->translationAcceleration_;
-          else
-            this->acceleration_.y = 0;
-
-          if (InputManager::isKeyDown(KeyCode::Delete) || InputManager::isKeyDown(KeyCode::Q))
-            this->momentum_ = Radian(-this->rotationAccelerationRadian_);
-          else if (InputManager::isKeyDown(KeyCode::PageDown) || InputManager::isKeyDown(KeyCode::E))
-            this->momentum_ = Radian(this->rotationAccelerationRadian_);
-          else
-            this->momentum_ = 0;
-        }/*else
-          COUT(4) << "not steering ship: " << objectID << " our ship: " << network::Client::getSingleton()->getShipID() << std::endl;*/
 
         WorldEntity::tick(dt);
@@ -533,5 +466,70 @@
         else
             this->tt_->setRate(0);
-    }
-
+
+        if( myShip_ )
+        {
+          COUT(4) << "steering our ship: " << objectID << std::endl;
+          this->acceleration_.x = 0;
+          this->acceleration_.y = 0;
+          this->momentum_ = 0;
+          this->mouseXRotation_ = Radian(0);
+          this->mouseYRotation_ = Radian(0);
+          this->bLMousePressed_ = false;
+        }/*else
+          COUT(4) << "not steering ship: " << objectID << " our ship: " << network::Client::getSingleton()->getShipID() << std::endl;*/
+    }
+
+    void SpaceShip::movePitch(float val)
+    {   getLocalShip()->setMovePitch(val);   }
+    void SpaceShip::moveYaw(float val)
+    {   getLocalShip()->setMoveYaw(val);   }
+    void SpaceShip::moveRoll(float val)
+    {   getLocalShip()->setMoveRoll(val);   }
+    void SpaceShip::moveLongitudinal(float val)
+    {   getLocalShip()->setMoveLongitudinal(val);   }
+    void SpaceShip::moveLateral(float val)
+    {   getLocalShip()->setMoveLateral(val);   }
+    void SpaceShip::fire()
+    {   getLocalShip()->doFire();   }
+
+    void SpaceShip::setMovePitch(float val)
+    {
+        val = -val * val * sgn(val) * this->rotationAcceleration_;
+        if (val > this->maxRotation_)
+            val = this->maxRotation_;
+        if (val < -this->maxRotation_)
+            val = -this->maxRotation_;
+        this->mouseYRotation_ = Radian(val);
+    }
+
+    void SpaceShip::setMoveYaw(float val)
+    {
+        val = -val * val * sgn(val) * this->rotationAcceleration_;
+        if (val > this->maxRotation_)
+            val = this->maxRotation_;
+        if (val < -this->maxRotation_)
+            val = -this->maxRotation_;
+        this->mouseXRotation_ = Radian(val);
+    }
+
+    void SpaceShip::setMoveRoll(float val)
+    {
+        this->momentum_ = Radian(-this->rotationAccelerationRadian_ * val);
+        //COUT(3) << "rotating val: " << val << " acceleration: " << this->rotationAccelerationRadian_.valueDegrees() << std::endl;
+    }
+
+    void SpaceShip::setMoveLongitudinal(float val)
+    {
+        this->acceleration_.x = this->translationAcceleration_ * val;
+    }
+
+    void SpaceShip::setMoveLateral(float val)
+    {
+        this->acceleration_.y = -this->translationAcceleration_ * val;
+    }
+
+    void SpaceShip::doFire()
+    {
+        this->bLMousePressed_ = true;
+    }
 }
Index: code/trunk/src/orxonox/objects/SpaceShip.h
===================================================================
--- code/trunk/src/orxonox/objects/SpaceShip.h	(revision 1407)
+++ code/trunk/src/orxonox/objects/SpaceShip.h	(revision 1502)
@@ -41,13 +41,13 @@
 namespace orxonox
 {
-    class _OrxonoxExport SpaceShip : public Model, public MouseHandler
+    class _OrxonoxExport SpaceShip : public Model
     {
         public:
-          
+
             static SpaceShip *getLocalShip();
-            
+
             SpaceShip();
             ~SpaceShip();
-            bool create();
+            virtual bool create();
             void registerAllVariables();
             void init();
@@ -64,25 +64,49 @@
             void setTransDamp(float value);
             void setRotDamp(float value);
+            void getFocus();
 
-            void getFocus();
-            static SpaceShip* instance_s;
-            static Vector3 getSPosition();
-            static Quaternion getSOrientation();
             static std::string whereAmI();
             static void setMaxSpeedTest(float value)
                 { SpaceShip::instance_s->setMaxSpeed(value); }
 
-            void mouseButtonPressed (MouseButton::Enum id);
-            void mouseButtonReleased(MouseButton::Enum id);
-            void mouseButtonHeld    (MouseButton::Enum id) { }
-            void mouseMoved         (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize);
-            void mouseScrolled      (int abs, int rel) { }
+            static void movePitch(float value);
+            static void moveYaw(float value);
+            static void moveRoll(float value);
+            static void moveLongitudinal(float value);
+            static void moveLateral(float value);
+            static void fire();
+            void setMovePitch(float value);
+            void setMoveYaw(float value);
+            void setMoveRoll(float value);
+            void setMoveLongitudinal(float value);
+            void setMoveLateral(float value);
+            void doFire();
 
             float getMaxSpeed();
+            Vector3 getDir();
+            Vector3 getOrth();
+            Camera* getCamera();
+
+            int getTeamNr() const
+                { return this->teamNr_; }
+            int getHealth() const
+                { return this->health_; }
+
+            bool getMyShip(){return myShip_;}
+
+        protected:
+            void setTeamNr(int teamNr)
+                { this->teamNr_ = teamNr; }
 
         private:
             void createCamera();
+            virtual ColourValue getProjectileColour() const
+                { return ColourValue(1.0, 1.0, 0.5); }
 
             Vector3 testvector_;
+            Vector3 initialDir_;
+            Vector3 currentDir_;
+            Vector3 initialOrth_;
+            Vector3 currentOrth_;
             bool bInvertYAxis_;
             bool setMouseEventCallback_;
@@ -130,5 +154,12 @@
 
             float emitterRate_;
-            bool server_;
+
+        protected:
+            bool myShip_;
+
+            int teamNr_;
+            int health_;
+
+            static SpaceShip* instance_s;
     };
 }
Index: code/trunk/src/orxonox/objects/SpaceShipAI.cc
===================================================================
--- code/trunk/src/orxonox/objects/SpaceShipAI.cc	(revision 1502)
+++ code/trunk/src/orxonox/objects/SpaceShipAI.cc	(revision 1502)
@@ -0,0 +1,293 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "SpaceShipAI.h"
+
+#include <OgreMath.h>
+#include "Projectile.h"
+#include "core/CoreIncludes.h"
+#include "core/Iterator.h"
+#include "core/Executor.h"
+#include "core/ConsoleCommand.h"
+#include "core/XMLPort.h"
+
+#define ACTION_INTERVAL 1.0f
+
+namespace orxonox
+{
+    SetConsoleCommand(SpaceShipAI, createEnemy, true).setDefaultValue(0, 1);
+    SetConsoleCommand(SpaceShipAI, killEnemies, true).setDefaultValue(0, 0);
+
+    CreateFactory(SpaceShipAI);
+
+    SpaceShipAI::SpaceShipAI()
+    {
+        RegisterObject(SpaceShipAI);
+
+        this->alive_ = true;
+        this->setPosition(Vector3(rnd(-1000, 1000), rnd(-1000, 1000), rnd(-1000, 0000)));
+        this->target_ = 0;
+        this->bShooting_ = 0;
+        this->bHasTargetPosition_ = false;
+
+        this->setTeamNr((int)rnd(NUM_AI_TEAMS) % NUM_AI_TEAMS + 1);
+
+        if (NUM_AI_TEAMS > 0)
+            this->teamColours_[1] = ColourValue(1, 0, 0, 1);
+        if (NUM_AI_TEAMS > 1)
+            this->teamColours_[2] = ColourValue(0, 1, 0, 1);
+        if (NUM_AI_TEAMS > 2)
+            this->teamColours_[3] = ColourValue(0, 0, 1, 1);
+
+        for (int i = 4; i <= NUM_AI_TEAMS; ++i)
+            this->teamColours_[i] = ColourValue(rnd(), rnd(), rnd(), 1);
+    }
+
+    void SpaceShipAI::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SpaceShip::XMLPort(xmlelement, mode);
+        myShip_=true;
+
+        this->actionTimer_.setTimer(ACTION_INTERVAL, true, this, createExecutor(createFunctor(&SpaceShipAI::action)));
+    }
+
+    void SpaceShipAI::createEnemy(int num)
+    {
+        for (int i = 0; i < num; ++i)
+        {
+            SpaceShipAI* newenemy = new SpaceShipAI();
+            newenemy->setMesh("assff.mesh");
+//            newenemy->setPosition(0, 0, 0);
+            newenemy->setScale(10);
+            newenemy->setMaxSpeed(500);
+            newenemy->setMaxSideAndBackSpeed(50);
+            newenemy->setMaxRotation(1.0);
+            newenemy->setTransAcc(200);
+            newenemy->setRotAcc(3.0);
+            newenemy->setTransDamp(75);
+            newenemy->setRotDamp(1.0);
+            Element xmlelement;
+            newenemy->XMLPort(xmlelement, XMLPort::LoadObject);
+        }
+    }
+
+    void SpaceShipAI::killEnemies(int num)
+    {
+        int i = 0;
+        for (Iterator<SpaceShipAI> it = ObjectList<SpaceShipAI>::begin(); it; )
+        {
+            delete *(it++);
+            ++i;
+            if (num && i >= num)
+                break;
+        }
+    }
+
+    ColourValue SpaceShipAI::getProjectileColour() const
+    {
+        return this->teamColours_[this->getTeamNr()];
+    }
+
+    void SpaceShipAI::action()
+    {
+        float random;
+        float maxrand = 100.0f / ACTION_INTERVAL;
+
+        // search enemy
+        random = rnd(maxrand);
+//std::cout << "search enemy: " << random << std::endl;
+        if (random < 20 && (!this->target_))
+        {
+            this->searchNewTarget();
+        }
+
+        // forget enemy
+        random = rnd(maxrand);
+//std::cout << "forget enemy: " << random << std::endl;
+        if (random < 5 && (this->target_))
+        {
+            this->forgetTarget();
+        }
+
+        // next enemy
+        random = rnd(maxrand);
+//std::cout << "next enemy: " << random << std::endl;
+        if (random < 10 && (this->target_))
+        {
+            this->searchNewTarget();
+        }
+
+        // fly somewhere
+        random = rnd(maxrand);
+//std::cout << "fly somewhere: " << random << std::endl;
+        if (random < 40 && (!this->bHasTargetPosition_ && !this->target_))
+        {
+            this->searchNewTargetPosition();
+        }
+
+        // stop flying
+        random = rnd(maxrand);
+//std::cout << "stop flying: " << random << std::endl;
+        if (random < 10 && (this->bHasTargetPosition_ && !this->target_))
+        {
+            this->bHasTargetPosition_ = false;
+        }
+
+        // fly somewhere else
+        random = rnd(maxrand);
+//std::cout << "fly somewhere else: " << random << std::endl;
+        if (random < 30 && (this->bHasTargetPosition_ && !this->target_))
+        {
+            this->searchNewTargetPosition();
+        }
+
+        // shoot
+        random = rnd(maxrand);
+//std::cout << "shoot: " << random << std::endl;
+        if (random < 75 && (this->target_ && !this->bShooting_))
+        {
+            this->bShooting_ = true;
+        }
+
+        // stop shooting
+        random = rnd(maxrand);
+//std::cout << "stop shooting: " << random << std::endl;
+        if (random < 25 && (this->bShooting_))
+        {
+            this->bShooting_ = false;
+        }
+    }
+
+    void SpaceShipAI::tick(float dt)
+    {
+        if (this->target_)
+            this->aimAtTarget();
+
+        if (this->bHasTargetPosition_)
+            this->moveToTargetPosition(dt);
+
+        if (this->bShooting_ && this->isCloseAtTarget(2000) && this->isLookingAtTarget(Ogre::Math::PI / 10.0f))
+            this->doFire();
+
+        SpaceShip::tick(dt);
+    }
+
+    void SpaceShipAI::moveToTargetPosition(float dt)
+    {
+        static Radian RadianZERO(0);
+
+//        float dotprod = (this->getOrientation() * Ogre::Vector3::UNIT_X).dotProduct(this->targetPosition_ - this->getPosition());
+        Quaternion rotation = (this->getOrientation() * Ogre::Vector3::UNIT_X).getRotationTo(this->targetPosition_ - this->getPosition());
+/*
+std::cout << "scalprod: " << dotprod << std::endl;
+std::cout << "dist: " << this->targetPosition_ - this->getPosition() << std::endl;
+std::cout << "yaw: " << rotation.getYaw().valueRadians() << std::endl;
+std::cout << "pitch: " << rotation.getPitch().valueRadians() << std::endl;
+std::cout << "roll: " << rotation.getRoll().valueRadians() << std::endl;
+*/
+        this->setMoveYaw(-rotation.getRoll().valueRadians());
+        this->setMovePitch(rotation.getYaw().valueRadians());
+
+        if ((this->targetPosition_ - this->getPosition()).length() > 100)
+        {
+            this->setMoveLongitudinal(1);
+        }
+
+    }
+
+    void SpaceShipAI::searchNewTargetPosition()
+    {
+        this->targetPosition_ = Vector3(rnd(-5000,5000), rnd(-5000,5000), rnd(-5000,5000));
+        this->bHasTargetPosition_ = true;
+    }
+
+    void SpaceShipAI::searchNewTarget()
+    {
+        this->targetPosition_ = this->getPosition();
+        this->forgetTarget();
+
+        for (Iterator<SpaceShip> it = ObjectList<SpaceShip>::begin(); it; ++it)
+        {
+            if (it->getTeamNr() != this->getTeamNr())
+            {
+                float speed = this->getVelocity().length();
+                Vector3 distanceCurrent = this->targetPosition_ - this->getPosition();
+                Vector3 distanceNew = it->getPosition() - this->getPosition();
+                if (!this->target_ || it->getPosition().squaredDistance(this->getPosition()) * (1.5f + acos((this->getOrientation() * Ogre::Vector3::UNIT_X).dotProduct(distanceNew) / speed / distanceNew.length()) / (2 * Ogre::Math::PI))
+                        < this->targetPosition_.squaredDistance(this->getPosition()) * (1.5f + acos((this->getOrientation() * Ogre::Vector3::UNIT_X).dotProduct(distanceCurrent) / speed / distanceCurrent.length()) / (2 * Ogre::Math::PI)))
+                {
+                    this->target_ = (*it);
+                    this->targetPosition_ = it->getPosition();
+                }
+            }
+        }
+   }
+
+    void SpaceShipAI::forgetTarget()
+    {
+        this->target_ = 0;
+        this->bShooting_ = false;
+    }
+
+    void SpaceShipAI::aimAtTarget()
+    {
+        if (!this->target_)
+            return;
+/*
+        Vector3 enemymovement = this->target_->getVelocity();
+        Vector3 distance_normalised = this->target_->getPosition() - this->getPosition();
+        distance_normalised.normalise();
+
+        float scalarprod = enemymovement.dotProduct(distance_normalised);
+        float aimoffset = scalarprod*scalarprod + Projectile::getSpeed() * Projectile::getSpeed() - this->target_->getVelocity().squaredLength();
+        if (aimoffset < 0)
+        {
+            this->bHasTargetPosition_ = false;
+            return;
+        }
+        aimoffset = -scalarprod + sqrt(aimoffset);
+        this->targetPosition_ = enemymovement + distance_normalised * aimoffset;
+        this->bHasTargetPosition_ = true;
+
+        std::cout << "targetpos: " << this->targetPosition_ << std::endl;
+*/
+        this->targetPosition_ = this->target_->getPosition();
+        this->bHasTargetPosition_ = true;
+    }
+
+    bool SpaceShipAI::isCloseAtTarget(float distance)
+    {
+        return (this->getPosition().squaredDistance(this->targetPosition_) < distance*distance);
+    }
+
+    bool SpaceShipAI::isLookingAtTarget(float angle)
+    {
+        return (this->getOrientation() * Ogre::Vector3::UNIT_X).directionEquals(this->targetPosition_ - this->getPosition(), Radian(angle));
+    }
+}
Index: code/trunk/src/orxonox/objects/SpaceShipAI.h
===================================================================
--- code/trunk/src/orxonox/objects/SpaceShipAI.h	(revision 1502)
+++ code/trunk/src/orxonox/objects/SpaceShipAI.h	(revision 1502)
@@ -0,0 +1,76 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _SpaceShipAI_H__
+#define _SpaceShipAI_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "SpaceShip.h"
+#include "tools/Timer.h"
+#include "util/Math.h"
+
+#define NUM_AI_TEAMS 3
+
+namespace orxonox
+{
+    class SpaceShipAI : public SpaceShip
+    {
+        public:
+            SpaceShipAI();
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            static void createEnemy(int num);
+            static void killEnemies(int num);
+
+        private:
+            virtual void tick(float dt);
+            virtual ColourValue getProjectileColour() const;
+
+            void action();
+
+            void moveToTargetPosition(float dt);
+            void searchNewTargetPosition();
+            void forgetTarget();
+            void searchNewTarget();
+            void aimAtTarget();
+            bool isCloseAtTarget(float distance);
+            bool isLookingAtTarget(float angle);
+
+            Timer<SpaceShipAI> actionTimer_;
+
+            bool alive_;
+            bool bHasTargetPosition_;
+            Vector3 targetPosition_;
+            SpaceShip* target_;
+            bool bShooting_;
+
+            ColourValue teamColours_[NUM_AI_TEAMS + 1];
+    };
+}
+
+#endif /* _SpaceShipAI_H__ */
Index: code/trunk/src/orxonox/objects/WorldEntity.cc
===================================================================
--- code/trunk/src/orxonox/objects/WorldEntity.cc	(revision 1407)
+++ code/trunk/src/orxonox/objects/WorldEntity.cc	(revision 1502)
@@ -85,4 +85,5 @@
             this->rotationRate_ += (dt * this->momentum_);
             this->rotate(this->rotationAxis_, dt * this->rotationRate_);
+            //COUT(3) << "rotationrate: " << this->rotationRate_.valueDegrees() << " momentum: " << this->momentum_.valueDegrees() << std::endl;
         }
     }
@@ -153,8 +154,8 @@
       registerVar( (void*) &(this->bStatic_), sizeof(this->bStatic_), network::DATA, 0x3);
       //register acceleration & momentum
-      registerVar( (void*) &(this->getAcceleration().x), sizeof(this->getAcceleration().x), network::DATA, 0x3);
-      registerVar( (void*) &(this->getAcceleration().y), sizeof(this->getAcceleration().y), network::DATA, 0x3);
-      registerVar( (void*) &(this->getAcceleration().z), sizeof(this->getAcceleration().z), network::DATA, 0x3);
-      registerVar( (void*) &(this->getMomentum()), sizeof(this->getMomentum()), network::DATA);
+//       registerVar( (void*) &(this->getAcceleration().x), sizeof(this->getAcceleration().x), network::DATA, 0x2);
+//       registerVar( (void*) &(this->getAcceleration().y), sizeof(this->getAcceleration().y), network::DATA, 0x2);
+//       registerVar( (void*) &(this->getAcceleration().z), sizeof(this->getAcceleration().z), network::DATA, 0x2);
+//       registerVar( (void*) &(this->getMomentum()), sizeof(this->getMomentum()), network::DATA, 0x2); // only backsync
     }
 
Index: code/trunk/src/orxonox/objects/WorldEntity.h
===================================================================
--- code/trunk/src/orxonox/objects/WorldEntity.h	(revision 1407)
+++ code/trunk/src/orxonox/objects/WorldEntity.h	(revision 1502)
@@ -53,5 +53,5 @@
             virtual void loadParams(TiXmlElement* xmlElem);
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-            inline bool create(){ return true; }
+            virtual inline bool create(){ return Synchronisable::create(); }
 
             void attachWorldEntity(WorldEntity* entity);
Index: code/trunk/src/orxonox/objects/weapon/AmmunitionDump.h
===================================================================
--- code/trunk/src/orxonox/objects/weapon/AmmunitionDump.h	(revision 1407)
+++ code/trunk/src/orxonox/objects/weapon/AmmunitionDump.h	(revision 1502)
@@ -60,5 +60,5 @@
 
   protected:
-    inline bool create() { return true; }
+    inline bool create() { return Synchronisable::create(); }
     void registerAllVariables();
 
Index: code/trunk/src/orxonox/objects/weapon/BulletManager.h
===================================================================
--- code/trunk/src/orxonox/objects/weapon/BulletManager.h	(revision 1407)
+++ code/trunk/src/orxonox/objects/weapon/BulletManager.h	(revision 1502)
@@ -60,5 +60,5 @@
 
   protected:
-    inline bool create() { return true; }
+    inline bool create() { return Synchronisable::create(); }
     void registerAllVariables();
 
Index: code/trunk/src/orxonox/tools/Mesh.cc
===================================================================
--- code/trunk/src/orxonox/tools/Mesh.cc	(revision 1407)
+++ code/trunk/src/orxonox/tools/Mesh.cc	(revision 1502)
@@ -40,7 +40,7 @@
     unsigned int Mesh::meshCounter_s = 0;
 
-    Mesh::Mesh()
+    Mesh::Mesh() :
+      entity_(0)
     {
-        this->entity_ = 0;
     }
 
Index: code/trunk/src/orxonox/tools/Timer.cc
===================================================================
--- code/trunk/src/orxonox/tools/Timer.cc	(revision 1407)
+++ code/trunk/src/orxonox/tools/Timer.cc	(revision 1502)
@@ -27,4 +27,6 @@
  */
 
+#include <set>
+
 #include "OrxonoxStableHeaders.h"
 #include "Timer.h"
@@ -37,5 +39,8 @@
 namespace orxonox
 {
-    ConsoleCommandShortcutExtern(delay, AccessLevel::None);
+    SetConsoleCommandShortcutExtern(delay);
+    SetConsoleCommandShortcutExtern(killdelays);
+
+    static std::set<StaticTimer*> delaytimerset;
 
     /**
@@ -47,4 +52,6 @@
     {
         StaticTimer *delaytimer = new StaticTimer();
+        delaytimerset.insert(delaytimer);
+
         ExecutorStatic* delayexecutor = createExecutor(createFunctor(&executeDelayedCommand));
         delayexecutor->setDefaultValues(delaytimer, command);
@@ -61,4 +68,16 @@
         CommandExecutor::execute(command);
         delete timer;
+        delaytimerset.erase(timer);
+    }
+
+    /**
+        @brief Kills all delayed commands.
+    */
+    void killdelays()
+    {
+        for (std::set<StaticTimer*>::iterator it = delaytimerset.begin(); it != delaytimerset.end(); ++it)
+            delete (*it);
+
+        delaytimerset.clear();
     }
 
Index: code/trunk/src/orxonox/tools/Timer.h
===================================================================
--- code/trunk/src/orxonox/tools/Timer.h	(revision 1407)
+++ code/trunk/src/orxonox/tools/Timer.h	(revision 1502)
@@ -69,4 +69,5 @@
     class StaticTimer;
     void delay(float delay, const std::string& command);
+    void killdelays();
     void executeDelayedCommand(StaticTimer* timer, const std::string& command);
 
