Please read the following topic before commenting/asking questions on this one: MonoGame inside your web browser
This is an alpha release of MonoGames web version, there are several parts unimplemented, as such, do not expect everything to work out of the box. Feel free to report any issues you find on the MonoGame GitHub issue tracker, I’ll prioritize implementing stuff that you request.
How to use:
# install template
dotnet new -i MonoGame.Template.Bridge.CSharp
# create project
dotnet new mgbridge
# build project (or just open the project file in your preferred IDE and build it from there)
dotnet restore
msbuild
# Open up index.html in your bin folder using Firefox to launch the game
FAQ:
Where should I run those commands from on Windows?
It should be called something along the lines of Visual Studio console. Make sure that you change your current directory before creating your project tho.
Can you make templates for Visual Studio
Once we get to a beta stage I’ll look into making the templates available from the GUI.
Rider IDE on the other hand will automatically pick up these templates so you can use it for creating your project.
Why can’t I run my game from Chrome/Opera/Vivaldi?
You actually can, but you have to start a web server before hand. This is because chrome does not allow resource loading from “file://”, while Firefox allows it as long as the original web page is also under “file://”.
Why can’t I run the game from Edge/Safari
They do not support WebGL 2.
Content loading freezes the page and takes a long time
Ah yes, this is a bit of a pickle and will require some new API. For now use the FromURL
functions, like Texture2D.FromURL
and make async methods for your content loading. They are implemented for more problematic types.
Can I modify index.html?
Yes, you can disable its generation in bridge.json file. Look at MonoGames example web game for an example on how to do it.
Any examples?