• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

iOS Achievements & Leaderboard for iOs

S

Siracher

Guest
Hi,

I have created achievements and a leaderboard.

the Achievements works fine like this:
if achievement_available() achievement_post("grp.XXX.XXX", 100);

but the leaderboard is just displaying the name without the score.
I used this code to post the score:
if achievement_available() achievement_post_score("grp.XXXX", global.highscore);

it works fine for android, so I'm not sure where the error is.
I read on the apple guidelines that the score need to be int64. So I converted it right now and waiting to see if it works.

Is anybody experienced in this and can give an advise or has a running code for this?
 
P

pSouper

Guest
Hi,

I have created achievements and a leaderboard.

the Achievements works fine like this:
if achievement_available() achievement_post("grp.XXX.XXX", 100);

but the leaderboard is just displaying the name without the score.
I used this code to post the score:
if achievement_available() achievement_post_score("grp.XXXX", global.highscore);

it works fine for android, so I'm not sure where the error is.
I read on the apple guidelines that the score need to be int64. So I converted it right now and waiting to see if it works.

Is anybody experienced in this and can give an advise or has a running code for this?
Hi Siracher, did you get this working for you?
I’m not getting much from my efforts or the forums on this same problem.

Could you post the code you used to put and to get the high scores to help us all out please ?

Thanks buddy.
 
S

Siracher

Guest
Hi

yes I got it working. Problem was not the coding itself. I had an issue with the ID of the leaderboard or in this case the achievements in itunes connect.
I named the leaderboard grp.nameofgame instead grp.nameofgame.leaderboard (or whatever name you want for the leaderboard) or for achievements grp.nameofgame.achievement1 and so on.

so the whole thing didn't worked and unfortunately you can't change or delete a leaderboard ID once it contains data.
So I had to create a new leaderboard and then it worked.

Make sure that you check within iTunes Connect > Features > GameCenter
that you have set up the leaderboard /achievements correctly and that it is connected with your app

I call the leaderboard post score on the game over object and it send the current points to the leaderboard.
Same with achievements. let me know if this helps or if you need any sample codes for these triggers
 
P

pSouper

Guest
Actually, that helps a whole lot. Thank you very much.

To pre-populate the game's hud with the current highscore from the iOS Game Center, should/could i call this at game init?

[A code example of the get and post would be a blessing, if only to reassure me I'm in the right ball park of understanding.]

My leaderboard in iTunesConnect currently says 'not live' is this to be expected? could/should i make it live before uploading the game or does it go live automatically once it has data submitted?

..Also, do I need to upload the game to iTunesConect for the highscores to work? I wonder if my testing from GMS2/xCode to a connected iPhone was too 'sandboxed' for the highscores to send/recive data?

Thanks in advance
pS.
 
S

Siracher

Guest
I think what you are looking for is this, to show the data in your hud, but I can't help with this one as I never used it:
https://docs.yoyogames.com/source/d...eaderboards/achievement_load_leaderboard.html

This is the code I'm using when the game is over in a object "obj_gameover" in the create event.
This code actually check the current score and submit it to the leaderboard if it is higher than the older score.
In this case the score is also the trigger for some achievements. If you reach a specific score you get an achievement.

Code:
if (obj_control.points > global.highscore){
global.highscore = obj_control.points;
newbest = 1;
}

ini_open("savedata.ini");
ini_write_real("Score", "Score", global.highscore);
ini_close();

var highscore_web = real(global.highscore);

// post achievements for android
 if (os_type == os_android)
 {
 
 if achievement_available() achievement_post_score("CgkI_7Kt__gXXXXXX", highscore_web);
 
if global.skullcrate == 1
{
if achievement_available() achievement_post("CgkI_7Kt__gXXXXXX", 100);
}

if global.highscore >= 1
{if achievement_available() achievement_post("CgkI_7Kt__gXXXXXX", 100);}

if global.highscore >= 15
{if achievement_available() achievement_post("CgkI_7Kt__gXXXXXX", 100);}

if global.highscore >= 40
{if achievement_available() achievement_post("CgkI_7Kt__gXXXXXX", 100);}
}

// post achievements for ios
 if (os_type == os_ios)
 {
   if achievement_available() achievement_post_score("grp.tomata.highscore", highscore_web);
 
if global.skullcrate == 1
{
if achievement_available() achievement_post("grp.yourgame.achievementname", 100);
}

if global.highscore >= 1
{if achievement_available() achievement_post("grp.yourgame.achievementname", 100);}

if global.highscore >= 15
{if achievement_available() achievement_post("grp.yourgame.achievementname", 100);}

if global.highscore >= 40
{if achievement_available() achievement_post("grp.yourgame.achievementname", 100);}

}

I am not sure what works and what not if you test locally. I think it doesn't work until the leaderboard is actually live. As I can remember i published it manually and then uploaded the game.
But it doesn't mater if you publish it already as long as the app is not live nobody will see it.
Anyway I would suggest that you are using Testflight from apple before releasing it in the store:
https://developer.apple.com/testflight/
 
P

pSouper

Guest
I have been having a mare with these leaderboards. I can't believe I'm the only one in GMS2 :D
I'm sure it's the not understanding the precise workflow apple have in place but it seems the web is full of grumbles and workarounds and yet none fit exactly.

at the end of my game I draw to gui: achievement_login_status() and achievement_available() ...both return 1, which is good news right? it show I'm connecting to the gamecenter leaderboard right?

I have two testflight testers testing the game, each scoring enough to be a highscore but the app doesn't show the score and itunesconnect doesn't show any scores (and i'm not sure if it is supposed to)

the code i use at the start of the game to get the highest score is:
achievement_login and achievement _load_leaderboard();

..tbh: i don't know what to do with this if all i want is the highest score.

I guess my biggest problem here is not knowing what is supposed to happen with each stage so i can see if i'm getting anywhere.

any help appreciated. pS
 
P

pSouper

Guest
Thanks Siracha,
with your help have now have the hi scores saving to the iOS Game Center. so thanks for that.

The very last piece of my jigsaw puzzle is getting the highest score from the game center at the start of the game to show in my hud.
I am trying with achievement_load_leaderboard() but getting an error saying the 'Data structure with index does not exist' (the index is just "id").

fyi: The code is just the example snippet from the help docs.

I remember you've said you;'ve not used that function before so no sweats :)
 

Slyddar

Member
with your help have now have the hi scores saving to the iOS Game Center.
I'm trying to implement this now, having a working achievement and leaderboard system on Android, and trying to move it to IOS, but am running into many unanswered questions, that the internet doesn't seem to have answers for.

I have a leaderboard listed in ITunes Connect but it shows as Not Live. achievement_login_status() is returning true, but achievement_show_leaderboards() only shows me the image I've attached.

So I assume I need the leaderboard to be live before achievement_show_leaderboards() will display it, and if that's the case, how do I make it live?

If you could share some of your findings it might help others who try and tackle this enigma.

Thanks.
 

Attachments

Slyddar

Member
As an update I was able to get the leaderboard to show. The bundle ID in Xcode was still set to yoyogames default, so I had to edit it in the project settings to the same as my app ID. I hadn't entered a bundle name in gamemakers IOS general settings, so I assume that's why it didn't get passed through to Xcode.

The leaderboard still shows as Not Live but at least now the score posts and the leaderboard shows when checking in the app.
 
Last edited:
P

pSouper

Guest
good job TheSly. Acually, the Leaderboard will be 'not live' until the game is 'live' so don't worry about that. If all is working for you in dev it will in live.

can I ask you a related Q... are you getting the leader-board data from iOS and rendering it in you own generated leader-board OR are you just linking to the iOS (bug-ugly) leader-board?
- i just can't work out the async event that get's the data from iOS leader-board...i get an error saying my data is emtpy which i think is just that I'm trying to use the data in the same script as requesting it. being async, it probably hasn't received the data at this point.

any tips? pseudo functions?

thanks.
 

Slyddar

Member
are you getting the leader-board data from iOS and rendering it in you own generated leader-board OR are you just linking to the iOS (bug-ugly) leader-board?
Unfortunately I'm just using their ugly system. It's functional for my purposes, so even though I'd like something nicer, it will get the job done.

A few questions back to you...
For achievements in IOS, can you reset the progress of them?
In your testing of incremental achievements for Android, did you find any time when the increment happened at twice the rate you expected? There's another post where that happens, and it's happened to me too.

And thanks for the tips!
 
P

pSouper

Guest
Sorry TheSly, strickly iOS ATM
..ps: what android os are you using to dev? I now need to get a cheap handset that I can use but have never owned or used a droid.
 
Last edited by a moderator:

Slyddar

Member
I picked up a cheap Sony XA, which is perfectly fine to use.

How about my incremental Android question?
 
P

pSouper

Guest
I picked up a cheap Sony XA, which is perfectly fine to use.

How about my incremental Android question?
oops... my fault. I meant "strictly iOS atm"

...with that kind of mistake I think maybe my brain isn't ready for computers at all :)
 
Top