# Packaging Files in Your Executable

It is possible to include a BGT pack file inside a compiled game executable. This means that you can ship an arbitrary number of files that you do not wish to store separately on disk, as part of the program itself. In order to do this, follow the steps below:
1. Generate a pack file using the pack_file object in the engine. In this pack you store all the files that you wish to include in the final executable.
2. In your script code, write:
#include "packname.dat"
Replace packname.dat with the name of the pack that you created in step 1. The engine automatically detects whether a given include file is a pack, or a regular script file. Note that you may not include more than one pack file in each BGT game.
3. When it is time to access the pack file, simply specify * as the pack file name wherever the name of the original pack file would normally have been given. For example, at the start of the main function you might write:
set_sound_storage("*");
If you run this script from source, the sounds will be searched for in the pack file on disk just as if you had specified the name that you gave in the include statement. However, when this script is compiled into an executable it will refer to the contents of the pack file that is stored inside the program itself.
You may access the contents of the pack directly using the pack_file object, as follows:
pack_file pack;
pack.open("*");
The same rule as above applies regarding execution of the script from source as opposed to when it is being run as an executable. In short, whenever a script is run from source the pack file that was included will be accessed directly on disk.
4. You may now compile your script, and the given pack file will be included along with your compiled game code in the resulting executable. As mentioned above, * should be used wherever the real pack file name would have been specified if you wish to access the pack inside the program.