Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Game Data Files

Author
Message
Ozor Mox
21
Years of Service
User Offline
Joined: 30th Mar 2003
Location:
Posted: 13th Jun 2003 02:01
In a game I wrote, game data is read and wrote from files in a directory in program files that it sets up, mostly in LONG format. It used to store data in TXT format, but when it is stored like this it is possible for the player to open a file (such as hiscore.txt), enter a random letter in and then save it. The result is that the high score will go to about 20,000,000. I changed the file format to DAT which means you have to use open with to edit it, but it still works. Since files always go to about 20,000,000 or above, a temporary fix is to make the game detect if a file has a number greater than 10,000,000 and if it has say the file has become corrupt to avoid cheating. However, I would prefer a more permanent method of avoiding files being edited altogether or having an easier check for corruption, since it will be a problem if some files need to have numbers over 10,000,000 for the actual game.

Sorry for the (quite) long post, any help is appreciated!
Goatpuzzle
21
Years of Service
User Offline
Joined: 12th Jun 2003
Location:
Posted: 13th Jun 2003 07:58 Edited at: 13th Jun 2003 08:00
Well, you could just try scrambling the data a bit. Like, say, writing the bytes for the score in reverse. If you wanted to get a bit fancier, you could multiply the score by the ASCII value of the first character of the name a player enters, and then write every other byte, starting back at the ones you missed after the first batch.

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 13th Jun 2003 10:56
If you use the SAVE ARRAY and LOAD ARRAY commands, it encrypts it for you. You can simply have a one or two dimensional array of the info you are wanting to save.

Thanks in advance.
All the Best,
StevieVee
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 13th Jun 2003 11:12
when saving arrays ignore how many dimensions it is in DBC and just place a zero in the location of the save command where u would have placed the array dimension sizes.

androo
21
Years of Service
User Offline
Joined: 13th Jun 2003
Location: United Kingdom
Posted: 13th Jun 2003 22:45 Edited at: 13th Jun 2003 22:46
when saving, devide 1 by score and then multiply by set number (eg 41245).
When score is being displayed, undo this by deviding by set number and then again do 1 devide result.
This will avoid blatent cheating.
Also, why not save score as eg "NOTHING_IMPORTANT.txt"?
You could even add comment in that line of code so you know what its doing.

andrew11
21
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 13th Jun 2003 23:50
You could try to make a file that looks like this:



If the two at the top are edited. you could delete all data in the file and force the player to start over.

"Food is güd!" -Dean
"All programmers are playwrites and all computers are lousy actors" -Anon
Click Here!!!
Ozor Mox
21
Years of Service
User Offline
Joined: 30th Mar 2003
Location:
Posted: 15th Jun 2003 17:21
All good ideas, and I'll try them and see which works best. Thanks!

Login to post a reply

Server time is: 2024-11-24 16:32:28
Your offset time is: 2024-11-24 16:32:28