Short background about me in preparation for the question.
Made games as a Level Designer in custom engines (that was built using C++) where we used Maya as a level editor and used LUA as scripting so I’m rather familiar with setting up assets via text and not how it’s in Unity.
Released a commercial game on multiple platforms using Unity as the only programmer (Steam, Origin, Switch, PS4)
Started programming in Unity in 2013.
Worked professionally in the industry at indie studios since end of 2014.
I want to start making my games outside of Unity, I would say that I’ve got good skills when it comes to C# and I’ve enjoyed creating my own level editors inside of Unity for some of my games.
My question is: If I want to release 2D games on Desktop, mobile and Switch. Am I able to do that in MonoGame using one project and not having one for each platform?
Also on my mind for future problems, how difficult is it to create option to rebind keyboards or controllers and are there some frameworks that helps with figuring out what type of controller is connected? Sorry if I get the lingo wrong, I’m new to programming outside of Unity and this thing was something I had huge problems with when using Unity, so I turned to a plugin from the Asset Store which handle this.
No. MonoGame does not do runtime abstractions (i.e. if platform == Android do stuff). Instead we have different projects for each platform and users reference the project for the platform their targeting. That means you need one project for each platform.
That said, you can put most of the game code in a shared project and include that in the platform specific projects. They then only need to handle platform specific stuff, like touch vs mouse input, screen resolution, launching the game…
MonoGame doesn’t really offer anything for this out of the box, but it’s pretty easy to implement. Just make sure you handle it at the start of the project because it’s a pain to change later.
I don’t think there is anything like that. For cross platform desktop projects you can use SDL directly to get a gamepad name (MG uses SDL in the backend for input and windowing for the cross platform desktop aka DesktopGL platform). I think that’s the most relevant one. Basically for each platform you’d have to use reflection to get the platform-specific gamepad object from MonoGame and then use the platform-specific API to get the name from it.
So when I start a new project, would it be okay to start either a “MonoGame Windows Project” or “MonoGame Cross Platform Desktop Project” and then take it from there? To clarify, what type of project would the “shared project” be when I start that project from the “New Project” window?
I’m actually pretty excited so I’ll start to just follow some tutorials to get more familliar with everything.
Copy Content-Folder from Monogame-Project to Shared Project
Delete Content.mgcb from Monogame-Project(But not the Content Folder)
Delete game1.cs from Monogame-project
Add Shared Project as a reference to Monogame-Project
Add Existing File to Monogame-Project Content Folder, in File Dialog choose the Content.mgcb from the Shared Project and before clicking “Add” choose the little arrow next to it and select “Add as Link”
Then set the content-build-action for the linked Content.mgcb to Monogame Content Reference