Platform Overview
| Platform | Backend | Minimum Requirements |
|---|---|---|
| Desktop | LWJGL3 | Java 8+, OpenGL 2.0 |
| Android | Android Backend | Android 5.0 (API 21+) |
Desktop Platform (LWJGL3)
Lwjgl3Launcher
Main class:com.pmm.games.lwjgl3.Lwjgl3Launcher (Lwjgl3Launcher.java:8)
The desktop launcher initializes the game with LWJGL3 (Lightweight Java Game Library 3) as the rendering backend.
Desktop Configuration
Window title displayed in the title bar.
Initial window dimensions in pixels. User can resize (if enabled).
Synchronizes frame rate with monitor refresh rate to prevent screen tearing.
Limits foreground FPS to monitor refresh rate plus one. VSync provides the actual limit.
Uses ANGLE to emulate OpenGL ES 2.0 for better compatibility on Windows and macOS (especially Apple Silicon).
Multiple icon sizes for different contexts: 128px, 64px, 32px, 16px.
Desktop Features
Performance
- Native performance via LWJGL3
- Hardware-accelerated OpenGL rendering
- Uncapped framerate possible (if VSync disabled)
- Low resource usage
Input Methods
- Full keyboard support
- Mouse support (right-click to shoot)
- Gamepad support (if implemented)
- Precise control
Distribution
- Single JAR file distribution
- Platform-specific JARs reduce size
- No installation required
- Cross-platform compatible
Development
- Faster build times
- Easier debugging
- Hot reload support
- Direct file system access
macOS Specifics
TheStartupHelper.startNewJvmIfRequired() automatically handles this by restarting the JVM with the correct flag if needed.
Desktop Asset Loading
Assets are loaded from theassets/ directory in the project root:
Android Platform
AndroidLauncher
Main class:com.pmm.games.android.AndroidLauncher (AndroidLauncher.java:10)
The Android launcher initializes the game with Android-specific backend.
Android Configuration
Unique identifier for the app on Google Play Store.
Android API level used for compilation.
Highest Android version tested and supported.
Lowest Android version supported (Android 5.0 Lollipop).
Hides status bar and navigation bar for fullscreen experience.
Internal version number for updates.
User-visible version string.
Android Features
Touch Input
- Native touchscreen support
- Drag to move player
- Tap to shoot (if implemented)
- Multi-touch capable
Mobile Optimization
- Adaptive resolution
- Immersive fullscreen mode
- Battery-efficient rendering
- Pause on minimize
Distribution
- Google Play Store ready
- APK sideloading support
- ProGuard minification
- Multi-ABI support
Compatibility
- Supports Android 5.0+
- ARM and x86 architectures
- 32-bit and 64-bit
- Tablet compatible
Android Asset Loading
Assets are packaged into the APK from theassets/ directory:
Native Libraries
The Android build includes native libraries for multiple ABIs:| ABI | Architecture | Common Devices |
|---|---|---|
arm64-v8a | 64-bit ARM | Modern Android phones (2015+) |
armeabi-v7a | 32-bit ARM | Older Android phones |
x86 | 32-bit Intel | Android emulators, some tablets |
x86_64 | 64-bit Intel | Android emulators, Chromebooks |
copyAndroidNatives Gradle task.
Including all ABIs increases APK size but ensures compatibility. Use App Bundles on Play Store to deliver only the needed ABI to each device.
Android Permissions
The game requires no special permissions. The manifest automatically includes:INTERNETpermission (not used, but common for games)WAKE_LOCKpermission (keeps screen on during gameplay)
Platform Differences
- Input Handling
- Performance
- Asset Loading
- Distribution
Desktop:
- Keyboard: Arrow keys, SPACE, ENTER, ESC
- Mouse: Right-click to shoot
- Precise control
- Touch: Drag finger to move player toward touch point
- Dead zone prevents jittery movement
- Less precise than keyboard
- No dedicated shoot button (shoot on cooldown removed for mobile)
Cross-Platform Code
The core game logic in thecore module is 100% shared between platforms:
lwjgl3/src/main/java/.../Lwjgl3Launcher.javaandroid/src/main/java/.../AndroidLauncher.java
Testing on Platforms
Desktop Testing
Android Testing
Platform Considerations
Screen Sizes
Screen Sizes
The game uses pixel coordinates, which works well for fixed-size desktop windows but can cause issues on different Android devices.Desktop: 640x480 window (configurable)Android: Varies wildly (480x800 to 1440x3200+)Recommendation: Use viewport scaling or aspect ratio calculations for production games.
Audio Management
Audio Management
Both platforms handle audio differently:Desktop: Audio continues when window loses focus (unless explicitly paused)Android: Audio should pause when app goes to background to save batteryCurrent implementation: Music is paused when switching states, but doesn’t handle Android lifecycle events.
Performance Optimization
Performance Optimization
Desktop: Can handle more objects, particles, and effects without issueAndroid: Consider:
- Reducing max simultaneous obstacles
- Using texture atlases
- Limiting particle effects
- Optimizing collision detection
- Reducing audio quality