0
\$\begingroup\$

Can you create a viable two player turn-based networking implementation using only REST API for outbound and push for inbound data? If a game is comprised of, on average, 30 moves, is it a bad idea to just send 15 push notifications to each user? If hosting expense is less than income for each DAU, is this perfectly acceptable, or an abuse of what push is intended for? ...Why or why not?

\$\endgroup\$
  • \$\begingroup\$ Why would you do that instead of the many far more viable options? \$\endgroup\$ – Philipp May 20 '16 at 19:09
  • \$\begingroup\$ ...options, such as? ...which are more viable because...? \$\endgroup\$ – greenland May 20 '16 at 19:11
  • \$\begingroup\$ That depends on the technology stack you are using to implement your client and your server. \$\endgroup\$ – Philipp May 20 '16 at 19:22
  • 1
    \$\begingroup\$ I don't recommend this, Push (Especially APN) can be very unstable at times, never rely on push for important data. Push can be dropped arbitrarily in delivery and has rate limiting as well. Trust push like you trust UDP packets, they can come out of order, very late, or never even reach a player. \$\endgroup\$ – user5665 May 20 '16 at 20:21
  • \$\begingroup\$ @MattJensJensen that sounds like it would work well as an answer, if you'd like to help give some closure to this old question. :) \$\endgroup\$ – DMGregory Jul 4 '17 at 16:37
2
\$\begingroup\$

Push Notifications are not ideal for this purpose as push notifications may come at long unpredictable delays, may come out of order, or may not come at all. Push notifications also encounter rate limiting at volume. In my comment to your question I said "Trust push like you trust UDP packets" that's giving push far too much credit. In most cases you'll find that sending push notifications comes with more overhead than just talking to your game client via your API.

You should probably just poll your game API from the client when the user is currently in game. If a user has not made their move and it has been some time, that may be a good opportunity to send a push.

This answer is somewhat predicated on the assumption that by turn based, you mean a pace similar to games like Hearthstone. If your game involves turns that are likely to be slow paced like a play by email game then push may not be a bad option, but it won't be a reliable option in the same way that email is.

An additional note, Apple Push Notifications for iOS are typically much less reliable in practice than Google's new Firebase Cloud Messaging for Android (Google Cloud Messages, their previous service seemed to be about the same in my experience).

\$\endgroup\$
  • \$\begingroup\$ Thanks for the thoughtful advice. I should've mentioned that the pace of the game is closer to Words With Friends than it is to Hearthstone; with perhaps hours between turns, running multiple games concurrently. If the client app we're active, I'd just poll for a response as you describe; but it's mostly a waiting game. I was thinking it would push a notification if X time had passed, but then just an API call to update all game states upon resuming the app. \$\endgroup\$ – greenland Jul 7 '17 at 18:53
  • 1
    \$\begingroup\$ I would use push notifications for helpful reminders, maybe just keep nudging the user with push at reasonable intervals until they take their turn. The main thing I was getting at is just to never rely on push or use them to transmit critical game data. \$\endgroup\$ – user5665 Jul 8 '17 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.