How do you make cocos2dx game multiplayer over internet?

Are there any examples for this?
I want two people to play together in a platform game.
Should I use an online server or something?

I know that you can use Game Center to create an online multiplayer session but that is limited to iOS devices. Also, you need to have a bit of knowledge in objective C.

Try reading this: http://www.raywenderlich.com/3276/how-to-make-a-simple-multiplayer-game-with-game-center-tutorial-part-12

thanks

Btw isnt it possible to make 1 player the host and let the other player connect to it?

bump

I believe that’s what Game Center does. One player creates a “room” and other people can join in it.

By being “host” you mean players can connect to the host directly without a server, I’m not sure.

Yeah I mean without the server, cause I cannot use the Game Center for both iphone and android

My idea is to put online a php server that keeps track of players who started a game so other players can join.
From then on the phones are connected and keep sending eachother data so the can continually synchronize.

Still cant get this to work for android :frowning:

Jay Bigguy wrote:

Still cant get this to work for android :frowning:

you can make this work on ios with gamecenter? please let me know, i have to do the same.

For your idea, what is the problem?

Use http://pocoproject.org

Supports iOS and Android.

@Ricard: Try reading this: http://www.raywenderlich.com/3276/how-to-make-a-simple-multiplayer-game-with-game-center-tutorial-part-12 it’s in Objective C but it should be easy to translate to C++

Thanks, i’m going to try. :slight_smile:

hi guys, i already done this for objective C but when i tried to pass it to C*+ i get a trouble, how can i keep updated the mainscene.cpp when something happend with the gamecenter delegate?
I mean, i have all of this in objectiveC, so i make a connector between C*+ and objectiveC, then i can use objectiveC functions in c*+ classes, like authenticate. But how can i say to the C*+ clases that some data just arrived ( from objectiveC to the C++ class). im sorry if this kind of noob thing, but i’m stuck

Sorry, i get this with this link [[http://stackoverflow.com/questions/7892382/how-to-handle-objective-c-delegation-from-c]]

Jay Bigguy wrote:

Yeah I mean without the server, cause I cannot use the Game Center for both iphone and android
>
My idea is to put online a php server that keeps track of players who started a game so other players can join.
From then on the phones are connected and keep sending eachother data so the can continually synchronize.

I had a similar question (http://www.cocos2d-x.org/boards/18/topics/33000) and someone suggested I use AppWarp. Its working well for me so far as the tutorial is really good and I got a simple 2 player shooter game going on both Android and iPhone. Note there is no server required with this and in that way its similar to game center.

For a multiplayer game the first thing you need is a server. Without server you can create a multiplayer game unless you are creating a peer to peer game. But writing a server application and hosting it is an exhausting task.

It’s better to use Cloud based services like AppWarp. With AppWarp you can create a multiplayer without writing server side code. It already has all the features that a multiplayer game will require like Rooms, Lobby, Match matchmaking, etc and is cross platform.

You can read getting started for cocos2Dx here http://appwarp.shephertz.com/game-development-center/cocos2dx-game-developers-home/cocos2dx-usage-guide/

1 Like

but i heard its too expensive, any idea on the price plans!!!

I am now using the free plan of nextpeer and it worked fine on android and ios.

https://www.nextpeer.com/

1 Like

will give a try for sure… thanks

Do you get ads from using the free version/plan of Nextpeer?