About

I updated my fork of the Game Center Cordova plugin to support the new Game Center Access Point. This is an addition to my last Game Center entry.

Access Point: Game Center Feedback while playing

The Access Point is a simple way to quickly allow to show the player’s achievements or leaderboard positions. As a developer it frees us from query the data from Apple’s Game Center server and simplifies the whole process a lot. It can be positioned in all four corners and be switched on and off as needed. It is possible to display a short highlight message when the point appears.

Here is how it looks on my test device:

Game Center Action Point in action
Game Center Action Point in action

I’m Nr. 1 but hopefully this will change once the game is released.

Implement it

As a start one can use my fork of the Cordova Game Center plugin. It should be easy to add missing features or fix potential bugs. Don’t expect support from me (MIT license).

Install

cordova plugin add https://github.com/CSchnackenberg/cordova-plugin-game-center.git

Check if Access Point is available

In the game code one can query for support of the access point like this:

window.gamecenter.isAccessPointAvailable(
  (available) => {        
  },
  (err) => {
  }
);

If you have a look at the Objective-C code you’ll see it mainly checks if the App is running on iOS14+. Nothing more.

Show the Access Point

Given the case that gamecenter.checkAuth(status => {status.isAuth == true}) returns true one can simply call: modifyAccessPoint().

window.gamecenter.modifyAccessPoint(
  () => {},    // success
  (err) => {}, // failed
  {
    location: "TOP_LEFT",
    showHighlights: true,
    active: true,
  },
);

This will enable the Access Point and show it on the top left on the screen. With showHighlights: true it’ll also display the some recent highlight event.

Hide the Access Point

Once activated the UI element will stay on top of Cordova until we say otherwise. It is therefore a good idea to hide on certain screens. To do so one calls modifyAccessPoint() again like this:

window.gamecenter.modifyAccessPoint(
  () => {},    // success
  (err) => {}, // failed
  {
    active: false,
  },
);

Not complete

While I write this I pushed my source code simply to be able to integrate it into my game. It supports the main options but no feedback information. Also the callback of success is pretty thin in meaning. It does not automatically mean the all properties have been changed as desired.

I suggest to test it on the device a lot before deploying anything to the store.