Highscöre

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
thelinx
The Strongest
Posts: 857
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

Highscöre

Post by thelinx »

Disclaimer: I don't know if this name has been used before, and I will be very angry if anyone points out if it indeed has been.

As a direct response to the support thread Online high score tables, I have created a server-client combination for global high scores.
It is very easy to "hack", but as was discussed, this is a given.

Code: Select all

-- sample client code
require("highscore")
highscore.new(942, "bestest player", "normal") -- submit a score of 942 as "bestest player" to the "normal" category
scores = highscore.get("normal", 10) -- get the 10 best scores in the "normal" category
for _, score in ipairs(scores) do
  print("global position: " .. score[1])
  print("score: " .. score[2])
  pritn("player name: " .. score[3])
end
Note that you need an always-on computer with a Lua intepreter to act as the server.

Download or fork: https://github.com/TheLinx/highscore
User avatar
Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

Re: Highscöre

Post by Tesselode »

The disclaimer kind of seems like a joke, but if it's not, then here's this library made a long time ago by yours truly. Oh the irony.

Anyway, I'll play with this and see if I can figure it out. I don't have my own server, but I have my own website hosted at HostGator with MySQL and whatever other random crud I could need. I assume this will work anyway?

Edit: If you want to change the name now, I think Leaderböard would be a good name. :P

Edit 2: Wait a second, how am I going to get my site to have a Lua interpreter?
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Highscöre

Post by Jasoco »

That's what I wanted to know.

If it were me, I'd make a web server with PHP and a SQL table and have Löve submit the data to that. But I don't know how to post data to a web site in Löve.
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Highscöre

Post by nevon »

Jasoco wrote:If it were me, I'd make a web server with PHP and a SQL table and have Löve submit the data to that. But I don't know how to post data to a web site in Löve.
I'm fairly certain it's just:

Code: Select all

http = require "socket.http"

http.request('http://afancyurlindeed.com/highscores.php', 'score=79&name=Sausage%20Wrangler')
User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: Highscöre

Post by tentus »

nevon wrote:
Jasoco wrote:If it were me, I'd make a web server with PHP and a SQL table and have Löve submit the data to that. But I don't know how to post data to a web site in Löve.
I'm fairly certain it's just:

Code: Select all

http = require "socket.http"

http.request('http://afancyurlindeed.com/highscores.php', 'score=79&name=Sausage%20Wrangler')
That's what I was thinking. It might be better to use socket.http.post() though, just to be a little bit harder to fake.
Kurosuke needs beta testers
User avatar
thelinx
The Strongest
Posts: 857
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

Re: Highscöre

Post by thelinx »

Code: Select all

curl http://afancyurlindeed.com/highscores.php -d score=79 -d "name=Sausage Wrangler"
Yes, much harder to fake.
User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: Highscöre

Post by tentus »

thelinx wrote:

Code: Select all

curl http://afancyurlindeed.com/highscores.php -d score=79 -d "name=Sausage Wrangler"
Yes, much harder to fake.
In my experience as a web developer, the concept of passing data through a URL is pretty widely grasped. Certainly not everyone gets it, but a lot of people do. POST, being largely invisible to the user, is much more magical and unknown to the general populace.

Remember that a lot of score fakers will probably start by examining their recent network traffic. URLs are guaranteed to be listed. Postdata, not so much.
Kurosuke needs beta testers
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: Highscöre

Post by TechnoCat »

thelinx wrote:

Code: Select all

curl http://afancyurlindeed.com/highscores.php -d score=79 -d "name=Sausage Wrangler"
Yes, much harder to fake.
I prefer wget

Code: Select all

$ wget --post-data="score=79&name=Sausage Wrangler" http://afancyurlindeed.com/highscores.php
The best anti-cheat highscore system I've ever read is a replay type thing (I think I read about it in Super Meat Boy). The server gets a score and a list of events and it replays it to validate it. This doesn't prevent people from botting perfect scores, but it at least doesn't allow you to just insert a huge number for the score and send it over. However, I'm guessing this method requires a constant dt.
User avatar
slime
Solid Snayke
Posts: 3166
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Highscöre

Post by slime »

wget isn't available by default on OS X, but curl is.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: Highscöre

Post by TechnoCat »

slime wrote:wget isn't available by default on OS X, but curl is.
That is messed up.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests