Skip to content

Xamarin Studio Content Pipeline Addin (In Progress)

Dean Ellis edited this page Aug 31, 2013 · 7 revisions

For those of you not working on a Windows machine, or not those not wanting to install XNA Game Studio. There is now an Addin for Xamarin Studio which will allow you to build certain content types on Windows and Mac.

Installing the Addin

Make sure you are running the latest stable Xamarin Studio.

  1. Download the approrpiate Addin for your operating system

  2. In Xamarin Studio

    • On Mac, click Xamarin Studio->Add-in Manager
    • On Windows click Tools->Add-in Manager
  3. On the first page click the "Install from File" button and select the .mpack you downloaded in step 1.

  4. Close the Dialog and Restart Xamarin Studio

Using the Content Pipeline

At the moment the Addin only compiles the following content

  • Textures
  • SpriteFonts

For other content you will need to use XNA. In addition the ability to add a Content project to a MonoGame project is not yet supported. So for now the best way to work is to link to the .xnb files produced by the Content Project.

In order to target a specific platform you will need to change the MonoGame Build options. You can do this by Right Clicking on the Content project and selecting Options. You will see the MonoGame Build tab in the list of available tabs.

The MonoGame Platform drop down contains all the platforms that are available, you will need to select the platform you are working on for the pipeline to generate the correctly formatted content. For example for iOS textures are compressed using PVRTC rather than DXT, this allows those textures to be loaded directly into the GPU, this saves on load time and GPU memory.

The platform selection is "per configuration" so you can add multiple configs for each platform. That said allot of platforms share the same formats so its possible to double up and reuse assets between platforms that match.

Texture Support

The following Image formats are supported on all platforms

  • png
  • bmp

Texture Properties

When compiling a texture the there are a few properties that you can set to change on the TextureProcessor. The most important one is the TextureFormat, this has 3 possible values Color, DXTCompressed, Compressed. The default is Compressed. When this option is set the pipeline will automatically attempt to compress the texture using a format specific to the platform you are compiling for. As mentioned earlier in the case of iOS this format is PVRTC, however there are some restrictions on its use. In the case of PVRTC textures MUST be power of 2 and square (i.e width == height). If the pipeline cannot compress the texture it will fall back to Color.

Another property is ResizeToPowerOfTwo, if this is set to true your texture will be automatically resized to be a power of 2. The following grid will give you an idea of which compression formats are used on each platform.

Platform Texture Compression Power of 2 required width == height
iOS PVRTC yes yes
Windows 8 DXT yes no
Windows Phone 8 DXT yes no
Windows (DirectX) DXT yes no
Windows (OpenGL) DXT yes no
Linux DXT yes no
MacOS DXT yes no
Android DXT yes no

SpriteFont Support

Font support works slightly differently than is does on XNA. Firstly and most importantly the font does not need to be installed on the target system. However the font DOES need to exist in the same directory as the .spritefont file, if the font file does not exist it will fallback to looking in the following directories

  • Mac /Library/Fonts
  • Windows c:\Windows\Fonts

If a file matching the font name is not found an error will be raised. Note its the font file name that is used, this is not always the same as the Font Name.

Supported font formats are as follows

  • .ttf
  • .otf
  • .ttc

In fact any font type supported by FreeType should work, however the Addin is limited to only picking up known working font types from the list above.

Third Party Projects

The following projects/libraries are used as part of the Addin.

This libraries are bundled with the addin.

Clone this wiki locally