Networking Extention

Networking Extention
0.0 0


Hi all,
I am going to write a networking extension for cocos2d-x as my final year project in my undergraduate studies.
I am not a game developer and have not experience with game engines. Please tell me the functionalities you want to add in this game engine.
Also please tell me how can I register myself as authorized developer of this game engine.
I badly need guidance from the experts.
Aqeel Raza

Local Multiplayer in Cocos2dx

Please don’t post the same content 3 times in different subforums.
extensions/network/CCHttpClient & CCHttpRequest is a start point, you can refer to this.
But what we lacked are:
# socket support. Many developers asked if cocos2d-x has socket API. The answer is no, you need to call BSD socket API from ios sdk & android ndk. People need to deal with multi-thread programming, take care of autorelease pool, keep the network thread from calling OpenGL functions etc. It’s not hard, but many beginners are trapped here
# As the progress of javascript binding, we have no unified API for network on both cocos2d-x & cocos2d-html5. On cocos2d-x, we use CCHttpClient/CCHttpReqeust, while on cocos2d-html5, we use XMLHttpRequest. If you can design a wrapper for both libcurl (the 3rd library under CCHttpClient) and XMLHttpRequest, That would be awesome!


Hi, I am sorry for the repetition. But thanks for the comments. I am thinking of adding server like photon server for cocos. Would it be much difficult or I can do it? I have around 7 to 8 Months along with my courses. Do you like the idea of making a server and writing client api for separate plateforms?
Also how can I be a registered as cocos2d-x developer on it site. I will send you a project proposal very soon.

Why do programmers require socket call? Programmers make their own server? Or they use it for p2p communication?
I will include multithreading, auto pool releasing and socket api.I want to know what level of abstraction programmers require?

Aqeel Raza


“I am thinking of adding server like photon server for cocos.”

Photon is already compatible to cocos2d-x and the combination cocos2d-x and photon is already used successfully for the development of several games.
The Photon C++ client SDKs even ship with a demo, for which cocos2d-x is used as the graphics engine.
So why would you want to invest the time to build another client-server solution, if you explicitly say, that you want it to be like Photon, anyway?

“Would it be much difficult or I can do it?”

There have been several dozens of developer manyears invested into making Photon what it is today. The development of the code, that evolved to Photon, has started 15 years ago and for the last 10 years most of the time the development team has been consisting of more than 10 concurrent programmers. So doing something like this as a single developer could be a “bit” too much work for just 7-8 months, especially without experience in this area of development.


`Stefan Ludewig seems like the developer of Photon, am I right?

`Aqeel Raza, Stefan is right. At first, reinventing the wheel doesn’t make sense. That’s the reason why cocos2d-x only focus on the cross-platform feature based on cocos2d-iphone, instead of creating a new engine from scratch. Secondly, Rome was not built in a day, it’s very very hard to finish a stable product for commercial usage like Photon in your undergraduate study.

My suggestions are:

  1. If you insist on complex CS structure network extension:

Only make a demo, write your paper and blog. It’ll be inspiring.
Maybe you have read this blog There’re only concepts and demos. It’s far far way to be a commercial product. But it’s very very famous in game engine design area.
Remember that, just demo. In this way you can control the project scope. But as the result, no matter how successful your paper/blog is, cocos2d-x repo will not merge your demo code.

  1. If you prefer network extension, and would like to make a completely stable module, ready for commercial usage. My suggestion is still the viewpoint above: to write a client-side network wrapper which compatible with:
    * c+/lua/javascript triple languages,
    * http/socket methods
    * for ios/android/window/mac native platforms
    web browsers(html5)
    This is already very challenged. This work will bring values to developer in this community. Once your extension is integrated into cocos2d-x repo on github, your name will be listed on But please don’t take the authorization as a goal of job.

  2. Something else you can do on cocos2d-x for your undergraduate studies:
    * Engine architecture. Cocos2d used the most traditional structure. You can refer to Entity/Component architecture, or even Entity/Component/EneityProcessSystem architecture like Artemis. You can improve cocos2d to more morden architectures, then analyse what’s the benefit and how much performance will be lost.
    * Editor on windows. Currently, CocosBuilder can only run on Mac OSX


Thanks for replies. I appreciate your guidance but its kind of too late. I have submitted project proposal for the server. I will also write client api’s.
I will extend my work further after my graduation. Photon isn’t open source so my intentions are to built an open source one.
Hopefully, at the end my contribution for open source community will be usefull. I will try to focus on problem you guys have posted.
Aqeel Raza


Yes, I am one of the Photon developers.

Photon is partly open source. The low level core is closed source, but the high layers are open source.