---
name: "SQF Bytecode"
type: topic
source: https://community.bistudio.com/wiki/SQF_Bytecode
revid: 370227
updated: 2024-11-12T18:44:27Z
---

# SQF Bytecode

An [SQF](../topics/SQF_Syntax.md) [bytecode](https://en.wikipedia.org/wiki/Bytecode) is a file that contains the instructions to be executed in an SQF script.
The bytecode is obtained after parsing the SQF script, which is written in a human-readable text-based file. Unlike an SQF script, SQF bytecode is not human-readable.

As of Arma 3 v2.04, it is possible to use SQF bytecode files (with the `.sqfc` extension) as compilation sources of in-game scripts instead of normal .sqf scripts, using the [compileScript](../commands/compileScript.md) command.
The [Functions Library](../topics/Functions_Library.md) has also been modified to use this command.

**Using bytecode as opposed to raw scripts**

| Pros | Cons |
|---|---|
| - Since the script is already parsed, parsing is skipped during compilation, which reduces compilation time. This improvement can be quite significant if the script uses [PreProcessor Commands](../topics/PreProcessor_Commands.md).<br>- Certain optimisations - that would take a long time to detect by the in-game compiler - can be detected and included in the bytecode, which improves execution performance. | - A bytecode is not human-readable and thus cannot be easily modified. |

### How to use SQF Bytecode

In order to use bytecode, a SQF script compiler is needed. See [Dedmen's Arma Script Compiler](https://github.com/dedmen/ArmaScriptCompiler) for an example of an SQF compiler.

To compile an SQF script into SQF Bytecode using Arma Script Compiler:

1. Mount the P drive (called "Mount the Project Drive" in [Arma 3 Tools](../topics/Tools_Installation.md))
1. Copy the script files into a folder on the P drive. They can be organized into sub-folders if needed.
1. Download [Arma Script Compiler](https://github.com/dedmen/ArmaScriptCompiler/releases) and extract the files into a folder.
1. Create a **sqfc.json** file next to the script compiler's executable file (**ArmaScriptCompiler.exe**).
1. Edit the **sqfc.json** file according to the following template:

   ```json
   {
       "inputDirs": [
           "P:/folder1/",
           "P:/folder2/"
       ],
       "includePaths": [
           "P:/"
       ],
       "excludeList": [
           "subfolder1",
           "subfolder2",
           "subfolder3/subfolder4"
       ],
       "outputDir": "P:/",
       "workerThreads": 8
   }
   ```
   - inputDirs: List of folders that should be searched for .sqf scripts. Search is performed recursively (sub-folders are searched as well)
   - includePaths: list of paths that contain the [#included](../topics/PreProcessor_Commands.md#include) files into the scripts. This should be set the same as the P drive path `P:\` to work correctly. If an external file is being [#included](../topics/PreProcessor_Commands.md#include) by the .sqf script, such as `#include "\a3\ui_f\hpp\definedikcodes.inc"`, you need to create that file on the P drive, such as: `P:\a3\ui_f\hpp\definedikcodes.inc`
   - outputDir: Set this the same as P drive if you want the .sqfc files to be created next to each .sqf file.
   - excludeList: List of folders to be excluded from searching.
   - workerThreads: How many threads will compile the scripts. Each thread will compile one file at a time
1. Execute **ArmaScriptCompiler.exe**. It will compile the scripts and create an **.sqfc** file next to each **.sqf** file.
1. In order to use the bytecode as compilation source in the game, use the [compileScript](../commands/compileScript.md) command, or the [Functions Library](../topics/Functions_Library.md).

<sub>Source: [BI Community Wiki — SQF Bytecode](https://community.bistudio.com/wiki/SQF_Bytecode) (revision 370227).</sub>
