Inquiry of service capabilities and suggestions on the best way to implementation
-
Hi,
We are looking for some advice/insight on if the service provides the following out of the box, and some suggestion on how to implement it
- Allow one player to login into multiple devices
- Allow each device to record active usage time
- Granularity of 1 minute is acceptable
- The total of active usage time of all devices is attributed to the player
- Currency or player Level increases based on total record active usage time
- Leaderboards
- by total active time of player
- Aggregated total active time of multiple players as friends/guild/clan
Additionally, at what level of subscription plan would these features be available?
-
Hi - apologies for the slow reply?
-
Allow one player to log into multiple devices.
This is supported. There's a setting under Design | Core App Info | Advanced Settings to set the Maximum Concurrent Sessions Per Player. It defaults to 1, but you can set it to a higher number. -
Allow each device to record active usage time. Granularity of 1 minute is acceptable.
brainCloud doesn't do this automatically for you - but you could certainly record this data yourself in a user entity. You'd probably want to use your "anonyousId" as the id for the device when recording the time. -
Total of active usage time of all devices is attributed to the player.
I'd user a userStatistic for that. Just increment the count at the same time that you're updating the userEntity for a specific device's time. Probably use a cloud code script to better ensure that they are both updated at the same time. -
Currency or player level increases based on total record active usage time.
Once again, use that same cloud code script to increment currency and/or xp level.
5a. Leaderboards - by total active time of the player
Use a cumulative leaderboard to track this. That same cloud code script to increment the player's leaderboard entry.5b. Leaderboards - aggregated total active time of multiple players as friends/guild/clan
brainCloud supports groups and group leaderboards, which could be used for this.All of this is possible with our Lite subscription and above.
Hope that helps!
Paul.
-
-
Hi Paul,
Thanks for help answering these questions, it sounds like the system would be able to record the necessary data, we have follow up questions regarding
- How do you suggest we secure the increment of active usage time if clients is sending this information?
- What service.mechnics should we use to notify all connected devices of a player with the increase of total points the player has, as well as level increase?
- How can we detect device disconnects? Do we need to implement polling, or that's automatically done?
-
Good questions.
- How do you suggest we secure the increment of active usage time if clients is sending this information?
Have the session stored in the server keep track of the time. The bridge.SetSessionCacheObject call allows you to set variables that are stored in the session - https://getbraincloud.com/apidocs/apiref/#cc-bridge-getsessioncacheobject
Maybe have a variable called "trackingTimeFromMillis" that records when tracking starts.
You could then implement an UpdateUsageTime() call that examines trackingTimeFromMillis, updates the user's device accumulated time based on the difference between now and trackingTimeFromMillis, and then resets trackingTimeFromMillis.
You could then call this script every 2 minutes or something - whatever makes sense for your app. I'd also call a variant of the script if the user exists the app... (you could have the variant script log out of the session when called via InvalidateSession call - https://getbraincloud.com/apidocs/apiref/#cc-bridge-invalidatesession).
- What service mechanics should we use to notify all connected devices of a player with the increase of total points the player has, as well as level increases...
Hmm, I think I'll need to understand your use case better for this. Message us directly on our support channel with the details if you aren't comfortable posting it here.
- How can we detect device disconnects? Do we need to implement polling, or is that automatically done?
brainCloud does automatically send a heartbeat to the server (to keep the session alive while the app is active) - but we don't detect disconnects or trigger api calls or events when an app exists.
All device OSes have hooks for this sort of thing though - so i'd recommend you hook into the OS's callbacks for such things, and call the UpdateUsageTime() with a disconnect parameter set to true when the user exists the app.
Hope that helps!
Paul.
- How do you suggest we secure the increment of active usage time if clients is sending this information?
-
Hi Paul,
Thanks for your response,
What we are trying to do is to show the most current accumulated player's stats on all devices. So the user can see their stats increase on any of their device.
Which is why we want ability to broadcast/notify when total usage time or level has increased. -
What sort of devices? Will people really sit there logged into multiple devices, and expect them all to rise in realtime?
I mean, wouldn't a user play on one device. Finish, and maybe pick up another device - and when they do, you refresh all the stats when the app loads?
I would suggest you use RTT for real-time notifications - but we actually assume that that a user would only have one logged in RTT session - so that won't work.
You could send push notifications to all of the devices. Push notifications can have data payloads - so your client app(s) can catch the updated data, or maybe the notification is just a signal to the client to request updated data... (likely more flexible).
Alternatively, I guess your option best option would be to have the devices poll every <x> minutes or so...
Honestly, the use case still seems a bit weird though - I'm probably just not understanding something
Paul.