How to Easy Save and Load Game in Firebase for Free - No Plugins

9

Attached Files

The following files have been attached to this tutorial:

.c3p

savegamefirebase.c3p

Download now 116.6 KB

Stats

3,236 visits, 4,509 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 8 Sep, 2020. Last updated 16 Sep, 2020

Hello All

If you want to save and load your app or game for free no plugins , in Firebase just do it :

All My tutorials here

construct.net/en/tutorials/construct-tutorials-2525

1): Create an account in firebase console.firebase.google.com

2): Add a project , give it a name

3): When Finished up go to : realtime database

4): Create a database in Test Mode

5): click on + and create a table with the name : coins , value =0

6): Now change the url from my example to your new url

on Start of Layout on missing the id on Localstorage , the Idtoogle is set to 0 , and the first time you save the game Firebase will creates a unique id on first data entry , and the ajax make a request to get the id and save on localstorage , it creates only once , and construct set toogle id to 1 , and next time when save or load , the ajax will send data with ID included ignoring the idtoogle= 0, check on line 5,6,7,8

On clicked clear localstorage it will clear yor id from localstorage , but still continue on firebase

but you will clear the localstorage only for testing purposes

I already gave an working example for test mode

What is Firebase ?

medium.com/firebase-developers/what-is-firebase-the-complete-story-abridged-bcc730c5f2c0

.C3P

savegamefirebase.c3p

Download now 116.6 KB
  • 8 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • Nice, thanks! How can I delete the key ID for real (including its value)

    Br,

  • Hello, where is URL should i replace? i don't know how to use it. Please help me

  • Hi Rafael, hope you are doing fine, thanks for this AMAZING tutorial. Thank you!

    I am wandering how to upload many variables and keep them in organized in firebase, so far I copied your script as many times as variables need to be stored. They seem to work ok,

    But I am wandering, Is this the way to do it? or should they all be uploaded on the same action? If so, how would this work? Could you give me an example of 2 simultanious variables?

    Sorry the newbie question, hopefully I can explain the situation :P

  • Very very nice!

  • Where is the username getting created? Is that from firebase?

    • on Start of Layout on missing the id on Localstorage , the Idtoogle is set to 0 , and the first time you save the game , Firebase creates a unique id on first data entry , and the ajax make a request to get the id and save on localstorage , it creates only once , and construct set toogle id to 1 , and next time when save or load , the ajax will send data with ID included , check on line 5,6,7,8

      justifun

  • Load more comments (2 replies)