Posts tagged: monogame

MonoGame: From Windows to Linux

The traditional way to have a C# MonoGame Project compile both under Linux and Windows is to use a tool named Protobuild. With the last version (3.6), the MonoGame OpenGL template for a cross platform game includes references to the libraries in the three main formats: DLL for windows, DyLib for mac, and so for Linux. This seemed like a good chance for making things work.

And it mostly did. Change to the path where the .csproj file resides, and run xbuild. The bin folder should be created, and inside there, a path accordingly with your project configuration. For example, bin/DesktopGL/AnyCPU/Debug. Then, go there, and just run your game with
mono Project.exe.

(future work: check how to make things work outside the output dir)

MonoGame, XNA and Documentation Hell

2000px-MonoGame_Logo.svgI confess I have some admiration towards the Mono Project. It is the base of different tools, and it allows those tools to run virtually on any device. A good example is the Unity 3D Game Engine.

In my teaching duties this year I need to each MonoGame. Not sure if this is a good choice or not, I just needed to keep with the old syllabus as I did not have any time to prepare the course as I should.

In case you are not aware, MonoGame is Microsoft XNA made public. Although the libraries, themselves, are easy to install under Windows, the most recent version is not available for Mac or Linux. The documentation that is available is mostly from the old XNA, in Microsoft MSDN. There are a few mini tutorials and blog posts that help on some specific details, but there isn’t a official, well prepared, source of documentation, and that is a shame.

Another problem from basing things on Microsoft previous work, is that MonoGame depends on Windows libraries, some of which are not free, and can’t be made available by the MonoGame project, meaning the developer needs to go through a list of old software (yeah, from 2011 is old software) to be able to have everything working.

One of the problems with MonoGame is that it depends on a binary format, named XNB, for importing assets. I am not sure if this format is open or not, but given it is Microsoft, I do not think so. To create these files, from other files, like image or sound files, you need a tool to convert. It seems (although I did not test yet) there is such a tool for Linux and Mac (the MonoGame Pipeline) but not for windows (are you sensing the strangeness here? the latest version of the library is only available for Windows, but the needed tools are not available for Windows…).

I wasted 5 hours trying to figure out how to create a XNB file from a WAV/MP3 file. I searched for tutorials, I downloaded software, I tried different approaches. None works with Windows 8.1 and Visual Studio 2013. I still did not try to contact the MonoGame team or foruns. But given this is something crucial for game development, I can’t understand how there isn’t an official reference from the project, on how to create these files).

The most promising tool I found was XNBBuilder (also known as XNBFormatter), a standalone tool for this conversion. But, from standalone it has few. It depends on XNA libraries (that I have installed) and, even with those libraries available, it still complains on them missing. In fact, a book I bought from Apress about C# game programming in MonoGame also suggests this tool (that means I am not the only trying to figure out how to create those XNB files). At the moment my try was to contact this tool author and asking for some support.

I confess I was expecting some more organization from MonoGame. I am really considering the suggestion to change the syllabus for another library. Even libgdx is more organized.