High Scores

BlitzMax Forums/BlitzMax Beginners Area/High Scores

Steve The Rock(Posted 2008) [#1]
How can I save my high scores so no one can change them. I'm saving them in a text file at the mo using this code ,but would like something better. Any ideas?

success=CreateFile("high.txt")
If Not success RuntimeError "error creating file"

file=WriteFile("high.txt")

If Not file RuntimeError "failed to open test.txt file" 

For i=0 To 9
	For j=0 To 1
	WriteLine file,highscores$[i,j]
	Next 
Next 

CloseStream file



Zethrax(Posted 2008) [#2]
Try encoding them using MD5 or a similar encoding format. Links below.

http://en.wikipedia.org/wiki/Md5
http://code.wikia.com/wiki/MD5_Checksum


Perturbatio(Posted 2008) [#3]
MD5 isn't reversible unless you have a lookup table as well (which is a tad pointless).

MD5 isn't encryption (although it can be used in a manner similar for the purposes of passwords and the like).

I'm sure there was a blowfish module kicking around somewhere. Might even have been one of Brucey's


MGE(Posted 2008) [#4]
I wouldn't even worry about it to be honest. If you're going to worry about this, then you're going to love worrying about those that change memory locations to increase high scores, levels, etc. ;)


DavidDC(Posted 2008) [#5]
you're going to love worrying about those that change memory locations

Yes it is a dark path once you venture down it! Adding a checksum of some sorts is a simple way to go to stop *very* casual cheating. Stopping those who make cheating their hobby is very difficult indeed.


tonyg(Posted 2008) [#6]
Can one of the XML modules create compiled XML? Can you zip it and add a password?


plash(Posted 2008) [#7]
OR you could use RC4 encryption ( http://www.blitzbasic.com/codearcs/codearcs.php?code=1711 ) to save your data. Not the best, but unless your player is a genius/program hacker theres no way he/she is going to change the data.


Yahfree(Posted 2008) [#8]
Another option would be to use a different format (maybe make your won like *.data?) and write raw ints and strings to the file, from my experiences, those seem all jumbled up and junk when you look at them through a text editor.


Paul "Taiphoz"(Posted 2008) [#9]
All you will do is prevent the people who dont want to cheat anyway, from cheating at your game.

The people that really want to will be able to cheat no matter what you do.

For Example, if you MD5 the score only. the cheat will simply make up a new score number, and then MD5 it, and then overwrite his old crappy Score.

If you MD5(salt kinda) the score with something else, like the player name or date or some other additional information then the cheat will debug your code to asm, find the part's he needs to work out what your doing and then just replace your score code again.

the point I am making here is that no matter what you do, if a player of your game really wants to cheat, then he will.

Even holding your scores in an online database isnt 100%.


Czar Flavius(Posted 2008) [#10]
Here's an unusual idea that I'm spinning of the top of my head. Output the highscores, then encrypt the exe (or vital parts of it) using the high score data. Then when the program is next ran, if the highscores have been changed, then the program will not decrypt correctly and will not run.


Muttley(Posted 2008) [#11]
Have a look at my ScoreHandler module, here:

ScoreHandler Module

I do optional encryption when saving using RC4 and it has a bunch of other benefits as well.

Muttley


JazzieB(Posted 2008) [#12]
Here's an unusual idea that I'm spinning of the top of my head. Output the highscores, then encrypt the exe (or vital parts of it) using the high score data. Then when the program is next ran, if the highscores have been changed, then the program will not decrypt correctly and will not run.

That's actually very similar to what I am doing with my current project. The scores are part of the level file though, and not the EXE. This information is used as one step to create a random key that is used to encrypt the rest of the level file. Mess with the high scores and you screw up the level data ... either causing the game to crash or end up with garbage for levels.