[PLUGIN] Firebase

0 favourites
From the Asset Store
The I18N (Translation) is a Construct plugin created to translate text in game.
  • Firebase v0.5

    contribute github

    download plugin only

    run LIVE multi-user demo

    Real time database-as-a-service integration. Have a real-time database without owning a server!

    So far, you can:

    • Set String, Numbers, Objects (as JSONs)
    • Register for updates of String, Numbers, Objects
    • Create (concurrency safe) lists of objects
    • Register for list updates

    Authenticate users securely using:

    • email/password
    • Facebook logins

    Use the webgui (firebase) to:

    -View/edit data

    -set read/write access

    -add consistency rules to be verified by firebase (stop cheating)

    A capx is included in the repo for testing. All communication is encrypted and compressed. Tested on static HTML export, preview and minification. It will NEVER work with Cocoon, but Firebase does provide APIs for native iOS, and Android, so you can possibly get to your data in a complicated post process operation if you want native.

    The project is hosted on github so if you need a feature and can add it yourself, add it yourself and send me a pull request! I have tried to comment my code to make it fairly obvious what the design is.

    Tom

  • Sounds like a nice idea.

    What different auths does it support?

    Is the plug going to do encryption/ decryption?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The technical details of firebase are at

    firebase.com

    Firebase is a *very* capable serverless database.

    Authentication supports

    Facebook

    Twitter

    Github

    Persona

    Email & Password

    You can set validation rules via a web gui, which firebase checks. So you can prevent certain types of cheating (e.g. you can't buy X unless you have Y cash in the bank). More complex logic won't fit in its validation rules (e.g. the rules of a game of cards), but you can add your own server with different permissions onto the firebase for those cases.

    Firebase supports SSL (by default), so data is encrypted on the wire, its also compressed effeciently.

    Oh and transaction support, which is a pretty neat technical feat on a real time over-the-web store. The database caches all data locally, so local data writes are fast, and they sync global writes in the background (a bit like dropbox). This avoids slow downs during poor connectivity situations (remember transactions!). Its very smart.

    I have no idea if half these features can be mapped to construct 2. But just as a non-server database with validation rules its pretty hand.

  • The basic API is now in place. Your Actions are

    (set, update, push*, remove) to (String, Number, JSON)

    *push is for lists

    you can register for real time updates of all event types:-

    ("value", "child_added", "child_removed", "child_updated", "child_moved")

    You associate a tag on registration like AJAX, so then your tagged conditions trigger when data is received from firebase.

    You can then use the expressions to get the data and URL references out

    (ValString, ValNumber, ValJSON, Ref)

    There is a capx demoing this functionality in github. A screen shot of the real-time database demo is at

    github.com/tomlarkworthy/construct2_firebase_plugin/blob/master/demo/firebase_ui.png

    MISSING FUNCTIONALITY from Firebase API:

    error callbacks

    transactions

    authentication

    filter queries

    list order priorities

    I probably won't implement all the missing parts, but I am quite keen to get my mits on authentication and transactions at some point (not massively urgent though)

  • I hope you can get it up and running.

    As is its crashing C2 on preview.

    I wouldn't think that was possible.

  • works on mine. Any clues in the javascript console? (CTRL + J)

    EDIT: just tested preview on Firefox, Chrome on Linux over network and fine. Does it boot the preview and die on the webpage or does C2 refuse to preview it (the later being a plugin install problem)? ***

    *** wait whats the directory the plugin is installed as??? on my machine its "firebase" but that might have got screwed when you cloned from github...

  • <img src="https://dl.dropboxusercontent.com/u/666516/fbcfb150.png" border="0" />

    Abort Crashes C2, retry, and ignore launches the browser.

  • Oh ok. I think thats because I said the plugin depends on "https://cdn.firebase.com/v0/firebase.js", a remote file, which I did so it would insert

    <script src="https://cdn.firebase.com/v0/firebase.js"></script>

    in the HTML. I think it expects that file to be in the plugin directory though locally.

    I don't have a debug version of C2 so it does not pop that up for me. Ignore it until I find another method for altering the HTML? Does it work in the browser afterwards?

  • Yeah, looks like it runs fine.

    Well if its a call to an external file, then it probably shouldn't be run in preview mode.

  • Great!

    Firebase needs to be an external API so you can get around the same origin policy and actually do database like things. There does not seem to be way of adding remote JS libraries in a nice way but I will ask elsewhere.

    I appreciate you giving it a spin and your debugging help a lot.

  • Hazzah!

    hopefully I have got rid of that error, and now it exports ok and also minifies ok.

    was a lot more involved than I bargained for. Oh and authentication is working with facebook or email/password

  • download plugin

    run LIVE multi-user demo

    Maybe its hard for non-git users to get to the plugin, so now the plugin is also distributed as a zip. I have also put up the exported demo application too. Try using it with multiple browsers at the same time, they all update at once! Magic!

    For those with a curious mind, I am using TravisCI to automatically zip up the source files on a git commit, and write the plugin and demo to the github page branch (gh-page). So you can be sure the plugin link is always the latest release, and any contributions made will be distributed promptly (its fully automatic)

  • hey there im really interested in using your plugin, ive done a little work with it and even gotten a demo of my own started (and working!), but suddenly I'm getting an error from your plugin. Maybe you can help?

    screenshot of the error:http://i.imgur.com/LGRxpNo.png

  • Glad you had it working for a while!

    Looks like you are trying to get a value before a callback has fired.

    You can't use the expressions ValJSON, ValString etc. until inside a "Firebase callback" or "Firebase once callback"

    If that doesn't help send me your capx to tom dot larkworthy at gmail dot com.

  • Oops! Thanks for your help :D

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