[plugin] firebase

  • Kyatric

    Thanks a lot. Finally it could turn to "Completed Addons".

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Update:

    rex_firebase plugin, for duplicated action number. It will pop a error message in r196.2

  • After looking at the differences between Firebase and Parse, it seems Parse offers a better package at the free level.

    While Parse offers 30 calls per second, Firebase offers 50 simultaneous connections, both at the free level. Assuming they scale comparatively in their paid tiers, I believe Parse is best suited for making apps intended for "the masses," so long as the purpose of the app is not to synchronize every user at all times.

    The benefit of Firebase, based on my impression so far, is to keep a small group of active users synchronized in real time. Scaling an app on this model to thousands of users or more would be expensive. While Firebase has the advantage of more 3rd party sign up options, the strength of Parse is the high bandwidth even at the free level, a big help for new apps and app developers.

    However, In trying to take advantage of both worlds, how about using Parse as the cloud database (a $9 C2 plugin), and using C2's multiplayer plugin as a substitute for Firebase?

    C2's multiplayer plugin has the advantage of allowing you to create "rooms" of users. If you're creating a chat app, for example, the size of the room could go up to as high as fifty. Once a size of 50 is reached, new users would be ushered into a new room, with a new host. The scalability of this approach has no real limit except for how fast C2's server can assign new rooms, and each additional room of 50 users is analogous to a new Firebase account. Since C2's MP plugin creates a direct connection between devices, there is no limit to the number of 50-user rooms C2's multiplayer server or the app can create.

    This adds a little extra work upfront for a C2 app developer, but does not inherently risk their app from being overburdened with too many simultaneous users.

    Subsequently, any data that is synced with Parse is contained to the app using it, but not limited to the room of 50 users that created the data. In this way, the database is not divided into different "accounts", as would be the case with multiple free Firebase accounts versus one very expensive account.

    Simultaneously, Parse resources do not have to be pushed to the limits either. The designated host of the app using the multiplayer plugin can be set to be the only one syncing data with Parse, and sync as sparingly as is practical for the app. That way, more data can be sent per sync less frequently. Syncing non-host users with Parse while they are in the room may not be necessary, because they can sync with Parse at any other time, and their data will be waiting for them.

    As a bonus to the app's developer (us), we will have gained not one but two extremely valuable skills: cloud storage (user to cloud data transfer); and multiplayer (user to user). The second skill alone will be a significant "player" in data security, because it will allow customers using our apps to connect directly with their peers if they are less trusting of "cloud" data management. The multiplayer plugin transfers data user-to-user directly. Having sensitive data not even pass through your app's "data server" (which the multiplayer plugin doesn't need), nor through Parse, would be a powerful selling feature of such an app. And what does this feature cost you to implement, scale AND maintain?

    Almost nothing.

  • hmott

    Yes, Firebase is good at real-time sync, parse is good at query data.

    In my one test, I combined them to create a message board,

    • using firebase to broadcast "new post",
    • if user wants to read some older posts, using parse to display older posts by some conditions.

    Official MP is another kind of multi-player plugin, it has lower response latency to be more real-time than firebase.

    Since parse could not sync data, only firebase and official MP need to be compared.

    Here is an example to show the different between firebase and official MP: firebase could send message to each user, or broadcast to some/all of users in real-time, but official MP could not (unless put all users in a room)

    Another case, if there are 50 users in a room, they are all connect to a host using officail MP plugin.

    1. all data will be broadcast through the host (user), and

    2. room will be destroyed if the host (user) had left,

    Firebase had different behaviors in these two points.

    1. all users connect to firebase server, not one of user. So the scaling of using firebase is better then official MP in this case.

    2. users could stay in the room in firebase server, even host user had left.... wait, there is no "host user" in this case. So the behavior of firebase will be more suitable for a mmo-like game.

    To solve these problem in offical MP plugin, designer could make a big, always running host for all players. In this solution, the hardware cost might not be ignored since the big host needs put on a dedicated server. And any user will receive status of all other users, it will become another problem.

  • rexrainbow

    Good points. I didn't mention before that substituting firebase for mp plugin would have strings attached. And there would have to be designs in place for handling the loss of the host if using mp instead of firebase.

    It would ultimately come down to the app in question. If it requires fifty users to be in sync in real time with the highest reliability, then firebase is the optimum choice. It's what happens when user 51 tries to connect that first made me start to compare the costs and benefits of substituting firebase for mp.

    As I understand it, using firebase would require the app owner to upgrade the plan and pay. Going with the mp plugin, however, would introduce the risks of latency and the host disconnecting. The advantage would then be that the user would eventually connect even if the connection is not as fast as firebase. But, if I'm right about this, they would not successfully connect to the app only because someone else has left.

    Will I use firebase at all? With its faster speed I would consider it as a premium upgrade to cover the cost. If the app user is fine with that, then I am too.

    Also, I would only be able to include firebase in my app because you made the plugin. So thank you for making it.

  • hmott

    Firebase is a "central memory" of a distribute system. Applications run around this central memory, and each application might be different.

    For example, some (server) applications might read data from one firebase space, produce result and save to other space, and this result space will be read by other (user) applications.

    [quote:d10lmdmh]... -> server applicatiions -> firebase -> user applications -> ....

    ---

    Edit: remove

  • These are fantastic! Thanks again rexrainbow !

    One quick question, I for the life of me cannot get the Facebook authentication to work. Since I'm trying a test version of the capx it is obviously localhost, so I try setting up my Facebook app settings to allow localhost calls but just keep getting the Given URL is not allowed by the Application configuration. Could you maybe post your settings you have on your Facebook app so I can see what I did wrong?

    App Domains: I try having just "localhost" or my firebase "pixelgolf.firebaseio.com"

    Site URL: tried just having "http://localhost:50001 (or whatever port)", then tried my firebase "http://pixelgolf.firebaseio.com"

    Client OAuth settings: I had added a bunch like "localhost", "localhost:50001", "pixelgolf.firebaseio.com"

    I have my firebase settings in all of the Domain spots in the capx which works with all the other plugins just fine. Does anything seem off?

    Thanks again!

  • Sorry I could not help you in this problem. I followed the document in firebase, and spent one day try and error, finally it passed...

  • Did you add it to all the places in firebase on the OAuth tab?

  • [quote:pe2t8zpe]In official MP, the host and client should be put in the same capx.

    In firebase, they might be in different capx.

    Is there a reason for this? I made a very basic test server and client, and so far I have had no issues having separate projects for each. :p

    Will I run into problems down the line, do you think, using the C2 Multiplayer plugin if I continue?

  • DatapawWolf

    If you only use MP to send and receive data, it is ok to have 2 capx.

    The power of MP is to sync the C2 objects like the position of sprites, and it is better to put host and client in one capx file.

  • rexrainbow I realize it is "better," however, so far it has been much simpler to manage a client-server connection using separate server and client projects, and I've yet to run into any issues.

    What I'm asking is if there is, in fact, some limitation I might run in to by not having the client and host be one project, because so far no one has noted any such limitations. : )

  • DatapawWolf

    You are right. It is OK if only using MP to send/receive message, like using websocket.

  • rexrainbow I'm currently using it to sync objects as well, not just messages, but basically everything the Multiplayer plugin is set to do.

  • DatapawWolf

    Thanks for correcting, I had removed these paragraphs.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)