/AppoMobi.Maui.DrawnUi.SpaceShooter

Arcade Game Etude built with DrawnUI for .NET MAUI

Primary LanguageC#MIT LicenseMIT

.NET MAUI Space Shooter Game Etude

devenv_KU0daJs2nS.mp4

The Challenge

To create a simple yet heavily animated arcade cross-platform game, using .NET MAUI XAML with Skia drawn UI, showing all the advantages that .NET MAUI and SkiaSharp provide. The game runs on Android, Windows, iOS, and Mac (Catalyst), all from a single code base. Desktop versions support both mouse and keyboard.

Implementation

Driven by one of the awesome ICT MOO tutorials, much content to play with, knowing we can do it all with .NET MAUI.

Free Lottie animations quickly fulfilled the need for animated content.

DrawnUI pre-alpha nuget was used to draw virtual controls on a Skia canvas.

Of Note

Android and iOS run hardware-accelerated, with iOS using Apple Metal and Android on GL.

For Windows and Mac Catalyst, hardware acceleration is not yet implemented, they still run above 100 FPS.

Desktop versions present non-resizable windows with platform-independent key events. They can be dragged among different displays adapting to new scale. Disabling the maximize button still needs to be implemented.

Final Words

Attained FPS looks okay in Release builds and even on Debug. With an optimized design, especially in regards to control caching, we could imagine more games and fancy animations built with #dotnetmaui.

Lottie animations have proven themselves to be very useful to quickly implement animations.

Windows version is actually behind other platforms due to the lack of HW acceleration but this might change soon.

Tried to make the garbage collector trigger as little as possible using Unity's suggested techniques. It still might have its small impact but we can hope for .NET MAUI someday to adopt a custom incremental GC-collector that Unity is using.

Would add examples of playing frames from a sprite sheet and separate image files if there would be enough interest from the community.

Licencing

This code and the DrawnUI nuget are provided under the MIT license. ICT MOO space ships sprites come under the Apache 2.0 license.