POCO libraries integration with Cocos2d-x (cross-platform)

(if this post is a duplicate of another, I am very sorry, but I couldn’t find it)

Hi,
short intro at first :slight_smile: I am starting to write final university project (a kind of game with networking in LAN) and I would like to do it in cocos2d-x (yeeey). After a long research I would like to use POCO libraries for networking and multithreading things and here comes my question:

Is there a way how to integrate POCO libraries with cocos-2dx? Both cocos2d-x and POCO are cross-platform, so putting them together seems to be very practical. I am not very big friend with makefiles and this stuff, but I am open to learn anything.

If you have another tips how to get cross-platform multithreading and sockets with cocos2d-x, I would be very happy. Cocos2dx with POCO seems to be the best combination for me (cocos for the game-related stuff, POCO for the network and multithreading).

Thanks for any reply.
Marek

1 Like

waiting when you will find answer:) also interested in this

If you are looking for network library for games i strongly recommend using RakNet which is BSD License and used in many games and now owned by OculusVR
http://www.jenkinssoftware.com/
POCO is great lib but it is to big and may be overkill for game .

Thanks for your tip. POCO seems good for me not only because of internet things, but it also supports cross-platform multithreading which is useful for the development. I don’t think POCO is too big, minimum requirements are: 75 MHz ARM9, 8 MB RAM. It is not necesarry to use the whole POCO, just only parts of it.

You have threads in cocos2d-x ,
see HttpClient.cpp and WebSocket.cpp under network .

Yes, by just using it like boost or stl.

Use the multithreading capabilities of C++11/14. There is no need for third party libs.

Regarding sockets, I would suggest RakNat as well, as already mentioned.

Thank you for answer.

I built it (http://pocoproject.org/docs/00200-GettingStarted.html). I found that I have to compile with option -lPoco. I did this with a simple cpp file, but I would like to build cocos2d-x with poco. Where should I add the -lPoco options? I mean which makefile or something like this?

C++11 supports cross-platform threading? Cool :slight_smile:

Ok, I’ll read more about it, it seems to be good, that everybody recommends it :slight_smile:

This is for telling the linker to link your binary with the Poco library.
You don’t build cocos2d-x with Poco, as it does not use it, but you have to link your app/game with Poco.
You have to add the Poco library to your linker settings. The settings are different for different IDEs.

C++11 is a language spec. Of course it is cross-platform, as there is a C++11 compiler for different platforms.

It’s one of the industry leading network middlewares used by major companies in their apps/games:
http://www.jenkinssoftware.com/customers.html

It was a commercial SDK, but since OculusVR bought them and OculusVR is owned by Facebook, they realeased it for free and as Open Source.

Future plans for the C++ language is incorporating Boost.Asio into the language:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4478.html

You can also use Boost.Asio for your networking needs:
http://www.boost.org/doc/libs/1_59_0/doc/html/boost_asio.html