Releases: cardillan/mindcode
3.16.3
3.16.3 – 2026-06-02
Fixed
- Fixed an internal error when using a built-in variable as an array index (#316).
- Fixed a case statement with an expression causing an internal error (#318).
- Fixed a procesor emulator error in handling the
setrateinstruction, rendering it ineffective.
Added
- Added support for displaying emulated game time spent by the processor emulator.
- Added new
processor-size-limitandreformat-mlogcompiler options. - Added a limit on the maximum generated processor configuration size, specified by the
processor-size-limitoption. When the generated mlog code exceeds this limit, an error or warning is generated, depending on the value of theenforce-size-limitscompiler option.
Changed
- Breaking: the
enforce-instruction-limitoption has been renamed toenforce-size-limits. - Changed the web app to use the new MlogWatcher API.
- Changed the Expression Optimization to handle integer division by one the same as the
op floorinstruction. - Changed the mlog parser to raise an error when the code contains duplicate labels, regardless of the processor version. This behavior matches the latest Mindustry version; in older Mindustry versions the code is still accepted.
- Changed the Expression Optimization and Array Optimization to remove an
op floorinstruction when applied to the array index. - Changed the Expression Optimization: when the
op roundinstruction is available, a sequence ofop addandop floorinstructions (as infloor(x + 0.5)) is replaced with theop roundinstruction (as inround(x)). - The variable reference index is recreated before each optimization, potentially allowing more optimizations to be performed.
3.16.2
3.16.2 – 2026-04-25
Fixed
- Fixed incorrect decompilation of a
readinstruction reading a character value from a constant string in Mlog Decompiler.
Added
- Added support for the new
bulletinstruction and for the new sensable/settable properties (@pingX,@pingY,@pingText,@bulletLifetimeand@bulletTime). - Added support for the new
queryinstruction and the@queriesbuilt-in array.
Changed
- The default compiler target is now
8m.
3.16.1
3.16.1 – 2026-04-12
Fixed
- Fixed incorrect Condition Optimization (#307).
Added
- Added a limit on the maximum length of mlog string literals (65,535 bytes in UTF-8 encoding). String literals larger than this limit cause compilation errors.
- Added a limit on the maximum generated mlog code size (102,400 bytes in UTF-8 encoding). When the generated or loaded mlog code exceeds this limit, an error or warning is generated, depending on the value of the
enforce-instruction-limitcompiler option. - Added support for the new
setrule pauseDisabledinstruction.
Changed
- The new version of the Mlog Watcher mod is now used by default by the tool app.
- Updated the Mindustry metadata to the latest version, adding the new
@large-canvasblock.
3.16.0
3.16.0 – 2026-03-06
Changed
- The
targetattribute specified in a Schemacode definition file now expects only the version number (e.g.,target = 8.0). The processor type cannot be specified using thetargetattribute, but is inferred from the block type in the schematic. - The web application has been completely overhauled. The highlights of the new web app are:
- Modern, mobile-friendly design.
- The compilation happens without page refresh, meaning the edit history of the code is not lost on compilation. It is also possible to undo (
Ctrl-Z) the action of loading an example code or clearing the editor. - Syntax highlighting in the source code editor. All syntaxes (Mindcode including mlog blocks, Schemacode) are supported.
- Code folding in all source code editors.
- Indicating syntax errors from the last compilation directly in the editor.
- Support for running schematics and generic mlog code on the built-in processor emulator.
3.15.1
3.15.1 – 2026-02-28
Fixed
- Fixed compiler crashing when an unsupported combination of a processor version and a processor type is specified (e.g.,
#set target = 6;). - Fixed wrong handling of linked blocks by the DFO (#303).
- Fixed Boolean Optimization bugs (#304):
- The optimization may crash when compiling for targets 8.0 and lower.
- The optimization incorrectly processes some noninteger values.
3.15.0
3.15.0 – 2026-02-22
Note
Atomic code sections are only guaranteed to execute correctly in Minddustry build 155 Beta or later.
Note
The new Mlog Watcher functionality available with the tool app requires a new version of the Mlog Watcher mod. The new version has not yet been released, but a Mindustry 8-compatible binary is available here. To use that version, the --watcher-version v1 command line argument must be specified.
Fixed
- Fixed a possible error in the tool app handling command-line parameters (#302).
Added
- Breaking: the
loopkeyword has been reintroduced, to create infinite loops. Code that usesloopas a function or variable name will not compile, and the variable or function will have to be renamed. - Added the possibility to use the
breakstatement to exit code blocks. - Added implicit labels to loops and code blocks.
Changed
- Breaking: Changed the meaning of the
targetcompiler option: when no processor type is specified, the compiler generates the code for a non-processor context. Privileged instructions are supported, but atomic sections and waits aren't.
3.14.0
3.14.0 – 2026-02-08
Note
Atomic code execution are only guaranteed to execute correctly in the latest BE version (build 26658 or later). The latest beta release (v154.3) doesn't provide necessary support for atomic code execution.
Note
The new Mlog Watcher functionality available with the tool app requires a new version of the Mlog Watcher mod. The new version has not yet been released, but a Mindustry 8-compatible build is available here. To use that version, the --watcher-version v1 command line argument must be specified.
Fixed
- Fixed an internal error when compiling a function in the main program declared as
export. - Fixed incorrect Temp variable elimination (#298).
- Fixed a possible internal error when parsing a syntactically incorrect file.
- Fixed incorrect handling of some privileged instructions by the Print Merging optimization (#300).
- Fixed incorrect handling of function calls in short-circuit expressions by the Data Flow Optimization (#301).
Added
- Added the
atomic()intrinsic function andatomicfunction modifier. - Added support for nested atomic sections and atomic function calls from an atomic section. The entire topmost atomic section is executed atomically.
- Added support atomic section merging. The duration limit of a merged section can be specified using the
atomic-merge-levelcompiler option (one tick by default). - Added a
atomic-safety-margincompiler option. No safety margin is necessary with the latest Mindustry BE build, though. - Added new tool app functionalities:
- Support for the new version of Mlog Watcher mod, providing several useful new ways to send or extract mlog code and schematics to/from a running game. To use the new Mlog Watcher mod, the
--watcher-version v1command-line argument needs to be specified. - Ability to execute mlog code loaded from a file on the processor emulator and for sending it to the Mlog Watcher. Use the new
pmorprocess-mlogcommand-line argument. - Ability to execute schematics loaded from a file on the processor emulator and for sending it to the new version of the Mlog Watcher. Use the new
psorprocess-schematiccommand-line argument.
- Support for the new version of Mlog Watcher mod, providing several useful new ways to send or extract mlog code and schematics to/from a running game. To use the new Mlog Watcher mod, the
- Added a validation step to the compiler to verify the generated code doesn't exceed the maximum number of instructions. The
enforce-instruction-limitcompiler option can be used to control this behavior.
Changed
- When an atomic section doesn't contain any protected instruction, the
waitinstruction providing the atomicity of the section is not generated. - The
setrateinstruction is no longer allowed in atomic sections. - The
volatile-atomiccompiler option has been renamed toatomic-full-protection, with inverted meaning. - Changed Mindcode syntax to allow specifying multiple function modifiers in arbitrary order. For example, it is now possible to declare a function as
inline debugas well asdebug inline(which was the only allower order previously). - Compiler and optimizer messages are no longer output on the console in the command-line application. To access these messages, a log file needs to be generated.
- Console output is generated on the fly, instead of being cached and dumped all at once when the processing is finished.
Deprecated
- The
dm(decompile mlog) andds(decompile schematic) command-line arguments are deprecated. Usepmandpsinstead ("p" stands for "process" as the command-line tool now allows more actions to be performed in addition to decompilation, such as running it on the internal emulator). - The Schematics Refresher mod is deprecated and will be no longer maintained. The Mlog Watcher mod will provide better functionality for managing schematics in the game.
3.13.0
3.13.0 – 2026-01-18
Note
The atomic code blocks are only guaranteed to execute correctly in the latest BE version (build 26609 or higher). The latest beta release (v154.3) doesn't provide necessary support for atomic code blocks.
Fixed
- Fixed incorrect emulation of the instruction accumulator for targets 6 and 7 affecting instruction scheduling.
Added
- Added new
@maxUnitssensable property. - Added an atomic code block: a block of code guaranteed to be executed atomically (without interruption), meaning that other processors or game updates do not change the world state.
- Added the
setrateandiptcompiler options. These options specify the rate at which a world processor executes instructions (used by the compiler when building atomic blocks). - Added the
volatile-atomiccompiler option governing the way atomic blocks are created. - Added the
processor-id,program-nameandprogram-versioncompiler options. These options take string values, which are then encoded into a*idvariable and can be used to identify the processor in the schematics. - Added the
emulator-fpscompiler options to specify the frame rate to be emulated by the processor emulator. While frames are always emulated fully by Mindcode emulator, the change in instruction scheduling caused by different frame rate only affects situations where an interaction between two or more processors is being emulated. - Added the ability to run the compiled schematics on the schematics emulator to the tool app.
- Added support for sensing
@xand@yin blocks when emulating schematics. - Added the
encode-zero-characterscompiler option, which allows encoding zero characters in string literals. Use with caution: resulting code cannot be edited or passed via clipboard. Option has no effect in the web app.
Changed
- Runtime errors generated when running the code in the processor emulator no longer prevent outputting the compiled code in the tool app.
- Changed the format of the
targetcompiler option. Instead of a processor edition (standard or world), a particular processor type is now specified, using the first letter of the type name (i.e.,mfor micro-,lfor logic-,hfor hyper-, andwfor world-processor, case-insensitive), for example,#set target = 8L;. - When compiling Mindcode for a processor in a schematic, the target type of the processor is determined by the block type in the schematic.
- Compiler-defined constants now follow the
@@VARIABLEpattern, instead of earlier__VARIABLE__(for example,@@MINDUSTRY_VERSION). - Changed the emulator handling of the
waitinstruction with zero argument to match the latest Mindustry BE behavior.
Miscellaneous
- The system of compiler options has been updated to allow determining whether a given option has been set. This allows the default values of unset options to be derived from the values of other options.
- The transfer variable, defined for uncached external and remote variables, is no longer used for reads. Instead, a fresh new temporary variable is used each time. This may increase the number of temporary variables generated but avoids unnecessary instructions when using postfix operators on these variables. This became quite important with atomic blocks.
3.12.1
3.12.0
3.12.0 - 2026-01-11
Fixed
- Fixed incorrect evaluation of some numeric mlog constants (#295).
- Fixed the Mandelbrot schematic sample not rendering after build.
Changed
- The Loop Rotation optimization has been updated:
- Full loop rotation is performed even for conditions which contain complex code (such as nested loops or function calls).
- A full loop rotation is also considered alongside a partial rotation if it could be beneficial to Loop Hoisting.
- The Loop Hoisting optimization has been extended:
- The optimizer gathers information to support the Loop Rotation optimization.
- When a loop is fully rotated, an instruction can be hoisted in such a way that it's executed at most once, but only if the loop actually runs.
- When a loop is not known to execute at least once, an instruction affecting just the loop can still get hoisted entirely out of the loop if the loop is nested.
- The mlog processor emulator has been completely rewritten. The emulator now matches the behavior if a Mindustry processor of the version identified by the
target(oremulator-targetcompiler options. - The execution flags have been updated to match the new processor emulator. Some flags have been removed, some have been added, and some have been renamed.
- The processor emulator is now able to execute supported instructions even when created using an
mlog()fuction or an mlog block. This includes the code generated by thecompatibilitylibrary.