Codesnippets > Userlibs [ *.gbal]
Game Center (testers and help needed)
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:
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:
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) ---void GCgetLastErrorDomain(char *errorDomain)
--- End code ---
the problem is that if we want to return a char*
--- Code: (glbasic) ---char *GCgetLastErrorDomain()
--- End code ---
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....)
Navigation
[0] Message Index
[#] Next page
Go to full version