How do i multi-platform?

Hello! What are the differences between various platforms when writing game with monogame? Is it only the platform specific UI part? What kind of graphics capabilities can each platform use? Can i just use types in, for example the namespace ““Microsoft.Xna.Framework.Graphics”” and expect it to work on all platforms, provided i have correct project and UI code for each platform?

I would like to write a simple 3D game that runs on mobile platforms and PC, using C#/F# as programming language and monogame as graphics/input/sound framework.

1 Like

The only truly different things between the platforms usually reside around:

  • Shader levels
  • Resolution (affects asset sizes that can be used)
  • Platform specific components (e.g. google play vs windows store)

The core part of your game will be pretty much the same across all platforms, generally about 90% or so. Just comes down to how you balance quality or if you are using any platform specific features. same for most multi-platform frameworks / engines.

But MG is made to be multi-platform, so almost everything in the framework works across all platforms.

So basically i could have individual projects for each platform, each with platform-specific monogame reference and platform-specific ui related stuff and a shared multi-platform code? Do the monogame platformer2D sample show a good way to manage this? Does it work on all platforms at it’s current state? I can’t seem to run WindowsGL project, it says at line “hudFont = Content.Load(“Fonts/Hud”);” - "An unhandled exception of type ‘Microsoft.Xna.Framework.Content.ContentLoadException’ occurred in MonoGame.Framework.dll

Additional information: Could not load Fonts/Hud asset as a non-content file!" - has anyone seen what is that? [don’t want to create another thread for that yet…]

Ok, so there are a few ways to manage a multi-platform project, which I’ve blogged about a few times. Which you use is up to you and your coding style:

1: Code in a single folder, create separate platform projects in a single solution and link the files to each project. Can share the same content project as well.
2: Code in separate projects with separate solutions with separate content projects (not really recommended)
3: Create a “shared project” for your game code (PCL or Xamarin/Windows shared) with separate platform projects all referencing the Shared project. Using a single Content project linked to each.

For content projects, you can share it with as many platforms as you like, however if the asset requirements are different for certain projects are different, then you would clone the same content project, one for high-res and one for low res.

Hope this helps. Basically there are many ways and it’s up to you which you prefer.

Might even be another good subject for my new MG channel :smiley:

Darkside of monogame youtube? I subscribed yesterday or something, small world? :smiley: Where is the blog at?

Small community :stuck_out_tongue:

Something else that differs from platform to platform, or at least if you go mobile is input, but for simple games you can abstract this away to handle mouse and touch input the same. I think there are some differences for data storage too, but I don’t know a lot about that. Another option to manage multiple platform-specific projects is Protobuild which is what MG uses in combination with partial classes/methods for managing the different platform solutions.

The blog is mentioned on the YT video, you can also find my MG stuff here: