Kni
Last updated
Last updated
The Kni Engine is an XNA-like library deriving from MonoGame. Compared to MonoGame it offers a number of benefits including more frequent fixes and improvements, and perhaps most importantly support for WebGL builds. In other words, by using Kni you can create games in C# using the XNA syntax which can be played in the browser.
Working with Gum in a Kni project is identical to MonoGame with the exception of how files are handled. Therefore, once you have a basic project working, you can follow the MonoGame documentation for detailed discussion of Gum's features.
If you already have an existing Kni project, then you can skip this section. If you are interested in working with Kni and Gum and you do not already have a project, then you have two options:
Convert an existing MonoGame project so it uses Kni
Create a brand new project using Kni
If you have an existing MonoGame project, you can convert it to Kni by swapping out the nuget packages. If you are interested in targeting WebGL specifically, this blog post discusses the process:
If you would like to create a new Kni project from scratch, you can follow these steps:
Go to the Kni Releases
Download and run the latest KniSdkSetup exe
After installing the SDK, open Visual Studio
Select the option to create a new project
Search for Kni
Select one of the project templates, such as Web browser
Click Next and proceed through the remainder of the steps to create a project
You should test your project to make sure it runs prior to adding Gum.
Once you have verified that your project runs, you can add Gum to your project by following these steps:
Right-click on your project's dependencies and select to Manage NuGet packages...
Search for Gum.Kni and add the Gum.Kni package to your project
Navigate to your Game class. Modify your code so it is similar to the following code. Note that your game class may differ from WebGlTest1Game: