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;
 }
 
