Ogre 1.8.0 RC1 for WinRT/Metro

Ogre 3D Logo

Here’s an interesting hypothesis: when Apple started its App Store, it was the El Dorado of software developers. Now Microsoft is adding an App Store to Windows 8. The Windows user base is huge, much larger than even the number of people running around with iPhones in their pockets (some estimates I came across average to around 75 million iPhone users [1] [2] versus around 600 million Windows users [3] [4]). Even if Windows 8 adoption rates are as bad as Vista’s you could turn a mighty profit!

What better way could there be to achieve that than to publish a 3D game on the Windows App Store when most of the world’s developers are still trying to get a grasp of WinRT? :)

Of course I wanted to use an existing 3D engine, so I reviewed my options:

EngineStatus
Ogre 3D A user named Eugene on the Ogre forums already did all the work required fixing invalid API calls so Ogre compiles and validates on WinRT. This is what this post is about!
C4 Engine No word on WinRT/Metro support. C4 is based on OpenGL, but Windows App Store only allows Direct3D 11 to be used. I’ve seen someone on C4’s forums working on a Direct3D 11 renderer, so if its source is released, C4 users might get lucky.
Unity I believe Unity is well positioned for Metro support (they have an experimental Direct3D 11 renderer, I wouldn’t rule out porting Mono to WinRT either). No official statement yet and I’ll not risk betting on some kind of surprise. You can vote for Unity WinRT/Metro support here.
Axiom 3D Axiom 3D is a .NET rewrite of Ogre. Work on a SharpDX renderer is on its way, and SharpDX will support WinRT/Metro. Sadly, Axiom 3D is severely understaffed, thus, despite fantastic people like Borrillis, the massive size of the code base means it’s moving slowly.

Ogre 3D

Thanks to Eugene’s work on porting Ogre to WinRT/Metro all I had to do was pick up his changes, reapply them to my sources and generate projects via Visual C++ 11 Beta (CMake is great and all that, but I already had some projects from my Mogre builds and wanted to customize a few things). The ARM debug build was a bit tricky, I had to use LTCG just so the linker wouldn’t blow up from the size of the object files.

In the end I managed to build a working set of Ogre WinRT binaries:

Screenshot of my Minimal Ogre Application running in the WinRT/Metro Simulator

You can download a minimal example application that will compile and run out-of-the-box as long as you have the Windows 8 Consumer Preview and Visual Studio 11 Beta installed. It includes binaries of Ogre, FreeImage, Hydrax and SkyX for x64, x86 and ARM in both Debug and Release flavors and is configured to automatically link the right versions of those libraries.

Notice

Binaries no longer work on Windows 8 Release Preview
WinRT and C++/CX have gone through some changes and the files below will no longer work with the current Visual Studio and Windows 8 versions. I have published a new package here: Ogre 1.8.0 for WinRT/Metro.

Download

Ogre-1.8.0-RC1-WinRT-VS11Beta-Demo.7z (29.6 MiB)

Ogre-1.8.0-RC1-WinRT-VS11Beta-Sources-and-Patches.7z (82.6 MiB)

Requires Windows 8 Consumer Preview and Visual Studio 11 Beta (I’m running the Express edition, but have Professional installed also, so it may or may not work with Express alone). The Demo package contains the example project and all compiled Ogre DLLs you need to get going. The Sources-and-Patches package contains the Ogre source code and is useful if you want to compile and debug Ogre yourself.

Status

As you probably already know if you’re interested in WinRT development, many of the Windows API methods are not accessible to WinRT applications. Visual C++ 11 Beta helps you by removing forbidden API methods if you compile a WinRT project, and to detect things such as linking to a non-WinRT DLL that uses forbidden API methods, the Windows App Certification Kit is used. If you submit anything to the Windows Store, Microsoft will do its own checks, which at the very least include running the Windows App Certification Kit. If that fails, your app will not be accepted.

Screenshot of the main dialog of the Windows App Certification Kit (ACK)

The current Ogre WinRT build passes validation with these exceptions:

  • PluginCgProgramManager uses NVidia’s CG toolkit. You can use it for development, but your final product must not load or use this plugin
  • RenderSystemDirect3D11 relies on D3DCompiler_44.dll, which is not WinRT-clean. We have to see whether Microsoft provides an HLSL compiler that can be used from WinRT or if we need to compile all shaders ahead of time and only ship their compiled versions.

Windows 8 RC1 is expected for May/June, so we may get a new Visual Studio 11 Beta and more informations then. Even if that brings bad news (eg. no HLSL compiling in Metro), there’s still at least 4 months left until release day, so my plan will be to begin development with what I got here and in 2-3 months I can evaluate if additional work will be required or not. That would also be a good time to decide whether aiming to publish a playable mini version of the game in the Windows Store before Windows 8 release day in order to get acquainted with the process would be a good idea.