Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

C++ and DirectX for Metro Style Games

Download

Right click “Save as…”

Slides (view online)

DirectX, the most popular 3-D game API, is directly accessible by Windows 8 metro-style applications in C++. If you have a C++/Direct3D codebase, or want to create a 3-D game, this talk will show you how to use C++ and DirectX to build metro-style apps. You will also learn about new Windows 8 metro features like process lifetime management, CoreWindow, asynchronous execution, live tiles, and display rotation, and the latest 'best practices' for their use from the perspective of C++/DirectX game development.

Follow the Discussion

  • 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.

     

  • jnemeshjnemesh

    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?

  • sbruno,

    I answered your question about the lack of processor query APIs over at http://social.msdn.microsoft.com/Forums/en-US/tailoringappsfordevices/thread/8e035ad1-10fc-465b-b930-d38edc875272

    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.

  • Michael HansenMichael 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..
    http://msdn.microsoft.com/en-us/library/windows/apps/hh465136.aspx

    CAN SOMEONE PLEASE ANSWHERE THIS
    ARE WE ALLOW TO USE C# FOR SCRIPTING FOR OUR GAME ENGINE WRITTEN IN C++

    WECTH MEEN IS THERE SUPPORT FOR NET FRAMEWORK ON YOUR PRODUCTS

  • 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

Remove this comment

Remove this thread

close

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.