From Hell to Heaven: Porting Doom to MAUI - Nico Vermeir - NDC Oslo 2024

Dive into the technical challenges and solutions of porting the iconic Doom game to .NET MAUI. Learn about cross-platform development, graphics handling, and input systems.

Key takeaways
  • .NET MAUI provides a cross-platform abstraction layer allowing native app development for Android, iOS, Windows, and MacOS from a single codebase

  • Porting Doom to MAUI revealed several key challenges:

    • No direct file system access in sandboxed environment
    • Different color handling on Android (R/B values inverted)
    • Need for custom touch controls on mobile
    • Missing WPF-equivalent bitmap functionality
    • Platform-specific keyboard input requirements
  • SkiaSharp library provided crucial graphics capabilities that MAUI’s built-in 2D library couldn’t handle, particularly for bitmap manipulation

  • Custom controls and behaviors were needed to:

    • Handle touch events and virtual buttons
    • Manage platform-specific keyboard input
    • Create game control abstractions
  • Key implementation patterns:

    • Using unsafe code blocks for direct pixel manipulation
    • Platform-specific code organization in Platforms folder
    • Custom event system for game input
    • Behavior patterns for cross-platform input handling
  • Platform considerations:

    • Windows version uses WinUI under the hood
    • Android/iOS require different input handling
    • Performance varies between platforms
    • Hardware acceleration limitations
  • Development approach takeaways:

    • Start with working code (WPF) and port incrementally
    • Abstract platform-specific functionality
    • Focus on core functionality first, then optimize
    • Don’t forget the fun factor in development
    • Open source collaboration opportunities
  • Project structure simplified compared to Xamarin:

    • Single project instead of multiple platform-specific projects
    • Shared codebase with platform-specific overrides
    • Resources handling through MAUI’s resource system