Live data from Hacker News

MonoGame: A .NET framework for making cross-platform games

github.com

41–50 of 76 posts

Re: MonoGame: A .NET framework for making cross-platform games

#41

Earlier quoted context omitted.

Ah weird. Did a bit of searching and it looks like maybe it targeted multiple frameworks with the xna API. Including xna itself https://www.pcgamingwiki.com/wiki/Celeste https://celeste.ink/wiki/Version_history

Several games used to target Monogame for consoles but XNA for PC, and later FNA for PC. Monogame on PC used to be somewhat buggy in my hobbyist experience.

Oh interesting. I never hit any walls personally but I guess I didn't push that hard.

Re: MonoGame: A .NET framework for making cross-platform games

#42

Also check out Stride3d https://github.com/stride3d/stride , which is a more full featured engine built on (i believe) Monogame. Runs on .net 10

Just an FYI, Stride isn't related to MonoGame or XNA. Stride was originally Paradox (and then Xenko) made by Silicon Studio. They eventually open sourced it and let the community take over.

The lead architect (I think) of Xenko also wrote SharpDX which MonoGame used for a while though.

Re: MonoGame: A .NET framework for making cross-platform games

#44
post #7

If you are wondering about the capabilities, Stardew Valley was made in MonoGame. I wonder how it compares, if at all, with Godot nowadays.

There isn't really a comparison to be made between MonoGame and Godot. MonoGame is for programmers. Godot is for people who want to make games but don't care for programming and would rather use a GUI for development. Godot locks you into the Godot way of doing things. MonoGame is a thin cross-platform abstraction over platform APIs for sprite rendering, audio playback, input, and font, leaving you to build your game…

Could you elaborate in how you've built your own framework for making your monogame project available in web?

I've been using KNI but it's been a real headache getting my game to run on itch.io.

Re: MonoGame: A .NET framework for making cross-platform games

#45

Earlier quoted context omitted.

There isn't really a comparison to be made between MonoGame and Godot. MonoGame is for programmers. Godot is for people who want to make games but don't care for programming and would rather use a GUI for development. Godot locks you into the Godot way of doing things. MonoGame is a thin cross-platform abstraction over platform APIs for sprite rendering, audio playback, input, and font, leaving you to build your game…

Could you elaborate in how you've built your own framework for making your monogame project available in web? I've been using KNI but it's been a real headache getting my game to run on itch.io.

To be clear, the framework I built is independent of the MonoGame framework. As for how it was built, it's relatively straightforward. There are three layers: platform layer, framework layer, and the game layer. On the platform layer, I started by implementing a basic hello world-tier game loop using Win32 window/messaging APIs, OpenGL for graphics rendering, and OpenAL for audio playback. Then I wrote tidy wrapper layer functions for calling into the platform layer, with better ergonomics/readability, which the game layer calls. Then, I began adding WASM APIs at the platform layer, with branching #if statements in the framework layer that control whether src\platform\win32 or src\platform\wasm functions are called based on build target. In this way, the game code remained unchanged but support for web was seamlessly added (with some pain in adjusting the wrapper APIs to handle the large differences in Win32 and web APIs). Then repeated this process for each additional platform. The primary csproj is set up to branch into different csprojs per build target, with one using the Microsoft.NET.Sdk.WebAssembly project SDK, etc. Over time, I expanded features of the platform layer and wrapper layer as they were needed.

For the game I had already made progress on when trying MonoGame, I had already written a wrapper layer over the MonoGame APIs even before I had started on my own framework. My new framework wrapper layer was designed as similarly as possible, so transitioning my game code to the new framework was mostly painless, and only required adjusting the shape of some rendering/audio/input calls here and there.

Re: MonoGame: A .NET framework for making cross-platform games

#46

Earlier quoted context omitted.

> wasting time reinventing the wheel It's always funny to me that this metaphor is used to indicate a bad thing, but re-inventing the wheel is actually very valuable. Note that our vehicles do not run on stone wheels. Thank goodness we kept re-inventing wheels that were more suitable for our specific use cases! This metaphor is, therefore, exactly apt for describing off-the-shelf game engines. All of the big open gam…

Are you going writing your own programming language as well? Can we call it Tolkien? Because you're making a game like J.R.R. Tolkien wrote books, and there's a reason nobody writes books the way he wrote his. Writing your own engine is great if you want to learn how to write a game engine. Knowing how to make a game engine can be helpful when making a game, but it's not necessary to make a game. Further, if you want…

> and there's a reason nobody writes books the way he wrote his

And there's a reason nobody came even close to his grandiose.

> Being condescending or dismissive of tools that do everything your tools you're going out of your way to construct will have to do is... weird logic.

They've merely pointed out that there's nothing wrong with reinventing tools, you're the one attacking them.

Re: MonoGame: A .NET framework for making cross-platform games

#47
post #7

If you are wondering about the capabilities, Stardew Valley was made in MonoGame. I wonder how it compares, if at all, with Godot nowadays.

There isn't really a comparison to be made between MonoGame and Godot. MonoGame is for programmers. Godot is for people who want to make games but don't care for programming and would rather use a GUI for development. Godot locks you into the Godot way of doing things. MonoGame is a thin cross-platform abstraction over platform APIs for sprite rendering, audio playback, input, and font, leaving you to build your game…

>Godot locks you into the Godot way of doing things. MonoGame is a thin cross-platform abstraction over platform APIs for sprite rendering, audio playback, input, and font, leaving you to build your game engine yourself however you like.

That might be changing: https://github.com/godotengine/godot/pull/110863

Besides, there's a lot of value Unity, Unreal and Godot provide besides just the GUI in ways similar to and different from MonoGame.

Re: MonoGame: A .NET framework for making cross-platform games

#48

Earlier quoted context omitted.

There isn't really a comparison to be made between MonoGame and Godot. MonoGame is for programmers. Godot is for people who want to make games but don't care for programming and would rather use a GUI for development. Godot locks you into the Godot way of doing things. MonoGame is a thin cross-platform abstraction over platform APIs for sprite rendering, audio playback, input, and font, leaving you to build your game…

Could you elaborate in how you've built your own framework for making your monogame project available in web? I've been using KNI but it's been a real headache getting my game to run on itch.io.

I’m not the commenter that you asked, but I have also built a cross platform game framework with backends for SDLGPU and WebGL. The answer to your question is pretty basic. AI did it for me.

I asked it to create a canvas-like API, noting that it should create platform independent code. The canvas API populates arrays for vertices, indices, and other relevant things relating to draw batches. My game is built on top of this platform independent canvas code, and is itself platform independent.

Then you have the platform code, which simply reads the memory of those arrays and does what it needs to do to draw it in its environment. I have barely looked at the platform code but it seems to just work, and it is really performant. It around 1000 lines of code for the web target. The key is to use shared memory as the bridge between the compiled WASM code and the platform code for draw calls. As I said, it’s mostly just arrays of vertices, texture ids, and indices.

It took me some thinking on how to define textures in a platform independent way, but it all ended up working well. I bounced some ideas with the AI to come up with a solution just using ids.

From there I just kept adding more features, FMOD support, shaders, etc.

Edit: Oops, I misread that your comment was referring specifically to getting Monogame on web. I thought I’d leave it here anyway though because it might help you. The key insight for me was that the canvas API (and Monogame as well) is just batching up vertices, indices, into draw calls, before the platform specific stuff happens. I realised this after investigating how the Spine animation software was able to achieve so much cross platform support (it’s just providing triangles with texture ids to platform code). You don’t need any concept of a platform to represent the entirety of your games as triangles associated with texture ids in memory.

Re: MonoGame: A .NET framework for making cross-platform games

#49
We used Monogame at a previous company and it's a nightmare to be productive in it. The lack of any kind of an editor makes any kind of dev a nightmare: 3d adjustments? Good luck, guess it.. UI adjustments: good luck, try it 300 times until you get it right.

Switched to Unity, best choice ever.

Re: MonoGame: A .NET framework for making cross-platform games

#50
post #3
post #2

For a more actively maintained XNA implementation, also worth looking at Ethan Lee's FNA: https://fna-xna.github.io/

I was trying to compare the two. At first glance, MonoGame has far more stars and recent commits. Or is it just in maintenance mode?

FNA is for porting /supporting XNA games with minimal changes.

MonoGame is trying to evolve XNA in small ways.

For a new project I would pick MonoGame.

Post reply on HN