Real-Time Multiplayer: how to?

How do you implement real-time multiplayer? Do you use Nuggeta or Appwarp or what?

:smile:
cocos2dxv3,xcode6.1

Neither of them, but https://developers.google.com/games/services/cpp/GettingStartedNativeClient :smiley:

thanks for sharing, GameCenter also offers this, yeah?

Of course it does: https://developers.google.com/games/services/cpp/realtimeMultiplayer

And there is always RakNet. It’s the best network middleware there is:
http://www.jenkinssoftware.com/

Wow i didn’t know Google offer Real-time Multiplayer in iOS
did someone try it ? is it free ? what are the limits ( pros/cons)?

thanks for the suggestions, will certainly check em out :smile:

Use the source, Luke! :smile:

We will usw it in our new game. It’s similar to other APIs like RakNet or Steam.

Of course it’s free, it’s from Google.

There are no limits, as the underlying network is peer to peer, and there is no capping on MAU or players per session/room. The only limit is the message size, you can send, which is 1400bytes with reliable messages and 1168bytes with unreliable messages.

Pros:

  • Offers rooms, matchmaking and messaging
  • It’s from google
  • Easy to implement
  • Lightweight
  • SDK available for iOS, Android and C++
  • It’s free

Cons:

  • It’s from Google (maybe Apple will block it in the future, if they
    decide to forbid 3rd party libs, but this will rarely happen)
  • Data is sent unencrypted, so you will have to implement that yourself
  • As the underlying network is P2P, you will have to come up with some
    logic, if your game relies on a host or owner

Thanks for the Detailed answer ,
what do you mean p2p ?
its not with server in between that delegates the massages ? something like SmartFoxServer ?
how can it do p2p?

P2P means peer to peer. The clients are communicating directly with each other.

No. The server is only creating the room. All data is transferred between the clients. It’s the same as nearly all AAA games/platforms are using. Be it on PC or Consoles. There are only a few games out there, that rely on dedicated servers like years ago.

You can also do P2P with it, and just rely on the lobby system the server would provide. But no, it’s not transferring/delegating game data/messages through a server like SmartFoxServer.

The clients register with the room/lobby and the P2P engine creates direct connections with the clients among each others. That’s why one of the clients has to act as the host or owner.
I’m sure, that you are familiar with actual games/shooters. The connection/game is dropped/canceled, if the host disconnects. Some games implement host migration. The host and all the clients in the P2P network knows each clients interconnected, and a new host can be announced. Mostly this happens on the best RTT.
As you see, nearly all modern games use P2P.

@iQD given that both GooglePlay and APple offer multiplayer, which one will you use? Im developing for iOS BTW :smile: or maybe I’ll just use RakNet instead… time to do some diggin! :smile:

Google Play Services, as they offer a C++ SDK.

@iQD

C++ SDK, EasySDK, man there is so much to know :smile:

Use AppWarp :wink:
Being part of AppWarp Core team, I would obviously ask you to try out AppWarp. Here is a guide on creating multiplayer in Cocos2D-x using AppWarp http://blogs.shephertz.com/2013/08/19/cocos2d-x-realtime-fighting-game-tutorial/

Please present your arguments, why it should be chosen over GPGS :wink:

1 Like

Since I am a developer too, I will say that every service has it’s own advantages and it’s own style of usage. It depends on developer, which service fulfill his requirements.

For me AppWarp is better choice. I would have choosen it even if I was not the one of the developers behind AppWarp. The reason is Shephertz provides a full cloud ecosystem where AppWarp is just a part. Combining with other service App42, I could create complex social and multiplayer features not only on Android and iOS but also on other platforms. And with great support and free plan for Indies, I can achive my goals in less time and resources.

In the end, It’s best to analysis all options and choose the one that suits your requirements better. All service are great :slight_smile:

1 Like

Since Google Play offers REST web services:

Does this mean we can use this and it will be cross platform for all of Cocos platforms? This way we can skip the specific Android/iOS SDK’s?

The GPGS is also a full cloud ecosystem, which provides an agnostic API. It does provide even more features for less money or is even completely free, if you don’t hit the quota(which is very high).

Of course. It just boils down to which company you are giving your data :wink:

Yes. It works everywhere, because you are just sending http(s) requests and receiving the responses. It’s an agnostic API.

They provided the REST API for Web-based Game Development, but it’s not limited to it.

The platform specific SDKs are just implementing the http(s) requests/responses and provide you with an API you can use, without the need of implementing the request/response handling yourself.

If you are implementing your own client-server solution, where your server implements anti-cheating mechanism or other fancy features, you would incorporate the REST API as well. It was designed for that.

Every SDK/service out there relies on some sort of REST/web API behind the scenes anyway.

Is there any platform-agnostic implementation in Cocos? Currently Google Play only offer iOS / Android SDK examples. But if it used the generic web code, maybe it would work also on Windows, Mac, Windows Phone, Linux, etc. That would be a huge boost for Cocos as this kind of service is a big deal to make cross platform.

I would just want the basic peer to peer. Something simple such as chat with friends and setup a game.

Also, is the message system just limited to games, or can we integrate their messaging into any app?

No.

You have to read the fine print of the platform, how you have to integrate/present the used service.

The GPGS does not provide a chat.

What message system are you referring to?
I guess it’s allowed for everything. You would need to read the disclaimers to be sure.