Could you give me some more information on how you are specifically logging in so I may help you troubleshoot this issue?
My game or sdk is Unreal engine.
here is the setup
Player clicks on a widget button and i call the GS AuthenticationRequest
this is pretty much copied straight from your authentication example in the docs.
Rather than just printing the players name i save the players name into a variable called User name which i then pass into the event Show Main Menu. if the authentication fails i simply show an error message back to the player so they can try again .
Everything works as expected so far and i get a new player registered and authenticated/logged in.
Then i show the create character panel.
nothing fancy player can just choose a character and then type his name and then click create.
Now when the player clicks the create character button i call the saveCharactersEvent
so first what happens is there is a switch on enumeration type that matches the character chosen by the player . For testing im only allowing the player to choose one character so it only has one branch output . (Speeda Gen)
next i am creating a basic structure to hold all the character data that will then be attached to an attribute and sent with the request.
this contains the characters name , current exp, and an id so that when i come to load the player mesh i know which character to spawn.
so from the struct data i am setting the GS data variables and then passing them into the Attribute (Characters)
finally i am then calling the GS LogEventRequest to pass the data from unreal into the attribute and call the cloud code event in order to save the data to the database.
and as you can see the result is as expected
i have one character saved in the database called test character.
now here is the bug part. ( i have tested this on a single computer, and on two completely separate computers on completely separate networks)
so now i package my game and open up the game twice. and log in on 2 different registered accounts as if i am testing a real live game scenario of two players logging into my game and making accounts.
The registration part works as expected . so i have created 2 new player accounts called AccountOne and AccountTwo
and it is registered fine in the database.
. now the problem is . when both players now create a character as before
and i call the request to save the data to the database i get unexpected/wrong behaviour
this screenshot is Player/Client 1 - AccountName/PlayerName =AccountOne
but as you can see it has saved the data as if i am logged in/authenticated as Player/Client 2 - AccountName/PlayerName =AccountTwo. which was the second player to log in.
so basically the unexpected behaviour is that the data is always being saved under the last player to log in.
so for example if i logged in as 3 players eg playerOne, PlayerTwo , PlayerThree. All of the data for all 3 players would have the id of playerThree and all the data would be saved under playerThree object etc in the database.
where as this is the behaviour i would expect
so here you can clearly see that there are two seperate player accounts , with seperate entries in the database and each has the correct unique id and character name.
thanks hope this makes sense .
I just copied your game's config and can confirm there's nothing wrong with your setup. It seems like your client setup has an inconsistency somewhere. To help us find out what it is, I need the following:
-Where does the login information come from? Do you players log in using password/username combo or some cached data somewhere?
-Do you do any caching of player data?
-Is there multiple authentication?
-Are there any hard set values that you forgot in Unreal?
Does checking the 'Clear cached authentication' bool in the GS connect node help?
Yeah I figured it had to
Be something wrong in unreal because I spent a day in the test harness debugging and trying different things but never had any problem with the code . That's why I made a brand blank new project to try and test things .
I'll post the setup I'm using for testing when I get home but it's very basic which is why I can't understand where this bug is coming from .
I have set up two test button inputs to simulate the user clicking login to start the authentification process .
I press 1 on the keyboard it calls the authentificarion node and for now I have hard coded the name and password to match what was used on the registration just in case it was incorrect values being set somewhere .
So it logs in correctly then I set print strings to print out the username and user ID from the response . As expected it is player1 and player 1 user ID
The second button input does exactly the same . I press 2 on the keyboard and it logs me in using player 2 username and password again hardcoded . Again I check with print strings and the name and ID is correct .
So I start the game twice . So I have client 1 and client 2.
On client 1 I press the 1 key and am logged in as player1
On client 2 I press the 2 key and I am logged in as player 2 .
Now I call the add_character script from client 1 and pass it a character name "client one"
In the database I get one entry which is client 2 ID and name but the playercharacter section has the character "client one" (wrong)
I now call the add_character from client 2 and pass in the character name "client two"
I now still have only one entry in the database but two characters "character one, and character two"
Both with client 2 ID and name .
I haven't tried changing the Boolean "clear cached" as I was unsure what it did and couldn't find it in the documentation . I will try it tonight and see if it makes any difference .
Understandable. If you upload the .uasset file where your logic is I will be able to debug for you.
i have attached just the playercontroller.uasset file. which is where the test is setup.
i have also uploaded the whole test project to dropbox in case you needed it all.
as i though it would the bug persists.
as you can see i authenticated twice with 2 different players , with 2 different IDs
but both the requests to ADD_CHARACTER came from the same ID which was the last player to authenticate.
setting the "clear cached" Boolean did nothing to change the behavior.
as you can see both player1 and player 2 characters have been saved into one log entry under player 2's character array.
Another strange part of the behaviour is this .
all of the prints strings that come out of the "OnResponce" execution from the GS NODES, always print out as client2/ Player 2 for both characters.
yet if i put the printstrings anywhere else they print out correctly so the hello would read as client1 : hello where as my name is : would read as client 2:testing1
thanks for your time