I've got a game idea which I think may work on a tablet so I've created the following 'demo'. I've hooked together the Bullet Physics engine with some 3D graphics, and the falling wall of cubes could pretty much be the canonical "Hello, World" equivalent for a 3D game. I'm not sure how much time I'll have to pursue my game idea, but it should in the worst case be a route to learning some new technologies.
The demo won't win any awards for its graphics, and the video is pretty poor quality (I recorded the screen with my camera instead of using any screen capturing software).
Microsoft seem to be definitely pushing for the use of C++ for game creation with Windows 8, with no announcement of a new version of XNA, but that seems to make sense; C++ is closer to the metal than C# and will get more performance out of lower power ARM tablets. Also, there's quite a buzz with the C++ renaissance with C++11, and modern-style C++. The corresponding new technologies in VS 2010 (PPL) and VS 11 (auto-vectorization, C++ AMP) are especially cool.
I'm also keen to get back into C++ - the past year or so I've been working purely in C#, but all my prior experience was using a mixture of C# and C++, and I do miss C++ (even though I am more productive in C#). Also, my previous roles were generally in a modern style (use of STL, smart pointers etc.) but my most recent experience was "C with Classes" style code, so I've been relearning modern style as well as picking up the new C++11 features.
Building Bullet as a static lib was pretty easy, I just had to switch it over to use the Multi-threaded DLL c-runtime. Defining WINAPI_FAMILY=WINAPI_PARTITION_APP to detect any non-metro API usages revealed the usage of GetTickCount, which is unavailable on Metro apps, so I just turned off profiling by defining BT_NO_PROFILE 1 in btQuickprof.h
The Windows 8 samples including a couple of games which are decent guides on using DirectX 11. These demos aren't supposed to be examples of a whole game engine, and don't necessarily follow best practices: Marble Maze has a class DirectXBase which encapsulates all rendering logic, which is great, but the game logic is in a class MarbleMaze, which derives from this class. It's nothing that would trip up an experienced developer, but beginners may follow the example. The Simple3DGame (which also demos DirectX and XAML interop) is better structured. The only strange thing in that example is that the render primitive classes are all C++/CX ref classes. This seems to contradict what I remember Herb Sutter saying in a Channel 9 video about sticking to ISO standard C++ where possible and only using C++/CX at the boundaries.
I'm not sure yet whether I'll try to continue to create a simple demo of my game idea purely in C++, or create a C++/CX interop layer to facilitate writing the game logic in C# - I'm tempted to do this as I'm more productive in C#, and it'll probably lead to a deeper understanding of WinRT which will be useful even when creating C# XAML applications.
I could have alternatively stayed purely in C# and used SharpDX, or a game framework such as ANX or Ogre (both of which say will soon be supporting XAML), but I was keen on having control of the whole game, C++ upwards - if after profiling any of the C# code any bottlenecks are found, it'll be easier to re-implement those parts of the code in C++.
As to my experiences of developing the demo: The new version of C++ definitely feels more productive, and feels closer to C#. I love auto (var), lambdas (pretty much the same), for_each (foreach) and range for, and initializer lists. Also, async programming using PPL tasks feels very similar to .NET's TPL. I've had to change mental gears a bit in thinking again about object ownership instead of relying on the garbage collector, and it took way longer than it should for me to figure out how to add a std::unique_ptr into a vector.
I could share the demo code if anyone would find it useful (I need to tidy it up a little bit, and can't be bothered otherwise) - just post in the comments!
Labels: 3D, C++, Direct3D, Metro, Simulation, Windows 8, WinRT