3

Can Firebase provide the necessary backend for Unity-based MMO implementations? I see that there is a Unity-socket.io integration. Has anyone tried Firebase? MuchDifferent.com certainly offers a complete suite for supporting Unity MMOs. Can Firebase be used to simplify the architecture? Under what circumstances would an attempt be advised? Not advised?

Chip
  • 31
  • 1
  • 3

4 Answers4

5

Firebase can be used to power an MMO, but some work will be required to integrate with Unity. Unity provides a limited interface for communication between the Unity player and javascript running in the browser: http://docs.unity3d.com/Documentation/Manual/UnityWebPlayerandbrowsercommunication.html

You can use the Application.ExternalCall() function to call out to the browser and perform Firebase operations. Calling back into the Unity player is a little more constrained. You will need to take the information in your Firebase callbacks and marshall it into a string, as the Unity interface only allows for the passing of a single string argument (see SendMessage in the above docs). JSON.stringify() should be pretty useful here, and then you will need a JSON library in whichever language you are using for your game. In addition, due to how Unity integrates with its host platform, you will want to make sure you are not passing messages back and forth on each frame (i.e. don't set a player's location into Firebase in each frame). However, periodic updates should not pose a problem.

The good news is that it shouldn't be too hard to abstract this behavior into a library. If you do decide to give it a try, please let us know how it goes, and don't hesitate to reach out if you run into any problems.

Hope that helps!

Greg Soltis
  • 1,434
  • 9
  • 10
  • [Interesting response](http://forum.unity3d.com/threads/173675-can-Firebase-be-used-to-backend-Unity-MMOs?p=1188205) from some Unity guys. – Chip Mar 12 '13 at 11:45
  • Hi Chip, I addressed some of their concerns over on that forum, but to summarize: Firebase runs over websockets in all browsers that support them, which behave like plain tcp connections. Firebase provides a robust authentication and authorization security framework to help you secure your client-side app and prevent cheating in your games. For more information, see the screencast here: [https://www.firebase.com/docs/security-quickstart.html](https://www.firebase.com/docs/security-quickstart.html) – Greg Soltis Mar 12 '13 at 16:00
  • Also, check out [roll20](http://roll20.net). It's a virtual table-top gaming site, powered by Firebase. It's a great example of an in-browser, multiplayer game and it demonstrates what Firebase can do. – Greg Soltis Mar 12 '13 at 16:39
  • What about the other platforms that Unity supports? like Android and iOS. – Oliver Oct 04 '14 at 05:21
  • Firebase has support for both Android and iOS. You will need to wrap them in Unity plugins to use them from the Unity player. – Greg Soltis Oct 08 '14 at 04:55
1

It seams that there is an official firebase unity plugin now. Firebase-Unity on github

gattsbr
  • 3,762
  • 1
  • 22
  • 34
Zohar
  • 1,820
  • 1
  • 18
  • 16
0

You can use IKVM to convert the Firebase Java Library into a C# library. Just use this command:

ikvmc -out:Firebase.dll Firebase.jar

You can then import the just created library together with all the IKVM DLLs to Unity (copy everything inside the root of the Assets folder).

Once you have everything imported, enable Mono SSL Stores and Certificates (off by default on Unity) http://www.mono-project.com/FAQ:_Security.

Neo
  • 47
  • 4
0

I mande a Lib for Unity based in Rest, it is starting, but work.

If want check it help, the link of FBaseUnity

ViTUu
  • 1,204
  • 11
  • 21