Index: code/branches/ggz2/src/SpecialConfig.h.in
===================================================================
--- code/branches/ggz2/src/SpecialConfig.h.in	(revision 5739)
+++ code/branches/ggz2/src/SpecialConfig.h.in	(revision 5740)
@@ -69,4 +69,10 @@
 #cmakedefine CMAKE_CONFIGURATION_TYPES
 
+/**
+@def GGZMOD_FOUND
+    Macro for availability of the ggzmod library
+*/
+#cmakedefine GGZMOD_FOUND
+
 // Handle default ConfigValues
 namespace orxonox { namespace specialConfig
Index: code/branches/ggz2/src/modules/gamestates/GSClient.cc
===================================================================
--- code/branches/ggz2/src/modules/gamestates/GSClient.cc	(revision 5739)
+++ code/branches/ggz2/src/modules/gamestates/GSClient.cc	(revision 5740)
@@ -24,8 +24,10 @@
  *   Co-authors:
  *      Fabian 'x3n' Landau
+ *      Adrian Friedli
  *
  */
 
 #include "GSClient.h"
+#include "SpecialConfig.h"
 
 #include "util/Exception.h"
@@ -35,4 +37,7 @@
 #include "core/GameMode.h"
 #include "network/Client.h"
+#ifdef GGZMOD_FOUND
+#include "GGZClient.h"
+#endif /* GGZMOD_FOUND */
 
 namespace orxonox
@@ -45,4 +50,5 @@
         : GameState(info)
         , client_(0)
+        , ggzClient(0)
     {
     }
@@ -56,5 +62,18 @@
         GameMode::setIsClient(true);
 
-        this->client_ = new Client(CommandLine::getValue("ip").getString(), CommandLine::getValue("port"));
+#ifdef GGZMOD_FOUND
+        if (GGZClient::isActive())
+        {
+            this->ggzClient = new GGZClient(this);
+            return;
+        }
+#endif /* GGZMOD_FOUND */
+
+        this->connect(CommandLine::getValue("ip").getString(), CommandLine::getValue("port"));
+    }
+
+    void GSClient::connect(const std::string& address, int port)
+    {
+        this->client_ = new Client(address, port);
 
         if(!client_->establishConnection())
@@ -68,4 +87,11 @@
         client_->closeConnection();
 
+#ifdef GGZMOD_FOUND
+        if (ggzClient)
+        {
+            delete ggzClient;
+        }
+#endif /* GGZMOD_FOUND */
+
         // destroy client
         delete this->client_;
@@ -76,5 +102,8 @@
     void GSClient::update(const Clock& time)
     {
-        client_->update(time);
+        if (client_)
+        {
+            client_->update(time);
+        }
     }
 }
Index: code/branches/ggz2/src/modules/gamestates/GSClient.h
===================================================================
--- code/branches/ggz2/src/modules/gamestates/GSClient.h	(revision 5739)
+++ code/branches/ggz2/src/modules/gamestates/GSClient.h	(revision 5740)
@@ -23,5 +23,5 @@
  *      Reto Grieder
  *   Co-authors:
- *      ...
+ *      Adrian Friedli
  *
  */
@@ -42,4 +42,5 @@
         GSClient(const GameStateInfo& info);
         ~GSClient();
+        void connect(const std::string& address, int port);
 
         void activate();
@@ -49,4 +50,5 @@
     private:
         Client* client_;
+        GGZClient* ggzClient;
     };
 }
Index: code/branches/ggz2/src/orxonox/CMakeLists.txt
===================================================================
--- code/branches/ggz2/src/orxonox/CMakeLists.txt	(revision 5739)
+++ code/branches/ggz2/src/orxonox/CMakeLists.txt	(revision 5740)
@@ -30,4 +30,8 @@
   Scene.cc
 )
+
+IF(GGZMOD_FOUND)
+  ADD_SOURCE_FILES(ORXONOX_SRC_FILES GGZClient.cc)
+ENDIF(GGZMOD_FOUND)
 
 ADD_SUBDIRECTORY(collisionshapes)
@@ -65,4 +69,5 @@
     ${VORBIS_LIBRARY}
     ${OGG_LIBRARY}
+    ${GGZMOD_LIBRARIES}
     tinyxml++_orxonox
     tolua++_orxonox
Index: code/branches/ggz2/src/orxonox/GGZClient.cc
===================================================================
--- code/branches/ggz2/src/orxonox/GGZClient.cc	(revision 5740)
+++ code/branches/ggz2/src/orxonox/GGZClient.cc	(revision 5740)
@@ -0,0 +1,96 @@
+#include "GGZClient.h"
+
+#include <cassert>
+#include <boost/bind.hpp>
+
+namespace orxonox
+{
+    GGZClient* GGZClient::singletonRef_s = 0;
+
+    GGZClient::GGZClient(GSClient * c)
+        : ggzSocket(io), gameSocket(io)
+    {
+        assert(singletonRef_s == 0);
+        singletonRef_s = this;
+
+        client = c;
+        initGGZ();
+    }
+
+    GGZClient::~GGZClient()
+    {
+        deinitGGZ();
+
+        assert(singletonRef_s);
+        singletonRef_s = 0;
+    }
+
+    GGZClient& GGZClient::getInstance()
+    {
+        assert(singletonRef_s);
+        return *singletonRef_s;
+    }
+
+    bool GGZClient::isActive()
+    {
+        return ggzmod_is_ggz_mode();
+    }
+
+    void GGZClient::tick(const float /*dt*/)
+    {
+        boost::system::error_code ec;
+        io.poll(ec);
+        if (ec)
+        {
+            /* TODO: Error */
+        }
+    }
+
+    void GGZClient::initGGZ()
+    {
+        COUT(3) << "Initializing GGZ\n";
+        ggzmod = ggzmod_new(GGZMOD_GAME);
+        ggzmod_set_handler(ggzmod, GGZMOD_EVENT_SERVER,
+                &orxonox::GGZClient::handleGGZModServer);
+        if (ggzmod_connect(ggzmod) < 0)
+        {
+            /* TODO: Error */
+        }
+        int fd = ggzmod_get_fd(ggzmod);
+        if (fd < 0)
+        {
+            /* TODO: Error */
+        }
+        /* TODO: Error */
+        ggzSocket.assign(boost::asio::local::stream_protocol(), fd);
+        ggzSocket.async_read_some(boost::asio::null_buffers(), boost::bind(&handleGGZ, boost::asio::placeholders::error));
+    }
+
+    void GGZClient::deinitGGZ()
+    {
+        ggzmod_disconnect(ggzmod);
+        ggzmod_free(ggzmod);
+    }
+
+    /* Got data from game server */
+    void GGZClient::handleGame(const boost::system::error_code& /*e*/)
+    {
+        /* TODO: read from gameSocket */
+    }
+
+    /* Got data from GGZ */
+    void GGZClient::handleGGZ(const boost::system::error_code& /*e*/)
+    {
+        ggzmod_dispatch(getInstance().ggzmod);
+    }
+
+    /* Connection to game server established */
+    void GGZClient::handleGGZModServer(GGZMod * ggzmod, GGZModEvent e,
+            const void *data)
+    {
+        COUT(3) << "GGZ Initialized\n";
+        ggzmod_set_state(ggzmod, GGZMOD_STATE_PLAYING);
+        getInstance().gameSocket.assign(boost::asio::local::stream_protocol(), *(int*)data);
+        getInstance().gameSocket.async_read_some(boost::asio::null_buffers(), boost::bind(&handleGame, boost::asio::placeholders::error));
+    }
+}
Index: code/branches/ggz2/src/orxonox/GGZClient.h
===================================================================
--- code/branches/ggz2/src/orxonox/GGZClient.h	(revision 5740)
+++ code/branches/ggz2/src/orxonox/GGZClient.h	(revision 5740)
@@ -0,0 +1,41 @@
+#ifndef _GGZClient_H__
+#define _GGZClient_H__
+
+#include "OrxonoxPrereqs.h"
+#include "objects/Tickable.h"
+#include "gamestates/GSClient.h"
+
+#include <ggzmod.h>
+#include <boost/asio.hpp>
+
+namespace orxonox
+{
+    class _OrxonoxExport GGZClient : public Tickable
+    {
+        public:
+            GGZClient(GSClient * client);
+            ~GGZClient();
+
+            static GGZClient& getInstance();
+            static bool isActive();
+            virtual void tick(const float dt);
+
+        private:
+            static GGZClient* singletonRef_s;
+
+            GSClient * client;
+            GGZMod * ggzmod;
+            boost::asio::io_service io;
+            boost::asio::local::stream_protocol::socket ggzSocket;
+            boost::asio::local::stream_protocol::socket gameSocket;
+
+            void initGGZ();
+            void deinitGGZ();
+            static void handleGame(const boost::system::error_code& e);
+            static void handleGGZ(const boost::system::error_code& e);
+            static void handleGGZModServer(GGZMod * ggzmod, GGZModEvent e,
+                    const void *data);
+    };
+}
+
+#endif /* _GGZClient_H__ */
Index: code/branches/ggz2/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/branches/ggz2/src/orxonox/OrxonoxPrereqs.h	(revision 5739)
+++ code/branches/ggz2/src/orxonox/OrxonoxPrereqs.h	(revision 5740)
@@ -193,4 +193,7 @@
     class SoundManager;
     class SoundMainMenu;
+
+    // GGZ
+    class GGZClient;
 }
 
