Hide game data from player?

Marco Giancotti
  • Hide game data from player? Marco Giancotti

    I'm working on my first (C++) game, and I want to use a component based design. I've read a lot about this lately and yesterday I decided I wanted to store object data in external JSON files, to allow for more flexibility and ease of access.

    Then it dawned on me that leaving these files in the game's directory tree would allow the players to modify anything they want very easily.

    I'm not worried about showing the code to developers, because the game will be open source, but I'm afraid an inexperienced gamer might break the game or at least ruin the fun.

    Am I missing something? What's the policy about hiding game data (in open source games)? Is it normal to leave everything plainly accessible to anyone?

    If not, what is a good way to hide the data?

  • You could store the data encrypted, using a symmetric encryption scheme (AES), but this is pointless: the software is opensource, so everyone can read the key and therefore decrypt the data. This would just "stop" the casual gamer from cheating.

    And it would be kind of pointless even in closed source projects, since it is quite easy to find the key into the game binary.

    So, you have two possibilities:

    1. just leave the stuff unencrypted (but at least collect the md5 hash of every file, so that you can check it at runtime against any damage in the distribution of your game);
    2. go closed-source, scramble the data (with a secret reversible multi-step algorithm like string reverse + byte swapping + xor with a constant string, etc...) and then crypt everything with AES. It will be harder for anybody to recover the data. A lot harder.

  • If players tinker and ruin the fun I would say that's their problem. For tinkerers half the fun is seeing what breaks.

    It's like getting worried that players would use a god mode cheat code and being worried that the player isn't challenged.

    I wouldn't do anything more than putting those config files in a zip file (which you should probably do anyway for loading times) and making sure your code can handle corrupted data gracefully.

  • I'm afraid an inexperienced gamer might break the game or at least ruin the fun.

    If they're meddling with the game data, then that is what they consider 'fun'. You don't need to protect them from this. Entity component data is hardly a spoiler, after all. Maybe if you had dialogue or quest data in there, it would be a problem, but probably not. Most gamers don't even know where to look for this sort of thing, never mind deliberately searching through it or editing it.

    My advice is to zip it up and rename the file extension. This will keep out the casual looker but won't be difficult for you to work with. You can use something like PhysicsFS to work with the files.

  • I would leave it. There is a huge mod community and players like changing/modding games. If they break something, it's on them. They could always reinstall.

    Also makes it easier for other developers to work with.

c++ data
Related questions and answers
  • I am trying to build and run Doom 3 from the open source release in order to better understand how the engine works. Unfortunately I am not able to run the game from the binary I built. I just get the console, but cannot run the actual game. Here is what I did: Downloaded the source code from the game repo Downloaded and installed the DirectX SDK Purchased, downloaded and installed Doom 3 from...\steamapps\common\doom 3\base\game01.pk4 (2 files) C:\Program Files (x86)\Steam\steamapps\common\doom 3\base\game00.pk4 (2 files) game DLL: 0x0 in pak: 0x0 Addon pk4s: file system initialized

  • don't want to find out in the end that I have to rewrite everything again, as a lot of other objects will be working with these data. Sorry if it's a too subjective matter, but I need some insight. I'm... them to be attached to the node in most cases, even if I allow setting global lights to the scene. @Nicol: Yes that's what I'm trying to figure out. You can see the code doesn't rely on any hardware...well... I'm building the animation system of my game engine (the skeletal and skinned animation stuff), and I came to a point where I added so much functionality in the frame and node structures

  • to be a standard OSS, especially when thinking about OOP, but since I'm not looking for complex effects and since the rendering quality of quake3 seems to be good enough to me, I wanted to ask what did the release of the quake3 engine changed for open source developpers (except the infamous invsqrt method). I heard Carmack released it for students or people alike, but C++ is here: is quake3's code...Everybody heard about the release of the Quake3 source code. But since it's plain C but uses OOP a little, isn't it too complex to decipher or to use for large projects such as a 3rd person shooter

  • Since building a game is not about 2D anymore, I just want to build a list of the (not necessarily best, but good enough) open source software available to make games. I prefer to put emphasis on libraries that insist on specializing on one part of what makes a game (like Ogre does for graphics, and OpenSteer does for steering), rather than engines/libraries that try to feature a lot of different features. 3D Graphics: OGRE3D http://www.ogre3d.org/ Irrlicht http://irrlicht.sourceforge.net/ Sound: IrrKlang http://www.ambiera.com/irrklang/ Found this: http://wiki.gamedev.net

  • Sorry for the ackward title, but i don't know what to call it exactly. I'm looking for code or libraries that allow easy creation of commonly used user input devices, and code/libs that make gaming controls easy to set up (i'm using SFML and Box2D at the moment) I don't want to re-invent things like buttons, arrows being placed wherever the mouse is located, and more game specific items such as "controls settings" or even being able to drag objects around with the mouse. More specifically i want source code for interfaces that.... Makes Buttons and Textboxes easy to create allows mouse

  • So I'm trying to start a C++, OpenGL project on Visual Studio 2010, and I have put glut.h and glut32.dll in the project directory, along with the glut.dll and glut32.lib files in a folder named "glut" in the project directory. I have also gone to "Porject Properties -> Linker -> Input -> Additional dependencies" and I have typed in "glut32.lib" at the end, and made sure I am not missing a semicolon. when I try doing #include "glut.h" in the Main.cpp file, it complains error LNK1104: cannot open file 'glut32.libkernel32.lib' Am I missing any files? What am I doing wrong here?

  • I have the book iPhone 3D Programming; this book taught be a lot about overall c++ iPhone application architecture and iPhone OpenGL ES. But a lot of the book is obviously about 3D, so most of the book wasn't that useful to me. I also have Game Coding Complete 3rd Edition; this book taught me a lot about game engine architecture but the emphasis is on c++ windows desktop game programming. I am looking for c++ 2D game engine architecture books. I'm not looking to use any frameworks; I want something more geared towards 2d c++ game engine architecture. Any suggestions? Thanks.

  • Possible Duplicate: Are there existing FOSS component-based frameworks? What open source game engines with component-based design of game objects do you know? And which best of them? I mean best not in Graphics or Physics, but best in context of Behaviour, Messaging, etc. This question is the result of inspiration by another question Thank you!!!

  • (indicating structure begin, structures end, etc.) and strings in a custom-defined format. What i want to know specifcally is how to do this with the STL and C++... Since the format is meant... to hold multiple classes and data in a single file have identifiable starts and ends to sections: such as the space in text files Maybe have it's own icon to represent it?? How do i do this in c++ ? ...Hey so i just learned about the i/o part of the STL, more specifically fstream. Although I can now save binary info and classes i've made to the hard drive, i am not sure how to define how the info