Protecting Game Data

Discussion in 'Game Development (Technical)' started by datxcod, Jan 31, 2006.

  1. datxcod

    Original Member

    Joined:
    Dec 16, 2005
    Messages:
    98
    Likes Received:
    0
    Greetings

    I just want to say that I've been a passive user of this board for some time but just recently made an account.
    I'm just going to paste here what I posted in gamedev, I got some answers but I want your opinion.

    I'm finishing a game.

    Everything was going smooth but then I realized I got a bunch of images and sounds in folders that anyone can easily modify.

    So I started searching for methods of protecting game data.
    I thought about packing everything as a resource file but then I would have a big exe. I also found some encryption methods like XORing everything (easiest one) using a key.
    I understand how to implement the code but I'm not sure how to encrypt sounds/images files using that (should I make a separate program for that?), I guess that means that the program has to decrypt everything at runtime (?)

    Also I thought about implementing a PAK file format like most ID games, (yes, I read the article in gamedev, it's good but not finished) but I couldn't find tuts or some clear explanations, I mean I understand everything but I'm not sure about the part where the program has to extract everything to a temp folder and dinamically load everything or allocate byte sized arrays the same size as the file I want to use and copy the file to that array.

    Right now I'm thinking of encrypting everything using a XOR algorithm, because the PAK file format seems like overly complicated for a normal game.

    So the question is: do you know of any good ways of protecting game data ? or you just don't worry about someone modifying the data ?.

    Thanks in advance
     
  2. Savant

    Original Member

    Joined:
    Feb 8, 2005
    Messages:
    1,674
    Likes Received:
    0
    id Software's PAK files are simply renamed ZIPs. You can open them and grab anything you like.

    PopCap simply dumps everything into the directory structure - nothing is obfuscated.

    My advice? It's not worth worrying about.
     
  3. datxcod

    Original Member

    Joined:
    Dec 16, 2005
    Messages:
    98
    Likes Received:
    0
    Yes I know PAK files are just renamed zips but the game somehow knows the exact size of the data so even if you extract everything you can't modify it.
     
  4. Savant

    Original Member

    Joined:
    Feb 8, 2005
    Messages:
    1,674
    Likes Received:
    0
    Again, you would have a hard time convincing me that it's worth worrying about. What's so wrong with someone modifying your game data?

    Unless you're running a contest with valuable prizes attached, very few people are going to bother cheating. If any bother at all. IMO, it's development time that could be spent on something else.
     
  5. Chozabu

    Original Member

    Joined:
    Nov 30, 2005
    Messages:
    30
    Likes Received:
    0
    Why do you want to stop the data being changed? quite a few games, ive bought only so that i can change them...

    although depending on how youre loading you data, checking the size, or a checksum could be an easy method.
    or perhaps a passworded compressed archive?
     
  6. Anlino

    Original Member

    Joined:
    Aug 31, 2005
    Messages:
    381
    Likes Received:
    0
    I agree with Savant. If someone buys a car, they are free to smash it to pieces, if that's what they want to do.

    They bought the game/downloaded the demo, so if they want to modify it, let them! The only one suffering from it, are themselves. This is just my personal opinion though. If you want to protect the data too restrict anyone from using your content for games or whatever, then that is another question.
     
  7. PoV

    PoV
    Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    2,132
    Likes Received:
    0
    I've been back and forth with this issue for years. Right now, I'm sitting somewhere inbetween. With a small game, I think it's worth protecting the title screen, or any screens that contain the developer or publisher information/logos/credits. You're not going to want some guy to take your hard work and claim credit for it by painlessly changing it. Casual gaming is the big boom of the game industry right now, so anythings possible. It hasn't happened yet (that I'm aware of), but some mischievous individual could theif the dot com's you neglected and easily hack you out of your game, and put it on *other* portals.

    But, all I suggest is doing something. Rename the file extension and file size check them at a minimum. Or 1 step better, frag the "Magic Number" or identification information in the file format ("PNG", "IHDR", "RIFF"), and restore it before/as it's loaded. Or even use an abscure file format you have or can easily write a loader for.

    Now, the rest of the assets, sure, leave them. If your game is freeware, then you'll get mail from people asking to borrow your game art. Been there, and it's a nice compliment to the artist.
     
  8. Savant

    Original Member

    Joined:
    Feb 8, 2005
    Messages:
    1,674
    Likes Received:
    0
    I haven't been attacked by a tiger either, so this tiger repellant must be working.
     
  9. Mike Wiering

    Original Member

    Joined:
    Jul 28, 2004
    Messages:
    246
    Likes Received:
    0
    Happened to me a long, long time ago with a mario clone I wrote. It didn't have a title screen or anything, but some guy added a program around it with a title screen and a message at the end, readme files and a registration form, etc. Years later I found my own game on a shareware CDROM!

    But to stay on the topic, I don't like the idea of people being able to browse through ending screens, images of all possible sprites, etc. without having to play the game. It's just like being able to edit the high scores with a text editor. Why play the game anymore?
     
  10. Savant

    Original Member

    Joined:
    Feb 8, 2005
    Messages:
    1,674
    Likes Received:
    0
    Because ... it's fun?
     
  11. datxcod

    Original Member

    Joined:
    Dec 16, 2005
    Messages:
    98
    Likes Received:
    0
    Exactly, I don't like that either. I've seen some BigFish games where you can easily edit the logos and other game elements. So can I get some insight on how to protect my data ? what methods do you use ?
     
  12. Savant

    Original Member

    Joined:
    Feb 8, 2005
    Messages:
    1,674
    Likes Received:
    0
    I can't believe that you're still concerned about this if a company like PopCap isn't. Oh well...
     
  13. joe

    joe
    Original Member

    Joined:
    Sep 28, 2004
    Messages:
    420
    Likes Received:
    0
    Probably that's the reason why pop cap is able to finish their games - because they don't need to write that super encryption alogrythm, but instead they have the time to finish their games...

    ok... just kidding... :D
     
  14. datxcod

    Original Member

    Joined:
    Dec 16, 2005
    Messages:
    98
    Likes Received:
    0
    Ok I guess I shouldn't bother.

    I'll dump all the game graphics into a folder.
     
  15. Anlino

    Original Member

    Joined:
    Aug 31, 2005
    Messages:
    381
    Likes Received:
    0
    I hope you know that we are all posting our personal opinion here - we don't set business standards:) Seriously, it is ultimatley up to you. If you wan't your data to be secure, and your game to be intact, then encrypt everything. If you are in a hurry, or you don't feel like it is worth the trouble, then skip the encryption. Do what feels best for you. I am afraid i can't help you with programs for encryption though, becuase i haven't finished my current, and first, Shareware game yet.

    Do what feels best for you, and ignore us if you want to, becuase ultimatley, it is all about personal preferences.
     
  16. datxcod

    Original Member

    Joined:
    Dec 16, 2005
    Messages:
    98
    Likes Received:
    0
    Yes, I know those are personal opinions. But since most of you are experienced casual game developers :) , I guess I should take your advice.
     
  17. Ryan Clark

    Indie Author

    Joined:
    Oct 29, 2004
    Messages:
    656
    Likes Received:
    0
  18. joe

    joe
    Original Member

    Joined:
    Sep 28, 2004
    Messages:
    420
    Likes Received:
    0
    You can also pack your game date in one big ZIP and protect this ZIP with a password. Then you can use a ZIP-Library to read the data (graphics, music etc.) out. It should be rather easy.
     
  19. joe

    joe
    Original Member

    Joined:
    Sep 28, 2004
    Messages:
    420
    Likes Received:
    0
  20. PoV

    PoV
    Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    2,132
    Likes Received:
    0
    Alright. But once you've been cloned, you see things a little differently.

    I'm having some fun, so a proof of concept. Here's comes the tiger. ;)

    http://junk.sykhronics.com/misc/drgerman/drgerman.jpg
    http://junk.sykhronics.com/misc/drgerman/splash.png
    http://junk.sykhronics.com/misc/drgerman/

    The first is obviously a joke, but given all the talk of parasidic game development, you could reskin such an open a game. Block a vital image file and you're home free. I think the 2nd one is a more serious issues. Painlessly, I changed the link from drgermgame.com to dr-germ-game.com, a domain that convieniently isn't taken. On the forum we've discussed people nabbing domains like this and getting affiliate sales. With a little rebranding, you could have it all.

    An absolutely no effort way to deter this, call the important .png files .img or .dat files. Easy. It's still as hackable, but if I can't double click on it, I might not notice.
     

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer