Btw, when building fonts with mgcb 3.8, these doesnt work with mgweb (mg3.7) (and these fonts doesnt work with FNA either). Luckily I have some builded fonts from 3.7.
I added my game files to Platformer2D as you suggested and it almost builds
I have 2 issue:
It does not like the Directory class (Its .Net Core only I think) so my load/save code will not compile.
I can rip that out as probably donât want that anyway in the browser version.
The other problem is the fonts. I am using the monogame.extended.BitmapFonts.BitmapFont class and there are 2 problems.
-
The content builder wonât build the fonts:
Error: Couldnât find a default importer for font. I think I will have to revert back to the MGCB 3.7 version. -
The code does not compile any of the font.MeasureString() calls. Each line gives these 2 errors:
The type âValueTypeâ is defined in an assembly that is not referenced. You must add a reference to assembly âmscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089â.
The type âObjectâ is defined in an assembly that is not referenced. You must add a reference to assembly âmscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089â.
I can possibly revert to the ordinary font code to get around this. Was just wondering if this is the same problem you mention above.
Well if anyone is interested I got the game to compile by reverting to SpriteFonts and removing my Load/Save code.
It runs in Chrome too ⌠sort of.
Unfortunately, itâs really really slow - far too slow to be usable.
I think this may be because I have some very large textures - my main background is 1606x1685.
Iâve found the webgl2 version to be way faster.
MG Web uses only webgl2. (edit: uses webgl1 as harry-cpp mentions below)
âI think this may be because I have some very large textures - my main background is 1606x1685.â
Test it with some test-bg 128x128 if it makes a difference, but I doubt it (webgl can use larger textures if I understood webgl2 spec right).
Slowdowns will come if you use lots of spriteBatch.Begin() and spriteBatch.End(), the more render calls (which that .End() puts, renders batched sprites), the slower program is.
Use big bg and sprite atlas for other graphis and fonts, then there are 3 drawcalls and should be fast.
Thereâs an older version that uses webgl1. I support this too so my games can be played on iPad.
The newest Bridge.NET version of MonoGame uses WebGL 1, I have not updated the nuget (nor will I as wasm version is in the works).
The demo at https://www.monogame.net/webdemo/ is compiled against it, you can, and I have tested it, run it inside Microsoft Edge on Windows Phone⌠also Safari.
Ah thatâs it. Itâs the other one I use for webgl2.
Is there any way I can contribute to the web project? Including financially.
Thanks for the information.
I draw everything in a single spriteBatch.Begin() in Game1.cs Draw().
There is a lot of scaling of sprites including the very large texture as I have a zoom in/out capability, so that is another candidate for the slow performance.
It has other problems also such as my Button class which draws a Filled Rectangle, Rectangle Border and Some text, only shows the text.
This is a really neat idea, and I have only myself to blame for waiting until project completion before attempting to hook it in.
Iâll take a look at the wasm version when it comes along.
Hello everyone! Important question: I have my Asp.Net Mvc site, in which I would like to insert my game, how do I somehow convert bridge into asp.net mvc, because bridge generates an index file for me that I can open, but I donât know how to join it to my asp.net mvc project, which by doing the build opens the site directly to me locally
Hello all,
Iâm trying to compile and run the platformer example.
First of all, I had to comment out this line
//[assembly: System.Reflection.AssemblyMetadataAttribute(âRepositoryUrlâ, âhttps://github.com/cra0zy/MonoGame/tree/bridgeâ)]
in the generated Debug\net47\MonoGame.Framework.Bridge.AssemblyInfo.cs file, because it doesnât recognize âAssemblyMetadataAttributeâ. Once I do it, I can compile (as long as I donât clean or change the project file), but when I try to run it in any browser, I only see this:
And thatâs it, it never progresses.
Any ideas whatâs going wrong?
Thanks
@Lajbert
You need to access it via a server. You canât just launch it from your hard drive by clicking the index.html.
The simplest you can do: Install python3. Run python -m http.server in the root directory where your index.html is and then go to localhost:8000 (or whatever port the console tells you to go) and then you can play it
I hope this helped.
It workdet, thanks!
A question for those in the know (like @harry-cpp ), how far are we from a nativeAOT wasm based monogame deployment in the browser?
Anyone know if thereâs a way to download to someoneâs local browser a compressed version of a texture and then converting it to the uncompressed format it supports? Load times are slow.
I also noticed theyâre much slower with the webgl1 version from the source tree than with the webgl2 version that nuget pulls in.
Where are we at to have a webassembly version? I really need it, I know how complicated development can be but we have been waiting for years now.
Iâve been asking about the same thing too!
I am using the - GitHub - harry-cpp/MonoGame at bridge - and it is great.
I get the html + javascript, and it generates a canvas -
but how to use the Monogame.Extended library in a project like this?
I want to be able to do things like drawing basic graphic elements like circles ect., but when trying to do spriteBatch.DrawCircle() - is gives this error:
Could not find file âC:\Users\mkjer\source\repos\monogameGrammatonWeb\bin\Debug\net47\System.dllâ. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)âŚect.
- any ideas?
Does this support thirdparty software such as monogame extended?
It should be fine, but youâd have to recompile it.