Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

13. June 2018

With Apple’s recent unfortunate decision to deprecate OpenGL support in iOS and Mac OS moving forward this will be the end to the only graphics API that worked natively across all platforms.  I think many developers would be willing to ignore the Mac OS market, but the iOS market is just too big for most people to ignore.  What then are theImage result for opengl logo alternatives to using OpenGL?  In this article we are going to look at exactly that topic.

Use a game engine and let them worry about it!

This is the category probably the majority of developers are going to fall under.  If you use an engine like Unity or Unreal this entire thing becomes a non-issue.  These engines generally already support a number of different rendering options, including native Metal support.  For other small or open source engines such as Godot, CopperCube, Shiva, Cocos, etc this is a bigger problem as they now potentially have to dedicate more time, money and/or resources to support yet another renderer… or drop support for Apple platforms completely.  Unless they rely on some kind of abstraction layer for rendering, life just got a bit more annoying for every single game engine manufacturer that previously supported Apple platforms.

The following engines have Metal support out of the box:

  • Unreal Engine
  • Unity
  • Lumberyard
  • Armory(via Kha)
  • Stingray (now defunct)

Use Vulkan + MoltenVK

A lot of game developers and engine developers specifically were planning to, or already have, implemented Vulkan rendering support.  Vulkan is a lower level alternative to OpenGL, from Khronos Group, the same people behind OpenGL.  Like Direct3D 12 and even Apple’s Metal, Vulkan is designed in a closer to the hardware manner, to better maximize new graphical functionality in modern GPUs.  Working in Vulkan takes a lot more effort than working in OpenGL or similar higher level APIs, but it is cross platform much the same way as OpenGL was.   The catch…  it doesn’t work on Apple products.   Ugh.  Ok, how then is this a solution?  We there is a product called MoltenVK that enables Vulkan to run on Apple’s Metal.  

Use an Abstraction Layer

Another option I’m really partial too… letting someone else do all the work!  There are a handful of low level cross platform graphics APIs that take care of the work for you.  So if you don’t want to use an existing game engine, but also don’t want to deal with rendering intricacies for each platform, this could be a great option.  Well will discuss available cross platform layers.


A cross platform “bring your own engine/framework” graphics rendering layer with bindings for several programming languages an renderers, including Metal ( and OpenGL, Direct3D, WebGL and more).  No Vulkan support however, at least not yet.


Kore is the open source C framework that kha is built on top of.  Kore supports a ton of renderers including metal.  You can learn more about kha in this video.


Ogre straddles the line between game engine and framework.  Either way, ogre3d has a metal renderer for iOS and MacOS.

The Forge

This one is fairly new to me, it’s a cross platform rendering framework that also supports Metal.


Veldrid is a .NET based rendering and computer library that supports Metal (as well as VUlkan, D3D11 and OpenGL, GL ES).  I have no personal experience with this library and it seems somewhat young from a developmental perspective.

SDL… maybe?

There are mutiple mentions and forks of SDL for supporting Metal.  I’m not sure if any are complete or still supported.

Implement A Metal Renderer

Of course you’ve always got the option of buckling down and implementing a Metal renderer for MacOS and iOS platforms.  Of course your work will only be useful on Mac/iOS platforms.  If you are interested in learning more about Metal you can learn more here.

Stick with OpenGL

Of course you’ve always got the option of just sticking with OpenGL.  Deprecated doesn’t mean it wont run on existing devices, just future ones.  Publish your game as it is now and let Apple deal with the fallout of their bad business decisions.

Programming ,

18. May 2018

It’s not very often a game engine takes me completely by surprise.  Especially a full featured, open source, C++ based, cross platform, heavily documented, feature rich, high performance 3D game engine.  Well that’s exactly what happened with the G3D Innovation Engine.  The primary maintainers are Morgan McGuire (@CasualEffects) who is currently an educator as well as a VR scientist at NVIDIA and previously worked on games such as Skylanders, Titan Quest and the Unity game engine, as well as Michael Mara at Standard University and Oculus Research.

The G3D Engine is self described as:

The G3D Innovation Engine is a commercial-grade C++ 3D engine available as Open Source. ss

G3D supports hardware accelerated real-time rendering, off-line rendering like ray tracing, and general purpose computation on GPUs. Its design emphasizes rapid prototyping and innovation, particularly of rendering and game algorithms.

G3D provides a set of routines and structures so common that they are needed in almost every graphics program. It makes low-level libraries like OpenGL, network sockets, and audio channels easier to use without limiting functionality or performance. G3D is a carefully designed, feature-rich base on which to prototype your 3D application.

Beyond being a capable engine it is also an incredible learning resource.  The engine is bundled with over 6GB of assets to experiment with, as well as over a dozen robust ss2samples with thoroughly documented source code.  One of the samples is even a full blown first person shooter, while another demonstrates a Minecraft-esque voxel based level.  There are also examples that show you how to work at the lowest level directly with OpenGL as well as advanced examples showcasing functionality such as real-time raytracing, lighting effects, procedural geometry and even VR.

Additionally each example can easily embed a suite of tools directly, enabling you to screen shot or video capture, change camera settings on the fly or launch the built in profiler.  There is even a complete scene editor built in, allowing you to place entities directly in your scene via simple drag and drop, turning your application into a minimalistic level editor.

Remember back at the beginning I mentioned that the maintainer was also an educator?  He has also authored a companion called the Graphics Codex which goes hand in hand with the G3D game engine.  For a mere $10 you gain access to an advanced reference that may just be one of the single best ways of learning computer graphics GIF2topics such as ray casting, BSDF, rendering and more.  You can see a full chapter list here.  So if you are trying to learn more advanced graphics programming, G3D is certainly a great resource.  Keep in mind however, this material was used with a 300s level graphics course, so you are going to need a solid foundation in math to follow along.

Purchasing the Graphics Codex is by no means a requirement however.  One thing open source projects often suffer from is poor documentation.  Thankfully this certainly isn’t the case with the G3D engine.   There is an extensive manual available here, as well as a comprehensive set of API references.  As mentioned earlier, the engine is also loaded with well documented samples.

If you are looking for a low level foundation to build your game on, a framework to do some graphical experiments or simply are looking for a way to learn more about modern graphics programming, I can think of little reason not to suggest checking out the G3D Innovation Engine. 

If you are interested in learning more about the G3D Innovation Engine, be sure to check out our hands-on video available here and embedded below.  I am almost certain you will be amazed.

GameDev News, Programming , ,

25. April 2018

The HTML5 base 3D game engine PlayCanvas has been covered several times here on GameFromScratch, both in the Closer Look series, as well as a more recent 3D game tutorial.  It has been under development for several years, but just yesterday it finally hit that biggest of milestones, a 1.0 release.  There wasn’t actually a huge number of changes in the 1.0 release, in fact there was only a single minor source change.  It’s more a sign of confidence from the PlayCanvas team about the maturity of the game engine.

From the PlayCanvas blog:

PlayCanvas was born 7 years ago, way back on 9th May 2011. In the early days, we were essentially prototyping, seeing what this amazing new WebGL API could do. By October 2011, we set up a source code repository and committed our first engine prototype. Right at the beginning, we adopted semantic versioning for naming our releases. Our initial commit generated engine v0.10.0. From that point onwards, we adopted a rapid release cadence, often publishing more than one release a week. The months and years passed, our team grew and feature after feature was integrated into the codebase. But through all that time, we never incremented the major version number. Why? Well, there were several reasons:

  1. Our rapid deployment meant we never delivered a monster release that seemed to warrant going to 1.0.0.
  2. We always made a huge effort to maintain backwards compatiblity. Projects like the inane Doom3: Gangnam Style created in December 2011 still work fine today! So we never (intentionally) broke your projects.
  3. We, uh, just never got around to it!

The PlayCanvas API is now very stable, mature and battle-hardened. Backwards compatibility is something we take very seriously indeed. And today, PlayCanvas is used in production by thousands of developers.

GameDev News , ,

20. April 2018

Dust3D is a new application unlike any other 3D modeller I’ve used.  It’s free, open source, runs on Mac and Windows, with Linux support possible if you compile it yourself.  What makes it unique however is it’s approach to modelling.  Essentially you model by create a series of circles along two axis, which act as loft points for the generated mesh.  Really it’s one of those things you need to see in action to understand… thankfully I’ve made this video showing exactly that.

Dust is certainly not for creating highly detailed 3D models, instead it’s more useful for rapidly creating base meshes, which can then be exported in OBJ format and sculpting/refined in other 3D modelling applications.

Art ,

18. September 2017

In this section of our Bowling with Game Engines series, we will be implementing our bowling game using the open source Godot engine. The idea is straight forward, implement the same simple 3D game across a number of game engines. One warning right up front, this engine uses Godot 2.x on the eve of Godot 3.0 being released. Godot 3.0 will receive rather large changes to the 3D portions of Godot. We will go step by step through the process of creating our game, both in text as well as a video version available. All of the assets used in this tutorial are available on Patreon as part of the bowling game kit, along with project files and this document in PDF form. Don’t worry, these aren’t needed to follow along.  There is a video version of this entire process available here or embedded below.

First fire up Godot and create a new project. Once Godot is loaded, click New Project, then pick a location to create the project in. The project directory will be the project’s name.


Now double click your newly created project to load it.


Let’s start things off by creating our Title screen. Before we go too far ahead, lets create an empty node to parent our scene then save it. In the Scene panel, click the Plus Icon


Select Node from the following dialog:


Select the Scene menu, then Save Scene as:


Name it TitleScene.tscn and click Save. Ok now the we have a Scene to work with, time to get to work. Let’s import the title scene image. You can use any supported texture format, but if you are working from the Patreon files, the document you want is Titlescreen.png. Select the Import Menu, then Texture


In the following dialog, be sure to select 2D Texture, locate the texture you want to import, then click the Import button. The defaults for Texture options and format are fine. Please note, for 2D steps you can actually skip this step and directly copy the texture into your project folder using Explorer/Finder.


Now that we have our title screen texture, it’s time to go ahead and use it. In the Scene panel, select the node we created earlier, then click the + Icon. This time we want to add a node of type TextureFrame. You can filter the options available in the node list to quickly find the node you want to create.


Now that we’ve created a TextureFrame node, in the Inspector, locate the Texture property, drop down the menu and select Load. Select our newly loaded texture.


Now turn the Expand property on:


And resize the Texture to the full size of your viewport:


Woot, most of the way there… now we want to add some looping title music that palys when the game starts. We need to import a song to use. In this case I’m using a simple WAV file that we are going to loop. The process is just like with Textures, select Import->Audio Sample


In the resulting dialog, locate the WAV file you want to import, in options select Loop then finally select Import.


Ok, now that we have a sound effect to play, let’s play it. In the Scene panel, select TextureFrame then click the + Icon. This time the node type we want is a sample player. Your scene should look like this now:


Hmmm, that error Icon can’t be a good thing, can it? No worries, we just need to define the sample to play. This is going to take a couple step sthough, first we need to add a Sample Library, then add our sample to it. Don’t worry, it’s not that difficult. With the SamplePlayer selected, in the Inspector drop down the Samples option and select New SampleLibrary.


Now select samples again and this time choose Edit.


This brings up a new editing window:


Click the folder icon, select your imported sample in the resulting dialog. It should then look like:


Now in the Inspector we should be able to select our newly loaded sample in the Play menu:


This whoever has one EXTREMELY annoying side effect… the sample will play over and over in the editor while you have this scene open. Yeah, it gets annoying fast. Time to do our first scripting instead! Let’s add some code that plays our sound when the scene is loaded… a sure way to keep sane! This means we need to add a script to node in our scene… don’t worry, its pretty easy.

We are going to create and attach a script to the TextureFrame node, the parent of our SamplePlayer. Right click the Texture Frame in the Scene panel, then select Attach Script.


In the resulting dialog click the .. next to Path and name your file, then click Create.


This will bring up the script editor like so:


Now we want to change the code like so:

func _ready():

Now it’s time to check out all of our hard work. Now click the Play icon:


Since this is the first time we’ve run it, we need to tell Godot which Scene is the entry point for our application.


Click the Select button. Then select TitleScreen.tscn in the resulting dialog. Now your application should run!


Now of course we have to get to the guts of our actual game. Next we create our next scene where the majority of the game is going to occur. First make sure to save your existing scene if you haven’t already. Then click Scene->New Scene.


Every scene must have at least one node. So in our newly created scene, again click the + Icon in the Scene Panel and select Node. Now save the scene as GameScene.tscn.

Perfect, now we have somewhere to go from our title screen... Next, we need to have some kind of action or trigger to switch between scenes. We are going to handle the scene change whenever the user presses any key or clicks any mouse button. This involves appending a bit of code to our script. Simply add the following function at the bottom of

func _input(event):
  if(event.type == InputEvent.KEY || event.type == InputEvent.MOUSE_BUTTON):

Excellent! We are now done with the Title scene… Time to move onto the main event!

If it isn’t already loaded, load up GameScene.tscn. Simply double click it in the asset view:


Multiple scenes can be open at once and you cant toggle between them using tabs across the top of the screen. You can also switch between scripting, 2D and 3D modes. We are working in 3D in this scene, so make sure that’s selected.


Now we are going to assemble all of the various assets we need to create our game. We have a Bowling Pin, Bowling Lane and in this example a Bowling Ball. You may note this differs from other “Bowling With” tutorials, in that in other tutorials we procedurally generate the bowling ball. In Godot 2.x there are no editor assessable geometric primitives so we instead import the bowling ball as a 3D model. There is however a plugin available for Godot that enables you to create meshes like spheres, cubes and planes that I document the use of in this video ( ).

Click here for next part in the series.

The Video

Programming , ,

Month List

Popular Comments