Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Firebase to backend Unity3D for the creation of MMOs

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?

like image 428
Chip Avatar asked Nov 17 '25 10:11

Chip


1 Answers

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!

like image 119
Greg Soltis Avatar answered Nov 20 '25 05:11

Greg Soltis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!