At some point while creating your game it will be necessary to
store information externally and be able to retrieve this
information. For example, you may wish to store login details, or
hi-scores, or maybe the progression of the player through your
levels. Whatever the reason, you will need to know how to use the
different file functions that are available to you when working
with GameMaker: Studio.
It is very important to realise that GameMaker: Studio is
Sandboxed, meaning that there are a number of limits and
minor complications when using the file system functions that are
available, and it is worth noting too that the file system will
work slightly differently depending on the platform you are
targeting. For more information this, please see the following
section:
If you have been granted permission by Steam to use their
dedicated API with your game, you will find that there is also a
new set of file functions available to you. These are explained in
the Steam API section of
this manual.
Information on the different file functions can be found in the following pages:
Obviously, there will be moments when you need to reference the directory in which files are store and GameMaker: Studio also has some special functions relating to the different possible directories that you may need:
When dealing with external files, there is always the possibility that the end user could open and change the information that they contain, and so change your game. This can result in broken game-play elements or fraudulent scores on-line (for example), and so GameMaker: Studio provides you with some basic encoding functions as well as functions to perform md5 checks on strings and files to make sure that they have maintained their integrity before being used. There are also two functions supplied for encoding and decoding JSON (JavaScript Object Notation) format strings.
NOTE: Encoding is NOT encryption! A base64 encoding
renders the file unreadable to the naked eye and will require an
effort on behalf of the user to decode, but it is not secure from
hacking. It is recommended that you mix those functions with your
own encryption (there are many forms of encryption and scripts are
available on the internet).
GameMaker: Studio permits you to open a zip file and extract its contents to the local storage area for your game, using the following functions (useful should you have downloadable content for your game):