Page 1 of 1
Highscöre
Posted: Mon Jul 25, 2011 3:34 am
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
Re: Highscöre
Posted: Mon Jul 25, 2011 5:20 am
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.
Edit 2: Wait a second, how am I going to get my site to have a Lua interpreter?
Re: Highscöre
Posted: Mon Jul 25, 2011 5:49 am
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.
Re: Highscöre
Posted: Mon Jul 25, 2011 7:34 am
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')
Re: Highscöre
Posted: Mon Jul 25, 2011 1:36 pm
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.
Re: Highscöre
Posted: Mon Jul 25, 2011 1:53 pm
by thelinx
Code: Select all
curl http://afancyurlindeed.com/highscores.php -d score=79 -d "name=Sausage Wrangler"
Yes, much harder to fake.
Re: Highscöre
Posted: Mon Jul 25, 2011 2:00 pm
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.
Re: Highscöre
Posted: Mon Jul 25, 2011 2:10 pm
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.
Re: Highscöre
Posted: Mon Jul 25, 2011 2:27 pm
by slime
wget isn't available by default on OS X, but curl is.
Re: Highscöre
Posted: Mon Jul 25, 2011 2:39 pm
by TechnoCat
slime wrote:wget isn't available by default on OS X, but curl is.
That is messed up.