Get Average GameCenter Leaderboard Score? - game-center

1) So I currently have a leaderboard that is based on people's score. Their scores are doubles, 0.00 - 100.00.
So if there are only 2 people on the leaderboard, one with a score of 90.00 and the other with a score of 80.00, i want to be able to tally up all of the scores and divide by the number of people on the leaderboard... in this case 90.00 + 80.00 / 2.0
So does anyone know how to do this?
2) Second, I want to create a leaderboard that the user can see their ranking, but is unable to see other people's names. Is there a way to do that as well? I know I could make a custom interface that only shows their ranking, but then if they open the gamecenter app, they would be able to look up my app and see names and rankings but I don't want to allow that.
3) Is there a way to make a leaderboard only show the user's most recent submission? For instance, if their first submit a 70.0, then a 80.0, then a 60.0, then a 71.2, it will only show the 71.2?

To answer your questions:
1. This is not possible with standard GameKit API. You will need your own server to achieve this.
2. You are right, even if you create a custom UI for leaderboards, the user will be able to see other players scores in the game center app. But if you just want local player highscore, store it locally and use iCloud to synchronise it.
3. This is also impossible with GameKit. But if you store it locally, you can do it your way.

Game Center doesn't provide API for fetching an average score. If you could fetch all the scores on the leaderboard, you could easily use KVC collection operators to compute their average. However, you can't get all the scores on a leaderboard -- its range property only allows you to fetch up to 100 scores.
Any leaderboards you create using Game Center will be visible in the Game Center app, names and all. (Note that only nicknames are shown for people not in your friends list -- if your question has to do with privacy of real names, you needn't be concerned.)
You can now use iTunes Connect to control whether a leaderboard shows each player's highest score or their most recently submitted score -- see under "score submission type" in iTunes Connect Developer Guide.

Related

How to store values for each user for each server

This is going to be more of an abstract question, since there's no code I can provide related to this question. I'm a bit new to working with databases, so I'm not familiar with conventional designs (yet).
I have these tables: users and servers.
I currently have a method of keeping score for each user by incrementing the score field in the users table. However, this results in global scores, which is fine, but I would like to be able to track server-specific scores as well.
What would be the best approach for keeping a user's score for each server they use?
To track server specific scores you can just add a table with servers ids by using guild.id.
You could have User(user.id) | Server(guild.id) | score
Then to track the server score find all the records for that server and add the score to a global variable.
This is an example in pseudocode/python
total = 0
for x in Server:
total += x[score]

Is it possible to get the actual calculated score of a custom ranked feed?

Right now getstream passes down ordinal score but not the actual internal score which makes it difficult to debug. I tried reading the api docs and inspecting the response but don't see anything. I'm also not quite sure how their own internal explorer works. When pressing "preview" the results set is limited and makes fine tuning difficult.
Our API call only returns an integer that orders the items. If you want the actual score, go to your organization's dashboard, click on your app, and click on the name of your ranking under the Ranking Methods header. then click on the "Preview Changes" you will see the ranked feed with the full score based on the ranking algorithm. There's also a search bar there if you want to change the feed and user_id values. I don't know if putting the actual score in the feed is on our roadmap but I can bring it up with the team.

Azure ML Recommendations

I want to use Azure ML to find related products using information from receipts from a store.
I got a file of reciepts:
44366,136778
79619,88975
78861,78864
53395,78129,78786,79295,79353,79406,79408,79417,85829,136712
32340,33973
31897,32905
32476,32697,33202,33344,33879,34237,34422,48175,55486,55490,55498
17800
32476,32697,33202,33344,33879,34237,34422,48175,55490,55497,55498,55503
47098
136974
85832
Each row represent one receipt and each number is a product id.
Given a product id I want to get a list of similar products, i.e. products that was bought together by other customers.
Can anyone point me in the right direction of how do to this?
This seems a good fit for their frequently bought together service (https://datamarket.azure.com/dataset/amla/mba). You may have to preprocess the dataset to get it in the required format. This service has a web UI as well: https://marketbasket.cloudapp.net/
This is a typical problem for Recommender, you can use a model called Machbox recommender to cover such a problem.
Recommender typically use Scoring about items to propose and the use some tricky calculation to predict scores for items users had not scored yet ( a score would be typically 1 user bought the item, 0 he did not)
If you need more details let me know ..(you have access to a free version of Azure ML where you can try all this)
Regards

questions about Game Center (sandbox)

I'm using pretty straightforward code, modeled on the code in Strougo & Wenderlich, but wacky things are happening that I'm trying to figure out. A couple of them:
1) In the Game Center app on the device one game I bought from the app store (namely Temple Run) is showing up in the sandbox along with the game I'm trying to debug. How did that get there? I have several other app store games with game center features that don't show up so it isn't that everything on my device is showing up.
2) The game I'm developing has achievements and leaderboards. The code for submitting both seems to be working but only my achievements show up in the Game Center app. It says "No Leaderboards" instead of showing my leaderboards. However if I run the code that retrieves leaderboard information it works as expected and I get back my scores.
3) The game center app in the simulator doesn't say "No Leaderboards". It has leaderboards for my game but it says "No score". On the leaderboard detail screen it shows my rank as #1 of 1 friend and #2 of 2 players, and on the detail of that it shows the actual scores in my test game.
4) The simulator's game center app says I have no achievements even though the device's game center app shows the achievements correctly. Is the simulator's Game Center app simulating the Game Center Server and not communicating with the real Game Center server?
5) Do I count as one of my own "Friends" even though I didn't do anything to become a friend (to explain #3 above)?
6) The leaderboard screen on the device looked like it was working at first glance but I just realized that the scores it's showing are numerically wrong! What's with that? Maybe they're left over from yesterday or some other time?
1) Game Center accounts get stuck in sandbox mode sometimes, one solution is to log out from the Game Center application and log-in from the game (temple run in this case)
2) I'm having similar issues too, I think some has to do with sandBox accounts. For example I can't see any of the leader board scores uploaded when I send a score from just one device, as soon as a second device submits a score, they both appear in the leader board.
Also have you also enabled Game Center for the current version from iTunes Connect?
I know this is old, but I found an answer that helped me, and might help someone else. Also the itunes connect changed a lot through time, maybe this answer is more relevant for recent problems. I hope the OP have fixed all his issues by now.
2) This one might do the trick. 2 test accounts. iOS Game Center: Scores not showing on leaderboard in sandbox
Even having one device you can have multiple test accounts with generics emails:
https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SettingUpUserAccounts.html#//apple_ref/doc/uid/TP40011225-CH25-SW9
This answer is more about the 2 question that helped me.
But for the other ones:
1) It happened with me too. I don't know if it was because the app were open when I logged into Sandbox environment or if recent downloads apps might affect this somehow - anyways the apps show there; but it seem harmless.
3) I always hear to test on devices always, so I believe you shouldn't take simulator in consideration on this. And the answer of 2 might solve this issue as well.
4) Did you check inside the itunes connect if you have added the Achievements to the game? And I mean added, not just created. After creating you must insert them on the "Versions" tab, find the Game Center part, press "+" on Achievement. I always forget to add in-app purchases the same way.
5) As you said about "temple run" appears on your account out of the blue, maybe your test game appeared on your "not test account" somehow, but with no data GC data recorded on it.
6) Didn't understand well. Sorry about my english.
A) They are like out of regular order (high to low), or
B) the score itself is wrong? Like: you scored 7, but it shows a previous 5.
A) This happens all the time and I figure the sandbox is a lil buggy. So I double check the high score on Player Preferences and when checking I always parse the value again.
B) you can change the order of score displaying when creating the leaderboard.
https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/GameKit_Guide/LeaderBoards/LeaderBoards.html#//apple_ref/doc/uid/TP40008304-CH6-SW22
Every time I create a new game is a fight testing GC. Hope this helps anyone out there.

Supply Demand Modeling

I thought I would ask the SO community on helping me with a project that I am currently working on. I need to model the price for a widget in a market situation. The price for the widget should be a result from the current supply and demand. Users will be able to buy and sell the widget at the fixed price. As users buy the widget the demand will go up along with the price. Conversely as users sell the widget the supply will go up and the price will go down. The quantity and current price of the widget will be stored in a database along with the total number of buys and sells for the widget.
Protrade.com has an excellent example of buying and trading widgets (players and teams), I would want to model my system in a similar fashion.
Is there any good programming libraries that will accurately model a market based on supply and demand?
Unfortunately I do not know of any libraries, but perhaps you can tap into Excel's statistics functions.
My opinion follows.
This is why economics is so boring, everything is supply/demand.
Something along the lines of the following should work as a start:
ListPrice = (Cost + Profit) * (demand/supply * economic-factor)
where economic-factor is some determined constant.
If you have some historical data, eg daily supply/demand ratio's you could factor it in, perhaps using some time-based scale.

Resources