Sign In Register

How can we help you today?

Start a new topic
Answered

Allow players to search for "Friend Codes" as seen in so many other games?

Hey all!


I just wanted to know what is the best way to go about generating a "Friend Code" for new players, and being able to search for other players by inputting their "Friend Code".


I'm assuming upon device authentication or facebook/google login you just save a random id as a player's friend code but I'm unsure about how to search through a list of OTHER players' friend codes.


Thanks!

-Sean


Best Answer

Hi Sean,


Yes that would be one way of doing it. For searching for other players friends a simple way to achieve this would be to have a Runtime Collection with a document for each player then in that player document an array of each of that players friends (Friend Code) which would need to be updated when a player adds or removes a new friend.


If you're planning on social integration there are other ways such as ListGameFriends which is explained here https://docs.gamesparks.com/api-documentation/request-api/player/listgamefriendsrequest.html and of course we have Teams which may suit your needs which is explained here https://docs.gamesparks.com/documentation/configurator/teams.html


Hope this helps,

 - Steve

1 Comment

Answer

Hi Sean,


Yes that would be one way of doing it. For searching for other players friends a simple way to achieve this would be to have a Runtime Collection with a document for each player then in that player document an array of each of that players friends (Friend Code) which would need to be updated when a player adds or removes a new friend.


If you're planning on social integration there are other ways such as ListGameFriends which is explained here https://docs.gamesparks.com/api-documentation/request-api/player/listgamefriendsrequest.html and of course we have Teams which may suit your needs which is explained here https://docs.gamesparks.com/documentation/configurator/teams.html


Hope this helps,

 - Steve

Login to post a comment