2

I am building a multiplayer game in Unity. For that purpose, I have to send some values from client to two or more clients who are connected via a Server. I want to build it as a server authentic game. Clients will be using Android and their data will be synchronised via a Server (may be some PHP functions or else, I don't know very well).

I can send data to my server from game but How can I send that data to other clients via my Server?

Actually I don't want to sync all players scene (i.e. gameObjects positions which can be done using the Unity's built-in networking or Photon ) because I want to show them different views and This is why I have to make communications among clients via my own Server.

Can anyone please help me out? Any help link or tool name or any kind of tutorial link is highly appreciated.

user3071284
  • 6,955
  • 6
  • 43
  • 57
  • Not 100% but I think you could use signalR to update multiple clients? – n1FF Dec 01 '15 at 12:19
  • Both, Photon in general and PUN, which you appear to actually mean when you say "Photon", in particular, are perfectly capable of what you want to do. Just use PhotonNetwork.RaiseEvent to transfer any kind of arbitrary data between the clients, – photonians Dec 02 '15 at 17:08
  • @photonians Thank you for your information. I will be grateful if you give any proper tutorial for this. – Shayed Hasan Shohag Dec 03 '15 at 11:18
  • https://doc.photonengine.com/en/pun/current/tutorials/rpcsandraiseevent – photonians Dec 09 '15 at 17:05

2 Answers2

0

You need to use WebSocket protocol. It can open bidirectional connection for you so you can push message to your client when you need.

WebSocket protocol in Wikipedia

Unity3d open source websocket plugin

Hossein Rashno
  • 3,073
  • 1
  • 25
  • 49
  • Thank you so much. It seems to be a great plugin. But it does not have Web Support. I will try it. It would be great if you can suggest any other plugin for Web. – Shayed Hasan Shohag Dec 02 '15 at 06:20
0

I am successful in doing what I needed. I am using Photon. Using RPC's I am just sending information to clients and In clients, I parsed the information and used it to show them in the game scene. No gameObjects are spawned in Network. One user creates room, and other joins that room. Just using RPC's i am syncing the informations. Thank you all for helping me.