Home Tutorials Download Beta Store Forum Documentation KnowledgeBase Wiki Blog

ShiVa3D

Return to Code Snippets

Game Center integrated!

Paste down any little snippets or request a new one.

Re: Game Center integrated!

Postby vklymenko » 01 Jul 2012, 12:16

ok, so first of all I've added section "MODIFICATION #1 "SUBMIT SCORES FOR MULTIPLY LEADERBOARDS" to the tutorial (very first post). I have tested it only by using logs, but if anyone need this and will implement - please let us know about how its working : )
@redmotion: I'll provide similar solution for your question, but based on this implementation you can figure out how to make same for "FillMarkers.." function.
User avatar
vklymenko
Platinum Boarder
Platinum Boarder
 
Posts: 758
Location: Europe

Re: Game Center integrated!

Postby redmotion » 01 Jul 2012, 23:37

Hi vklymenko, thanks for tweaking the code for multiple leaderboards. I'll be checking this out over the next couple of nights so I'll let you know how I get on.

The fillmarkers function is only if you want to populate game centre data into your own hud layout/design, isn't it?

Thanks again.
User avatar
redmotion
Platinum Boarder
Platinum Boarder
 
Posts: 573

Re: Game Center integrated!

Postby vklymenko » 01 Jul 2012, 23:51

The fillmarkers function is only if you want to populate game centre data into your own hud layout/design, isn't it?


this function is for retrieving scores from a leaderboard into your own table in scripts. For example in Doodle Jump, while you're jumping - you can see your previously raised high-scores as markers on scene. So by using this function you do vice versa to "post score".. When i was implementing game center first time - I wasn't thinking it will turns out as a tutorial - so I named some things not correct enough - sorry for that : )
User avatar
vklymenko
Platinum Boarder
Platinum Boarder
 
Posts: 758
Location: Europe

Re: Game Center integrated!

Postby redmotion » 13 Sep 2012, 10:07

I think I'm going to give integration with GC another try, vklymenko.

Would you be able to add some code so it's possible to specify a particular leaderboard? When a level is completed, I'd like to have the player go straight to the leaderboard for the level they just finished.

I promise my next game will have just one leaderboard! :) Sorry!
User avatar
redmotion
Platinum Boarder
Platinum Boarder
 
Posts: 573

Re: Game Center integrated!

Postby vklymenko » 13 Sep 2012, 10:16

Would you be able to add some code so it's possible to specify a particular leaderboard? When a level is completed, I'd like to have the player go straight to the leaderboard for the level they just finished.


hi redmotion, huh.. I don't know what iOS 6 will come with, from the presentation I saw changes in GameCenter as well..
So you have integrated the GameCenter, and only thing left is to display different leaderboards?
as a quick fix I founded this can be added:
leaderboardController.category = name;
so you can specify name for leaderboard to display. If to not use this line or set nil - player will see default leaderboard displayed.
As for the whole tutorial - I'll check out iOS6 when out (Sept19?) and will polish it accordingly to the new features.
(p.s.: I remember we were speaking on skype, but you've not contacted me another day - so feel free to contact me if I can help more ; )
User avatar
vklymenko
Platinum Boarder
Platinum Boarder
 
Posts: 758
Location: Europe

Re: Game Center integrated!

Postby redmotion » 21 Oct 2012, 10:56

Yay! Finally made some progress on this!

The score wasn't being formatted correctly before it was sent from ShiVa to Game Center.

I've got scores showing up in the Game Centre sandbox now so thanks a lot!
User avatar
redmotion
Platinum Boarder
Platinum Boarder
 
Posts: 573

Re: Game Center integrated!

Postby vklymenko » 21 Oct 2012, 11:04

Yay! Finally made some progress on this!

The score wasn't being formatted correctly before it was sent from ShiVa to Game Center.

I've got scores showing up in the Game Centre sandbox now so thanks a lot!


happy to hear :D
User avatar
vklymenko
Platinum Boarder
Platinum Boarder
 
Posts: 758
Location: Europe

Re: Game Center integrated!

Postby redmotion » 21 Oct 2012, 20:36

Hi, I'd like to use the onShowLeaderboard ( sLevel ) handler to call a specific leaderboard by name, I've tried to tweak the showLeaderboard method in S3DEngine_EAGLView.m (below), but I'm missing something!

Code: Select all
- (void)showLeaderboard:(NSString *)leaderboard //added to recieve string (leaderboard ID)
{
    tempVC = [[UIViewController alloc] init];
    UIWindow* window = [UIApplication sharedApplication].keyWindow;
   
    GKLeaderboardViewController* leaderboardController = [[[GKLeaderboardViewController alloc] init] autorelease];
   
    [GKLeaderboardViewController setCategory:leaderboard]; // added this to set category as leaderboard string
    //leaderboardController.category = leaderboard; //also tried this
   
    if (leaderboardController != nil)
    {   leaderboardController.leaderboardDelegate = self;
        [window addSubview:tempVC.view]; //Doesn't show up without this
        [tempVC presentModalViewController:leaderboardController animated:YES];
    }
   
}


This just crashes to desktop.

EDIT: Just had a thought: I didn't modify the header file. Will try tweaking it and see if I can get it to work.
User avatar
redmotion
Platinum Boarder
Platinum Boarder
 
Posts: 573

Previous

Return to Code Snippets