Issues with loading data from Firebase Realtime Database

And I didn’t ignore anything you said for the record. the ToJson thing doesn’t work, I still get “0” back no matter what.

I didn’t only say “Use ToJSON”, I also said to be aware that the action is asynchronous:




If you are using an https:// and not an http:// url yes. You need a valid certificate to do SSL which is essential for https.

Countless people have done it multiple times before. All actions are thoroughly tested before release and the community feedback carefully examined after release to spot bugs. If something as obvious and much used as network action were not working, it would have been spotted way sooner. I see no way this can be an error with GDevelop.

The “Parse JSON from api” example is outdated and uses swapi.co which is dead and the old synchronous network action that is now not directly usable. Though it’ll work if you replace swapi.co with swapi.dev, it is not a good example anymore. The firebase example showcases fetching data from Cloud Firestore and works well.

That means the action does not execute when you call it, but runs in the background while the other actions continue running. They don’t wait to be completed to continue executing the rest. That is why you cannot set the text to the variable just after calling the action, as the action is actually still running in the background. You need to contiguously set the text of the text object every frame with a conditionless event.

Oh my god. I feel like such a moron! I am so sorry I didn’t get what you meant last time and I cannot believe it was such a simple thing such as taking out the at beginning of scene thing. You were 100% right now it works fine. I am really grateful for your help and if you need anything at all just ask and I owe you big time.

I have a diploma for graphic design if you need any logos made, or business cards or anything just ask and I will do it for you free of charge.

Thanks again!

1 Like

Hello,
is it possible to call a query ?
In the gd example it is necessary read all the value (not twitter example( and manage them into gd app. It isn’t the best performance solution.
I prefare write something similar: select 10 rows from table order by score decending.
So I’ll receive only the leadboard andnot all the player values.

Thanks a lot,
J

1 Like

While firebase allows that, the extension for GDevelop do not support that yet.

1 Like

Thanks. Do you think is it possible to use javascript to call these functions:https://firebase.google.com/docs/database/ios/lists-of-data#sorting_and_filtering_data
If it is possible, do you know a tutorial that can help me to understand how to do it? I don’t know how to call the firebase object into javascript ( I dont know js but I can learn)

Hey everybody after a month of messing around and learning about Cross Platform Requests and trying to get variables in Gdevelop for my leaderboard I finally think I came up with the answer. I need my own server so I can handle server request permission. I had a shared hosting plan which wasn’t enough and I just found this out from tech support on godaddy(great help these guys). I figured this out when I tried to install an Advanced Policy Firewall on my shared hosting server LOL and tried to demand the worker at godaddy gvie me the login for the Web Hosting Manager, which I didn’t have access to on a shared hosting account LOL again!

So for anyone doing CROSS PLATFORM REQUESTS with PHP and an SQL Database and those who really want Online High Scores inside their actual game and not in an html table you need to purchase a linux hosting plan with a virtual private network add-on in order to accomplish these goals. I will post again tomorrow with the results as I have to wait 24 hours for my server to propagate itself.

Thanks to all the people who gave input or tried to assist me and I love Gdevelop! It’s my favorite app for building android games and got me into it to begin with, just glad to be getting the most out of the app with online leaderboard scores!

1 Like

Cross Platform Requests require a VPN see my post below.

While firebase allows that, the extension for GDevelop do not support that yet.

That is a pity. I was hoping the sorting could be done automatically. Is there a plan to implement this function? I have with your help managed to use Firebase and it is perfect for creating the ranking system. That is in place now. But a sorted list of the top 10 would require a lot of code I guess in the engine.

I was planning on adding that after this change is integrated:

1 Like

The new update came out. I saw a lot had changed in the Firebase departement. Can you tell me if it is possible to select the data via a query now in Gdevelop?

Sadly not, I finished converting it to TypeScript, but I began adding queries.

I see. Eager anticipation here :D… Thanks for all the great programs. Really cool.

Ok, it is done, queries should come with next version. You can already check out the docs.

1 Like

WOW :astonished:
That is a game changer (pun intended). Thank you !!!

One edit in the text. not forst but first document (typo)

For example, if you want to get the data of the forst document as JSON, you can use this expression:

1 Like

That’s how I originally subtitled the Firebase integration announcement blog post but 4ian changed that because it made GDevelop sound not serious

Hi Arthuro. Great to see the update is here. How are you doing? I am trying to invoke your query reading through the doc you had me check out. It is not working yet. What am I doing wrong? I can not seem to figure out the difference between watch and execute precisely but I guess it has to do with the fact that if something changes within the document with a watch it will update immediately while execute is an one time only thing (which I need). This is my code:

The disabled code (list all documents in “ranking” and store in RankingList provided me with a list that was not sorted in ascending order on the field Rank. I changed it to:

-Create a query.
-Order query.
-Execute query.

After that I load the fields into the structure variable. The results is all zero’s. Could you help me on my way to see what it is I am doing wrong please?

Cheers,
Ray

There are 2 things I see that seem wrong here:

  1. Indeed, execute query only execute the query once, while the watch will update the callback variables whenever a document affected by the query is modified on the database, but here you have as only condition that the first query was not resolved, but until it finishes the query you are launching a new one every frame. I would add a trigger once there.
  2. The returned variables is not a list of document names, it already contains all the documents that matched the query.
1 Like

I’ve got it. Thanks for the clarification. It is fantastic that it is now so easy to order in descending order. Thank you a lot!

1 Like

I want to write a number field (this is needed in order to be able to query in desc or asc order. But I can only write a string. Is there anyway to make it write a field as a number instead of a string?