Thread: Advice for securing text files?

  1. #1
    Registered User
    Join Date
    Sep 2008
    Posts
    42

    Advice for securing text files?

    Hello All,

    My program utilizes text files to load data like weapons, rooms, monster information. I can't have player's opening the files and editing them.

    Does anyone have any advice on what to do about preventing players from opening up the text files used by the game?

    I could not find any threads on this. Maybe I'm not searching well enough. Any advice would be great. I'm doing all of this in C with Visual Studio 2017.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    37,490
    Well the short answer is you can't.

    All you can do is raise the bar by employing various encoding and encryption techniques.

    But ultimately, whatever is needed to decode it is buried in your program. If someone is determined enough, they will find it and make a level editor.

    Why not embrace the possibilities and make it easy for players to design their own levels?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Banned
    Join Date
    Aug 2017
    Posts
    861
    Binary files is a thought. Or look into how other games protect their files from being modified.

  4. #4
    Registered User
    Join Date
    Sep 2008
    Posts
    42
    I thought about binaries. I'll have to research that.

    I thought about people editing for their own purposes, but I would want them to first play the game as intended instead of modifying the monsters and items to their benefit.

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    27,164
    I think that generally the approach where it matters is to have a client/server model where the important stuff you don't want the user to touch is put on the server, though in practice that has its limitations since for speed the important stuff might need to be cached on the client anyway.

    The binary file approach is basically yet another form of obfuscation, and so it could be cracked. Encrypting the file would probably be simpler (since you don't need to come up with an obfuscated binary file format; the encryption/decryption becomes just another stage in your save/load process) and arguably more secure since then you're burying the encryption key in yet another binary file, i.e., your program, though as Salem noted this just raises the bar in obfuscation rather than actually making the data secure.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    37,490
    I would suggest you concentrate on making an enjoyable experience for the 99.9% who will play your game out of the box regardless of what you do, than waste time worring about a minority who won't bother if your game is crap to start with.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  7. #7
    Banned
    Join Date
    Aug 2017
    Posts
    861
    Quote Originally Posted by edomingox View Post
    I thought about binaries. I'll have to research that.

    I thought about people editing for their own purposes, but I would want them to first play the game as intended instead of modifying the monsters and items to their benefit.
    you know that really takes the fun out of hacking, and mods to the game. Look at doom and its other games. you could even set it up for long term to write another package one needs so they can hack your game and make mods to it. think long term.

    and yeah what Salem said. I'm sure you can get it to be market ready then put your improvements on it later in what are called upgrades.Then do as they do put them needed changes in after you've completely figured out that part later.
    Last edited by userxbw; 12-15-2017 at 10:45 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Securing files through Encyption
    By JonathanS in forum Tech Board
    Replies: 10
    Last Post: 05-10-2012, 03:20 PM
  2. Need some advice executing 2 files at once.
    By Ereshkigal in forum Game Programming
    Replies: 0
    Last Post: 09-03-2011, 08:13 PM
  3. Securing .Net code (the 3rd party conundrum)
    By Mario F. in forum Tech Board
    Replies: 24
    Last Post: 03-07-2011, 01:55 PM
  4. Securing data?
    By canpakes in forum C++ Programming
    Replies: 2
    Last Post: 07-24-2009, 03:52 PM
  5. Need Advice in reading files
    By jon in forum C Programming
    Replies: 4
    Last Post: 10-07-2001, 07:27 AM

Tags for this Thread