ProwlEngine / Prowl

An Open Source C# 3D Game Engine under MIT license, inspired by Unity and featuring a complete editor and built on Silk.NET
MIT License
433 stars 35 forks source link

NativeAOT support #181

Open Armynator opened 1 month ago

Armynator commented 1 month ago

Is your feature request related to a problem? Please describe. The current runtime build size is quite big and requires the .NET runtime. NativeAOT builds don't require the runtime and trim down the final binary size quite a lot.

Describe the solution you'd like Add support for NativeAOT release builds, at least for built games. The editor requiring the .NET SDK is fine.

Additional context I've tested building it with NativeAOT myself, as Silk.NET already supports it. While it works after registering the GLFW window and input platforms manually, the render pipeline can't initialize for some reason. Probably because something important related to it was trimmed out. Would be nice to get easy NativeAOT support out of the box.

michaelsakharov commented 1 month ago

There is a bit of research that needs to go into this For example how the Serializer with all its reflection will handle itself. And how do we handle cases of serializing generic types, like List in NativeAOT

This is definitely something we should look into eventually though, As I believe it is required for Web, and possibly other platforms as well

sinnwrig commented 1 month ago

Build pipeline should now be AOT-compatible and Assembly.LoadFrom is gone from the player. However, there is likely to be some trimming issues and DllImport's still in our way, specifically in Prowl.Veldrid. Will need to look into this more.