Play C++ and DirectX for Metro Style Games

The Discussion

  • User profile image

    If you want us to target Metro, you're going to have to fix the API so that we can do basic things like query for the number of CPU cores on the user's machine.

    Presently, WinRT offers me no way to determine how many threads I should create to make good use of the CPU. I will fail certification if I use Win32::GetLogicalProcessorInformation, and Win32::GetNativeSystemInfo only tells me the number of logical processors, which does not distinguish between physical cores and SMT/Hyperthreads. Please see your own documentation (DirectX sample "Core Detection") for why it's important to have the correct count.

    You want me to support Metro, but Metro doesn't support me -- not because I've fallen behind the tech curve, but because Metro doesn't support state of the art. State of the art means multicore, and in order to do multicore correctly I need to know how many threads I should create for the user's CPU.

    Until such basic functionality is made available to the developer, I must conclude that Metro simply isn't "for" real heavy-duty PC games. Metro is for phone games and tablet games.

    If I sound frustrated it's only because I've chased down this glaring oversight in the API already on your dev forums and on User Voice, to no avail. The official response was, "Yeah, it's not possible to do this". Well, OK then, as long as you understand what you're really saying is that it's not possible to put an actual, modern game on your new platform.


  • User profile image

    Glad to see the devs are paying attention to the abysmal policies and restrictions of Windows 8 and RT! Here's a hint MS...if your devs aren't happy, they won't write compelling software and consumers won't have a real reason to upgrade (see Windows Phone for a great example of this in action!).

    With major studios porting over to Linux now (see Valve, others) one of Windows main strengths in the consumer market is being eroded, RIGHT IN FRONT OF YOUR EYES! Meanwhile, you depreciate the desktop environment and push everything to Metro while at the same time you CRIPPLE your developers!

    Does ANYONE at MS realize the huge mistake(s) you are making with this?

  • User profile image


    I answered your question about the lack of processor query APIs over at

    I will just link to that here to save typing it all out again.  Hopefully this clarifies how you should implement multicore optimisations in Metro.

  • User profile image
    Michael Hansen

    what i do not understand , when we have developing our game engine in c++ , why are we not allow to use c# for scripting of our game engine

    can you folks please put some light in this case , and explain why ?
    is there no net framework on ARM tablets or phones

    or is it becourse windows is total sand box and powered by your microsoft warp technology , wicth meens a virtual os running on top of the os

    a sample from your doc..
    •Is your app a game that relies on Microsoft XNA components for graphics rendering? If so, you cannot use XNA with a Windows 8 application. You also cannot effectively use DirectX with managed code; you must develop the DirectX game with C++. For more info, see Creating a DirectX game.

    link to the doc..



  • User profile image

    Metro doesn't use the .NET Framework.  It uses WinRT. WinRT is native. In managed languages there is a projection which makes the API look correct in managed code. Another projection makes it look right in JavaScript.

    The sample you mention says XNA isn't supported.  It doesn't say C# isn't supported.

    Metro apps can be written with C#/JavaScript/C++ and VB.NET all in the same app.  This is done by creating WinRT components.

    Since C# isn't a scripting language it needs to be compiled before it can run. Folks that have used C# as a scripting language in a C++ game engine have used Code Access Security to keep the script from doing bad things.  However, Metro apps all have to pass certification which means that code must be compiled up front.  So if you are creating C# scripts and can compile those before hand I would think you could make it work in Metro.  But you definitely can't have .cs files on the machine where users could create mods to your game by changing the .cs file and have your game compile them on the fly.

    If you can precompile the scripts then you can actually make your scripts WinRT components.

    There are 4 requirements for WinRT components.

    (Note: These 4 requirements are only needed on the public types and members in your component)

    1. API signatures must use only Windows Runtime types
    2. Structs can only have public data fields
    3. All types must be sealed
    4. Only supports system provided generic types.

    VS has a project you can use to create a WinRT component.

    I'm still getting my head around all things Metro, so take my information with a grain of salt.  Hopefully someone from Microsoft can provide better information.

    Assuming you can precompile your scripts and ship them as precompiled WinRT components you should be fine.  If that doesn't fit with the game you are making, then it may be that you need to stick to a Desktop game.

    It shouldn't take a lot to test this out.

    Good luck!

    Chad Carter

Add Your 2 Cents