Get number of players

0 votes
Hi All

I want to show number of current active players in UI. I guess I will use getOnlineUsers() api right? And lets say there are 10.000 current active player. How many api call it cost in this scenario? Also I have different game types like easy medium and hard. I also want to show number of players currently playing all these game types seperately. How I can do it?

Thanks
asked May 17, 2016 in Unity by gokhan (20 points)

1 Answer

0 votes
Hi Gokhan,

Calling getOnlineUsers() api results in 1 request + 1 callback. So it will be 2 api call. There are two ways to achieve your second requirement which is getting the user info of all active users.

When user connects to the server, you can set the user info as custom data using setCustomUserData API. Now when a user fetches the list of active users then youo have to call getLiveUserInfo for each and every users.

Another way is to store the user info in App42 Coud API storage service and when you have the list of active users, you can fetch the user info from App42 Storage.

Please let me know if you have any queries.

Thanks.
answered May 18, 2016 by rajeev.etc (1,660 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...