The Remixed Dungeon project uses a sophisticated platform abstraction system that allows the game to run on multiple platforms (Android, Desktop, Web) and distribution channels (Google Play, F-Droid, ruStore, etc.) while sharing the majority of core game logic. Understanding this system is crucial for developing cross-platform mods.
The platform abstraction system separates platform-specific functionality from the core game code using:
The game uses product flavors to support different markets:
One of the most important examples for modders is the EventCollector class, which handles analytics and crash reporting:
import com.nyrds.platform.EventCollector; // Used throughout your mod EventCollector.logEvent("mod_started"); EventCollector.logException(e);
src/googlePlay/java/com/nyrds/platform/EventCollector.java - Full Firebase implementationsrc/fdroid/java/com/nyrds/platform/EventCollector.java - Empty stub implementationsrc/ruStore/java/com/nyrds/platform/EventCollector.java - Minimal logging implementationsrc/libgdx/java/com/nyrds/platform/EventCollector.java - Desktop implementationThe build system automatically selects the correct implementation based on the selected flavor.
The preferences system is another important abstraction:
When creating mods that need platform-specific features:
Always use the existing platform abstraction classes rather than platform-specific APIs directly:
// Good - uses platform abstraction import com.nyrds.platform.storage.Preferences; Preferences.INSTANCE.put("music_volume", 0.8); float volume = Preferences.INSTANCE.getFloat("music_volume", 1.0f); // Avoid - platform-specific APIs SharedPreferences prefs = context.getSharedPreferences(...); // Android-only
For complex platform-specific functionality, you can check which platform you're on:
import com.nyrds.platform.PlatformSupport; if(PlatformSupport.isAndroid()) { // Android-specific code } else if(PlatformSupport.isDesktop()) { // Desktop-specific code }
If your mod needs platform-specific functionality, create the abstraction in your mod the same way the main game does:
1. Define the interface or abstract class in your shared code 2. Implement platform-specific versions in respective flavor directories 3. Use the same fully-qualified class name for all implementations
When developing mods, test on multiple platforms if possible, particularly:
Understanding the platform abstraction system will help you create mods that work across all platforms and distribution channels where Remixed Dungeon is available.