Remove dependency on Blazor for WebGL platform? #1863
Replies: 6 comments 2 replies
-
That's interesting. I found a clean example here https://github.com/khalidabuhakmeh/HelloDotnetWasm/ At the moment I still support net6, which will be dropped after November which reach it's end of support. But also, are we talking about dropping Blazor completely? At the end we can ignore the hosting environment, whether it's Blazor, WinForms, or SDL, and focus on writing the Game. |
Beta Was this translation helpful? Give feedback.
-
Here is a list of brotli compressed files in /_framework/ of the published Primitives3D sample, I am currently excluding the Content readers in the ILLink.Descriptors.xml. Also, I am currently excluding all the backend factories. That's why it brings in Framework.Media.wasm and Framework.Audio.wasm which I don't really use in the sample. Perhaps there's a way to remove those. Directory of \XNAGameStudio\docs\wasm\Primitives3D_framework |
Beta Was this translation helpful? Give feedback.
-
My game is taking about 6 seconds on first load, while my competitor's games built with Javascript/HTML5 frameworks have sub-second load times that feel almost instant. So anything that can be done to remove unnecessary dependencies and improve load time would be most welcome, at least for my projects. I haven't seen any benchmarks comparing the load time of a plain wasm build with a Blazor wasm build, so I don't know how much of an improvement we're talking about here, but any improvement would be appreciated. From what I've read it seems like AOT + full trimming can significantly reduce the deployed project size and reduce load times. I tried trimming the BlazorGL project and ran into dotnet/aspnetcore#49409 which seems to say that Blazor itself is not trimmable and it doesn't look like it's a priority for the Blazor team to fix. On the other hand, the Silk.NET team was able to make their project fully trimmable without Blazor (see https://perksey.com/blog/blazor-silkdotnet.html). So it seems like removing the Blazor dependency could unblock some potential load time improvements, and if I understand correctly, the Blazor API's aren't an intentional part of the API surface of the game engine anyway (since they can never be cross-platform, e.g., for WindowsDX), so they could be removed without impacting the engine. Anyway, I appreciate your thoughts on your long-term goals for the Blazor dependency, and if you'd like to remove it I may have some time to help. |
Beta Was this translation helpful? Give feedback.
-
I found some interesting stuff following those links. There is this video , This sample is supposed to be ~1MB when published. some suggest to add those properties, I already had the BlazorEnableTimeZoneSupport in the template. I've tested it on Primitives3D and _framework\ went down to 1.943.445 Bytes. Also, if you are hosting on a static server, make sure you set enableBrotliDecompression=true inside index.html |
Beta Was this translation helpful? Give feedback.
-
Is it fair to say that you intend to keep the Blazor dependency long term? I definitely want to remove it for my own purposes, and it would be great if that's the direction you're headed as well. |
Beta Was this translation helpful? Give feedback.
-
Note that one of the issues requiring a workaround in the webassembly build has been resolved as noted in dotnet/runtime#99176 |
Beta Was this translation helpful? Give feedback.
-
What do you think of removing the dependency on Blazor for the WebGL platform?
It seems like the technical issues may have been solved in the sample project at https://github.com/RedMike/SdlWasmSample
Beta Was this translation helpful? Give feedback.
All reactions