Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon Join the GFS Discord Server!
8. July 2018

Apple have just rejected an application being updated on their app store due to “non-public API usage”.  This generally means the application used an non-official or undocumented API on their system and this is not allowed.  There are a variety of reasons for this, such as guaranteeing the application will run in the future if that API call is changed or removed, or it could be that the app is intended for Apple’s usage only.  Why is this relevant at all?  Well last month Apple deprecated OpenGL support and using Vulkan with MoltenVK was one such work around for supporting iOS and Mac OS 3D in the future without having to write your own Metal renderer.  That makes the timing of this news suspect.  This leaves three possible outcomes.  First, the developer could have made a mistake.  Second, the MoltenVK team may in fact be using APIs they shouldn’t be.  Or finally, Apple may be trying to force people into their developer ecosystem by targeting a cross platform tool.

The original notice of the app’s reject and MoltenVK usage was posted on

We were alerted today by an indie game studio that one of their iOS games is now rejected by Apple over its MoltenVK usage. Specifically, the game was rejected for "non-public API" usage. Apple's rejection letter cites the use of non-public interfaces around IOSurface, which is used directly by MoltenVK.

There is also now an open issue on the MoltenVK github, which is most likely where this story will unfold.  If you are looking for alternatives to writing your own Metal renderer, be sure to check out our guide to OpenGL alternatives.  Just realize that MoltenVK may not be as good of a recommendation as it was before!

GameDev News

9. June 2015


In this tutorial we are going to look at getting a MonoGame development environment up and running on MacOS, create and run our first MonoGame application and finally take a quick look at the Content Pipeline tool.


For those that prefer video, there is a video version of this tutorial available here or embedded below.


The Installation Process

In order to get up and running there are a couple things you need to install, Mono itself then MonoGame.  We will also be installing Xamarin Platform, which includes Xamarin’s cross platform Mono based IDE Xamarin Studio.  It is not strictly required, but will make your life a great deal simpler.


The process is as straight forward as installs can get, simple download an run each installer.  There is not ambiguity to the install, however the install order is extremely important.  Download the following in this order.  In each case be sure to install the most recent version if given an option.

As I said earlier, there should be nothing complicated about any of those installs, except the order.  If you install out of order the proper templates for MonoGame won’t get added to Xamarin Studio.

Our First Project

Now let’s fire up Xamarin Studio and create our first application.  Once Xamarin loads, select New Solution...
In the resulting dialog, next select the project template to get started.  Along the left hand side scroll down and locate Other->Miscellaneous. On the right hand side you should see a number of preconfigured MonoGame templates.  For this example we are going to target only Mac OS using Xamarin’s Mac libraries, so select MonoGame Mac Application (Xamarin.Mac), then click Next.
All that remains is to pick a location and name for your application as well as if you want Git control or not.  When ready click Create.
This should create a simple application for us with the following code:
#region Using Statements
using System;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.Input;


namespace HelloMonoGame
  /// <summary>
  /// This is the main type for your game.
  /// </summary>
  public class Game1 : Game
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;

    public Game1 ()
      graphics = new GraphicsDeviceManager (this);
      Content.RootDirectory = "Content";
      graphics.IsFullScreen = true;

    /// <summary>
    /// Allows the game to perform any initialization it needs to 
    before starting to run.
    /// This is where it can query for any required services and load 
    any non-graphic
    /// related content. Calling base.Initialize will enumerate 
    through any components
    /// and initialize them as well.
    /// </summary>
    protected override void Initialize ()
      // TODO: Add your initialization logic here
      base.Initialize ();

    /// <summary>
    /// LoadContent will be called once per game and is the place to 
    /// all of your content.
    /// </summary>
    protected override void LoadContent ()
      // Create a new SpriteBatch, which can be used to draw textures.
      spriteBatch = new SpriteBatch (GraphicsDevice);

      //TODO: use this.Content to load your game content here 

    /// <summary>
    /// Allows the game to run logic such as updating the world,
    /// checking for collisions, gathering input, and playing audio.
    /// </summary>
    /// <param name="gameTime">Provides a snapshot of timing values.<
    protected override void Update (GameTime gameTime)
      // For Mobile devices, this logic will close the Game when the 
      Back button is pressed
      // Exit() is obsolete on iOS
      #if !__IOS__
      if (GamePad.GetState (PlayerIndex.One).Buttons.Back == 
          ButtonState.Pressed ||
          Keyboard.GetState ().IsKeyDown (Keys.Escape)) {
        Exit ();
      // TODO: Add your update logic here 
      base.Update (gameTime);

    /// <summary>
    /// This is called when the game should draw itself.
    /// </summary>
    /// <param name="gameTime">Provides a snapshot of timing values.<
    protected override void Draw (GameTime gameTime)
      graphics.GraphicsDevice.Clear (Color.CornflowerBlue);
      //TODO: Add your drawing code here
      base.Draw (gameTime);

We aren’t going to go into any specifics of what this code does, not yet anyways, but we will make sure that it runs.  Hit the Play icon in the top control bar:
You should now see a full screen cornflower blue window.  If so, congratulations, you just successfully made your first Monogame application!

The Content Pipeline


The content pipeline was a major component missing from MonoGame, but they have recently implemented one.  The Content Pipeline takes external assets for your game, be them videos, textures, sounds, fonts, etc…  converts them for your platform of choice, generating a XNB file, a binary format that XNA used internally.  Let’s take a look at the process in MonoGame.


If you look under the Content folder of your Solution, you will see a file called Content.mgcb. 



Double click this and the Content Pipeline tool will load:



This is the tool you use to assemble the assets your game is going to use.  Let’s take a quick example of importing a texture.


First select Edit->Add->Existing Item...



Browse to the image you wish to import as a texture then select OK.

Screen Shot 2015 06 09 at 12 35 35 PM


Now you will be asked how you wish to import the file.  I want a copy to be made so the original is unaffected.

Screen Shot 2015 06 09 at 12 36 41 PM


Your texture should now be added:

Screen Shot 2015 06 09 at 12 37 09 PM


You now have a few options about how the content will be processed on import.  With the image selected, notice the options available below it:

Screen Shot 2015 06 09 at 12 38 17 PM


Each different importer has a different set of parameters you can modify.  Here you can set the automatic generation of mip maps, resize to power of 2 dimensions, change the compression settings, etc.


By selecting the Importer drop down you can get an idea of the various type of assets supported by the Content Pipeline:

Screen Shot 2015 06 09 at 12 40 04 PM


Now select the Content node and the properties available will change again.  This time we simply want to change the target platform to MacOS:

Screen Shot 2015 06 09 at 12 41 11 PM


You can have the Content Pipeline automatically process content for a variety of different platforms.  Now that this task is done let’s actually build our content.  Simply select Build->Build or hit F6:

Screen Shot 2015 06 09 at 12 42 08 PM


In the directory [Content]/bin/MacOSX there will now be an XNB file available for use.  Let’s add it to our project.


In Xamarin Studio, right click the Content folder and select Add->Add Files...

Screen Shot 2015 06 09 at 12 44 15 PM


Navigate to the XNB file in Content/bin/MacOSX that you just created and select it.  Then select Override Build action and choose ‘Content'

Screen Shot 2015 06 09 at 12 46 11 PM


This time when prompted how to add the file, choose the Link option:

Screen Shot 2015 06 09 at 12 47 57 PM


Congratulations, you have now added an asset to your game.  In future tutorials we will look at using them in more detail.

The Video Version

2. June 2014

EDIT:  For a better understand of Apple’s Metal API and what it means for OpenGL, click here. 

So finally we are getting some developer related announcements out of the Apple Developer Conference.  For game developers, todays announcement is a dozy.  iOS 8 SDK includes 4,000 new API calls but most importantly includes Metal, a new lower level graphics API similar to AMD’s Mantle.  The idea is to get closer to the metal ( thus the name ) and remove the overhead of OpenGL:


Gaming on iOS takes a huge leap forward in iOS 8 with Metal, a new graphics technology that maximizes performance on the A7 chip. With its dramatic 10 times improvement in draw call speed, Metal enables leading game providers for the first time to bring console-class 3D games to mobile devices. For casual games, iOS 8 now features SceneKit, making it easy to create fun 3D games, along with major enhancements to SpriteKit, including field forces, per-pixel physics and inverse kinematics.


10 times performance improvement over OpenGL?  That sounds like marketing BS to me or describes an edge case.  If OpenGL was that bloated it would have died off year ago.  The important take away is it’s A7 only, so newest iPad and iPhones are the only ones that support it.  Unity, Crytek and Unreal are all expected to support it so it should be pretty transparent to most developers.


The other major announcement was Swift:


Swift is a powerful new programming language for iOS and OS X® that makes it easier than ever for developers to create incredible apps. Designed for Cocoa® and Cocoa Touch®, Swift combines the performance and efficiency of compiled languages with the simplicity and interactivity of popular scripting languages. By design, Swift helps developers write safer and more reliable code by eliminating entire categories of common programming errors, and coexists with Objective-C® code, so developers can easily integrate Swift into their existing apps. Xcode® Playgrounds make writing Swift code incredibly interactive by instantly displaying the output of Swift code.


The iOS beta software is available now for registered Apple developers.  XCode 6 is required to support the Swift programming language.  You can learn more about Swift here.  I LOVE new programming languages, so I will certainly be taking a closer look.  Some Apple toted features of swift are:


Swift has many other features to make your code more expressive:

  • Closures unified with function pointers
  • Tuples and multiple return values
  • Generics
  • Fast and concise iteration over a range or collection
  • Structs that support methods, extensions, protocols.


… interesting.  I hate ObjC, so an alternative is certainly appreciated. 

14. January 2014


EDIT: You can download the precompiled binaries here.  The Mac binaries are in  The reason for the failed build is LibGDX used a previous build of Autodesk’s library.


If you want to convert 3D models to LibGDX’s native file format G3DB you need to use fbx-conv.  The general instructions for the entire process is available here.  If you are working on Windows, you are in luck, as there are pre-compiled binaries.  If you are however working on MacOS, like I currently am, there is a bit more of an adventure ahead.


Simply put, you need to compile from scratch and that requires a few hoops to be jumped through, especially if you are used to working only in Java, as the source is actually C++.  I will run through the process I went through.


First and foremost, you need to install Xcode if you haven’t already.  You can get Xcode in the App Store, or here.

Make sure command line tools are installed.  Simply open a terminal and type “gcc”.  If a prompt appears asking you to install the tools, do it.


If it doesn’t, yay, you have them installed. 

Run gcc from the terminal one more time after install is completed and agree to the EULA.


Ok, Xcode is configured.  Now you need to set up the Autodesk FBX sdk.  From this link locate and download FBX SDK 2014.2.1 GCC.  Once downloaded, in Finder double click to extract, then double click the extracted file to install.

By default it will install to Application/Autodesk/FBX SDK/2014.2.1.  Obviously if you do this at a later date, the version number will be different.  You need to add FBX_SDK_ROOT to your environment.  To do so open a terminal window and cd to your home ( ~ ) directory.  Type:

pico .profile

Add the line:

export FBX_SDK_ROOT='/Applications/Autodesk/FBX SDK/2014.2.1'


to the end of the script.  Then hit CTRL+X to exit, and chose Y when prompted.  Now you need to create a new terminal window for the updated settings to be valid.


Next you need to install Premake.  Simply download the file from the link, extract it and copy the binary ‘pre make’ somewhere it can be seen ( I in a fit of poor judgement simply used /usr/bin ).


OK, ready to go.  First we need to download the fbx-conv code.  Open a terminal and cd to a directory you want to build in.


git clone



This will create an Xcode project in the directory build/xcode3.  cd into that directory then type:


If all goes well, you will now have fbx-conv in the root directory you cloned the git to.  fox-conv depends on the dylib file libfbxsdk.dylib being in the path.  I simply copied it from Applications/Autodesk/FBX SDK/2014.2.1/lib/gcc4/ub/release/ to the same folder as fbx-conv.  That said, I really don’t understand dylib pathing in OSX since they changed it in OSX 10.8 so there is probably a much better solution.



There is one gotcha I ran into.  The code actually failed to compile on this line:


In FbxConverter.h. It seems GetEvaluator() is no longer a member of  FBXScene.  Perhaps fbx-conv was built on a previous release?  Anyways, I simply commented the line out and fbx-conv seems to still work.  YMMV. 


10. June 2013


The Apple World Wide Developer conference is currently going on and generally there isn’t all that much of interest to game developers.  This year is a bit of an exception as they added SpriteKit to OSX Maverick (10.9) as well as an upcoming release of iOS.  SpriteKit seems to be a combination of sprite library and physics engine.  In their own words:

Sprite Kit provides a graphics rendering and animation infrastructure that you can use to animate arbitrary textured images—sprites. Sprite Kit uses a traditional rendering loop that allows processing on the contents of each frame before it is rendered. Your game determines the contents of the scene and how those contents change in each frame. Sprite Kit does the work to render frames of animation efficiently using the graphics hardware. Sprite Kit is optimized to allow essentially arbitrary changes to each frame of animation.

Sprite Kit also provides other functionality that is useful for games, including basic sound playback support and physics simulation. In addition, Xcode provides built-in support for Sprite Kit, allowing complex special effects and texture atlases to be easily created and then used in your app. This combination of framework and tools makes Sprite Kit a good choice for games and other apps that require similar kinds of animations. For other kinds of user-interface animation, use Core Animation instead.

Followed by:

Sprite Kit is available on iOS and OS X. It uses the graphics hardware available on the hosting device to efficiently composite 2D images together at high frame rates. Sprite Kit supports many different kinds of content, including:

  • Untextured or untextured rectangles (sprites)

  • Text

  • Arbitrary CGPath-based shapes

  • Video

Sprite Kit also provides support for cropping and other special effects, allowing these effects to be applied to all or a portion of the content. All of these elements can be animated or changed in each frame. You can also attach physics bodies to these elements so that they properly support forces and collisions.

By supporting a rich rendering infrastructure and handling all of the low-level work to submit drawing commands to OpenGL, Sprite Kit allows you to focus your efforts on solving higher-level design problems and creating great gameplay.

So basically it’s a 2D game engine competing with the likes of Cocos2D.  Of course, if you use SpriteKit you will be tied to iOS/OS/X and the newest release at that.  If you are an Apple only shop, this isn’t a big deal, but if you work cross platform or are targeting older hardware, this new library is pretty much useless for now.


If you have an Apple ID, you can log in and read the documentation here.


AppGameKit Studio

See More Tutorials on!

Month List