Welcome to the Godot Engine Optimization repository. This repository includes all the necessary files and resources to help you optimize your Godot 2D games for Android, reducing the APK size significantly. Please follow along with the provided files and abstract steps to make it more efficient for your games.
Complete detailed steps on Medium
- custom.py: Custom build script for optimizing the Godot engine.
- forced classes.txt: List of forced classes to include in the build.
- APKs & AARs: Pre-built Android debug and release APKs and AARs.
- Source Template: Optimized Godot engine source template.
- Ensure you have Godot installed. Download the version you are using for your game.
- Familiarize yourself with the Compiling for Android guide on Godot Docs.
git clone https://github.com/NIKHIL0VERMA/GodotEngine-Optimization.git
cd GodotEngine-Optimization
-
Download Godot Source Code:
git clone https://github.com/godotengine/godot.git -b 4.1.3-stable
-
Copy Configuration Files:
- Copy
custom.py
andforced_classes.txt
to the root of the Godot source directory.
- Copy
-
Navigate to Godot Source Directory:
cd godot
-
Build Debug Templates:
scons target=template_debug
-
Build Release Templates:
scons target=template_release
-
For Maximum Device Support:
scons -j4 target=template_release arch=arm32 scons -j4 target=template_release arch=arm64
-
Navigate to Android Directory:
cd platform/android/java
-
Generate APKs:
- On Windows:
.\gradlew generateGodotTemplates
- On Linux and macOS:
./gradlew generateGodotTemplates
- On Windows:
Follow the guide on using Godot templates for detailed instructions on applying the optimized templates to your project.
- Remove unused assets and compress textures and audio files.
- Use sprite atlases to combine multiple textures into a single image.
- Strip unused features and modules during the build process.
- Use ProGuard for shrinking, optimizing, and obfuscating code.
Feel free to contribute by opening issues, submitting pull requests, or providing feedback. Let's optimize together!
This project is licensed under the MIT License.
Reach out to me on Twitter or LinkedIn for any queries or feedback.