As a follow-on from the previous lab, I was wondering how hard it would be to get the same project running in a web browser rather than on the Windows Desktop via DirectX. One idea was to take the core code and convert it to Unity, as I already knew that Unity had a reasonably mature web target. However, I found that there is MonoGame support for running projects on the browser under WebGL - albeit, as an unofficial and experimental-only target.
By inspecting the example web project from the MonoGame site, I was able to see what was needed to create a build that would run in a modern web browser (i.e. Chrome/Edge/Firefox). The basic premise is to use Bridge.NET to convert the .NET into javascript. An extension written by the MonoGame developers is then used to provide the MonoGame implementations of the core functionality on the browser.
The final result was actually better than I was expecting. The project compiles down a javascript-based project that uses the canvas element (in WebGL mode) to render the MonoGame project. The performance seems completely adequate, for this simple demo anyway - even on Android Chrome & Android Firefox mobile browsers!
With more and more the development landscape moving from desktop onto web/mobile platforms I really hope the MonoGame developers continue to improve this target and hopefully make it a fully-suppported option. A final cherry on the cake would be to be able to compile the runtime to WASM (if this was more efficient than javascript)!