The automation tower defense RTS, written in Java.
The SwitchGDX backend enables support for more portable target platforms by transpiling to C++ using Clearwing VM. The primary target is a Nintendo Switch Homebrew application.
- Performance is not amazing
- No multiplayer/networking support
- Poor mod support
- No controller support
- This port targets the development version of Mindustry, so mod compatibility is poor (Asthosus is known working)
- JavaScript mods currently have issues
- Mods must be extracted into
mods
directory due to a runtime bug with ZipFile extraction or string encoding - Java mods must be extracted into
Mindustry/switch/mods
to be included in the built program (No JIT support) and have relevant class packages added to theswitch.json
reflective
section to prevent classes being optimized out.
-
- Ensure the project directory is as close to the filesystem root as possible to avoid Windows path limits (In 2025...)
- Install MSYS2
- Open a mingw64 shell:
C:\msys64\msys2_shell.cmd -mingw64
- Install dependencies:
pacman -S gcc git rsync texinfo mingw-w64-x86_64-cmake mingw-w64-x86_64-zziplib mingw-w64-x86_64-glew mingw-w64-x86_64-SDL2_mixer mingw-w64-x86_64-freetype mingw-w64-x86_64-bullet
- Install devkitPro Updater with Switch packages selected (Leave downloaded files)
- Open DevKitPro's MSYS2:
C:\devkitPro\msys2\msys2_shell.cmd -mingw64
- Install dependencies:
pacman -S switch-zlib switch-zziplib switch-sdl2_mixer switch-libvorbis switch-freetype switch-glad switch-curl dkp-toolchain-vars texinfo
- Build LibFFI for Switch
- Install CMake, Ninja, Rsync, Texinfo, SDL2, SDL2_Mixer, GLEW, libffi, zlib, zziplib, freetype
- With APT:
sudo apt install build-essential texinfo rsync cmake ninja-build libffi-dev libzzip-dev libsdl2-dev libsdl2-mixer-dev zlib1g-dev libglew-dev libfreetype-dev libcurl4-gnutls-dev
- Install devkitPro pacman
dkp-pacman -S switch-zlib switch-sdl2 switch-sdl2_mixer switch-freetype switch-glad switch-curl switch-bulletphysics dkp-toolchain-vars
- Build LibFFI for Switch
- The
NRO
task builds a Homebrew application - The
Deploy
task uses NXLink to deploy to a Switch running the Homebrew Launcher
- Install CMake for Windows
- Install Visual Studio 2022 and C++/UWP support (
Desktop development with C++
,Windows application development
) - Run twice (Rebuild) for DLLs and assets to properly be copied for some reason
This is a library that has to be compiled and installed manually for Switch. Run this for Linux normally and on Windows under MSYS2. Ensure that the working directory doesn't contain any spaces.
git clone https://github.com/libffi/libffi.git
cd libffi
./autogen.sh
source $DEVKITPRO/switchvars.sh
source $DEVKITPRO/devkita64.sh
CFLAGS="-g -O2 -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIC -ftls-model=local-exec" CHOST=aarch64-none-elf ./configure --prefix="$DEVKITPRO/portlibs/switch" --host=aarch64-none-elf
make install
See CONTRIBUTING.
Bleeding-edge builds are generated automatically for every commit. You can see them here.
If you'd rather compile on your own, follow these instructions. First, make sure you have JDK 17 installed. Other JDK versions will not work. Open a terminal in the Mindustry directory and run the following commands:
Running: gradlew desktop:run
Building: gradlew desktop:dist
Sprite Packing: gradlew tools:pack
Running: ./gradlew desktop:run
Building: ./gradlew desktop:dist
Sprite Packing: ./gradlew tools:pack
Server builds are bundled with each released build (in Releases). If you'd rather compile on your own, replace 'desktop' with 'server', e.g. gradlew server:dist
.
- Install the Android SDK here. Make sure you're downloading the "Command line tools only", as Android Studio is not required.
- In the unzipped Android SDK folder, find the cmdline-tools directory. Then create a folder inside of it called
latest
and put all of its contents into the newly created folder. - In the same directory run the command
sdkmanager --licenses
(or./sdkmanager --licenses
if on linux/mac) - Set the
ANDROID_HOME
environment variable to point to your unzipped Android SDK directory. - Enable developer mode on your device/emulator. If you are on testing on a phone you can follow these instructions, otherwise you need to google how to enable your emulator's developer mode specifically.
- Run
gradlew android:assembleDebug
(or./gradlew
if on linux/mac). This will create an unsigned APK inandroid/build/outputs/apk
.
To debug the application on a connected device/emulator, run gradlew android:installDebug android:run
.
If the terminal returns Permission denied
or Command not found
on Mac/Linux, run chmod +x ./gradlew
before running ./gradlew
. This is a one-time procedure.
Gradle may take up to several minutes to download files. Be patient.
After building, the output .JAR file should be in /desktop/build/libs/Mindustry.jar
for desktop builds, and in /server/build/libs/server-release.jar
for server builds.
Post feature requests and feedback here.