Jump to content
  • Advertisement
Sign in to follow this  
programwizard

Hiding Resources

This topic is 4517 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How is it that comercial PC games are able to keep you from seeing their graphics and sound files? Whenever I build a game that uses external files, all files have to be in the same directory as the executable, otherwise the program just crashes.

Share this post


Link to post
Share on other sites
Advertisement
They normally keep thier resources in some sort of custom file format. Resource Files Explained seems to give a good explanation of it along with a sample implementation you can look at - I'm sure you can find plenty of other articles if you try, that was the first one I came across with a quick Google on the topic.

A quick way of doing this that people often use is to write code to load your resources from a zip (or other compressed) file, and then simply rename the extension to something else. You can also try encrypting your resources, but if someone wants to get to them they will, so don't spend too much time worrying about it for that reason - the better reason why you'd want to do it is because it's neater, and you may be able to reduce your overall filesize a bit.

Share this post


Link to post
Share on other sites
Well they may use proprietary formats for their resources which you'll be unable to open unless you have the right tools. Many games also use a pak-style file which is basically just like a big zip file that contains a whole load of files. PhysicsFS is a library that you can use to setup this kind of system.

Quote:
all files have to be in the same directory as the executable, otherwise the program just crashes.


All programs have what's called a working directory, when you specify a path in your program unless it's absolute (e.g. C:\Dir\File or in Unix /dir/file) it's relative to the current working directory. So if your program is run from a directory which has subdirectories named music and graphics you can access the files in those directories within your program by using paths like 'music\file' and 'graphics\file'.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!