Problem with PlayFab (SOLVED)

Is it? Nah, I’m fairly certain that I got PlayFab working on desktop when PlayFab support was first added.

In bundle or in editor?
I don’t try desktop bundle.

Thanks, both of you.

I already took a look at britzls example, but, he’s always using the ludobits stuff I dont understand o.O
In the Code the trigger and flow is used but I dont really understand that in depth.

The main Problem at playfab is, I call a PF function, lets say Login, if result is positive, next I call another PF function. With an error: Not logged in. Are These functions threaded? It seems like the Login is called and the lua-script (f.e. init()) is continuing without waiting for the end of the prevous function.

Nearly the same if I “stack” them like if Login = success then getLeaderboard. This also runs into an error.

Sure, I could call a PF function and in (f.e.) update() I could “wait” for the result-value and then call the next PF function. Is that the right way? I
Is that whats FLOW and/or TRIGGER are for @britzl?

All PlayFab calls are asynchronous, meaning that they do nit block execution while waiting for a response. The response is received as a callback. If you need to chain multiple PF calls it typically becomes a nested chain of calls and callbacks.

Now, Lua has something called coroutines which allows for collaborative multi tasking. You can start a coroutine, make a PF call, pause the coroutine, resume when you receive a response and through this get nice sequential looking code.

Ah ok.

I quess I have to take a Close look to the ludobits … flow and trigger things.

But, isnt this the way of coroutines (taken this from your pf-example):

local result,error = PlayFabClientApi.LoginWithCustomID(PfRequest, Pf_GetStats, PfError)

@britzl
hmm, seems not only Playfab has problem with connect to server in dmengine (windows 10, 1.2.114):

look, GA, defold stats too:

I don’t known, may be dmengine blocked by Windows Firewall, but I accept it always when update Defold.

in my case its not blocked imho. Its working (most times). Sometimes there is a Kind of timeout.

But my main Problem is -like britzl correctly said- the asychronous handling. I have to Change the “handling” for the external calls of the Playfab functions.

By the way @Dragosha. I mostly have the Problem with hamster that my Name isnt accepted. In different cases. Sometimes I Change my Name, ist written down below, after playing I was saved as “noname”. Sometimes I Change my Name after clicking ok ist back to “noname” etc.
…just by the way :wink: Love your Card-game anyway :slight_smile:

Tried to build https://github.com/britzl/playfabexamples on Windows 10 PC and got the same error in console when dmengine is running.

@britzl any ideas why is it happening?

I tried building and running on OSX and it works. What if you take that URL and paste it into a browser? Can you reach it?

in browser that URL takes HTTP ERROR 404

But all works fine if we do html5 build.

Ok, so the server is reachable. The 404 is probably caused by the browser doing a GET while that url expects a POST.

And it works when doing an HTML5 build? Strange…

yep, in hamster the same problem. Works in browser but not works in dmengine (windows bundle too).

These Error I’ll get very often, thats why I implemented the “RETRY” Button (instead of PLAY) in my game. Sometimes it works, sometimes not. after 1 or 2 more tries it works. Its like a timeout.

There are definitely problems with playfab and defold.

Very often there is no login possible. Sometimes after login and updating highscores the connection is also lost.

debug output while trying to login:

DEBUG:SCRIPT: PF loginname = 688194289677-1506715084
INFO:DLIB: SSDP: Started on address 192.168.178.20
ERROR:SCRIPT: HTTP request to 'https://XXXX.playfabapi.com//Client/LoginWithCustomID' failed (http result: -1  socket result: -5)
DEBUG:SCRIPT: MENU: LMB
DEBUG:SCRIPT: PF loginname = 637434176366-1506715087
ERROR:SCRIPT: HTTP request to 'https://XXXX.playfabapi.com//Client/LoginWithCustomID' failed (http result: -1  socket result: -5)
DEBUG:SCRIPT: MENU: LMB
DEBUG:SCRIPT: MENU: LMB
DEBUG:SCRIPT: PF loginname = 628745872218-1506715090
ERROR:SCRIPT: HTTP request to 'https://XXXX.playfabapi.com//Client/LoginWithCustomID' failed (http result: -1  socket result: -5)
DEBUG:SCRIPT: MENU: LMB
DEBUG:SCRIPT: PF loginname = 695232198612-1506715093
ERROR:SCRIPT: HTTP request to 'https://XXXX.playfabapi.com//Client/LoginWithCustomID' failed (http result: -1  socket result: -5)
DEBUG:SCRIPT: MENU: LMB
DEBUG:SCRIPT: PF loginname = 643152389569-1506715099
ERROR:SCRIPT: HTTP request to 'https://XXXX.playfabapi.com//Client/LoginWithCustomID' failed (http result: -1  socket result: -5)
DEBUG:SCRIPT: MENU: LMB
DEBUG:SCRIPT: PF loginname = 673495369544-1506715108
ERROR:SCRIPT: HTTP request to 'https://XXXX.playfabapi.com//Client/LoginWithCustomID' failed (http result: -1  socket result: -5)
DEBUG:SCRIPT: MENU: LMB
DEBUG:SCRIPT: PF loginname = 675329747257-1506715119
ERROR:SCRIPT: HTTP request to 'https://XXXX.playfabapi.com//Client/LoginWithCustomID' failed (http result: -1  socket result: -5)
DEBUG:SCRIPT: MENU: LMB
DEBUG:SCRIPT: PF loginname = 668838742725-1506715121
ERROR:SCRIPT: HTTP request to 'https://XXXX.playfabapi.com//Client/LoginWithCustomID' failed (http result: -1  socket result: -5)
DEBUG:SCRIPT: MENU: LMB
DEBUG:SCRIPT: PF loginname = 739346275192-1506715123
ERROR:SCRIPT: HTTP request to 'https://XXXX.playfabapi.com//Client/LoginWithCustomID' failed (http result: -1  socket result: -5)

-5 is CONNRESET (connection reset). This can happen for several reasons:

  • the peer deliberately reset the connection
  • the peer closed the connection while he still had unread data pending
  • you had sent data to a connection that had already been closed by the peer
  • you had pending write data and the TCP retries have timed out
  • TCP keepalive detected a lost connection.

So the question is if this is something that happens only for you on a single network or if it is a general problem. I’ve tried my PlatFab example project and haven’t seen any issues with Defold and the PlayFab SDK.

Hm…

Wondering.

Thats the custom-login who has called:

local function Pf_CustomLogin(id)
	if not id then
    math.randomseed(os.clock() + os.time() + math.random(1000))
    local temp = ""
    for c=1, 12 do
      temp = temp .. math.random(9)
    end
    temp = temp .. "-"..  tostring(os.time())
		id = temp
	end
  pprint("PF loginname = " .. id)
	local PfRequest = {
        TitleId = PlayFabClientApi.settings.titleId,
        CustomId = id,
        CreateAccount = true
    }
    -- Call API
    PlayFabClientApi.LoginWithCustomID(PfRequest, Pf_LoginSuccess, Pf_FailureLogin)
end

If I try the game online (HTML5) it seems to work fine.

In editor or win-bundle (local) there are connection problems. Strange. There is no firewall etc at all (deactivated). Other games and services dont have any problems.

I have the same problem in normal build as well.

yep.

Have you guys reached out to PlayFab and asked on their support forums? -5 indicates RESULT_CONNRESET. I wonder if you perhaps could debug this using an https proxy and wireshark or something like that?

1 Like