With this post, we are officially past the halfway point of this series! There’s a good chance we’ll wrap this up at the end of the month, and if not we’ll definitely finish before the end of the year.
But enough about that, let’s take a look at this week’s demo:
Overall, this demo is in-line with DFGame and HaxeFlixel. In the interest of transparency though, I should mention that I had a few days off last week and had much more time to work on this than usual… without that, the demo would probably have a lot less. In general, I’d say that Monogame is one of those frameworks that requires a bit of scaffolding to work in quickly. Since Monogame is C#, extending this sort of API is still pretty reasonable though. (As an aside, I really wish extension methods were a thing in more programming languages)
Setting that aside for a moment, let’s talk about what I liked first. Obviously, as someone who works in C# professionally it’s a pretty comfortable environment to work in. The compile times are also pretty good, although they still pale in comparison to raw C. To balance that out, I don’t need to worry about defining code files in my build config or managing #include directives.
Like most of the tech we’ve reviewed so far, Monogame doesn’t try to enforce a particular engine structure on the user. I always appreciate that, and in terms of complexity the framework seems to sit at a nice medium spot between DFGame and LÖVE.
…aaaand, that’s the stuff I liked. I’m going to be honest, I was somewhat disappointed by Monogame. I have a number of friends and coworkers who use it, so I went in with pretty high expectations. However, I was less than thrilled by some of the design decisions.
Let’s start with the big complaint: I really hate the Monogame Content Pipeline. To cater to larger games, Monogame compiles asset files into an intermediary binary format. This is great when you’re publishing a game commercially, and terrible for everyone else! Every time you make a new asset, you have to pop open a special tool and ‘import’ your asset into the project. I haven’t tested, but I suspect this also makes any sort of ‘hot reload’ feature infeasible. Regardless, at the end of the day it only serves to slow down the development process without bringing any real benefits until the game is ready to ship.
Now that you’ve marked down “Feature that slows down iteration” on your bingo card, let’s move on the the free space: Griping about API documentation.
At a glance, Monogame’s docs look fine. There’s a search bar to filter through classes, and plenty of details. Unfortunately, there’s one really serious issue: The sidebar listing class members doesn’t scroll. Like, at all. If there are more results than your screen can display, you cannot see them. This is actually worse than not having such a bar, because it gives no indication that the results are trimmed. It’s useless in the best case, misleading in the worst case, and you still have to Ctrl+F for class members.
I also have some complaints about the design of the API itself. I’m a firm believer that UX applies not only to User Interfaces, but to Programmer Interfaces (literally, APIs) as well. Monogame makes a good case for this, because I think it has pretty bad UX.
The SpriteBatch class, which handles most of the drawing functions, makes for a good example:
- When drawing anything with the SpriteBatch, you have options to position, rotate, and scale the element you draw by passing vectors / angles. But if you want to do that to everything you draw, you need to provide SpriteBatch with a 4x4 transformation matrix instead.
- Conversely, you can’t use a transformation matrix with individual elements. You must pass in the individual transforms.
- You can draw text, and you can ‘measure’ text for placement/alignment purposes… but you can’t draw aligned text without writing the alignment code yourself.
- You can recolor any element you draw. In fact, you are required to pass a color in every draw call. Yes, it will almost always be white. No, you still can’t skip it.
While working with Monogame, I felt like I was spending most of my time doing busywork and adding things that should’ve been redundant instead of getting work done. I’m sure it can be a good framework with enough helper libraries, but it really feels like the API designers don’t respect the user’s time at all. I’m trying make games here, if I wanted to write my own framework I would rebuild DFGame in OpenTK. (It’s still leagues better than Godot tho)