Ah, from what I see you made a special framework for Blazor/WebGL? I had briefly looked into that, but then decided that I don’t know enough of either MonoGame or WebGL to do that.
I will try to play around with that, thanks.
Indeed!
The Wasm/WebGL bindings are in a separate library.
Okay, I will have to look into it, but this may be what I have been looking for, for some time.
Out of curiosity, where is the repo/code for the wasm specific monogame framework? Or is that actually just the same as DesktopGL?
The repo is at https://github.com/kniEngine/kni
If you are interested to look into the implementation then begin with those two .targets. They contain a list of files that implement graphics and audio (WebGL and WebAudio).
https://github.com/kniEngine/kni/blob/main/MonoGame.Framework/BlazorAudio.targets
https://github.com/kniEngine/kni/blob/main/MonoGame.Framework/Blazor.targets
Hi, I see there are NuGet packages including one for Blazor. Sorry if this is an ignorant question, but do those work straightforwardly in conjunction with the MonoGame templates? (I’m not too familiar with C# project configuration, but would love to use this.)
Hi,
look at my preview post here .
There isn’t a template yet. That github repository will eventually become the basis of the template.
At the moment you can download the source and start building from there.
I still have to to iron out how a couple of thing, like for example making the content builder to work seemingly.
Hello,
There’s now a BlazorGL template for VS2022.
The template supports automatic content build.
You have to install the SDK from the 3.8.9102 release.
For those who used the project from the WebGLxnaProj repo
you have to merge the latest updates and install the SDK which
includes the mgcb and the build targets.
I downloaded and installed the 3.8.9102 release and selected VS2022 only.
I don’t see the new template when I try to create a new project in VS2022.
Should the new blazor template be available in the list of templates?
Also I unzipped MGCBEditor.zip and tried to run ProtonType.exe but it crashes on startup.
That is what you should see. sometimes it takes a couple of restarts for VS2022
to update the template cache. Try running this command in the command prompt.
“C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv” /updateconfiguration
The MGCBEditor is an additional WPF editor that’s under development.
Do you have .net framework 4.8 installed? If you can find the error from
the windows Event Viewer I can see what I can do.
The SDK installs the pipeline editor as well. Type ‘Kni PipelineEditor’ on
windows Start and you should see it.
Thank you!!!
I have created a project form the template and run it sucessfully.
Here is the event viewer information. I do have .net framework 4.8 installed.
I can carry on with the pipelineEditor.
Application: ProtonType.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NotSupportedException
Application: ProtonType.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.NotSupportedException Exception Info: System.IO.FileLoadException at System.Reflection.RuntimeAssembly._nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean, Boolean, Boolean) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(System.Reflection.AssemblyName, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean, Boolean, Boolean) at System.Reflection.RuntimeAssembly.InternalLoadFrom(System.String, System.Security.Policy.Evidence, Byte[], System.Configuration.Assemblies.AssemblyHashAlgorithm, Boolean, Boolean, System.Threading.StackCrawlMark ByRef) at System.Reflection.Assembly.LoadFrom(System.String) at tainicom.ProtonType.App.Modules.ModulesMgr.LoadModule(System.String) at tainicom.ProtonType.App.Modules.ModulesMgr.LoadModules(System.String, System.String) at tainicom.ProtonType.App.Modules.ModulesMgr.LoadModules() at tainicom.ProtonType.App.Models.MainModel…ctor() at tainicom.ProtonType.App.ViewModels.MainViewModel.Initialize(tainicom.ProtonType.App.Views.MainWindow) at tainicom.ProtonType.App.Views.MainWindow.Window_Loaded(System.Object, System.Windows.RoutedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean) at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs) at System.Windows.BroadcastEventHelper.BroadcastEvent(System.Windows.DependencyObject, System.Windows.RoutedEvent) at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(System.Object) at MS.Internal.LoadedOrUnloadedOperation.DoWork() at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks() at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() at System.Windows.Media.MediaContext.RenderMessageHandlerCore(System.Object) at System.Windows.Media.MediaContext.RenderMessageHandler(System.Object) at System.Windows.Interop.HwndTarget.OnResize() at System.Windows.Interop.HwndTarget.HandleMessage(MS.Internal.Interop.WindowMessage, IntPtr, IntPtr) at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
Good to know!
As for the WPF editor, probably the system locked it because it’s was downloaded from the internet.
By right-click to see the properties of the folder and/or the executable you will be able to unlock it and give it executing permissions.
The permissions appear to be set correctly, so not sure what is going on with the WPF Editor.
I am using the “Kni pipeline” version of the original pipeline.
All works okay except it does not recognise the fnt files I am tryung to use with Monogame.Extended.BitmapFont. I have referenced the Monogame.Framework.Content.Pipeline.dll in the Kni Pipeline references, but no option for BitmapFont appears in the dropdown list.
I can regress back to the normal mongame fonts if there is no easy solution.
I see that MonoGame.Extended.Content.Pipeline 3.8.0 is targeting .net Core3.1.
That won’t work. Importer has to be build either for netstandard2.0 or .net4.0.
The previous version 3.7.0 however is targeting netstandard2.0. Possibly that would work.
However, you should be adding the pipeline nuget to your main project.
The installation instructions on the Extended webpage are wrong.
I thought you might be interested to see this:
This is my latest game Scéal running in a browser.
I had to remove the monogame.extended.bitmapfont stuff as it’s not compatible.
I then switch to fontstashsharp but that’s built on the DesktopGL framework so that had too many issues also.
I regressed my fonts back to use good old SpriteFonts and it now works.
One font was too large (> 2048k) so I had to remove that.
I also had to remove apos.shapes as the built in shader caused an issue.
I didn’t get sound to work yet - it throws an error on load - so sound is disabled.
I will look into that.
Congratulations on a magnificent achievement - I strongly feel this will have a huge impact on monogame development.
Nice, thanks for testing it out.
extended.bitmapfont are exporting .fnt files right? It’s strange, doesn’t the default processor (SharpFont) support those fonts?
There are other ways to import bitmap fonts with the build-in texture font importer.
Bitmap Font Maker
Songs are not implemented yet. But sound effects should work.
I can confirm that ogg format sound files work.
The problems with monogame.extended.bitmapfonts occured when I added using statements to the code. There appeared to be a conflict between different versions of the Framework and it reported errors for Vector2 etc
I successfully integrated monogame.extended.tweening since then though, so not sure why Bitmapfonts did not work.
I’ll keep experimenting.
I tried monogame.extended.bitmapfonts again.
This is the error i get:
The first issue (1) is it is not recognising the extension methods for DrawString that support BitmapFonts, event though I have
using MonoGame.Extended.BitmapFonts;
at the top of the file.
spriteBatch.DrawString(font, $"{Count}", position, Color.Red);
When I try to call the extension method directly, I get the strange compile error shown (2):
"Reference to type Vector2 claims it is defined in “Monogame.Framework”, but it could not be found.
I got to the bottom of the strange compile errors.
It’s because my proejct code is using the new nkast.Xna.Framework, and also referencing monogame.extended which is built against monogame.Framework.DesktopGL.
I downloaded the source for monogame.extended and built it against nkast.Xna.Framework and this resolved the compile errors.
There is still an issue though.
At runtime it fails when trying to load the first BitmapFont (from monogame.extended) with “Specific cast is not valid”.
monogame.extended is referencing monogame.Framework.Content.Pipeline nuget from the DesktopGL build.
This needs to be replaced with an nkast.Xna.Framework based version.
I didn’t find one in nuget - I’m guessing you are replacing the pipeline with ProtonType.exe whch crashes on startup.
So the alternative is to get that running instead.
UPDATE
I can confirm that games built with the new framework will work in a browser on itch.io.
This is a remake I did about 15 years in C++ which I recently ported to monogame.
It took only a few hours to create a web version using the new Framework.
And it’s now up live on itch.io.
How do I install the SDK in CI, where I don’t have access to a GUI? Can the SDK be installed using a CLI?
Also, I’m curious as to how this even works. I tried the example project, and it launches a web server at localhost that you then visit with your browser. What does this server do, exactly? When I visit a website that runs a KNI game, does my browser simply download the entire game to local storage and run it from there, or does any part of the game run on the server?