{"id":78,"date":"2021-10-15T18:10:54","date_gmt":"2021-10-15T18:10:54","guid":{"rendered":"https:\/\/arcade.netingredients.com\/discussion\/?p=78"},"modified":"2021-10-15T18:13:47","modified_gmt":"2021-10-15T18:13:47","slug":"leaderboards","status":"publish","type":"post","link":"https:\/\/arcade.monkeybusiness.games\/discussion\/general\/leaderboards\/","title":{"rendered":"Leaderboards"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Working on leaderboard(s) for all of the current and upcoming games&#8230;I was originally storing the (5) high scores in a text file on the server. It felt more portable to me. And since I was only needing to hang on to a few scores at a time, it was pretty easy to implement in this way. But now with all-time leaderboards, I&#8217;m moving to keep them in a database. Makes for easier retrieval and sorting.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And more importantly, the scores that are fed into the machines are &#8220;reset&#8221; each month. Selfishly, I wanted to be able to get my own high scores to show up on the machines (hey, I built these damn games, you&#8217;d think I would be good enough to regularly do it, but there are some people who are consistently better than I am &#8211; I&#8217;m looking at you MAT and AAA&#8230;) But I think it&#8217;ll also keep things fresh, by allowing new people to see their scores\/initials in the game high scores.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So the pseudo-query looks something like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT\n  score, name\nFROM\n  game\nWHERE\n  MONTH(datetime) = &#91;current month] AND YEAR(datetime) = &#91;current year]\nORDER BY\n  score DESC\nLIMIT\n  5<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Working on leaderboard(s) for all of the current and upcoming games&#8230;I was originally storing the (5) high scores in a text file on the server. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-78","post","type-post","status-publish","format-standard","hentry","category-general"],"_links":{"self":[{"href":"https:\/\/arcade.monkeybusiness.games\/discussion\/wp-json\/wp\/v2\/posts\/78","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/arcade.monkeybusiness.games\/discussion\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arcade.monkeybusiness.games\/discussion\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arcade.monkeybusiness.games\/discussion\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/arcade.monkeybusiness.games\/discussion\/wp-json\/wp\/v2\/comments?post=78"}],"version-history":[{"count":5,"href":"https:\/\/arcade.monkeybusiness.games\/discussion\/wp-json\/wp\/v2\/posts\/78\/revisions"}],"predecessor-version":[{"id":83,"href":"https:\/\/arcade.monkeybusiness.games\/discussion\/wp-json\/wp\/v2\/posts\/78\/revisions\/83"}],"wp:attachment":[{"href":"https:\/\/arcade.monkeybusiness.games\/discussion\/wp-json\/wp\/v2\/media?parent=78"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arcade.monkeybusiness.games\/discussion\/wp-json\/wp\/v2\/categories?post=78"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arcade.monkeybusiness.games\/discussion\/wp-json\/wp\/v2\/tags?post=78"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}