Mindustry is a tower-defense type of game, now with added Logic. Logic is a programming language, but it is very low-level. It is more akin to assembly than high-level language.

Mindcode is a high-level language that compiles down to Mindustry Logic. Mindcode includes higher-level constructs, such as expressions, user-defined functions, control statements, or "direct" memory access.

Mindcode now comes with significantly improved code generation, including data flow analysis, loop unrolling and function inlining; for a list of recent changes, see changelog.

Go ahead and try the following samples, then write your own!

126 lines of code

123 lines of code

Start with a new script

Bug reports, suggestions and questions are welcome at the project page.

  • 193 instructions before optimizations.
  • 14 instructions eliminated by Temp Variables Elimination.
  • 16 instructions eliminated by Dead Code Elimination (4 iterations).
  • 1 instructions eliminated by Jump Normalization (4 iterations).
  • 8 instructions eliminated by Jump Optimization (4 iterations).
  • 8 instructions eliminated by Single Step Elimination (2 passes, 6 iterations).
  • 4 instructions eliminated by If Expression Optimization (3 iterations).
  • 19 instructions eliminated by Data Flow Optimization (2 passes, 7 iterations).
  • 1 loops improved by Loop Hoisting.
  • 1 instructions added by Loop Optimization (3 iterations).
  • 2 loops improved by Loop Optimization.
  • 1 instructions eliminated by Print Merging.
  • 123 instructions after optimizations.
  • Performance: parsed in 154 ms, compiled in 10 ms, optimized in 131 ms.