Click here to see your recently viewed pages and most viewed pages.
Hide
Google Play Game Services

Getting Started for Web-based Game Development

Welcome to web game development with the Play Game services!

The Play Game services SDK provides cross-platform Game services that lets you easily integrate popular gaming features such as achievements, leaderboards, and Cloud Save in your web-based games.

This guide describes how to enable Game services for your web-based games.

Introduction

The REST API for Play Game services allows you to issue REST calls to set and retrieve game services data from your web game. You can also use the Management API to make REST calls to reset the game services data and perform other administrative functions.

Finding sample code

Links to sample code are available on the Downloads page. You will need to set up your own versions of these games in the Google Play Developer Console before they can work properly.

Communicating with Game services

There are two ways you can communicate with Game services.

In a client-only setup, your game only communicates with Game services through the browser using JavaScript. This is the technique you typically will use if you are creating a simple Flash or HTML5 game that doesn't rely on a backend server for any game logic.

To enable Game services in a client-only setup, follow the Client-Only Setup instructions.

In a client-server situation, your game typically communicates with Game services from your server using a server-side language such as Java, Ruby, or PHP, although you can still communicate client-side if you wish. This is the technique you typically will use if you are creating a game that uses a backend server for much of your game logic, such as an MMO or a simulation game.

To enable Game services in a client-server setup, follow the Client-Server Setup instructions.

Common REST calls

Ready to make a game? Here are some of the more common calls you might need to make.

Player

  • Want to know more about the current user? Try making a call to Players.get with 'me' as the ID.

Achievements

Make sure you review the Achievements guide, which explains achievements in more detail.

Leaderboards

Make sure you review the Leaderboards guide, which explains leaderboards in more detail.

  • Want to get a list of all scoreboards in the game? Make a call to Leaderboards.list.
  • Is the player done with a game? You can submit their score to Scores.submit and find out if this is a new high score.
  • Want to display a leaderboard? Get the data from Scores.list and show it to the user.
  • Use Scores.listWindow to find an assortment of scores close to the user's high score.
  • To get more information about the player's score in a particular leaderboard (for example, if the player is in the top 12% of all players), call Scores.get.
  • Are you debugging a game? Try calling Scores.reset from the Management APIs to reset all scores for that player from a particular leaderboard