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   versus around 600 million Windows users  ). 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:
|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.|
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:
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.
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.
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.