Game Center (testers and help needed)

Previous topic - Next topic

Dark Schneider

Hi, I am currently working on Game Center integration in GLBasic, and some help would be fine.

Inside the ZIP, there are 2 folders:

- GameCenterWrapper: here is the source code for XCode, it is yet incomplete because I want to test before.

- GCTest: a simple GLBaisc project to test it.

I thnk each function is self-descriptive, with a notation about "lastErrorCode", as access to GC is asynchronous, we need a way to know when has been completed in GLB, then I use the lastErrorCode for that, I set it to -1 while working, and when is <>-1 we can see the result (see source code of GCTest). For NO ERROR, lastErrorCode passes from -1 to 0 (0 is NO ERROR). I think there is no error =-1 in Apple documentation, for that I use it, if there is any, simply change it.

With GCisSupported + GCisAuthenticated + GCgetLastErrorDomain + GCgetLastErrorCode IMO there is full to know about if there is success or any error, only looking at Apple documentation. In example, if  GCgetLastErrorDomain="NSURLErrorDomain" this is internet connection problem, look at Apple docs for more info.


Well, after this, what I need are testers, Game Center doesn't works on jailbroken devices for development purposes, so you need an original iOS device with Game Center support.


In the simulator it works perfectly, I have tested on a jailbroken device (it is not mine) and it says "This game is not recognized by Game Center", this is GOOD because it seems that it tries to authenticate, and this is exactly what should be seen on jailbroken devices for developer compilations (including AdHoc ones), but for better results, it would be good that someone with an original device test it.

To use:

- Create a project with Game Center in your iTunesConnect, you can use any name, as they are going to expire, I recommend something like MyDomainGameCenterTest01, so when expires you can use MyDomainGameCenterTest02, etc, etc. Get all needed certificates and blahblah (see at Apple documentation).

- In XCode: once we have our XCode project from GLBasic, simply follow these steps:
1) Add GameKit framework to frameworks. Before this you need to select the "Release" configuration.
2) Add the folder "GameCenterWrapper" to the project, i.e. in "Other Sources" section.
3) Configure you target settings, in "Properties" set the "Identifier" to your APP ID, remember that wildcards doesn't work for Game Center.
4) Build and Run  ;)

IMPORTANT: remember to create a Sanboxed Game Center profile for testing purposes. this can be done by logout with the current profile and then starting the Game Center development app, and click on Create New, use a new e-mail that will be attached to an Apple ID by its own with a verification mail, so there is no need to create an Apple ID for this before, simply a non-used email by other Apple ID.


Comment here if it works (you see the Game Center authentication notification). Modify the GCTest or create your own for deeper tests.

Note: the files to modify are the GameCenterWrapper.h and .m, and maybe the GameCenterWrapperFunctions.m

Update: lastest code in the attached file, including an example project.

[attachment deleted by admin]

Dark Schneider

#1
I think GCgetLastErrorDomain() is not working, maybe someone could fix it.

At this moment the more important thing is to test if the "report" functions work properly, as the "show" can be made using the Game Center app because if it is recommended to show them in your app, is not required, and more having a multi-task iOS. It could be added in the future.

Dark Schneider

#2
New version, now the leaderboards shows correctly, when showing achievements it can crash, but I think is because if we show achievements for a "not supported" game (then there are no achievs) the object "*achievements" using the Apple Game Center function can be the problem, and should be tested with a real supported game with real achievements created on iTunesConnect. If the game has no achievements, there is no sense in showing them.
I say this because in the simulator it works fine always.

Now the GCgetLastErrorDomain() is in the form:
Code (glbasic) Select
void GCgetLastErrorDomain(char *errorDomain)
the problem is that if we want to return a char*
Code (glbasic) Select
char *GCgetLastErrorDomain()
in GLB we must define the function like GCgetLastErrorDomain$() and then we have errors or must use a conditional compilation ?IFDEF for any use, so filling a buffer is better solution IMO.
But I think is not working yet.

blackway

Hi Dark Schneider.
First I want to say thank you very much for your work!! I really appreciate what you are doing about Game Center (I think that Game Center is a must these days).  :good:

Sadly I can't help you testing because my Ipod touch is jailbreaked  :-[

Keep it the good work!
cheers,

spacefractal

My phone is not jailbreaked and have not need to do that (3GS).

I Can help and test, but Fortuna i have still not brought a dev account yet (only registred) and my game is still a bit early...

I guees its would been happens few weeks so i finally can test on
My phone. I do want gamecenter and/or openfeint support for it.

But cant help right now in this momment, but i look when possible.

Sad I would test this soon (so I should do that this week anyway....)
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Dark Schneider

#5
Well currently is fully functional for reporting, but the problem is to show the Leaderboards and Achievements, the current code doesn't work on iPad  :blink:

I attach the XCode project, there is no need of an original iOS device and there is no need of a GC account because there is no need to be authenticated to show the tables, nothing. The project is a GLBasic one, you only need to test it by pressing the 2 last buttons in the bottom row, they have the "Show" text (detects when we leave the finger over its position). If you press on another ones, you will see how the most rigth number at bottom increases, ignore it.

So anyone can use it to find the way these tables should be shown. The file to modify is the GameCenterWrapper.m, functions showLeaderboardCategory and showAchievements.

Take a look at it, earlier they work, earlier we have a full GC features.

Updated: changed the "show" functions so currently they work on an iPad executed in iPhone mode, I need someone to test them on real iPhones, the 3GS and on iPhone 4 and view what happends. So at this moment we can detect the device and in case of iPad show a message "Open the Game Center App", but on iPhones we could show the Game Center tables inside the application, as most game buyers are iPhone users its better than nothing.

But other developers can modify it so they work too on iPad.

Note: the showAchievements works on iPad if we change in the dissmissdelegate:
.view.superview removefromsuperview
to
.view removefromsuperview

so we could modify it to conditional execution depending on device type. Bu this should be done when leaderboards were working IMO to have a full working Game Center on iPad.

Dark Schneider

#6
Moved the last attached file version to the first post, also now the showAchievements function should be fully functional, as said it detects the device type, including when we run the app in iPhone mode on an iPad (for non-Universal apps).

Now we need to test it on iPhone models, but I don't have any iPhone supporting Game Center.

Crivens

I have a 3GS (4.3.5), an iPod Touch 4G (4.2 I think), and an older iPod Touch 2 or 3G (I forget which). All non-JB. Oh, and plus a developer licence obviously.

I'm a bit busy at the minute so if that GCTest attachment project is pretty quick to just compile and then setup in Xocde then if I have a moment over the weekend I will put it on my iPhone. No promises as I have a busy weekend.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

Crivens

Quick thing though. I just downloaded the zip from the first post so it is ready when I have a spare minute, but I can't find any GLB files. Is the GLB project files in a different download?

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

Dark Schneider

A great collection  ;/

At this moment is the XCode project, only to test if the leaderboards and achievements tables are shown correctly on iPhones, because I only have an iPad to test it, and assuming than an iPad running in iPhone mode is he same than an iPhone is not good at all  :S

Once tested, I will put the entire project including the GLBasic one to see how to use it in GBasic (this phrase is not a bit redundant?  :zzz: ).

Crivens

Ah, ok, sorry I misunderstood when you said it contained a simple GLB project.

I'll try and get a moment to try it out this weekend. Busy one this time so might not get the chance till next week.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

Dark Schneider

Project updated (look at the first post), what I have tested:

- Device not supporting GC: all fine, there is no crash.

- Device suppotring GC: iPad. All reporting features works well, tested with a real app project with GC configured and the scores and achievements reports work fine, both on iPad and on iPhone mode. Note: when I talk about iPhone mode it means runing the app compiled as iPhone only on an iPad, not a real iPhone.
Showing tables:
iPad mode: leaderboards doesn't show, achievements works fine.
iPhone mode: both shows correctly, no animation when hiding.

I have tested it trying to force it to crash, with a long sequence of continuous show/hide, show/hide..., sliding the finger while showing and while hiding, etc. But all tests was on iPad (both iPad and iPhone modes).

I have simplified the project so it only have 3 buttons, "Add score", "show leader" and "show achievs" for evading crashes for using reports to an undefined/unconfigured GC app.
Then what I need is someone to test ONLY the "show" (both) on a real iPhone, trying to force it like I said before (show/hide, show/hide, show/hide, sliding fingers while shows/hides, etc.) and report the results.
The "add socre" button is used to see if continue to having control over the app when hiding a panel. The buttons respond to the event "lift up" the finger, because I noticed the boards can block the control if we have pressed on the screen at the moment they appear. So responding to this event we are sure there is no finger on the screen when we show the board.

Crivens

How is this going? Have you got any further? Is it still just in XCode or have you linked to a project in GLB? I'm sure a fair few people here are hoping it works out well.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

pinete

Hi,
completely agree with Crivens!
how is it going? this project seems quite interesting! it would be great to have it done to boost the games of the community! :)
let us know something more about it!!!  :nw:
best of lucks!

Crivens

Heh, completely forgot about this. Yeah, any news?

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.