David Abaev
David Abaev

Reputation: 696

Unity3d - Online multiplayer Turn

Sorry for my English grammar :( (I try learn it)

I want to try write online turn based game with Unity3d. I want that people will have login with their username and password and will can play from different device like : 1 player from android/iphone and second from facebook or 1 from web - second from tablet etc... Right now I think to create game 1 vs 1 (for 2 players) - but maybe in the feature I will open a new mode for multiplayer

it's simple to card game.

I'm c# developer so I will write code with c#.

My question is:

1) What I have to use for TURN BASED game (if you can give me link) I think about WCF or WebAPI - for cross-platform So what is best practice???

2) I want integrate a premium feature in the game - what you can suggest about billing system inside the game? With which company work is better?

3) I also can write code on JavaScript - if is give me plus in performance??

4) Authorization in the game: What is best practice today? User have create account in my system or better to give to user login with his facebook account??

5) How I can sync. between mobile device and facebook game? if is possible? Where I can save his credentials? If in mobile/tablet I can save in local database, in web - in cookie? where in facebook??

6) server - where the best place to publish the server side ? Amazon cloud? or not??

Upvotes: 2

Views: 3614

Answers (3)

user5242208
user5242208

Reputation:

3) I also can write code on JavaScript - if is give me plus in performance??

No really different. Here is performance test Result is:

The average of C# is 8,075ms and Unityscript is 8,142ms. So C# is a little bit ahead,

Upvotes: 0

Zohaib Javed
Zohaib Javed

Reputation: 343

  1. Unity itself supports networking. But there are other plugins like Photon Unity Networking which are enhanced version of unity networking. It also supports Turn based game plus it is a cross platform will support iOS, android and web. Photon Engine for Unity Networking

  2. I assume by Billing System you mean In apps in the app. I have used UniBill its works fine with iOS,GPlay,Amazon etc stores. With so much less effort you can integrate the plugin. Unibill by Outline Games

  3. C# is enough i think.

  4. You can use facebook it good enough. You can also add simple guest login for authorization. Guest will be registered on the basis of Unique User ID which is provided by unity.

  5. For storing data, you can use Parse Third party plugin. I have tried it and it works great. If you are going to web app as well then try using their Rest API. It will work will all their supported platforms.

Upvotes: 5

David
David

Reputation: 16277

Q1) What I have to use for TURN BASED game (if you can give me link) I think about WCF or WebAPI - for cross-platform So what is best practice???


WCF might not be the best choice, though it functions, but in typical cases, you might wish use Socket or Websocket to communicate.

The benefits of Websocket is that the connection, once established, remains active, and this is quite different from http protocols, in which request-response model is used. With http, the connection dismisses once the message is sent/received, you need to repeatedly setup the channel which has overheads if you have massive message, be it large in payload or frequency.

As a comparison shown below, the performance of Websocket is much better than http based communication, refer to this link for more details.

enter image description here

Another option is to use Redis or MongoDB, which has built-in support of the pub-sub model. Since you are talking about the card game, you might wish that:

  • Player 1 flips the card, all the other players in this game/room can immediately see this change
  • Player 2 does sth else, all the other players in this game/room can immediately see this change as well.

This is very simple if you use Redis, one client publishes a message (e.g. card flip), then let all the other clients to subscribe this, then all other players (Android, iOS, web, facebook, tablet whatever) get notified immediately, it is then up to you implement your game logic.


The 3rd option is to use xxx-MQ (e.g. RabbitMQ, ZeroMQ, MSMQ, ActiveMQ) which are essentially message brokers, you can use the pub-sub model easily to implement the turn-based game logic.


Upvotes: 1

Related Questions