Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global hall of fame #264

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Conversation

ryfactor
Copy link
Member

@ryfactor ryfactor commented Jun 4, 2017

No description provided.

emlai and others added 13 commits March 16, 2017 22:02
- Add dependency on libcurl.
- Highscore menu now has two views: local and global scores. The enter
  key toggles between them.
- Global highscores are fetched from the server when entering the global
  highscore listing. The results are received in CSV format.
- New local scores are submitted to highscore server.
- The server URL is currently hardcoded to localhost.
Wrap in #ifndef to allow it to be easily redefined e.g. during development.
TODO: Hide it from the in-game menu.
TODO: Encrypt password for persistent storage, and don't show it as
plain-text in the options menu.
Otherwise trying to print a newline here just results in a nasty
segfault that's not immediately obvious.
Conflicts:
	FeLib/CMakeLists.txt
	FeLib/Source/rawbit.cpp
- Use HTTP Basic Auth to validate username+password combo and fetch
auth token when changing password setting.
- Send auth token when submitting high-scores for user authentication.
@andrewtweber
Copy link
Member

andrewtweber commented Oct 24, 2017

Just tested and it looks good to me.

@emlai is Heroku free? Any chance it will ever go down? Seemed pretty slow to respond when I first refreshed the page, like maybe they don't keep the site running until it is accessed or something. I'd be willing to host this on my server if you want

@emlai
Copy link
Contributor

emlai commented Oct 24, 2017

Yes Heroku has a free tier, which this is using. The free tier apps are put to sleep when unused and waking them up takes a while. You can definitely host this on your server, that would be nice!

However it is currently too easy to send a fake high-score to the server and have it accepted, and I feel like it should be made less easy before putting this into production.

@andrewtweber
Copy link
Member

Gotcha. Tough since the code for both the game and the server are open source.

@emlai
Copy link
Contributor

emlai commented Oct 24, 2017

Yep… I don't think it should try to prevent all possible misuses. Just not submitting high-scores when the data files have been modified or if running a non-release-build would be a good start, to prevent accidental fake score submissions.

@ryfactor
Copy link
Member Author

ryfactor commented Oct 24, 2017

No rush from my corner
Can we wait until it's fully featured?

Can't wait to deploy this! :)

@ryfactor
Copy link
Member Author

I've been tooling around with MSYS2 and it's a pretty complete build system for building windows binaries now, I was really surprised.
I can build the hi-score server version of IVAN, and it works really well. Only catch is I have to package all the DLLs with IVAN.exe, but this is fine as long as it's not missing anything.

As far as windows compatibility goes, I'm happy to build the binaries :)

@ryfactor
Copy link
Member Author

What if we use an IVAN quiz question, one of a hundred or so, randomly generated by the server, which appears in game and the user has to answer it to submit their score? It should prevent robots, but not weirdos who spam manually.

We could also use filters on the hi-score page to filter the scores by registered user, so even if the combined hi-score page gets vandalized by anonymous users, those scores can be filtered out.

@ryfactor
Copy link
Member Author

What about using SHA1 checksums? Some stackoverflow artcles to this end:
https://stackoverflow.com/questions/1435953/how-can-i-pass-git-sha1-to-compiler-as-definition-using-cmake
https://stackoverflow.com/questions/1704907/how-can-i-get-my-c-code-to-automatically-print-out-its-git-version-hash

We could put the SHA1 source and datafile hashes in the code at compile time and the server could match them?

@emlai
Copy link
Contributor

emlai commented Dec 25, 2017

SHA1 helps to prevent accidental fake submissions if you have modified the data files locally.

But it doesn’t help against intentional fake submissions, you can e.g. calculate the SHA1 and send an HTTP request to the server with that SHA1 and an arbitrary score (without even opening the game). And that works on a registered account too.

The only way to prevent this that I can think of is to record every keypress and send them to the server to replay and verify the playthrough with an authentic copy of the game. This would also allow us to watch replays of other people’s games which I think would be very cool. But it requires a lot of work, so:

What do you think, do we want a replay system? And do we want to first release an early-access/beta version of the high score server without the replay verification (only the SHA1 checking), and later add the replay verification when (if) we have implemented it? Or wait until the replay system is implemented and then release the high score server with it?

@ryfactor
Copy link
Member Author

It does seem like a lot of effort. What components would we need to make a replay system?
How does the server verify a game if monster generation, to take an example, is a psuedorandom process? I guess the monster generation order would also be logged? Level layout and current state is already encapsulated in bonefiles and savefiles, so I suppose we could make use of those resources.
There's always merit in "doing it once, doing it right", but there's no harm in doing it in stages in the way you mentioned. We can test the appetite for a global hiscore server from the player community using an unsecured pilot.
The other thing is that exploits might get accidentally merged in. There would definitely need to be a scrubbing tool available on the hi score server. No lack of reliable administrators on Attnam's forum though!

@ryfactor
Copy link
Member Author

What if we get the application to make a screenshot of the final moment in the game, be it victory or defeat, and get the server to check whether it is authentic using some image processing? Could check the image for player stats or death message? It's kind of done on the Attnam forums this way at the moment.
We could get the server to send a code to be watermarked into the image as well?

Come to think of it, maybe we can quickly "savefile" the game and send that to the server so that the server loads the game and plays the player's last move? Could additionally verify the final screenshot by correlation, as an example. Would need to make sure it's not too memory intensive,

@ryfactor
Copy link
Member Author

@andrewtweber I wonder if it would be easiest to secure this by hosting the hiscore app behind the forum server, such that folks need to log in to the forum to verify and post their high score?
In this way high scores remain invisible until they get claimed by a forum user. If bogus high scores surface, these can be moderated away in the normal way.
Could something like this be workable?

@andrewtweber
Copy link
Member

That'll be tough since they are written in different languages and I don't really have a (good) public API for the forum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants