Turn based skeleton project

For iOS9+: I created TurnBasedSkeleton (github.com/mhatzitaskos/TurnBasedSkeleton). This project aims to create a skeleton for any turn based game using GameCenter. As GameCenter seems to lack in documentation and tutorials, especially as far as turn based gaming is concerned, I decided to create this project to help others who might want to integrate GameCenter to their projects.

Replies

You should probably log into the Bug Reporter (bugreport.apple.com) and file a Documentation enhancement request describing what's needed. You might even offer to provide that skeleton project as sample code! 🙂 (I'm not sure they'd accept your offer, but it's worth a try, and you might be able to do something cool for the rest of the game development community!)

Thanks mhatzitaskos,


A very good initiative!


I've taken a quick look. One initial comment is that I don't use a singleton to implement the listener functions. Instead I register a listener on the GKLocalPlayer when I enter different scenes. Each SKScene inherit GKLocalPlayerListener and can thus have specific listener methods, and some scenes can just ignore some events. Any comments on that?

I've cloned your repo now, and I have trouble with the following:


AUTHENTICATION CHANGED

Player is authenticated

GameCenter is unavailable with error: Optional(Error Domain=GKErrorDomain Code=15 "The requested operation could not be completed because this application is not recognized by Game Center." UserInfo={NSLocalizedDescription=The requested operation could not be completed because this application is not recognized by Game Center.})


I have changed the bundle id, and registered the app in Member Center, and in Itunes Connect. I have some memory about having to enable the app for Game Center in Itunes Connect, but I did not find that option now. Maybe that has been removed? Any suggestions?

Yea, I got the same error in the beginning and I read somewhere that I need to create a high score ladder in order for the gamecenter to become enabled (although it was enabled in itunesconnect and Xcode) and the error to go away. So, I did, and the error went away. It's like gamecenter is not enabled until this is done. You can then remove the high scores ladder. One of the few things that seem to be weird about gamecenter. :)

Well, that's a way to go. I feel that having a singleton allows for all of the gamecenter related stuff to be bundled together and not be present in various SKScenes around the project. It's a matter of preference and also on how you have structured your project. At the end of the day both work.

Thanks. And now I ran into the problem of missing notifications (https://forums.developer.apple.com/thread/23938). The game does not advance after turns, but the matches are indeed updated because if I restart the app everything is ok.


Does that work for you?

I'm not near a computer where I can test it. So I'll get back to you on this. However, I would try to test the functionality between two devices and not the device and the simulator or two simulators. Simulators seem not to work correctly (as far as push notifications go and probably other things) with all these gamecenter messages.

I do use two devices. An iPad4 and an iPhone6s. I think this is related to the thread I posted. It's not your fault.


Notifications works for my "real" app. I hope Apple fixes the bug, or if the bug should be on my side (which I doubt considering the other thread), gives some kind of error indication that describes what's wrong. Noone wants to implement a Game Center game without notifications. 😟

I feel that when a new app is registered in itunesconnect, with gamecenter capabilities, it takes a while for the notifications to start coming in. After some time they do come in a more timely manner. It's very annoying and it's one of the reasons that I have been thinking of also finding alternatives to gamecenter.

I really think this thread is a good initiative. A couple of reflections, if you have the time and interest...


Cut from https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/GameKit_Guide/MatchmakingwithGameCenter/MatchmakingwithGameCenter.html:


A player can use the Game Center app to create a match with another player.


I don’t know any way to invite players from the Game Center app. I know that I can launch my app by selecting “Play” in the “…” menu on top of the Game menu. Is this the intended functionality?


I really don’t want any more functionality from the Game Center app apart from removing & ending matches. For instance, I don’t want anyone to be able to accept an invite from the GC app. It only complicates the states within my app. I have no control. I mean, the user might have put the app to background in the middle of a turn, and now the GC app wakes it up and prompts for turn acceptance actions. I guess it’s also possible to take a turn from within the GC app. How shall I handle those cases in an intuitive way?


I don’t have my development environment here — I’m drinking coffee at a café — so I’m not 100% sure, but I am quite sure that I've been able to handle invites and take turns from within the GC app. Is it possible to disable this GC app functionality? Can I just ignore it, or will my app be rejected if I do so?

Has anyone gotten the turn based notifications to work consistently on iOS 9? If so, what is your secret formula?


Thanks for any hints.

Jay

Thank you a lot! Your skeleton provides some insight that I could not find anywhere else.

I mean, bravo!

Apple should really consider game center with a lot higher priority than they currently do. I think a huge percentage of their income is through games, no?