I am interested how it would be possible to setup simplest Unity multiplayer game for Facebook SDK? It doesn’t need to be very detailed - I just need some solution that one player could control one GameObject, while another player could control another GameObject in the same scene at the same time.
I would prefer to use Unity build-in Network system without using any Photon or some other assets.
I am more keen not to use Photon or any other external tool, as there is a build-in pipeline right in the Unity. Here I found quite good tutorial, which covers basic networking: http://cgcookie.com/unity/2011/12/20/introduction-to-networking-in-unity/
On the other hand there is recently released 3 parts how to set up simplest Facebook SDK with explanation from scratch:
What is interesting part now is how to combine these two things into one working pipeline, as I didn’t found no single discussion about this.
I don’t know about tutorials. They have a wrapped-up login system for Flash games to use, which handles all the UI stuff for you, but with Unity you’ll need to make the UI yourself, or use the Facebook plugin from the Asset Store. The SDK includes some examples - the Unity one only covers game networking, but you can also look at the Flash examples to see how to use their APIs for things like database storage, shop purchases, analytics, etc.
Well, UI is not a problem - you can check my current Facebook game: https://apps.facebook.com/tales_of_eightrivers
where I used new Unity 4.6 UI system. It’s also not about login system, as login is basically just authentication check.
The biggest issue is how to set up multiplayer part, that (lets say) I and my friend would be able to join the same match at the same time and that we would be able to see each others actions right through web browser (in Facebook, Yahoo, etc.). More particularly I am keen about setting up master servers, IP adresses, etc., and how Facebook will recognise that. Basically it’s a question how to add multiplayer functionality to already existing game, which is already set on Facebook as single player game.
Oh I see, I thought you’d need to implement the facebook connect UI but I guess it does it for you. The webplayer crashes Chrome when leaving your game though.
If you just want players to be able to host a session or join a session, with simple state synchronization for some gameobjects, then you may be OK with Unity networking. It’s the only thing that will let a player host in the webplayer, in any case. Pretty much anything in the webplayer other than Unity’s built-in networking needs to relay through an external server as peer-to-peer sockets are not generally supported.
I guess what’s still not clear to me is what you mean by combining Facebook with Unity networking. I don’t see much scope for interaction between those features. I might be just shortsighted though
That’s interesting point - I was thinking actually what is going on with servers when webplayer build is on Facebook: first connection is going through Facebook, original build is saved in e.g. dropbox and multiplayer master server would be somewhere in Unity (if used Unity build-in networking)? Do I miss something here?
No, you got it right. The webplayer plugin lets your code run in the browser pretty much the same as it does natively, so once it’s running it can mostly do anything native code can do. The exceptions are things that are disabled for security reasons, but it’s not really anything to do with Facebook. They just serve up a wrapper around your game, and provide services like authentication if you choose to use them.
Has anyone got anything futher in this thread i am in real need of it
Please share if you have found anything, any alternative just any help for multiplayer game development(majorly facebook even other solutions will do)
Thanks for a reminder! I was working a bit more afterwards and on November I made a combined tutorial myself of how to set up simple Facebook game:
And I released my own free game “Tales of Eightrivers” based on this approach. However, it’s not exactly multiplayer, as I am still quite confused about multiplayer part. It seems like it would be needed a host or matchmaker servers to communicate between players. However, most of such servers are not free, what makes additional difficulties. On the other hand, on LAN it can be created simple host server on one of players computer. However, when we are outside of LAN, this approach stops working. If somebody knows how to setup online multiplayer, which would work not just on LAN without using matchmaking services, it would be a great start.
First of all A BIG BIG THANKS for the tutorial … We also used dropbox as a server for facebook game … But I have noticed that after converting to openGL its become a very big file and it really very time-consuming to download the game from dropbox in facebook canvas … rendering is very slow and big waiting time … Do you feel the same ? If so then what will be the solution .
Yes, I know that problem. The solution is to use asset bundles. I have another video of showing how to create them:
You can put mostly textures, audio files and other data files, which takes most of the space. Once the asset bundle is created, copy it to dropbox public folder and when downloading, use that link. In that case asset bundles will be no longer in the project and initial loading time of WebGL build will be increased. Player will be downloading the data from your dropbox while playing.