Skip to main content

Get Started

Before we start, thank you SO much for being interested in Monine! It truly means a lot to me :)

Now, if you're on these docs, you're probably looking at how you use Monine Engine. So let's get started on that!

What you'll need

These tools are required for both people making games with Monine, and those contributing to Monine.
This list may change if new dependencies are used, update existing ones, or discover version requirements. It's good to check in every now and then to see what changed with the latest commits!

  • .NET SDK version 8 or above.
    • While the .NET runtime is also required, the .NET SDK comes bundled with the .NET runtime alongside it, so you do not need to download them individually.
    • This project will attempt to keep the version used as the latest stable LTS release of .NET.
      • As of writing, .NET 10 (the latest LTS version of .NET) is still in the release candidate phase, and will not be used until the first stable release.
  • Any version of NuGet, although the latest version is preferred.
    • Any IDE that supports .NET should naturally come with NuGet setup. In most cases, you will not need to install NuGet yourself.
  • An IDE of your choice.
    • It is recommended to use one like Visual Studio or JetBrains Rider, as they naturally integrate with NuGet and .NET. Any IDE that works with C# will work.
      • Choosing an IDE that doesn't naturally support NuGet or .NET will require you to handle those both manually. This includes using the NuGet Package Manager, and using the .NET CLI to test or build your game.
      • If you want to torture yourself and your development workflow, your OS's basic text editor will technically work. While I heavily discourage using it (unless it has tools to make it work as a minimal IDE), I won't stop you.

If making a game using the Monine Engine source code, OR contributing to the Monine Engine source code:

  • Any version of Git, although the latest version is preferred. This will be used to clone the source from git.gay.
    • Git is not technically required per se, although it's highly recommended. If you are using Git, it's a good idea to create a Git repository to track changes. This is especially prevalent when working with the source code, as some changes may break Monine internally, and Git can allow you to roll back to a working version.
  • If you are do not know and are unwilling to learn the Git CLI, find a Git GUI client to use Git
    • If you know the Git CLI and are okay with using it, then use it. I use it to work on Monine myself, and it works well!
  • If you want to a local copy of/want to modify the Monine Engine documentation, install Node.js version 20.0 or above.

If you skipped the reading since there were a lot of words, no, there aren't many dependencies. I just provided a decent bit of information about each one.
Anywho, those are the things you need for working with Monine Engine! And only 2 of them are actually required! If you count "required" as "you physically cannot work with the engine unless you have this", at least.

Create a Development-Ready Project

You can make a game with Monine Engine in 2 different ways, each with their own pros and cons. Below are both methods, listed with their pros and cons respectively.

  • Create a local copy of the source code, and create a project file within the solution to make your game.

    • This allows you to directly look at the Monine API, without needing to deal with decompilers or inaccurate functions.
    • If a part of the source code isn't fit for your game, you can modify it directly! While this should not be needed for most games, it is available as a last resort.
    • You don't need a decompiler to look at the source code! If you're curious about how things may work, or want to see what stuff a class offers, you can just open the file associated with it! No time wasted waiting for a decompiler to run!
    • If you want to update to a newer version of Monine Engine, you'll need to redownload the entire source code again and place it into your project.
      • If you do this, any changes you made to the source will be lost. Preventing this would require you to download only the files that were changed in the version you intend to upgrade to, which will take quite a while.
    • It will take up more storage on your device, which isn't good if you're running low.
    • If you don't have an IDE that supports NuGet, you may need to install the NuGet packages Monine requires yourself.
  • Use the Monine Engine NuGet package to reference Monine Engine within your game.

    • Updating is as easy as clicking a button! So long as your IDE has a NuGet GUI.
    • Takes up less storage space than the raw source code.
    • NuGet should automatically install any other NuGet dependencies Monine may need to work.
    • If a piece of Monine isn't fit for your game, you'll just have to suck it up and deal with it.
    • Requires use of a decompiler if you want to look at the internal functions of a Monine script. This would take a bit of time out of your work every time you want to look, and some parts may be inaccurate.

Overall, I'd recommend you use the source code if you prefer more freedom and control over your project, and don't plan on changing engine versions/don't mind the hassle of updating. But if you never plan on changing the source code, updating shouldn't be too much of a hassle, so long as you're fine with downloading the entire thing again and porting your project over. Otherwise, use the NuGet package if you prefer the simplicity of installing/updating Monine, and don't mind the requirement of a decompiler.

Below are sections to get a working project on each method.

Using the git clone command, you can create a local copy of the Monine Engine source code on your device.
First, open the terminal on your operating system, and enter the directory you want to place the source code.

cd /path/to/directory/

# An example directory below:
cd $HOME/Dev/Projects/

After this, use git clone to create a local copy of the source.

git clone https://git.gay/StatusZer0/MonineEngine.git

This will create a new folder inside of the folder you assigned your terminal to called "MonineEngine-Main", which contains the source code of the engine.
Be aware that this source code contains the nightly version of the source code, and not the latest release. If you want the latest release, find the commit tagged with the version you want, get the ID, and use the Git CLI to "checkout" the repository. This will place the repository into whatever state it was in at that commit.
The command below puts the repository into the state it was in when player assets were first added to the sample.

git checkout 59049103

From here, inside that folder are 3 subfolders.

  • ".forgejo" contains YAML files for CI integration with git.gay (which uses ForgeJo). You can delete this if you don't want to use ForgeJo Actions with your project. If you plan to use something else like GitHub Actions, you should still keep this, rename it to ".github", and alter the files to be compatible with GitHub Actions.
  • "docs" contains the documentation for Monine Engine. You can delete this if you don't want to do anything with the docs.
  • "src" contains the source code of Monine Engine. You can delete this if you don't want to do anything with the source, or don't plan on making a game with it. (e.g. if you only want to write guides in the docs, you can delete this. unless you need the API reference.)

If you're wanting to make a game, you'll want "src", so you can place that inside whatever folder you want, and rename it to your project name.

After that, create a project with the ".NET Console Application" template within the Monine solution. After that, add a reference to all Monine modules you think you might need for your project. (Using Monine Engine will REQUIRE the project to reference the MonineEngine.Core module, and the MonineEngine.Graphics module. Everything else is optional.)

Starting the Engine

Now that we have a Monine Engine project, we can actually make a script that boots it up! Inside of your Program.cs file, add this in:

using MonineEngine.Core;
using MonineEngine.Graphics;

public class Program
{
[STAThread]
static void Main(string[] args)
{
using var engine = new Engine( // create a new instance of the engine
device => new RendererService(device), // give the engine a RendererService based on the GraphicsDevice given
new Scene("My Scene"), // give the engine a scene to load on bootup
"My Monine Engine Game" // define the title of the game window
);

engine.Run(); // run the engine!
}
}

This may look at least mildly confusing if you're not too experienced with C# as a whole, specifically a lambda expression. Don't be alarmed though, as that's the only one required to use the engine! After this, lambdas are completely optional. If you're curious and want to know what a lambda expression is, check out C#'s docs or something, I don't know. I suck at explaining stuff like that, so it'd make even less sense if I tried.
Sorry.

Regardless, with this script, we can boot up our application and we should see this:

(insert image of blank scene)

Huzzah! We have a game window!
It's... kind of boring.

Now, this is just a blank scene with nothing in it. Unfortunately, we can't modify blank scenes directly, so we have to create a new class that inherits Scene.
Create a new StartingScene.cs file in your project, and add this in:

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MonineEngine.Core;
using MonineEngine.Graphics;

public class StartingScene : Scene
{
public override string Name = "Starting Scene"; // our scene name is "Starting Scene"

private Entity FirstEntity;

public override void Initialize()
{
base.Initialize(); // run the base initialization of Scene. This loads content needed and sets things up for us to use.

FirstEntity = CreateEntity("My First Entity"); // Create a new entity with the name "My First Entity"
FirstEntity.Transform.Position = Engine.Instance.WindowCenter; // Set the entity position to the center of the game window.

var sprite = new Sprite(); // Sprites act as a container for image data
sprite.CenterOrigin(); // Place the origin of the sprite in the center, as it defaults to the top-left corner.
sprite.Scale = new Vector2(30, 30); // Set the scale to be 30 times larger!

FirstEntity.AddComponent(new SpriteRenderer(sprite)); // Add a SpriteRenderer component to the entity, using the sprite we just created
}
}

From there, modify the engine constructor in your Program.cs file to this:

using var engine = new Engine(
device => new RendererService(device),
new StartingScene(), // this now creates a new StartingScene instead of a blank Scene!
"My Monine Engine Game"
);

Now, if we boot up the game, we should see this:

(insert image of booted game)

Success! We now have a null texture within our game window!
If you thought this was a lot to process, I wish you good luck, because these are just the basics. There is a LOT more to cover, and I hope you're ready to continue!