Rok
Rok

Reputation: 2578

Integrating Google Turn-Based Multiplayer with Google App Engine

My existing Android (Java) game pits the player against up to eight AI opponents. I've now decided to implement an asynchronous online turn-based multiplayer mode. As I currently support leaderboards and achievements through Google Play Game Services I was hoping to use their turn-based multiplayer API but this has proved far from ideal due to the following restrictions within that API -

My game is of the type where you might play a turn and then close the game down until a notification comes in to say that it's your turn again. Also, for an eight player game it's unlikely that all eight instances are going to remain running throughout the duration of an entire game. It's also likely that a player will want to participate in a number of different games at once. (Although the game is nothing like Draw Something, their multiplayer model is similar to the type that I need).

Having dismissed the possibility of using the turn-based API, I've been looking into other possibilities and have come across App Engine. Unfortunately 99% of my developer experience is with client-side coding so some of these questions may seem naive...

  1. Is it possible to integrate Google Play Game Services with Google App Engine? I would ideally like to keep everything tied to each players' Google account seeing as I'm already using Google Play Game Services for achievements and leaderboards.

  2. Is App Engine suitable for allowing multiple instances of asynchronous turn-based games?

  3. Will I be able to use parts of the multiplayer API such as the lobby system or will it all need to be written from scratch?

  4. How much of a learning curve will be involved with setting up the backend system? What resources will I need?

Any advice on the above will be very gratefully received.

Upvotes: 2

Views: 941

Answers (2)

Michael A.
Michael A.

Reputation: 4193

As the earlier answer noted, there is a different between real-time and turn-based APIs - the turn-based APIs DO allow you to play asynchronously, and - as far as I know - you can also have multiple games running without any problems.

https://developers.google.com/games/services/android/turnbasedMultiplayer

The system doesn't work for turn-based games with simultaneous moves, but based on your description, I would think it would work fine for your purposes.

Regarding your questions, I've spent some time looking at solutions for multiplayer turn-based game myself and these are my observations:

  1. Everything is possible. But if your question is - does Google Play Services support integration, then the answer is no.

  2. It's as suitable as most other framework that you might would use to implement a web service. Though it does depend on how much processing you need on the server side; note that there are some limits on how long requests can run, etc.

  3. You'll need to roll your own.

  4. If you're a Java programmer, you should look at working with a Java-based framework for the backend; Google App engine support this OK. You could also consider setting up your own virtual server somewhere else as - at least right now - there is not much benefit to using Google App engine for stuff like this (at least IMO). Two key elements you need to be clear on: how is your game state saved server-side, and how is the user authenticated. The latter, in particular, is important.

If your game structure fits within the Google Play services turn based framework, I would certainly think twice before going for an own solution - at least at the moment.

Upvotes: 2

user2252106
user2252106

Reputation: 91

The game api provides either realtime or turn based multiplayer games. In a realtime game, all the playa must remain connected, true. But for a turn based game, they can exit, turn of their phone, even pay each turn from a different device. It sounds exactly like what you want. Had you confused the realtime documentation with the turn based?

Upvotes: 1

Related Questions