Issues with loading data from Firebase Realtime Database

I know for a fact I have the right code in GDevelop for the Firebase Configuration String(at least I think I do) because I can connect to a realtime database and send variables to the realtime database. So far I got it to list a new user with a new score everytime by using the score variable as the field name to update. Anyways I can PUT variables into the database but I cannot for the life of me GET back anything. I’m attaching two images. the first is the screen where I need to put my Database information in to get a field from the database. Is there some special way to do this? Am I missing something? Or is the firebase plugin in gdevelop just not working right?

In the red circle can you please explain the formatting of what I am suppossed to put in those boxes? Ans in the second image, is there anything wrong with what I am doing to see the variable? This is just a test. I just want to pull data back form the database and I have honest to god looked for hours and hours and hours on end. I’m getting so discouraged with this I’m close to purchasing a web server with mysql just so I can create a php style leaderboard but that isn’t what I want! I want a leaderboard inside my game so high scores are shared across the world and it should be easy with this plugin but it really isn’t and I cannot find any help for this topic on the internet. Even the firebase example project doesn’t have this kind of thing in it! I was even gonna settle for just putting SHARE on FACEBOOK and TWITTER buttons when you got a high score but even that is complicated as hell with facebook and only easy to do with other social network sites.

Maybe it’s something simple I am doing wrong? Anyways I’m not one of those lazy people that just wants answers for everything I actually have been working my ass off trying to find a solution but nothing is working so please can someone find it in their heart to help me succeed at this? I’m making a game called Rhythm Retro it’s a tapping music rhythm game and ONLINE high scores is a must!

I see two big issues here:

  1. You are not taking the asynchronous nature of the action in account
  2. You are loading a structure variable and expecting it to work as a string.

To fix 1., simply remember that the action doesn’t wait for the request to finish before continuing executing the rest of the actions, so the variable will probably still be “0” (a variable default value) when you are putting it into the text object. Instead, always set the text of the text object and not just at the beginning of the scene so once it changes it updates.

To fix 2., instead of trying to display a structure variable as text using VariableString, use ToJson to make a textual visualization of your variable.

I’m still just getting ZERO in the textbox. And I have the word TEST typed into the box already.

I tried: Change the text of postwork set to ToJSON(postwork)

Is there a special format for the PATH or FIELD boxes?

Still not sure what to do here.

Please see my last post I am still having trouble could you please explain it better to me?

Again, make sure to take into account that the firebase actions are asynchronous. If you want to get the whole database, the path you have entered is already correct.

how do I retrieve a specific variable from the database? what do I put in the boxes exactly? I’m still having trouble and not able to pull anything back.

This is all really new to me. I don’t understand what you mean by telling me it’s asynchronous. You mean it pulls in more than just one thing? Like an array? I already knew that. And in my PHP file I am echoing out one value. That error came up after I messed with the .htaccess file that isn’t the problem I got rid of that issue. I realize I don’t have an SSL certificate. I didn’t pay extra for it, because I didn’t think I needed it at this time. The only reason I paid for the server was so I could try to get an online leaderboard working in my game. And I have set up my files in gdevelop exactly like other people have online it shouldn’t be returning zero but it does even in the error variable. It won’t even show a value with a simple echo “hello world” in a php file.

Are you saying that without an SSL certificate it won’t work at all? I didn’t ignore anything you said about the firebase thing. I just never got it working. And I’m starting to think it has nothing to do with me doing anything wrong. Do you have a working example pulling in values into gdevelop from a database you can show me? Believe me when I say I have tried a thousand different combinations and things to get this to work, and I don’t believe it’s possible. Not like it’s suppossed to anyways. And if anyone thinks I was rude, I wasn’t meaning to be. I never capitalized anything to yell it I’ve just never used a forum before and didn’t realize it was rude.

As far as I can tell it’s in the Gdevelop programming that there is an issue because I cannot find any working examples of this on the internet.

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 which is dead and the old synchronous network action that is now not directly usable. Though it’ll work if you replace with, 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

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,

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:Trabalhar com listas de dados nas plataformas da Apple  |  Firebase Documentation
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.