Index: /code/branches/resource/src/core/Core.cc
===================================================================
--- /code/branches/resource/src/core/Core.cc	(revision 3354)
+++ /code/branches/resource/src/core/Core.cc	(revision 3355)
@@ -364,5 +364,4 @@
         guiManager_ = new GUIManager(renderWindow);
 
-        GameMode::setShowsGraphics(true);
         bGraphicsLoaded_ = true;
     }
@@ -378,5 +377,4 @@
 
         bGraphicsLoaded_ = false;
-        GameMode::setShowsGraphics(false);
     }
 
Index: /code/branches/resource/src/core/CorePrereqs.h
===================================================================
--- /code/branches/resource/src/core/CorePrereqs.h	(revision 3354)
+++ /code/branches/resource/src/core/CorePrereqs.h	(revision 3355)
@@ -170,6 +170,6 @@
     // game states
     class Game;
-    struct GameStateConstrParams;
     class GameState;
+    struct GameStateInfo;
     struct GameStateTreeNode;
 
Index: /code/branches/resource/src/core/Game.cc
===================================================================
--- /code/branches/resource/src/core/Game.cc	(revision 3354)
+++ /code/branches/resource/src/core/Game.cc	(revision 3355)
@@ -48,4 +48,5 @@
 #include "CoreIncludes.h"
 #include "ConfigValueIncludes.h"
+#include "GameMode.h"
 #include "GameState.h"
 
@@ -59,5 +60,5 @@
     SetConsoleCommandShortcutExternAlias(stop_game, "exit");
 
-    std::map<std::string, Game::GameStateInfo> Game::gameStateDeclarations_s;
+    std::map<std::string, GameStateInfo> Game::gameStateDeclarations_s;
     Game* Game::singletonRef_s = 0;
 
@@ -143,6 +144,5 @@
             // Only create the states appropriate for the game mode
             //if (GameMode::showsGraphics || !it->second.bGraphicsMode)
-            GameStateConstrParams params = { it->second.stateName, it->second.bIgnoreTickTime };
-            gameStates_[getLowercase(it->second.stateName)] = GameStateFactory::fabricate(it->second.className, params);
+            gameStates_[getLowercase(it->second.stateName)] = GameStateFactory::fabricate(it->second);
         }
 
@@ -292,8 +292,8 @@
                 // Add tick time for most of the states
                 uint64_t timeBeforeTick;
-                if ((*it)->ignoreTickTime())
+                if ((*it)->getInfo().bIgnoreTickTime)
                     timeBeforeTick = this->gameClock_->getRealMicroseconds();
                 (*it)->update(*this->gameClock_);
-                if ((*it)->ignoreTickTime())
+                if ((*it)->getInfo().bIgnoreTickTime)
                     this->subtractTickTime(static_cast<int32_t>(this->gameClock_->getRealMicroseconds() - timeBeforeTick));
             }
@@ -517,7 +517,28 @@
     /*** Internal ***/
 
+    void Game::loadGraphics()
+    {
+        if (!GameMode::bShowsGraphics_s)
+        {
+            core_->loadGraphics();
+            GameMode::bShowsGraphics_s = true;
+        }
+    }
+
+    void Game::unloadGraphics()
+    {
+        if (GameMode::bShowsGraphics_s)
+        {
+            core_->unloadGraphics();
+            GameMode::bShowsGraphics_s = false;
+        }
+    }
+
     void Game::loadState(GameState* state)
     {
         this->bChangingState_ = true;
+        // If state requires graphics, load it
+        if (state->getInfo().bGraphicsMode)
+            this->loadGraphics();
         state->activate();
         if (!this->activeStates_.empty())
@@ -538,4 +559,10 @@
         {
             state->deactivate();
+            // Check if graphis is still required
+            bool graphicsRequired = false;
+            for (unsigned i = 0; i < activeStates_.size(); ++i)
+                graphicsRequired |= activeStates_[i]->getInfo().bGraphicsMode;
+            if (!graphicsRequired)
+                this->unloadGraphics();
         }
         catch (const std::exception& ex)
@@ -549,9 +576,9 @@
     std::map<std::string, Game::GameStateFactory*> Game::GameStateFactory::factories_s;
 
-    /*static*/ GameState* Game::GameStateFactory::fabricate(const std::string& className, const GameStateConstrParams& params)
-    {
-        std::map<std::string, GameStateFactory*>::const_iterator it = factories_s.find(className);
+    /*static*/ GameState* Game::GameStateFactory::fabricate(const GameStateInfo& info)
+    {
+        std::map<std::string, GameStateFactory*>::const_iterator it = factories_s.find(info.className);
         assert(it != factories_s.end());
-        return it->second->fabricate(params);
+        return it->second->fabricateInternal(info);
     }
 
Index: /code/branches/resource/src/core/Game.h
===================================================================
--- /code/branches/resource/src/core/Game.h	(revision 3354)
+++ /code/branches/resource/src/core/Game.h	(revision 3355)
@@ -61,4 +61,13 @@
     class GameConfiguration;
 
+    //! Helper object required before GameStates are being constructed
+    struct GameStateInfo
+    {
+        std::string stateName;
+        std::string className;
+        bool bIgnoreTickTime;
+        bool bGraphicsMode;
+    };
+
     /**
     @brief
@@ -97,5 +106,5 @@
         public:
             virtual ~GameStateFactory() { }
-            static GameState* fabricate(const std::string& className, const GameStateConstrParams& params);
+            static GameState* fabricate(const GameStateInfo& info);
             template <class T>
             static void createFactory(const std::string& className)
@@ -103,5 +112,5 @@
             static void destroyFactories();
         private:
-            virtual GameState* fabricate(const GameStateConstrParams& params) = 0;
+            virtual GameState* fabricateInternal(const GameStateInfo& info) = 0;
             static std::map<std::string, GameStateFactory*> factories_s;
         };
@@ -110,14 +119,6 @@
         {
         public:
-            GameState* fabricate(const GameStateConstrParams& params)
-                { return new T(params); }
-        };
-
-        struct GameStateInfo
-        {
-            std::string stateName;
-            std::string className;
-            bool bIgnoreTickTime;
-            bool bGraphicsMode;
+            GameState* fabricateInternal(const GameStateInfo& info)
+                { return new T(info); }
         };
 
@@ -129,4 +130,7 @@
 
         Game(Game&); // don't mess with singletons
+
+        void loadGraphics();
+        void unloadGraphics();
 
         void loadState(GameState* state);
Index: /code/branches/resource/src/core/GameMode.h
===================================================================
--- /code/branches/resource/src/core/GameMode.h	(revision 3354)
+++ /code/branches/resource/src/core/GameMode.h	(revision 3355)
@@ -41,5 +41,5 @@
     class _CoreExport GameMode
     {
-        friend class Core;
+        friend class Game;
 
         public:
@@ -59,6 +59,8 @@
             ~GameMode();
 
-            static void setShowsGraphics(bool val) { bShowsGraphics_s = val; updateIsMaster(); }
-            static void updateIsMaster  ()         { bIsMaster_s      = (bHasServer_s || bIsStandalone_s); }
+            static void updateIsMaster()
+            {
+                bIsMaster_s = (bHasServer_s || bIsStandalone_s);
+            }
 
             static bool bShowsGraphics_s;                   //!< global variable that tells whether to show graphics
Index: /code/branches/resource/src/core/GameState.cc
===================================================================
--- /code/branches/resource/src/core/GameState.cc	(revision 3354)
+++ /code/branches/resource/src/core/GameState.cc	(revision 3355)
@@ -38,4 +38,5 @@
 #include "util/Exception.h"
 #include "util/OrxAssert.h"
+#include "Game.h"
 
 namespace orxonox
@@ -45,7 +46,6 @@
         Constructor only initialises variables and sets the name permanently.
     */
-    GameState::GameState(const GameStateConstrParams& params)
-        : name_(params.name)
-        , bIgnoreTickTime_(params.bIgnoreTickTime)
+    GameState::GameState(const GameStateInfo& info)
+        : info_(info)
         , parent_(0)
     {
@@ -65,4 +65,9 @@
     {
         OrxAssert(this->activity_.active == false, "Deleting an active GameState is a very bad idea..");
+    }
+
+    const std::string& GameState::getName() const
+    {
+        return info_.stateName;
     }
 
@@ -107,5 +112,5 @@
         else
         {
-            ThrowException(GameState, "Game state '" + name_ + "' doesn't have a child named '"
+            ThrowException(GameState, "Game state '" + this->getName() + "' doesn't have a child named '"
                 + state->getName() + "'.");
         }
Index: /code/branches/resource/src/core/GameState.h
===================================================================
--- /code/branches/resource/src/core/GameState.h	(revision 3354)
+++ /code/branches/resource/src/core/GameState.h	(revision 3355)
@@ -45,14 +45,4 @@
     /**
     @brief
-        Helper class to group construction parameters for better genericity.
-    */
-    struct GameStateConstrParams
-    {
-        std::string name;
-        bool bIgnoreTickTime;
-    };
-
-    /**
-    @brief
         An implementation of a tree to manage game states.
         This leads to a certain hierarchy that is created at runtime.
@@ -87,12 +77,11 @@
 
     public:
-        GameState(const GameStateConstrParams& params);
+        GameState(const GameStateInfo& info);
         virtual ~GameState();
 
-        const std::string& getName() const { return name_; }
-        State getActivity()          const { return this->activity_; }
-        GameState* getParent()       const { return this->parent_; }
-
-        bool ignoreTickTime()        const { return this->bIgnoreTickTime_; }
+        const std::string& getName()   const;
+        State getActivity()            const { return activity_; }
+        GameState* getParent()         const { return parent_; }
+        const GameStateInfo& getInfo() const { return info_; }
 
         void addChild(GameState* state);
@@ -111,7 +100,6 @@
         void updateInternal(const Clock& time);
 
-        const std::string                        name_;
+        const GameStateInfo&                     info_;
         State                                    activity_;
-        const bool                               bIgnoreTickTime_;
         GameState*                               parent_;
         std::map<std::string, GameState*>        children_;
Index: /code/branches/resource/src/orxonox/gamestates/GSClient.cc
===================================================================
--- /code/branches/resource/src/orxonox/gamestates/GSClient.cc	(revision 3354)
+++ /code/branches/resource/src/orxonox/gamestates/GSClient.cc	(revision 3355)
@@ -42,6 +42,6 @@
     SetCommandLineArgument(ip, "127.0.0.1").information("Sever IP as strin in the form #.#.#.#");
 
-    GSClient::GSClient(const GameStateConstrParams& params)
-        : GameState(params)
+    GSClient::GSClient(const GameStateInfo& info)
+        : GameState(info)
         , client_(0)
     {
Index: /code/branches/resource/src/orxonox/gamestates/GSClient.h
===================================================================
--- /code/branches/resource/src/orxonox/gamestates/GSClient.h	(revision 3354)
+++ /code/branches/resource/src/orxonox/gamestates/GSClient.h	(revision 3355)
@@ -40,5 +40,5 @@
     {
     public:
-        GSClient(const GameStateConstrParams& params);
+        GSClient(const GameStateInfo& info);
         ~GSClient();
 
Index: /code/branches/resource/src/orxonox/gamestates/GSDedicated.cc
===================================================================
--- /code/branches/resource/src/orxonox/gamestates/GSDedicated.cc	(revision 3354)
+++ /code/branches/resource/src/orxonox/gamestates/GSDedicated.cc	(revision 3355)
@@ -55,6 +55,6 @@
     termios* GSDedicated::originalTerminalSettings_;
 
-    GSDedicated::GSDedicated(const GameStateConstrParams& params)
-        : GameState(params)
+    GSDedicated::GSDedicated(const GameStateInfo& info)
+        : GameState(info)
         , server_(0)
         , closeThread_(false)
Index: /code/branches/resource/src/orxonox/gamestates/GSDedicated.h
===================================================================
--- /code/branches/resource/src/orxonox/gamestates/GSDedicated.h	(revision 3354)
+++ /code/branches/resource/src/orxonox/gamestates/GSDedicated.h	(revision 3355)
@@ -48,5 +48,5 @@
     {
     public:
-        GSDedicated(const GameStateConstrParams& params);
+        GSDedicated(const GameStateInfo& info);
         ~GSDedicated();
 
Index: /code/branches/resource/src/orxonox/gamestates/GSGraphics.cc
===================================================================
--- /code/branches/resource/src/orxonox/gamestates/GSGraphics.cc	(revision 3354)
+++ /code/branches/resource/src/orxonox/gamestates/GSGraphics.cc	(revision 3355)
@@ -57,6 +57,6 @@
     DeclareGameState(GSGraphics, "graphics", false, true);
 
-    GSGraphics::GSGraphics(const GameStateConstrParams& params)
-        : GameState(params)
+    GSGraphics::GSGraphics(const GameStateInfo& info)
+        : GameState(info)
         , console_(0)
         , soundManager_(0)
@@ -88,7 +88,4 @@
     void GSGraphics::activate()
     {
-        // Load OGRE, CEGUI and OIS
-        Core::getInstance().loadGraphics();
-
         // load debug overlay
         COUT(3) << "Loading Debug Overlay..." << std::endl;
@@ -147,7 +144,4 @@
         // HACK: (destroys a resource smart pointer)
         Map::hackDestroyMap();
-
-        // Unload OGRE, CEGUI and OIS
-        Core::getInstance().loadGraphics();
     }
 
Index: /code/branches/resource/src/orxonox/gamestates/GSGraphics.h
===================================================================
--- /code/branches/resource/src/orxonox/gamestates/GSGraphics.h	(revision 3354)
+++ /code/branches/resource/src/orxonox/gamestates/GSGraphics.h	(revision 3355)
@@ -50,5 +50,5 @@
     {
     public:
-        GSGraphics(const GameStateConstrParams& params);
+        GSGraphics(const GameStateInfo& info);
         ~GSGraphics();
 
Index: /code/branches/resource/src/orxonox/gamestates/GSIOConsole.cc
===================================================================
--- /code/branches/resource/src/orxonox/gamestates/GSIOConsole.cc	(revision 3354)
+++ /code/branches/resource/src/orxonox/gamestates/GSIOConsole.cc	(revision 3355)
@@ -38,6 +38,6 @@
     DeclareGameState(GSIOConsole, "ioConsole", false, false);
 
-    GSIOConsole::GSIOConsole(const GameStateConstrParams& params)
-        : GameState(params)
+    GSIOConsole::GSIOConsole(const GameStateInfo& info)
+        : GameState(info)
     {
     }
Index: /code/branches/resource/src/orxonox/gamestates/GSIOConsole.h
===================================================================
--- /code/branches/resource/src/orxonox/gamestates/GSIOConsole.h	(revision 3354)
+++ /code/branches/resource/src/orxonox/gamestates/GSIOConsole.h	(revision 3355)
@@ -38,5 +38,5 @@
     {
     public:
-        GSIOConsole(const GameStateConstrParams& params);
+        GSIOConsole(const GameStateInfo& info);
         ~GSIOConsole();
 
Index: /code/branches/resource/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- /code/branches/resource/src/orxonox/gamestates/GSLevel.cc	(revision 3354)
+++ /code/branches/resource/src/orxonox/gamestates/GSLevel.cc	(revision 3355)
@@ -60,6 +60,6 @@
     XMLFile* GSLevel::startFile_s = NULL;
 
-    GSLevel::GSLevel(const GameStateConstrParams& params)
-        : GameState(params)
+    GSLevel::GSLevel(const GameStateInfo& info)
+        : GameState(info)
         , keyBinder_(0)
         , gameInputState_(0)
Index: /code/branches/resource/src/orxonox/gamestates/GSLevel.h
===================================================================
--- /code/branches/resource/src/orxonox/gamestates/GSLevel.h	(revision 3354)
+++ /code/branches/resource/src/orxonox/gamestates/GSLevel.h	(revision 3355)
@@ -41,5 +41,5 @@
     {
     public:
-        GSLevel(const GameStateConstrParams& params);
+        GSLevel(const GameStateInfo& info);
         ~GSLevel();
         void setConfigValues();
Index: /code/branches/resource/src/orxonox/gamestates/GSMainMenu.cc
===================================================================
--- /code/branches/resource/src/orxonox/gamestates/GSMainMenu.cc	(revision 3354)
+++ /code/branches/resource/src/orxonox/gamestates/GSMainMenu.cc	(revision 3355)
@@ -45,6 +45,6 @@
     DeclareGameState(GSMainMenu, "mainMenu", false, true);
 
-    GSMainMenu::GSMainMenu(const GameStateConstrParams& params)
-        : GameState(params)
+    GSMainMenu::GSMainMenu(const GameStateInfo& info)
+        : GameState(info)
         , inputState_(0)
     {
Index: /code/branches/resource/src/orxonox/gamestates/GSMainMenu.h
===================================================================
--- /code/branches/resource/src/orxonox/gamestates/GSMainMenu.h	(revision 3354)
+++ /code/branches/resource/src/orxonox/gamestates/GSMainMenu.h	(revision 3355)
@@ -40,5 +40,5 @@
     {
     public:
-        GSMainMenu(const GameStateConstrParams& params);
+        GSMainMenu(const GameStateInfo& info);
         ~GSMainMenu();
 
Index: /code/branches/resource/src/orxonox/gamestates/GSRoot.cc
===================================================================
--- /code/branches/resource/src/orxonox/gamestates/GSRoot.cc	(revision 3354)
+++ /code/branches/resource/src/orxonox/gamestates/GSRoot.cc	(revision 3355)
@@ -53,6 +53,6 @@
     SetCommandLineSwitch(standalone).information("Start in standalone mode");
 
-    GSRoot::GSRoot(const GameStateConstrParams& params)
-        : GameState(params)
+    GSRoot::GSRoot(const GameStateInfo& info)
+        : GameState(info)
         , timeFactor_(1.0f)
         , bPaused_(false)
@@ -174,4 +174,7 @@
     @brief
         Changes the speed of Orxonox
+    @remark
+        This function is a hack when placed here!
+        Timefactor should be related to the scene (level or so), not the game
     */
     void GSRoot::setTimeFactor(float factor)
Index: /code/branches/resource/src/orxonox/gamestates/GSRoot.h
===================================================================
--- /code/branches/resource/src/orxonox/gamestates/GSRoot.h	(revision 3354)
+++ /code/branches/resource/src/orxonox/gamestates/GSRoot.h	(revision 3355)
@@ -38,5 +38,5 @@
     {
     public:
-        GSRoot(const GameStateConstrParams& params);
+        GSRoot(const GameStateInfo& info);
         ~GSRoot();
 
Index: /code/branches/resource/src/orxonox/gamestates/GSServer.cc
===================================================================
--- /code/branches/resource/src/orxonox/gamestates/GSServer.cc	(revision 3354)
+++ /code/branches/resource/src/orxonox/gamestates/GSServer.cc	(revision 3355)
@@ -41,6 +41,6 @@
     SetCommandLineArgument(port, 55556).shortcut("p").information("Network communication port to be used 0-65535 (default: 55556)");
 
-    GSServer::GSServer(const GameStateConstrParams& params)
-        : GameState(params)
+    GSServer::GSServer(const GameStateInfo& info)
+        : GameState(info)
         , server_(0)
     {
Index: /code/branches/resource/src/orxonox/gamestates/GSServer.h
===================================================================
--- /code/branches/resource/src/orxonox/gamestates/GSServer.h	(revision 3354)
+++ /code/branches/resource/src/orxonox/gamestates/GSServer.h	(revision 3355)
@@ -40,5 +40,5 @@
     {
     public:
-        GSServer(const GameStateConstrParams& params);
+        GSServer(const GameStateInfo& info);
         ~GSServer();
 
Index: /code/branches/resource/src/orxonox/gamestates/GSStandalone.cc
===================================================================
--- /code/branches/resource/src/orxonox/gamestates/GSStandalone.cc	(revision 3354)
+++ /code/branches/resource/src/orxonox/gamestates/GSStandalone.cc	(revision 3355)
@@ -36,6 +36,6 @@
     DeclareGameState(GSStandalone, "standalone", false, true);
 
-    GSStandalone::GSStandalone(const GameStateConstrParams& params)
-        : GameState(params)
+    GSStandalone::GSStandalone(const GameStateInfo& info)
+        : GameState(info)
     {
     }
Index: /code/branches/resource/src/orxonox/gamestates/GSStandalone.h
===================================================================
--- /code/branches/resource/src/orxonox/gamestates/GSStandalone.h	(revision 3354)
+++ /code/branches/resource/src/orxonox/gamestates/GSStandalone.h	(revision 3355)
@@ -38,5 +38,5 @@
     {
     public:
-        GSStandalone(const GameStateConstrParams& params);
+        GSStandalone(const GameStateInfo& info);
         ~GSStandalone();
 
