PBO Tools includes a built-in code obfuscation feature designed to protect your mod's code from being easily read or copied. By default, this feature only obfuscates strings. However, with the correct naming conventions, you can extend obfuscation to include functions, variables, and classes.
How It Works
When enabled, the obfuscation process will:
Obfuscate all string literals in your code.
Obfuscate additional code elements if they use specific prefixes.
To include functions, variables, or classes in the obfuscation process, use the prefixes listed below when naming them.
Obfuscation Prefixes
To mark a code element for obfuscation, name it with the appropriate prefix:
Variables:obfv_
Functions/Methods:obfm_
Classes:obfc_
Example
void obfm_CheckServer(string obfv_ip)
{
Print("Connecting to: " + obfv_ip);
}
In this example:
obfm_CheckServer will be obfuscated as a function.
obfv_ip will be obfuscated as a variable.
The string "Connecting to: " will also be obfuscated.
Print remains unchanged as it is a base game function and should not be touched.
If you have two or more mods that rely on each other (e.g.AirdropClient and AirdropServer), and you want them to share the same obfuscated variable, function, and class names, follow these steps carefully:
Create a new folder in your P Drive. Name it something like Airdrop.
Move your dependent mods into this folder. For example:
P:\Airdrop\AirdropClient
P:\Airdrop\AirdropServer
Drag the entire Airdrop folder into PBO Tools.In the options, make sure the following are enabled:
- PBO Obfuscation
- Code Obfuscation
- (Optional) Remove Comments
Close PBO Tools once itβs finished.
Delete the .pbo file that was created.
Youβll now see a folder named Airdrop_obfuscated.
Inside, both AirdropClient and AirdropServer will be obfuscated with the same naming map.
Now, to pack the mods individually, you can process AirdropClient and AirdropServer from inside the Airdrop_obfuscated mod separately in PBO Tools, but:
- Do not re-enable Code Obfuscation.
- You can still enable PBO Obfuscation.
Best Practices
Do not obfuscate any vanilla DayZ methods, variables, or classes.
Avoid obfuscating cross-mod elements (e.g. shared class names across different mods), as each modβs obfuscation is handled separately and may conflict.
Always test your mod thoroughly after obfuscation to ensure functionality is preserved.