Table of Contents

Platform Abstraction System for Modders

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.

Overview

The platform abstraction system separates platform-specific functionality from the core game code using:

Key Concepts for Modders

Market Separation

The game uses product flavors to support different markets:

EventCollector Example

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);
 

The build system automatically selects the correct implementation based on the selected flavor.

Preferences System

The preferences system is another important abstraction:

Creating Platform-Aware Mods

When creating mods that need platform-specific features:

1. Use Platform Abstractions

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

2. Check Platform Capabilities

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
}

3. Add Platform-Specific Implementations

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

Cross-Platform Testing

When developing mods, test on multiple platforms if possible, particularly:

Common Platform Abstractions

Storage

Audio

Analytics

Input

Best Practices for Modders

  1. Always use the existing platform abstraction classes
  2. Test your mod on different platform flavors when possible
  3. Use stub implementations in F-Droid flavor to comply with privacy requirements
  4. Follow the package structure used by the main game
  5. Don't make assumptions about platform-specific behavior

Understanding the platform abstraction system will help you create mods that work across all platforms and distribution channels where Remixed Dungeon is available.