MonoGame inside your web browser

We have some exciting news to share with you all, recently I have managed to get MonoGame running inside the web browser. The web version of MonoGame requires WebGL 2 and has support for Chrome, Firefox, Opera and Vivaldi web browsers. You can see the good old Platformer2D XNA sample running on the following link: http://www.monogame.net/webdemo/ (source code also available)

Currently the web version is getting compiled to JS using Bridge.NET, this is however only a temporary solution and we’ll switch to using WebAssembly (WASM) once C# -> WASM conversion gets to a more stable point. This will greatly improve performance.

An Alpha version will become available on October 12th with easy to use templates, so keep your eyes peeled. If you are interested in following the news regarding this, you can do so in one of the following ways:

30 Likes

This is awesome! I’ve been keeping an eye on your progress for the past year. This is huge news!

Looks great :clap:With the demo I experience a little input lag in Firefox, the character respond with a delay for key press and release but it runs smooth in Chrome :slight_smile:

I have pushed some graphics optimization code so performance should be greatly improved right now.

3 Likes

It runs really smooth also in Firefox now. Thanks for the update!

I’ve been hoping for this for years! This is amazing!

Awesome!
Is Bridge.NET similar to what Microsoft is doing with Blazor?
Just wondering if there’s any competition in this area :slight_smile:

It’s very different actually! Blazor implements Mono in WebAssembly to run .NET assemblies directly while Bridge transpiles C# to JavaScript. Neither method is strictly better than the other, they’re just very different. As @cra0zy mentioned the plan is to compile to WASM directly once that’s possible. That will be way faster than either method, but probably still very far away at this point.

Absolutely awesome. The future is here :slight_smile:

This is very cool and promising. I can’t wait for full support of WebGL.

Not sure what you mean by full webgl support?

So far the Blazor approach is probably the best way of implementing the WASM solution of Monogame. However, it immediately breaks on iOS 11. Still some time to wait until all the big guys stabilize it.

Blazor is just using monos wasm port, technically there is only 1 way to convert C# to WASM right now.

Great stuff! Looking forward to the results in the future

This looks super awesome, the Monogame JS looks pretty light as well which is great, excited to try out :slight_smile: :slight_smile:

Currently, assets are not encrypted ( https://i.imgur.com/KNBbkG5.png ). Will this change? :slight_smile:

It can load .xnb assets, if you are asking that, but in general XNA/MonoGame never had any encrypted assets to begin with.

Whatever happened to XNA + Silverlight + Windows Phone?

Silverlight’s last Visual Studio is 2015 (2017 doesn’t support it by default and not sure about addons).

XNA has a Silverlight app option for Windows Phone, is there anyway to forget the app and make it run in a browser? Silverlight seems dead or dying and is probably best for XNA/MonoGame developers to avoid and is probably a nightmare for any past XNA users(?).

This seems like a working example, although I haven’t tried it, XNA on Silverlight for those interested:

As for the post’s solution(Web Demo), it doesn’t run on Windows 10’s or Windows 10 Mobiles’ Edge Browsers. Haven’t tried Internet Explorer…

Silvevrlight is a browser plugin, and browser plugins are dead.

As for not being able to run on Edge, its because its much easier to support WebGL 2 than 1 as it is way more feature complete. I can actually run stuff using WebGL 1 but render targets are way too much of a pain to implement them:

And as the last note, who uses Edge? Its a horrible horrible web browser.

1 Like