Hi, I need to use a database in my game. Someone told me that I could use playfab . but his getting started defold tutorial doesnt explain to much.
Anyone knows another easier options, or know a step by step tutorial of this? thank you.
Hi, I need to use a database in my game. Someone told me that I could use playfab . but his getting started defold tutorial doesnt explain to much.
Anyone knows another easier options, or know a step by step tutorial of this? thank you.
How far have you gotten so far? Have you set up an account with Playfab? Have you added Playfab as a project dependency? Have you tried the dependency in any way to confirm that it is functional?
I added Playfab as a project dependency, but now I dont understand How to connect my game to playfab. and how to store data or login
edit:
I can connect to playfab using my game id. But now I dont know what can I do, or how to store data.
Have you read the PlayFab documentation? Hereās the documentation on their data storage solution:
https://api.playfab.com/documentation/Data
And hereās the matching Lua API that you will be using:
I read the documentation, but It is not enough for me, too confusing.
Im using this script of their getting started documentation, but its different than yours, what I need to use?
> local PlayFabClientApi = require("PlayFab.PlayFabClientApi")
> local IPlayFabHttps = require("PlayFab.IPlayFabHttps")
> local PlayFabHttps_Defold = require("PlayFab.PlayFabHttps_Defold")
> IPlayFabHttps.SetHttp(PlayFabHttps_Defold) -- Assign the Defold-specific IHttps wrapper
>
> PlayFabClientApi.settings.titleId = "BE9A" -- Please change this value to your own titleId from PlayFab Game Manager
>
> function init(self)
> local loginRequest = {
> -- https://api.playfab.com/documentation/Client/method/LoginWithCustomID
> TitleId = PlayFabClientApi.settings.titleId,
> CustomId = "GettingStartedGuide",
> CreateAccount = true
> }
> PlayFabClientApi.LoginWithCustomID(loginRequest, OnLoginSuccess, OnLoginFailed)
> end
>
> function OnLoginSuccess(result)
> print("works")
>
> function OnLoginFailed(error)
> print(error)
> end
With this script, sometimes connect to my game, sometimes not. I dont know what to doā¦
Its very confusing, and note well explained. I found this for read data. And its different that your documentationā¦
https://api.playfab.com/documentation/Client/method/GetTitleData
Hello,
Iām using Defold and Playfab, itās very useful.
As you said, you can use Playfab Client API in your Defold application.
Did the login request succeed?
If it succeeded, you can check the login event at your Playfab developer dashboard.
I checked below sample code after login success:
function get_title_data()
local request = {
Keys = { "title_key" }
}
PlayFabClientApi.GetTitleData(request,
function(result)
pprint(result)
end,
function(error)
pprint(error)
end)
end
You can see how to set your title data in here.
I might be misunderstanding your problem, please feel free to ask me
Hello. Im very confused with the entity/classic apiā¦ If I want to use the entity api, how can I login and how to store data or read data?.
I was all night trying to get it work I put this
local IPlayFabHttps = require("PlayFab.IPlayFabHttps")
local playfav=require("PlayFab.PlayFabAuthenticationApi")
local PlayFabHttps_Defold = require("PlayFab.PlayFabHttps_Defold")
IPlayFabHttps.SetHttp(PlayFabHttps_Defold)
function init(self)
playfav.GetEntityToken(nil, onSuccess, onError)
end
got This API method does not allow anonymous callers, when using GetEntityToken error
then I tried with classic api
local PlayFabClientApi = require("PlayFab.PlayFabClientApi")
local IPlayFabHttps = require("PlayFab.IPlayFabHttps")
local PlayFabHttps_Defold = require("PlayFab.PlayFabHttps_Defold")
IPlayFabHttps.SetHttp(PlayFabHttps_Defold) -- Assign the Defold-specific IHttps wrapper
PlayFabClientApi.settings.titleId = "BE9A" -- Please change this value to your own titleId from PlayFab Game Manager
function init(self)
local loginRequest = {
-- https://api.playfab.com/documentation/Client/method/LoginWithCustomID
TitleId = PlayFabClientApi.settings.titleId,
CustomId = "GettingStartedGuide",
CreateAccount = true
}
PlayFabClientApi.LoginWithCustomID(loginRequest, OnLoginSuccess, OnLoginFailed)
end
function OnLoginSuccess(result)
print("works")
end
function OnLoginFailed(error)
print("no")
end
Now I got HTTP request to āhttps://BE9A.playfabapi.com/Client/LoginWithCustomID?sdk=DefoldSdk_0.50.190205ā failed (http result: -1 socket result: -5)
Its very frustrating
Sorry, I have never use entity API
However, I tried to create test account with your titleId a while ago, then LoginWithCustomID was success.
(If you donāt need it, please delete the account )
Could you print the error object like this?:
function OnLoginFailed(error)
pprint(error)
end
First, than you for help me, seems nobody uses databases or playfabā¦
DEBUG:SCRIPT:
{ --[[0000000022978F90]]
error = āServiceUnavailableā,
errorCode = 1123,
code = 0,
status = 0,
errorMessage = "Could not deserialize reseponse from server: "
}
Thanks for error message.
I think the reason might be your environment such as OS or PC setting.
https://community.playfab.com/questions/24064/trouble-making-calls-to-playfab-server.html
Iām using MacOS, so it works wellā¦
Too much problemsā¦
I can log, calling the LoginWithCustomID() every time it returns errorā¦
nowā¦ How can I store data? I trying to use
PlayFabClientApi.UpdateUserData({Data={test=1,test2=āhelloā}}, onSuccess, onError)
But it calls onError
DEBUG:SCRIPT: noo
DEBUG:SCRIPT:
{ --[[0000000037DA6A70]]
status = āOKā,
code = 200,
data = { --[[0000000037DA6C50]]
DataVersion = 5
}
}