Index: code/branches/gui/src/core/CorePrereqs.h
===================================================================
--- code/branches/gui/src/core/CorePrereqs.h	(revision 2816)
+++ code/branches/gui/src/core/CorePrereqs.h	(revision 2817)
@@ -166,6 +166,4 @@
 
   // game states
-  class GameStateBase;
-  template <class ParentType>
   class GameState;
   class RootGameState;
Index: code/branches/gui/src/core/GameState.cc
===================================================================
--- code/branches/gui/src/core/GameState.cc	(revision 2816)
+++ code/branches/gui/src/core/GameState.cc	(revision 2817)
@@ -30,5 +30,5 @@
 @file
 @brief
-    Implementation of GameStateBase class.
+    Implementation of GameState class.
 */
 
@@ -43,7 +43,7 @@
         Constructor only initialises variables and sets the name permanently.
     */
-    GameStateBase::GameStateBase(const std::string& name)
+    GameState::GameState(const std::string& name)
         : name_(name)
-        //, parent_(0)
+        , parent_(0)
         , activeChild_(0)
         //, bPausegetParent()(false)
@@ -57,5 +57,5 @@
         Destructor only checks that we don't delete an active state.
     */
-    GameStateBase::~GameStateBase()
+    GameState::~GameState()
     {
         OrxAssert(this->operation_.active == false, "Deleting an active GameState is a very bad idea..");
@@ -69,10 +69,10 @@
         The state to be added.
     */
-    void GameStateBase::addChild(GameStateBase* state)
+    void GameState::addChild(GameState* state)
     {
         if (!state)
             return;
         // check if the state/tree to be added has states in it that already exist in this tree.
-        for (std::map<std::string, GameStateBase*>::const_iterator it = state->allChildren_.begin();
+        for (std::map<std::string, GameState*>::const_iterator it = state->allChildren_.begin();
             it != state->allChildren_.end(); ++it)
         {
@@ -96,5 +96,5 @@
 
         // merge the child's children into this tree
-        for (std::map<std::string, GameStateBase*>::const_iterator it = state->allChildren_.begin();
+        for (std::map<std::string, GameState*>::const_iterator it = state->allChildren_.begin();
             it != state->allChildren_.end(); ++it)
             this->grandchildAdded(state, it->second);
@@ -113,7 +113,7 @@
         GameState by instance pointer
     */
-    void GameStateBase::removeChild(GameStateBase* state)
-    {
-        std::map<GameStateBase*, GameStateBase*>::iterator it = this->grandchildrenToChildren_.find(state);
+    void GameState::removeChild(GameState* state)
+    {
+        std::map<GameState*, GameState*>::iterator it = this->grandchildrenToChildren_.find(state);
         if (it != this->grandchildrenToChildren_.end())
         {
@@ -127,5 +127,5 @@
             else
             {
-                for (std::map<GameStateBase*, GameStateBase*>::const_iterator it = state->grandchildrenToChildren_.begin();
+                for (std::map<GameState*, GameState*>::const_iterator it = state->grandchildrenToChildren_.begin();
                     it != state->grandchildrenToChildren_.end(); ++it)
                     this->grandchildRemoved(it->first);
@@ -150,7 +150,7 @@
     */
 
-    void GameStateBase::removeChild(const std::string& name)
-    {
-        GameStateBase* state = getState(name);
+    void GameState::removeChild(const std::string& name)
+    {
+        GameState* state = getState(name);
         if (state)
         {
@@ -173,11 +173,11 @@
         The child that has been added.
     */
-    inline void GameStateBase::grandchildAdded(GameStateBase* child, GameStateBase* grandchild)
+    inline void GameState::grandchildAdded(GameState* child, GameState* grandchild)
     {
         // fill the two maps correctly.
         this->allChildren_[grandchild->getName()] = grandchild;
         this->grandchildrenToChildren_[grandchild] = child;
-        if (this->getParentAsBase())
-            this->getParentAsBase()->grandchildAdded(this, grandchild);
+        if (this->getParent())
+            this->getParent()->grandchildAdded(this, grandchild);
     }
 
@@ -191,11 +191,11 @@
         The child that has been removed.
     */
-    inline void GameStateBase::grandchildRemoved(GameStateBase* grandchild)
+    inline void GameState::grandchildRemoved(GameState* grandchild)
     {
         // adjust the two maps correctly.
         this->allChildren_.erase(grandchild->getName());
         this->grandchildrenToChildren_.erase(grandchild);
-        if (this->getParentAsBase())
-            this->getParentAsBase()->grandchildRemoved(grandchild);
+        if (this->getParent())
+            this->getParent()->grandchildRemoved(grandchild);
     }
 
@@ -206,8 +206,8 @@
         Remember that the every node has a map with all its child nodes.
     */
-    GameStateBase* GameStateBase::getState(const std::string& name)
-    {
-        if (this->getParentAsBase())
-            return this->getParentAsBase()->getState(name);
+    GameState* GameState::getState(const std::string& name)
+    {
+        if (this->getParent())
+            return this->getParent()->getState(name);
         else
         {
@@ -216,5 +216,5 @@
                 return this;
             // Search in the map. If there is no entry, we can be sure the state doesn't exist.
-            std::map<std::string, GameStateBase*>::const_iterator it = this->allChildren_.find(name);
+            std::map<std::string, GameState*>::const_iterator it = this->allChildren_.find(name);
             return (it!= this->allChildren_.end() ? it->second : 0);
         }
@@ -225,8 +225,8 @@
         Returns the root node of the tree.
     */
-    GameStateBase* GameStateBase::getRoot()
-    {
-        if (this->getParentAsBase())
-            return this->getParentAsBase()->getRoot();
+    GameState* GameState::getRoot()
+    {
+        if (this->getParent())
+            return this->getParent()->getRoot();
         else
             return this;
@@ -240,5 +240,5 @@
         have active children itself. Many states can be active at once.
     */
-    GameStateBase* GameStateBase::getCurrentState()
+    GameState* GameState::getCurrentState()
     {
         if (this->operation_.active)
@@ -251,6 +251,6 @@
         else
         {
-            if (this->getParentAsBase())
-                return this->getParentAsBase()->getCurrentState();
+            if (this->getParent())
+                return this->getParent()->getCurrentState();
             else
                 return 0;
@@ -262,5 +262,5 @@
         Determines whether 'state' is in this subtree, including this node.
     */
-    bool GameStateBase::isInSubtree(GameStateBase* state) const
+    bool GameState::isInSubtree(GameState* state) const
     {
         return (grandchildrenToChildren_.find(state) != grandchildrenToChildren_.end()
@@ -275,5 +275,5 @@
         The state to be entered, has to exist in the tree.
     */
-    void GameStateBase::requestState(const std::string& name)
+    void GameState::requestState(const std::string& name)
     {
         assert(getRoot());
@@ -286,7 +286,7 @@
         the method can assume certain things to be granted (like 'this' is always active).
     */
-    void GameStateBase::makeTransition(GameStateBase* source, GameStateBase* destination)
-    {
-        if (source == this->getParentAsBase())
+    void GameState::makeTransition(GameState* source, GameState* destination)
+    {
+        if (source == this->getParent())
         {
             // call is from the parent
@@ -308,5 +308,5 @@
 
         // Check for 'destination' in the children map first
-        std::map<GameStateBase*, GameStateBase*>::const_iterator it
+        std::map<GameState*, GameState*>::const_iterator it
             = this->grandchildrenToChildren_.find(destination);
         if (it != this->grandchildrenToChildren_.end())
@@ -319,8 +319,8 @@
         {
             // parent. We can be sure of this.
-            assert(this->getParentAsBase() != 0);
+            assert(this->getParent() != 0);
 
             this->deactivate();
-            this->getParentAsBase()->makeTransition(this, destination);
+            this->getParent()->makeTransition(this, destination);
         }
     }
@@ -330,5 +330,5 @@
         Activates the state. Only sets bActive_ to true and notifies the parent.
     */
-    void GameStateBase::activate()
+    void GameState::activate()
     {
         this->operation_.active = true;
@@ -341,5 +341,5 @@
         Activates the state. Only sets bActive_ to false and notifies the parent.
     */
-    void GameStateBase::deactivate()
+    void GameState::deactivate()
     {
         this->operation_.leaving = true;
@@ -358,5 +358,5 @@
         This method is not virtual! You cannot override it therefore.
     */
-    void GameStateBase::tick(const Clock& time)
+    void GameState::tick(const Clock& time)
     {
         this->operation_.running = true;
Index: code/branches/gui/src/core/GameState.h
===================================================================
--- code/branches/gui/src/core/GameState.h	(revision 2816)
+++ code/branches/gui/src/core/GameState.h	(revision 2817)
@@ -60,9 +60,7 @@
         Then Bar stores Foo in map by its name. The other one then maps Foo to Foofoo.
     */
-    class _CoreExport GameStateBase
+    class _CoreExport GameState
     {
         friend class RootGameState;
-        template <class ParentType>
-        friend class GameState;
         // Hack
         friend class Game;
@@ -83,19 +81,20 @@
 
     public:
-        virtual ~GameStateBase();
+        GameState(const std::string& name);
+        virtual ~GameState();
 
         const std::string& getName() const { return name_; }
         const Operations getOperation() const { return this->operation_; }
-        bool isInSubtree(GameStateBase* state) const;
+        bool isInSubtree(GameState* state) const;
 
-        GameStateBase* getState(const std::string& name);
-        GameStateBase* getRoot();
+        GameState* getState(const std::string& name);
+        GameState* getRoot();
         //! Returns the currently active game state
-        virtual GameStateBase* getCurrentState();
+        virtual GameState* getCurrentState();
 
         virtual void requestState(const std::string& name);
 
-        void addChild(GameStateBase* state);
-        void removeChild(GameStateBase* state);
+        void addChild(GameState* state);
+        void removeChild(GameState* state);
         void removeChild(const std::string& name);
 
@@ -105,21 +104,17 @@
         virtual void ticked(const Clock& time) = 0;
 
-        GameStateBase* getActiveChild() { return this->activeChild_; }
+        GameState* getActiveChild() { return this->activeChild_; }
 
         void tickChild(const Clock& time) { if (this->getActiveChild()) this->getActiveChild()->tick(time); }
 
-        virtual GameStateBase* getParentAsBase() const = 0;
-        virtual void setParent(GameStateBase* state) = 0;
+        GameState* getParent() const     { return this->parent_; }
+        void setParent(GameState* state) { this->parent_ = state; }
 
     private:
-        // Making the constructor private ensures that game states
-        // are always derivates of GameState<T>. Note the friend declaration above.
-        GameStateBase(const std::string& name);
+        //! Performs a transition to 'destination'
+        virtual void makeTransition(GameState* source, GameState* destination);
 
-        //! Performs a transition to 'destination'
-        virtual void makeTransition(GameStateBase* source, GameStateBase* destination);
-
-        void grandchildAdded(GameStateBase* child, GameStateBase* grandchild);
-        void grandchildRemoved(GameStateBase* grandchild);
+        void grandchildAdded(GameState* child, GameState* grandchild);
+        void grandchildRemoved(GameState* grandchild);
 
         void tick(const Clock& time);
@@ -129,36 +124,9 @@
         const std::string                        name_;
         Operations                               operation_;
-        GameStateBase*                           activeChild_;
+        GameState*                               parent_;
+        GameState*                               activeChild_;
         //bool                                     bPauseParent_;
-        std::map<std::string, GameStateBase*>    allChildren_;
-        std::map<GameStateBase*, GameStateBase*> grandchildrenToChildren_;
-    };
-
-
-    template <class ParentType>
-    class GameState : public GameStateBase
-    {
-    public:
-        GameState(const std::string& name)
-            : GameStateBase(name)
-            , parent_(0)
-        { }
-        virtual ~GameState() { }
-
-        GameStateBase* getParentAsBase() const
-            { return parent_; }
-
-        ParentType* getParent() const
-            { return parent_; }
-
-    protected:
-        void setParent(GameStateBase* state)
-        {
-            assert(dynamic_cast<ParentType*>(state) != 0);
-            this->parent_ = dynamic_cast<ParentType*>(state);
-        }
-
-    private:
-        ParentType* parent_;
+        std::map<std::string, GameState*>        allChildren_;
+        std::map<GameState*, GameState*>         grandchildrenToChildren_;
     };
 }
Index: code/branches/gui/src/core/RootGameState.cc
===================================================================
--- code/branches/gui/src/core/RootGameState.cc	(revision 2816)
+++ code/branches/gui/src/core/RootGameState.cc	(revision 2817)
@@ -36,5 +36,5 @@
 {
     RootGameState::RootGameState(const std::string& name)
-        : GameState<GameStateBase>(name)
+        : GameState(name)
         , stateRequest_("")
     {
@@ -50,5 +50,5 @@
         the method can assume certain things to be granted (like 'this' is always active).
     */
-    void RootGameState::makeTransition(GameStateBase* source, GameStateBase* destination)
+    void RootGameState::makeTransition(GameState* source, GameState* destination)
     {
         if (source != 0)
@@ -65,11 +65,11 @@
 
         // Check for 'destination' in the children map first
-        std::map<GameStateBase*, GameStateBase*>::const_iterator it
+        std::map<GameState*, GameState*>::const_iterator it
             = this->grandchildrenToChildren_.find(destination);
         if (it != this->grandchildrenToChildren_.end())
         {
-            OrxAssert(static_cast<GameStateBase*>(it->second) != 0,
+            OrxAssert(static_cast<GameState*>(it->second) != 0,
                 "There was a mix with RootGameState and GameState, could not cast.");
-            GameStateBase* child = static_cast<GameStateBase*>(it->second);
+            GameState* child = static_cast<GameState*>(it->second);
             // child state. Don't use 'state', might be a grandchild!
             this->activeChild_ = child;
@@ -85,8 +85,8 @@
     void RootGameState::gotoState(const std::string& name)
     {
-        GameStateBase* request = getState(name);
+        GameState* request = getState(name);
         if (request)
         {
-            GameStateBase* current = getCurrentState();
+            GameState* current = getCurrentState();
             if (current)
             {
Index: code/branches/gui/src/core/RootGameState.h
===================================================================
--- code/branches/gui/src/core/RootGameState.h	(revision 2816)
+++ code/branches/gui/src/core/RootGameState.h	(revision 2817)
@@ -35,5 +35,5 @@
 namespace orxonox
 {
-    class _CoreExport RootGameState : public GameState<GameStateBase>
+    class _CoreExport RootGameState : public GameState
     {
         // Hack!
@@ -47,5 +47,5 @@
 
     private:
-        void makeTransition(GameStateBase* source, GameStateBase* destination);
+        void makeTransition(GameState* source, GameState* destination);
         void gotoState(const std::string& name);
 
Index: code/branches/gui/src/orxonox/Game.cc
===================================================================
--- code/branches/gui/src/orxonox/Game.cc	(revision 2816)
+++ code/branches/gui/src/orxonox/Game.cc	(revision 2817)
@@ -45,4 +45,6 @@
 #include "core/Core.h"
 #include "core/Identifier.h"
+#include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
 
 #include "gamestates/GSRoot.h"
@@ -61,6 +63,14 @@
 int main(int argc, char** argv)
 {
-    orxonox::Game orxonox(argc, argv);
-    orxonox.run();
+    {
+        orxonox::Game orxonox(argc, argv);
+        orxonox.run();
+        // objects gets destroyed here!
+    }
+
+    // Clean up class hierarchy stuff (identifiers, xmlport, configvalue, consolecommand)
+    // Needs to be done after Game destructor because of ~OrxonoxClass
+    orxonox::Identifier::destroyAllIdentifiers();
+
     return 0;
 }
@@ -89,6 +99,17 @@
         this->abort_ = false;
 
+        // reset statistics
+        this->statisticsStartTime_ = 0;
+        this->statisticsTickTimes_.clear();
+        this->periodTickTime_ = 0;
+        this->periodTime_ = 0;
+        this->avgFPS_ = 0.0f;
+        this->avgTickTime_ = 0.0f;
+
         this->core_ = new orxonox::Core();
         this->gameClock_ = this->core_->initialise(argc, argv);
+
+        RegisterRootObject(Game);
+        this->setConfigValues();
     }
 
@@ -101,10 +122,14 @@
         delete this->core_;
 
-        // Clean up class hierarchy stuff (identifiers, xmlport, configvalue, consolecommand)
-        // Needs to be done after 'delete core' because of ~OrxonoxClass
-        orxonox::Identifier::destroyAllIdentifiers();
-
         assert(singletonRef_s);
         singletonRef_s = 0;
+    }
+
+    void Game::setConfigValues()
+    {
+        SetConfigValue(statisticsRefreshCycle_, 250000)
+            .description("Sets the time in microseconds interval at which average fps, etc. get updated.");
+        SetConfigValue(statisticsAvgLength_, 1000000)
+            .description("Sets the time in microseconds interval at which average fps, etc. gets calculated.");
     }
 
@@ -143,9 +168,42 @@
         root.gotoState(CommandLine::getValue("state"));
 
+        this->gameClock_->capture(); // first delta time should be about 0 seconds
         while (!this->abort_)
         {
             this->gameClock_->capture();
-
+            uint64_t currentTime = this->gameClock_->getMicroseconds();
+
+            // STATISTICS
+            statisticsTickInfo tickInfo = {currentTime, 0};
+            statisticsTickTimes_.push_back(tickInfo);
+            this->periodTime_ += this->gameClock_->getDeltaTimeMicroseconds();
+
+            // UPDATE
             root.tick(*this->gameClock_);
+
+            // STATISTICS
+            if (this->periodTime_ > statisticsRefreshCycle_)
+            {
+                std::list<statisticsTickInfo>::iterator it = this->statisticsTickTimes_.begin();
+                assert(it != this->statisticsTickTimes_.end());
+                int64_t lastTime = currentTime - this->statisticsAvgLength_;
+                if ((int64_t)it->tickTime < lastTime)
+                {
+                    do
+                    {
+                        assert(this->periodTickTime_ > it->tickLength);
+                        this->periodTickTime_ -= it->tickLength;
+                        ++it;
+                        assert(it != this->statisticsTickTimes_.end());
+                    } while ((int64_t)it->tickTime < lastTime);
+                    this->statisticsTickTimes_.erase(this->statisticsTickTimes_.begin(), it);
+                }
+
+                uint32_t framesPerPeriod = this->statisticsTickTimes_.size();
+                this->avgFPS_ = (float)framesPerPeriod / (currentTime - this->statisticsTickTimes_.front().tickTime) * 1000000.0;
+                this->avgTickTime_ = (float)this->periodTickTime_ / framesPerPeriod / 1000.0;
+
+                this->periodTime_ -= this->statisticsRefreshCycle_;
+            }
 
             if (root.stateRequest_ != "")
@@ -161,3 +219,10 @@
         this->abort_ = true;
     }
+
+    void Game::addTickTime(uint32_t length)
+    {
+        assert(!this->statisticsTickTimes_.empty());
+        this->statisticsTickTimes_.back().tickLength += length;
+        this->periodTickTime_+=length;
+    }
 }
Index: code/branches/gui/src/orxonox/Game.h
===================================================================
--- code/branches/gui/src/orxonox/Game.h	(revision 2816)
+++ code/branches/gui/src/orxonox/Game.h	(revision 2817)
@@ -38,5 +38,6 @@
 #include "OrxonoxPrereqs.h"
 #include <cassert>
-#include "core/CorePrereqs.h"
+#include <list>
+#include "core/OrxonoxClass.h"
 
 namespace orxonox
@@ -46,16 +47,28 @@
         Main class responsible for running the game.
     */
-    class _OrxonoxExport Game
+    class _OrxonoxExport Game : public OrxonoxClass
     {
     public:
         Game(int argc, char** argv);
         ~Game();
+        void setConfigValues();
 
         void run();
         void stop();
 
+        float getAvgTickTime() { return this->avgTickTime_; }
+        float getAvgFPS()      { return this->avgFPS_; }
+
+        void addTickTime(uint32_t length);
+
         static Game& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
 
     private:
+        struct statisticsTickInfo
+        {
+            uint64_t    tickTime;
+            uint32_t    tickLength;
+        };
+
         Game(Game&); // don't mess with singletons
 
@@ -65,4 +78,17 @@
         bool abort_;
 
+        // variables for time statistics
+        uint64_t              statisticsStartTime_;
+        std::list<statisticsTickInfo>
+                              statisticsTickTimes_;
+        uint32_t              periodTime_;
+        uint32_t              periodTickTime_;
+        float                 avgFPS_;
+        float                 avgTickTime_;
+
+        // config values
+        unsigned int          statisticsRefreshCycle_;
+        unsigned int          statisticsAvgLength_;
+
         static Game* singletonRef_s;        //!< Pointer to the Singleton
     };
Index: code/branches/gui/src/orxonox/GraphicsManager.h
===================================================================
--- code/branches/gui/src/orxonox/GraphicsManager.h	(revision 2816)
+++ code/branches/gui/src/orxonox/GraphicsManager.h	(revision 2817)
@@ -66,11 +66,4 @@
             { return this->detailLevelParticle_; }
 
-        // <HACK>
-        float getAverageFramesPerSecond() const   { return this->avgFramesPerSecond_; }
-        float getAverageTickTime() const          { return this->avgTickTime_; }
-        void setAverageTickTime(float tickTime)   { this->avgTickTime_ = tickTime; }
-        void setAverageFramesPerSecond(float fps) { this->avgFramesPerSecond_ = fps; }
-        // </HACK>
-
         inline void setViewport(Ogre::Viewport* viewport)
             { this->viewport_ = viewport; }
Index: code/branches/gui/src/orxonox/gamestates/GSClient.cc
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSClient.cc	(revision 2816)
+++ code/branches/gui/src/orxonox/gamestates/GSClient.cc	(revision 2817)
@@ -41,5 +41,5 @@
 
     GSClient::GSClient()
-        : GameState<GSGraphics>("client")
+        : GameState("client")
         , client_(0)
     {
Index: code/branches/gui/src/orxonox/gamestates/GSClient.h
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSClient.h	(revision 2816)
+++ code/branches/gui/src/orxonox/gamestates/GSClient.h	(revision 2817)
@@ -31,11 +31,11 @@
 
 #include "OrxonoxPrereqs.h"
+#include "core/GameState.h"
 #include "network/NetworkPrereqs.h"
 #include "GSLevel.h"
-#include "GSGraphics.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport GSClient : public GameState<GSGraphics>, public GSLevel
+    class _OrxonoxExport GSClient : public GameState, public GSLevel
     {
     public:
Index: code/branches/gui/src/orxonox/gamestates/GSDedicated.cc
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSDedicated.cc	(revision 2816)
+++ code/branches/gui/src/orxonox/gamestates/GSDedicated.cc	(revision 2817)
@@ -41,5 +41,5 @@
 {
     GSDedicated::GSDedicated()
-        : GameState<GSRoot>("dedicated")
+        : GameState("dedicated")
         , server_(0)
         , timeSinceLastUpdate_(0)
Index: code/branches/gui/src/orxonox/gamestates/GSDedicated.h
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSDedicated.h	(revision 2816)
+++ code/branches/gui/src/orxonox/gamestates/GSDedicated.h	(revision 2817)
@@ -31,11 +31,11 @@
 
 #include "OrxonoxPrereqs.h"
+#include "core/GameState.h"
 #include "network/NetworkPrereqs.h"
 #include "GSLevel.h"
-#include "GSRoot.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport GSDedicated : public GameState<GSRoot>, public GSLevel
+    class _OrxonoxExport GSDedicated : public GameState, public GSLevel
     {
     public:
Index: code/branches/gui/src/orxonox/gamestates/GSGUI.cc
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSGUI.cc	(revision 2816)
+++ code/branches/gui/src/orxonox/gamestates/GSGUI.cc	(revision 2817)
@@ -40,5 +40,5 @@
 {
     GSGUI::GSGUI()
-        : GameState<GSGraphics>("gui")
+        : GameState("gui")
     {
     }
Index: code/branches/gui/src/orxonox/gamestates/GSGUI.h
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSGUI.h	(revision 2816)
+++ code/branches/gui/src/orxonox/gamestates/GSGUI.h	(revision 2817)
@@ -32,9 +32,8 @@
 #include "OrxonoxPrereqs.h"
 #include "core/GameState.h"
-#include "GSGraphics.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport GSGUI : public GameState<GSGraphics>
+    class _OrxonoxExport GSGUI : public GameState
     {
     public:
Index: code/branches/gui/src/orxonox/gamestates/GSGraphics.cc
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSGraphics.cc	(revision 2816)
+++ code/branches/gui/src/orxonox/gamestates/GSGraphics.cc	(revision 2817)
@@ -44,12 +44,11 @@
 #include "overlays/console/InGameConsole.h"
 #include "gui/GUIManager.h"
-
-// for compatibility
 #include "GraphicsManager.h"
+#include "Game.h"
 
 namespace orxonox
 {
     GSGraphics::GSGraphics()
-        : GameState<GSRoot>("graphics")
+        : GameState("graphics")
         , inputManager_(0)
         , console_(0)
@@ -157,10 +156,6 @@
         uint64_t timeAfterTick = time.getRealMicroseconds();
 
-        // Also add our tick time to the list in GSRoot
-        this->getParent()->addTickTime(timeAfterTick - timeBeforeTick);
-
-        // Update statistics overlay. Note that the values only change periodically in GSRoot.
-        GraphicsManager::getInstance().setAverageFramesPerSecond(this->getParent()->getAvgFPS());
-        GraphicsManager::getInstance().setAverageTickTime(this->getParent()->getAvgTickTime());
+        // Also add our tick time
+        Game::getInstance().addTickTime(timeAfterTick - timeBeforeTick);
 
         this->graphicsManager_->update(time);
Index: code/branches/gui/src/orxonox/gamestates/GSGraphics.h
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSGraphics.h	(revision 2816)
+++ code/branches/gui/src/orxonox/gamestates/GSGraphics.h	(revision 2817)
@@ -34,9 +34,8 @@
 #include "core/OrxonoxClass.h"
 #include "tools/WindowEventListener.h"
-#include "GSRoot.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport GSGraphics : public GameState<GSRoot>, public WindowEventListener
+    class _OrxonoxExport GSGraphics : public GameState, public WindowEventListener
     {
         friend class ClassIdentifier<GSGraphics>;
Index: code/branches/gui/src/orxonox/gamestates/GSIOConsole.cc
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSIOConsole.cc	(revision 2816)
+++ code/branches/gui/src/orxonox/gamestates/GSIOConsole.cc	(revision 2817)
@@ -40,5 +40,5 @@
 {
     GSIOConsole::GSIOConsole()
-        : GameState<GSRoot>("ioConsole")
+        : GameState("ioConsole")
     {
     }
Index: code/branches/gui/src/orxonox/gamestates/GSIOConsole.h
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSIOConsole.h	(revision 2816)
+++ code/branches/gui/src/orxonox/gamestates/GSIOConsole.h	(revision 2817)
@@ -33,9 +33,8 @@
 #include <OgrePrerequisites.h>
 #include "core/GameState.h"
-#include "GSRoot.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport GSIOConsole : public GameState<GSRoot>
+    class _OrxonoxExport GSIOConsole : public GameState
     {
     public:
Index: code/branches/gui/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSLevel.cc	(revision 2816)
+++ code/branches/gui/src/orxonox/gamestates/GSLevel.cc	(revision 2817)
@@ -53,5 +53,5 @@
 
     GSLevel::GSLevel()
-//        : GameState<GSGraphics>(name)
+//        : GameState(name)
         : keyBinder_(0)
         , inputState_(0)
Index: code/branches/gui/src/orxonox/gamestates/GSLevel.h
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSLevel.h	(revision 2816)
+++ code/branches/gui/src/orxonox/gamestates/GSLevel.h	(revision 2817)
@@ -31,4 +31,5 @@
 
 #include "OrxonoxPrereqs.h"
+#include "core/GameState.h"
 #include "core/OrxonoxClass.h"
 
Index: code/branches/gui/src/orxonox/gamestates/GSRoot.cc
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSRoot.cc	(revision 2816)
+++ code/branches/gui/src/orxonox/gamestates/GSRoot.cc	(revision 2817)
@@ -33,9 +33,9 @@
 #include "util/Debug.h"
 #include "core/Core.h"
-#include "core/ConfigValueIncludes.h"
 #include "core/CoreIncludes.h"
 #include "core/ConsoleCommand.h"
 #include "tools/Timer.h"
 #include "objects/Tickable.h"
+#include "Game.h"
 
 namespace orxonox
@@ -47,7 +47,4 @@
         , timeFactorPauseBackup_(1.0f)
     {
-        RegisterRootObject(GSRoot);
-        setConfigValues();
-
         this->ccSetTimeFactor_ = 0;
         this->ccPause_ = 0;
@@ -58,12 +55,4 @@
     }
 
-    void GSRoot::setConfigValues()
-    {
-        SetConfigValue(statisticsRefreshCycle_, 250000)
-            .description("Sets the time in microseconds interval at which average fps, etc. get updated.");
-        SetConfigValue(statisticsAvgLength_, 1000000)
-            .description("Sets the time in microseconds interval at which average fps, etc. gets calculated.");
-    }
-
     void GSRoot::enter()
     {
@@ -71,14 +60,7 @@
         timeFactor_ = 1.0f;
 
-        // reset frame counter
-        this->statisticsStartTime_ = 0;
-        this->statisticsTickTimes_.clear();
-        this->periodTickTime_ = 0;
-        this->avgFPS_ = 0.0f;
-        this->avgTickTime_ = 0.0f;
-
         {
             // add console commands
-            FunctorMember01<GameStateBase, const std::string&>* functor = createFunctor(&GameStateBase::requestState);
+            FunctorMember01<GameState, const std::string&>* functor = createFunctor(&GameState::requestState);
             functor->setObject(this);
             this->ccSelectGameState_ = createConsoleCommand(functor, "selectGameState");
@@ -144,38 +126,8 @@
         uint64_t timeAfterTick = time.getRealMicroseconds();
 
-        // STATISTICS
-        assert(timeAfterTick - timeBeforeTick >= 0 );
-        statisticsTickInfo tickInfo = {timeAfterTick, timeAfterTick - timeBeforeTick};
-        statisticsTickTimes_.push_back(tickInfo);
-        assert(statisticsTickTimes_.back().tickLength==tickInfo.tickLength);
-        this->periodTickTime_ += tickInfo.tickLength;
+        // Also add our tick time to the list in GSRoot
+        Game::getInstance().addTickTime(timeAfterTick - timeBeforeTick);
 
-        // Ticks GSGraphics or GSDedicated
         this->tickChild(time);
-
-        if (timeAfterTick > statisticsStartTime_ + statisticsRefreshCycle_)
-        {
-            std::list<statisticsTickInfo>::iterator it = this->statisticsTickTimes_.begin();
-            assert(it != this->statisticsTickTimes_.end());
-            int64_t lastTime = timeAfterTick - statisticsAvgLength_;
-            if ((int64_t)it->tickTime < lastTime)
-            {
-                do
-                {
-                    assert(this->periodTickTime_ > it->tickLength);
-                    this->periodTickTime_ -= it->tickLength;
-                    ++it;
-                    assert(it != this->statisticsTickTimes_.end());
-                } while ((int64_t)it->tickTime < lastTime);
-                this->statisticsTickTimes_.erase(this->statisticsTickTimes_.begin(), it);
-            }
-
-            uint32_t framesPerPeriod = this->statisticsTickTimes_.size();
-            this->avgFPS_ = (float)framesPerPeriod / (timeAfterTick - this->statisticsTickTimes_.front().tickTime) * 1000000.0;
-            this->avgTickTime_ = (float)this->periodTickTime_ / framesPerPeriod / 1000.0;
-
-            statisticsStartTime_ = timeAfterTick;
-        }
-
     }
 
Index: code/branches/gui/src/orxonox/gamestates/GSRoot.h
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSRoot.h	(revision 2816)
+++ code/branches/gui/src/orxonox/gamestates/GSRoot.h	(revision 2817)
@@ -38,14 +38,9 @@
 namespace orxonox
 {
-    class _OrxonoxExport GSRoot : public RootGameState, public OrxonoxClass
+    class _OrxonoxExport GSRoot : public RootGameState
     {
         friend class ClassIdentifier<GSRoot>;
 
     public:
-        struct statisticsTickInfo
-        {
-            uint64_t    tickTime;
-            uint32_t    tickLength;
-        };
     
     public:
@@ -59,11 +54,4 @@
         float getTimeFactor() { return this->timeFactor_; }
 
-        float getAvgTickTime() { return this->avgTickTime_; }
-        float getAvgFPS()      { return this->avgFPS_; }
-
-        inline void addTickTime(uint32_t length)
-            { assert(!this->statisticsTickTimes_.empty()); this->statisticsTickTimes_.back().tickLength += length;
-              this->periodTickTime_+=length; }
-
     private:
         void enter();
@@ -71,21 +59,7 @@
         void ticked(const Clock& time);
 
-        void setConfigValues();
-
         float                 timeFactor_;       //!< A factor that sets the gamespeed. 1 is normal.
         bool                  bPaused_;
         float                 timeFactorPauseBackup_;
-
-        // variables for time statistics
-        uint64_t              statisticsStartTime_;
-        std::list<statisticsTickInfo>
-                              statisticsTickTimes_;
-        uint32_t              periodTickTime_;
-        float                 avgFPS_;
-        float                 avgTickTime_;
-
-        // config values
-        unsigned int          statisticsRefreshCycle_;
-        unsigned int          statisticsAvgLength_;
 
         // console commands
Index: code/branches/gui/src/orxonox/gamestates/GSServer.cc
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSServer.cc	(revision 2816)
+++ code/branches/gui/src/orxonox/gamestates/GSServer.cc	(revision 2817)
@@ -39,5 +39,5 @@
 
     GSServer::GSServer()
-        : GameState<GSGraphics>("server")
+        : GameState("server")
         , server_(0)
     {
Index: code/branches/gui/src/orxonox/gamestates/GSServer.h
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSServer.h	(revision 2816)
+++ code/branches/gui/src/orxonox/gamestates/GSServer.h	(revision 2817)
@@ -31,11 +31,11 @@
 
 #include "OrxonoxPrereqs.h"
+#include "core/GameState.h"
 #include "network/NetworkPrereqs.h"
 #include "GSLevel.h"
-#include "GSGraphics.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport GSServer : public GameState<GSGraphics>, public GSLevel
+    class _OrxonoxExport GSServer : public GameState, public GSLevel
     {
     public:
Index: code/branches/gui/src/orxonox/gamestates/GSStandalone.cc
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSStandalone.cc	(revision 2816)
+++ code/branches/gui/src/orxonox/gamestates/GSStandalone.cc	(revision 2817)
@@ -40,5 +40,5 @@
 {
     GSStandalone::GSStandalone()
-        : GameState<GSGraphics>("standalone")
+        : GameState("standalone")
     {
     }
Index: code/branches/gui/src/orxonox/gamestates/GSStandalone.h
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSStandalone.h	(revision 2816)
+++ code/branches/gui/src/orxonox/gamestates/GSStandalone.h	(revision 2817)
@@ -31,10 +31,10 @@
 
 #include "OrxonoxPrereqs.h"
+#include "core/GameState.h"
 #include "GSLevel.h"
-#include "GSGraphics.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport GSStandalone : public GameState<GSGraphics>, public GSLevel
+    class _OrxonoxExport GSStandalone : public GameState, public GSLevel
     {
     public:
Index: code/branches/gui/src/orxonox/overlays/debug/DebugFPSText.cc
===================================================================
--- code/branches/gui/src/orxonox/overlays/debug/DebugFPSText.cc	(revision 2816)
+++ code/branches/gui/src/orxonox/overlays/debug/DebugFPSText.cc	(revision 2817)
@@ -30,7 +30,7 @@
 #include "DebugFPSText.h"
 #include <OgreTextAreaOverlayElement.h>
+#include "util/Convert.h"
 #include "core/CoreIncludes.h"
-#include "GraphicsManager.h"
-#include "util/Convert.h"
+#include "Game.h"
 
 namespace orxonox
@@ -51,5 +51,5 @@
         SUPER(DebugFPSText, tick, dt);
 
-        float fps = GraphicsManager::getInstance().getAverageFramesPerSecond();
+        float fps = Game::getInstance().getAvgFPS();
         this->setCaption(convertToString(fps));
     }
Index: code/branches/gui/src/orxonox/overlays/debug/DebugRTRText.cc
===================================================================
--- code/branches/gui/src/orxonox/overlays/debug/DebugRTRText.cc	(revision 2816)
+++ code/branches/gui/src/orxonox/overlays/debug/DebugRTRText.cc	(revision 2817)
@@ -32,5 +32,5 @@
 #include "core/CoreIncludes.h"
 #include "util/Convert.h"
-#include "GraphicsManager.h"
+#include "Game.h"
 
 namespace orxonox
@@ -51,5 +51,5 @@
         SUPER(DebugRTRText, tick, dt);
 
-        float rtr = GraphicsManager::getInstance().getAverageTickTime();
+        float rtr = Game::getInstance().getAvgTickTime();
         this->setCaption(convertToString(rtr));
     }
