Apple Game Center and Google Play Services support

#1

Hi,

I heard that Defold team is working on native extension for Google Play Services do we have an ETA when it will be available? Also is there a plan to build a native extension for Apple Game Center.

I am particularly interested - how comprehensive support of the native API SDK will be available? Are these native extensions will support not just Leaderboards, Achievements, and Challenges but also multi-player sessions (Turn based and Real-Time Matches)/peer to peer)

0 Likes

#2

Nope, no ETA, I’m afraid. The work hasn’t begun yet. I’ve currently looked into a Firebase extension and the next extension I’ll take a look at would be GPGS.

No, not at the moment. You could always implement it yourself if you really need it :slight_smile:

2 Likes

#3

I didn’t try it, but as I know @Dragosha use it in his game: https://github.com/vinhvd/defoldgamecenter

2 Likes

#4

Oh, yeah, forgot about that one!

2 Likes

#5

a bit improved fork of this lib:

now callback returns an alias and playerID

...
gamecenter.login(login_cb)
...

-- Login callback
local function login_cb(self, data)
	print("Game center logging:")
	if(data.error) then
		print("===>code :" .. data.error.code)
		print("===>message :" .. data.error.message)
	else
		if data.playerID then
			print("Game center initialized with:", data.alias, data.playerID)
            ...
		end
	end
end

also I tried to implement saveGame function, but Game Center required iCloud support for this, and I haven’t find good example how do that in pure object-C, all examples was for X-Code. So, I just connect player’s account in PlayFab cloud with his iOS PlayerID and make the save file there.

5 Likes

#6

My fork on GitHub is here:

Added: alias and playerID within login’s callback data.
Added: “Try-Catch” constructions in objective-C code to prevent hard crash on devices with turn off Game Center (tested on iPad Pro with iOS 12)

6 Likes

#7

I’m trying to gauge the status of Game Center and Google Play support;

Game Center: Authentication, leaderboards, achievements with the extension mentioned above. @animonger has also started an extension mentioned in this post. Has anyone used Game Center functionality in a live game?

Google Play: Authentication and cloud saves with this extension.

Is this right?

After a year or so making HTML5 Facebook Instant games it looks likely that I’ll start using Defold for iTunes and Google Play games soon. Native leaderboards and achievements are likely to be requirements. I can’t add this functionality to Google Play myself, but I could support someone who can with testing and possibly payment too if needed.

1 Like

#8

Actual extension repo is here: https://github.com/Dragosha/extension-gamecenter

1 Like

#9

Thanks, updated the link.

0 Likes

#10

You should submit this to the asset portal!

1 Like

#11

I’m looking to save progress to the cloud in an upcoming game. Google Play has support for it with this extension.

For iTunes, the two (lovely) existing extension don’t seem to support cloud saves:

https://dragosha.github.io/extension-gamecenter

Have I missed a way to save to the elusive Apple cloud?

0 Likes

#12

The code to save game data to iCloud exists in the extension I wrote. Scroll to line 171 here.

The Obj-C code I used in the extension is taken directly from the Apple docs but it doesn’t work. I posted to the Apple support forums and the only responses I got were from other iOS devs saying they had the same problem or I should try Swift. Apple has not responded to any of my inquiries. I tried for about a month all the workarounds I could think of or find on the internet and they all result in error 27: not logged into iCloud. I tried this with multiple test AppleIDs and my real AppleID with no progress. I suspect that the Obj-C code is broken and Apple no longer cares about supporting it and is focused on Swift moving forward but I have no official word on this.

The functionality is in place for you to test this out for yourself if you download the included test Defold project and set it up on Game Center. If you decide to do this please let me know what your results are.

2 Likes

#13

If your game save is very small, you could probably use iCloud key-value storage (I know NSUbiquitousKeyValueStore works fine, I use it to store e.g. Tutorial progress and which tips have been shown). I never tried GKSavedGame because I didn’t want to deal with conflicts — can you really just ignore those?

1 Like

#14

Thanks for the interesting workaround suggestion.
Considering you would have to register an Apple identifier for a iCloud Container and add iCloud capabilities to the AppID I think NSUbiquitousKeyValueStore would work better in a separate iCloud native extension. Especially for Defold developers who only want Game Center features like Leaderboards and Achievements. Its too bad GKSavedGame doesn’t work because it has no specific limit on the amount of data that can be saved.

Which conflicts are you referring to regarding GKSavedGame?

1 Like

#15

True, though I wanted iCloud persistence (so if you play on both your iPhone and your iPad, you don’t have to see the same tutorial tips).

If you do have both an iPhone and iPad, and play the same game (save slot) on both, you are likely to get out of sync if you are ever off a network. This is an iCloud conflict, and needs to be resolved in some fashion (possibly automatically with the more recent save, but ideally by asking the player which device is the truth).

And yes, you are absolutely right about the amount of data. Many games are probably small enough to use NSUbiquitousKeyValueStore but if you’re in any doubt, I would avoid it.

2 Likes

#16

Wow, that’s not great is it?!

Yes, in my case this is likely to be enough. Are you using this in Defold? I couldn’t find a public extension for it?

0 Likes

#17

as I remember (can be mistake) save/load functional isn’t a part of GameKit now and needs for special permission at the Apple gamesettigs panel (iCloud enabling).

1 Like

#18

I’m still deciding if I want to use Defold for a future project. I use NSUbiquitousKeyValueStore in the iOS version of Six Ages (but not for saving full game state because it’s too large).

I noticed that game save/load was not available for tvOS, which seems like an odd omission. Would this keep you from getting a game on Apple Arcade?

For the record, the simplistic version of Steam cloud saves worked pretty well for Six Ages. In the game, you do nothing at all. The Steam client handles conflict resolution. And it handles Mac and Windows files in different folders. Obviously, it is of no use for mobile.

0 Likes

#19

Thanks for the tip! I’ll try adding iCloud capabilities to the AppID identifier and see if that works.

@radiofreelunch Good to know that there are potential syncing issues between iPhone and iPad. Thanks for the info.

@totebo I’ll try @Dragosha fix suggestion this weekend and report back with the results.

2 Likes

#20

I’m still working on iCloud capabilities but I’m stuck adding the entitlements in Defold properly. I’ve posted the problem details in this question to the forum: How to properly add iOS entitlements to an app?

The good news is, I’ve since found out that the Unity Game Center plugins that have the GKSavedGame feature require iCloud capabilities to work. So, when I can get iCloud entitlements added properly it’s looking like Save Game is possible.

0 Likes