And again Game Center module.
Monkey Targets Forums/iOS/And again Game Center module.
| ||
Hello everyone! Can somebody, please, help with York's module? Original topic: http://www.monkeycoder.co.nz/Community/posts.php?topic=1207 I have an issue with OpenLeaderboard() function. Here's a leaderboard code from module (ios.cpp): - (void)showLeaderboard { if(!isAuthenticated) { return; } GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init]; if (leaderboardController != nil) { leaderboardController.leaderboardDelegate = self; [app->appDelegate.view addSubview: gameCenterViewController.view]; [gameCenterViewController presentModalViewController: leaderboardController animated: YES]; isViewOpened = YES; } } - (void)leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController { [gameCenterViewController dismissModalViewControllerAnimated:YES]; [viewController.view.superview removeFromSuperview]; [viewController release]; isViewOpened = NO; } It perfectly works in Portrait View. And doesn't work in Landscape. When I tap on GC button in my app in Landscape and then turn device, here's what I see. ![]() The Leaderboard window shows up, but in the wrong place. Here's the module. https://dl.dropbox.com/u/71223199/gamecenterModule.zip If someone has ever implemented Game Center, please, post here the code from xCode, so we can make a module! Thanks! |
| ||
Finally! I didn't tested too much, but it seems to work fine! https://dl.dropbox.com/u/71223199/gamecenterModule.zip Functions implemented: Function IsGameCenterAvailable:Bool() Function InitializeGameCenter:Void() Function ReInitGameCenter:Void() Function IsPlayerAvailable:Bool() Function SendScore:Void(scScore%, scCategory$) Function SendAchievement:Void(scAchName$, scPercent#) Function OpenLeaderBoard:Void() Function OpenAchievements:Void() Function DeInitGameCenter:Void() Function IsGameCenterVisible:Bool() 'useful for disable taps affect on what's under the Leaderboard or Archievements window. The mod was made from this: http://www.garagegames.com/community/forums/viewthread/122529/ Sorry for english =) Good luck! |
| ||
Hi Here's my version for comparison (I didn't compare with the one above yet). It supports awards and leader boards, as well as error reporting. And it has correct leader board / achievements screen orientation. http://innotech.pl/anawiki/4people/iosGameCenter.zip If you find the code messy then feel free to clean up :D |
| ||
Hi Anawiki, Just tried yours, when I bring up the game centre screen and press the "Done" button the app crashes. :( |
| ||
Does it show any errors? What Monkey version do you use? What XCODE and iOS? |
| ||
Also, when you say "game center screen" which screen exactly do you mean? Achievements, leader board, creating account? I just checked again my game and it works fine here. |
| ||
It works on the iPad and in the emulator. It crashed on the iPhone 4 and iPod 4th generation. I am using Xcode 4.2 and calling the LeaderBoard in my game. When the leader board comes up everything is ok, when I click the "Done" button it crashes. Using 5.0.1. |
| ||
The error seems to be coming from this code after pressing the Done button -(BOOL)resizeFromLayer:(CAEAGLLayer *)layer{ // Allocate color buffer backing based on the current layer size glBindRenderbufferOES( GL_RENDERBUFFER_OES,colorRenderbuffer ); [context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:layer]; glGetRenderbufferParameterivOES( GL_RENDERBUFFER_OES,GL_RENDERBUFFER_WIDTH_OES,&backingWidth ); glGetRenderbufferParameterivOES( GL_RENDERBUFFER_OES,GL_RENDERBUFFER_HEIGHT_OES,&backingHeight ); if( glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) != GL_FRAMEBUFFER_COMPLETE_OES ){ NSLog( @"Failed to make complete framebuffer object %x",glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) ); abort(); } return YES; } |
| ||
OK, I didn't test it on iPhone or iPod yet. What Monkey version do you use? I work on tweaked v46, that should be quite equivalent to v48. In versions lower than v46 there could be some issues. Not sure, but above doesn't look like my mod code? |
| ||
I am using v48 :) The crash is calling that code which is not yours, but it happens when pressing the done button. |
| ||
I am trying to use Anawiki's module but seem unable to send scores to the leaderboard. The gamecenter initialises ok and I can bring up the leaderboard but I'm not sure how to submit... I have tried both... GCSendScore(score, "com.newstargames.newstarsoccer.ARCADESCORE_1") GCSendScore(score, "ARCADESCORE_1") iTunes Connect doesn't seem to use the term "Category ID" anymore so I assume it is referring to the Leaderboard ID. ARCADESCORE_1 is the Leaderboard ID but nothing appears on the leaderboard. I've also tried using the Leaderboard Reference Name but no joy. |
| ||
Hmm, it seems it is working fine and takes a while for the sandbox board to update. Hopefully will be quicker with the live version. (I used GCSendScore(score, "ARCADESCORE_1")). I can confirm that pressing the "Done" button on the leaderboards does crash the app when using an iPhone 3GS though. |
| ||
I've also tried Alex's version but get the error: "Unbalanced calls to begin/end appearance transitions for <UIViewController: 0x6a9510>" when opening the leaderboard. |
| ||
This GL stuff is way over my head. Can anyone help? Basically as SpaceBuddy says, when using Anawiki's module the app exits on older devices when closing the leaderboard screen (works fine for retina displays). The function resizeFromLayer halts the app at the line: if( glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) != GL_FRAMEBUFFER_COMPLETE_OES ) After a days googling and chucking various lines of code at the problem I'm no further forward. Any help would be greatly appreciated! |
| ||
I am still researching that issue and it may be that we will need to change whole viewController and related staff. The problem is that it will also require us to change the way Monkey is working (automatic updates and renders vs manual calls to render). |
| ||
That's too bad. I was looking forward to implement Game Center into my games. |
| ||
It's not as big problem on iPad, just iPod/iPhone. |
| ||
Can anyone confirm if it's a problem on an iPhone 4? |
| ||
I can't confirm it myself, but QA team reported that on iPhone 4S with iOS 5.1 pressing done crashes the game. |
| ||
I can't reproduce the "Unbalanced calls to begin/end appearance transitions for <UIViewController: 0x6a9510>" bug. However, I made some changes. Hope it'll help. http://www.white-zebra.com/upload/iosGameCenter.zip |
| ||
Hey man, it works! Aside from testing and tweaking my game, getting the Gamecenter working was the last major hurdle so I am dead chuffed. Cheers! :D |
| ||
Sorry for the question, but how did you fix the problem with the IPhone 4 crash? |
| ||
There is another thread with GC mod that has updated version without iphone crash bug. |
| ||
hey thanks for your answer, but I only find two threads. But nothing with a new updated mod... hmm? Can you give me a tip where I can find it? I am just blind.. Oo |
| ||
Hi guys! I'm trying to get game center integration sorted out for my game as well. This thread seems like the latest one. Unfortunately it seems to have unresolved issues with iPhone 4 crashes. Like York before me, I'd appreciate a redirect to the thread without the iphone crash bug. Could Alex, anawiki or siread help me/us out! Thanks so much guys. |
| ||
I used Alex's latest: http://www.white-zebra.com/upload/iosGameCenter.zip Is that version still crashing? |
| ||
I often get crashes with NSS when pressing the Game Center icon. |
| ||
Hey, for me it helps to set the animation off. so like this.. [gameCenterViewController dismissModalViewControllerAnimated:NO]; |
| ||
Hi siread and simonh and York! Thanks for the confirmations! I'll give Alex's a whirl and see if I run into issues. I can't say I've seen any crashes with NSS for me, but I've only got it running on the iPad 2. What device were you running it on simonh? I'll try turning off the animation too. Thanks for that York! Have you had any crashes at all with game center, once you did that? BTW, congratulations on the phenomenal success with NSS, siread! Excellent stuff. |
| ||
I didnīt have any issues since I removed the animation. With animation it only runs on iphoneīs / ipodīs < ios 5.0 . With Ipad there is no problem... |
| ||
Great stuff! I'll confirm this once I've got it running on my app. Thanks for that York! |
| ||
Running on an iPhone 4 and iOS 5.1.1. |
| ||
Hi All, Wanting to know where a bug free version of the gamecenter code can be found. I tried the above : http://www.white-zebra.com/upload/iosGameCenter.zip but that is now a dead link. |
| ||
Sorry, my bad. Some troubles with domain. Here it is. https://dl.dropbox.com/u/71223199/gamecenterModule.zip |