Results 1 to 12 of 12
  1. #1
    MSgt. Shooter Person
    Join Date
    Jan 2011
    Location
    Egypt - Cairo
    Posts
    72

    Question [SOLVED]Game Center Leaderboards & Achievements Question

    Hi, I'm having some trouble with Game Center.

    So far I have 2 buttons, one launches the Leaderboards UI, and one for Achievments UI, and are both working fine, I can see the Leaderboard with No Scores, and can see all the Unlocked Achivements that I already have setup in iTunesConnect.

    Problem is I cant seem to update the leaderboards, or Unlock Achievements.

    I'm using the ChikenCoup code to unlock an achivement:

    Code:
    if (OnlineSub != none  && OnlineSub.PlayerInterface != none)
    		{
                      OnlineSub.PlayerInterface.UnlockAchievement(0, myAchievement_ID);
                     }
    myAchievement_ID is an integer with values from (1-10) depending on the achivement I want unlocked.
    Not sure where the problem is here.

    and to post my leaderboard score:
    Code:
    if (PlayerReplicationInfo.UniqueId != zeroID)
    	{
    		WorldInfo.Game.Broadcast(self, "Saving Stat");
    		leaderboardWrite.SetIntStat(class'PuzzLeaderboardWrite'.const.BananaScore, Score);
    		OnlineSub.StatsInterface.WriteOnlineStats('Game', PlayerReplicationInfo.UniqueId, leaderboardWrite);
    	}
    I think the problem is in if (PlayerReplicationInfo.UniqueId != zeroID) ,its never true

    any help would be appreciated.
    thanks.
    Last edited by _hany_; 10-27-2011 at 02:54 PM.

  2. #2
    MSgt. Shooter Person
    Join Date
    Jun 2011
    Location
    Slovenia
    Posts
    71

    Cool

    In my experience you start unlocking achievements with 0 , for example this command
    Code:
    OnlineSub.PlayerInterface.UnlockAchievement(0,0);
    will unlock first achievement, basically just changes bWasAchievedOnline to true !
    Code:
    if((!AchievementsArray[0].bWasAchievedOnline)==true) //check to see if its not already unlocked
    					{
    						//unlock 1st achievement
    						OnlineSub.PlayerInterface.UnlockAchievement(0,0);
    						OnlineSub.PlayerInterfaceEx.ShowAchievementsUI(0); //shows game center in game
    					}
    Note that once you unlock it, bWasAchievedOnline cant be changed anymore, so for testing is good to just go and create more achievements, and test them!
    I don't have leaderboards in my game so I don't know much about that, but for start I would try writing to screen PlayerReplicationInfo.UniqueId and zeroID to see whats going on...
    Last edited by Jurij; 10-28-2011 at 04:05 PM.

  3. #3
    MSgt. Shooter Person
    Join Date
    Jan 2011
    Location
    Egypt - Cairo
    Posts
    72

    Default

    thanks Jurij, my problem was i mis-spilled the word "Achievement" in iTunesConnect. lol.. I need some sleep

    so now Achievements are fully functional.

    But still cant figure out the leaderboards problem,
    the PlayerReplicationInfo.UniqueId is always equal to "ZeroID", thats the problem, and i cant seem to figure out how to get it assigned the right value. any ideas?

  4. #4
    MSgt. Shooter Person
    Join Date
    Jan 2011
    Location
    Egypt - Cairo
    Posts
    72

    Default

    I managed to get it to work, FINALLY, after hours and hours of banging my head to the wall.

    I used the OnlineSub.PlayerInterface.GetUniquePlayerId() function to reset the PlayerReplicationInfo.UniqueId, It seems to be working now, but I'll need to further test it to make sure nothing is broken.

    Here's the code I used:

    Code:
            local PuzzLeaderboardWrite leaderboardWrite;
    	local UniqueNetId zeroID;
    	local UniqueNetId myPlayerID;
    
    	local int testScore;
    
    	testScore = 100;
    
    		leaderboardWrite = new class'PuzzLeaderboardWrite';
    		OnlineSub = class'GameEngine'.static.GetOnlineSubsystem();
    
    		OnlineSub.PlayerInterface.GetUniquePlayerId(0, myPlayerID);
    
    		PlayerReplicationInfo.UniqueId = myPlayerID;
    
    	if (PlayerReplicationInfo.UniqueId != zeroID)
    	{
    		WorldInfo.Game.Broadcast(self, "Saving Stat");
    		leaderboardWrite.SetIntStat(class'PuzzLeaderboardWrite'.const.BananaScore, testScore);
    
    		OnlineSub.StatsInterface.WriteOnlineStats('game', PlayerReplicationInfo.UniqueId, leaderboardWrite);
    	}

  5. #5

    Default

    Hey,

    This thread has already been very helpful but I seem to missing one step in order to get my leaderboards working. From what I can tell I have all the pieces correct my read/write classes are set up and I can view the leaderboards with no scores. For starters, does the submitLeaderboardData function need to be in the playerController? (like it is in chicken coup) Thanks for the help so far and any future help.

  6. #6
    MSgt. Shooter Person
    Join Date
    Jan 2011
    Location
    Egypt - Cairo
    Posts
    72

    Default

    hey, ya its all in the playerController class. make sure you have your leaderboard setup correctly in iTunesConnect and in your UDK config files, also make sure you are logged in to a GameCenter *Sandbox* account, not the normal GameCenter. good luck

  7. #7

    Default

    Thanks, I am in sandbox mode and my leaderboard is set up with an ID of com.my.bundle.leaderboard_01. my write/read class id i set to 1 and that seemed to get me to the right leaderboard when accessing the gamecenter ui. I also have all the ini's set up according to what I found on the UDN developelr site. (using the same com.my.bundle and adding .leaderboard_ where pointed out). I think a big part of my problem is I can't seem to figure out how to get the broadcast function to display, therefore reducing my ability to debug on the device itself. I have a menu open while running the function to submit data and there it calls broadcast. This is my first project in UDK so I'm still dealing with issues in getting the engine to do what I want.

    Anyways, more specifically to what I have done:
    Config files
    - set up bundle strings for achievements and leaderboards
    - disablegamecenter = false
    itunesconnect
    - created a leaderboard with id the same as ini leaderboard string with an appended 01
    code
    - made a custom extension of the write class setting it's property ID to 1 (to coincide with the 01 in itunesconnect)
    - put the chicken coup writeleaderboard function in my playercontroller class with the added line from your code (playerreplicationdata.uniqueid = GetUniqueNetID(); // <-- psuedo-code)
    - made a button in a menu that calls that function sending 9001 as the test score.

    If the problem is just finding out where there is bad data that is stopping the code, I am trying to figure out why my broadcast doesn't work so I can use that to find where the issue is. Otherwise, if there is some important setup step that I missed, please let me know. Thanks for all the help
    Last edited by Ggjeed; 02-07-2012 at 12:13 PM.

  8. #8

    Default

    I figured out the broadcast thing, it was being overlapped by the menu background >.<

  9. #9

    Default

    The code makes it all the way through to the WriteOnlineStats function and that returns true (which I assume means the function did what it was meant to do). However, there are no scores in my leaderboard. I tried adding a FlushOnlineStats call but that function returned false (meaning it didn't work as intended). None of the examples make the flush call so a part of me assumes that it's done implicitly somewhere. I feel, then, that my problem may be somewhere in the setup.

    Leaderboard on itunes connect:
    - Reference name: Leaderscore test (i assume this is arbitrary and used for finding it on the website)
    - ID: com.my.bundle.leaderboard_01 (i assume this means my write/read class property ids should both be 1, this is backed up by the leaderboard successfully loading that there are no scores verses saying it couldn't load)
    - High to low (seems easy to understand)
    - Range: I left this blank as it was optional
    - Language: I set that up as it told me to

    As for the config files, I set up all 4 unique name fields with either com.my.bundle.achievement_ or com.my.bundle.leaderboard_

    I did everything that the documentation / examples told me to do and even though the code is making it through all my checks, it still isn't actually writing. Thanks for helping

  10. #10
    Palace Guard

    Join Date
    Jun 2007
    Location
    Christchurch
    Posts
    3,556

    Default

    To properly check leaderboards, you actually need two people to submit scores. Leaderboards are designed to show who is in the leading position, and if there is no one else but the single test user then there is no way to be the leader of the pack.

    Best methodology for testing is:

    a) Start up your game and log in with one test account and submit a score.
    b) Log out from GameCenter with the current test account.
    c) Start up your game again, ensure to close it, and log in with another test account and submit another score.
    d) By opening the supplied UI, you should be able to see the two players scores and your current position.

    Note: It may take some time for Leaderboards to update.

  11. #11

    Default

    Thanks a lot! That was exactly what was happening! So thanks Solid and Hany for the help and this thread it was definitely a huge part of my success in this!

  12. #12
    MSgt. Shooter Person
    Join Date
    Dec 2010
    Location
    Guwahati, India
    Posts
    116

    Default

    this thread does help me too....a lot.
    thanks


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.