-
Notifications
You must be signed in to change notification settings - Fork 27
Compiler options
Compiler options begin with the #!
operator, not indented.
Inserts the text of the specified file. The file path can be relative; if so, it is relative to the main file. For example:
#!include "heroes/zenyatta.opy"
#!include "../main.opy"
Specifies an .opy file as the main file (implying the current file is a module). This directive MUST be placed at the very beginning of the file. For example:
#!mainFile "../main.opy"
Obfuscates the resulting code. This directive assumes all your code is in the overpy file, meaning you should not combine the generated code with code that is only in the workshop GUI.
Usage of this directive will result in a size increase, and a very low performance decrease, but should not in any case alter how the existing code functions. (if it does, please report that as a bug)
The following obfuscation methods are applied:
- Rule filling: 2500 empty rules are inserted, making it impossible to view the gamemode within the workshop UI. It must be copy-pasted to be able to be edited (you can then apply various anti copy-paste integrity checks).
- Name obfuscation: all rule titles and comments are removed, and all variable/subroutine names are replaced with a combination of capital i and lowercase L.
- String obfuscation: characters in custom strings are replaced with special characters that display in Overwatch, but not text editors.
- Constant obfuscation: some constants, such as heroes or maps, are replaced with other values that compute to the original value.
- Inspector obfuscation: the inspector is disabled, and all disable/enable inspector actions are removed.
- Copy protection: the gamemode will break upon copying it via text. It is highly recommended to enable constant obfuscation to greatly strengthen this protection.
To save elements, it is possible to specify methods to disable, by prefixing them with no
. For example, #!obfuscate noRuleFilling noConstantObfuscation
will disable rule filling and constant obfuscation, which is useful if the obfuscation adds too much elements.
Suppresses the specified warnings globally across the program. Warnings must be separated by a space. Example:
#!suppressWarnings w_type_check w_unsuitable_event
#!disableOptimizations
- Disables all optimizations done by the compiler. Should be only used for debugging, if you suspect that OverPy has bugs in its optimizations.
#!optimizeForSize
- Prioritizes lowering the number of elements over optimizing the runtime. (see #238)
Several compiler options are available to automatically replace some constants, in order to save elements:
#!replaceTeam1ByControlScoringTeam
#!replace0ByCapturePercentage
#!replace0ByPayloadProgressPercentage
#!replace0ByIsMatchComplete
#!replace1ByMatchRound
These replacements should only be used if the requirements for the replacement are met. They are detailed in the intellisense description of each compiler option.
Size optimizations must be enabled for these replacements to work (with #!optimizeForSize
).
OverPy:
- Overview
- General Usage
- General Syntax
- Rules and Events
- Functions
- Control Flow
- Strings
- Compiler Options
- Custom game settings
- Preprocessing
- Advanced Constructs
Various stuff:
Development:
- [Coming soon]