SQF Bytecode
From Bohemia Interactive Community
What is SQF bytecode?
An SQF 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, an SQF bytecode is not human-readable.
As of Arma 3 V2.04, it is possible to use SQF bytecode files (with .sqfc format) as compilation sources of in-game scripts instead of normal .sqf scripts.
Bytecode Advantages
Using bytecode, as opposed to raw scripts, has the following benefits:
- Since the script is already parsed, parsing is skipped during compilation, which reduces compilation time.
- Certain optimizations - 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.
Bytecode Disadvantages
A bytecode is not human-readable and thus cannot be easily modified.
How to use SQF Bytecode
In order to use bytecode, an SQF script compiler is needed. See Dedmen's Arma Script Compiler for an example of an SQF compiler.
To compile a SQF Bytecode using Arma Script Compiler:
- Mount the P drive
- Copy the script files into a folder on the P drive. They can be organized into sub-folders if needed.
- Download Arma Script Compiler and extract the files into a folder.
- Create a sqfc.json file in the same folder as where the script compiler's executable file is located.
- Edit the sqfc.json file according to the following template:
- Execute ArmaScriptCompiler.exe. It will compile the scripts and create an .sqfc file next to each .sqf file.
- In order to use the bytecode as compilation source in the game, use the compileScript command, or the Functions Library.