locked
Transitioning from XNA to C++/DirectX - where to start?

    General discussion

  • Hi there.

    I'm fairly experienced in C# and XNA, and we want to start porting our games to Windows 8. To start with, BulletAsylum: http://bulletasylum.com.

    I've been through every resource I can find but I simply cannot find a "here's a basic game loop with Pong on top of it" type sample to get us started. All of the DX information seems to be localized to setting up the swap chain (http://msdn.microsoft.com/en-us/library/windows/apps/hh465149.aspx). Common game development tasks such as loading and drawing texture are nowhere to be found. I understand that this is native, and there is no content pipeline to coddle us with and we are expected to role our own solutions... But at the same time, Microsoft is asking developers such as myself to learn an entirely new architecture so that we can support Windows 8. I'm fine with that, but would like to be met halfway since the documentation is currently so sparse. :)

    I've looked into SharpDX but it seems that it does not yet support the Consumer Preview, and it's not quite the solution I'm after - I'm fine with working in C++, but I need an example of how a 2D game should be set up in it. Should I be using Direct2D? If so, how do I load and display a texture with it? If not, should I be working on a SpriteBatch-style rendering system in 3D? If so, has anyone done something similar or is there an open source library for it already out there?

    Thanks!

    Wednesday, March 14, 2012 9:50 AM

All replies

  • That content pipeline was great wasn't it? Sometimes I wonder if Shawn's new job has him creating one for winRT/c++.
    Wednesday, March 14, 2012 1:36 PM
  • If you look more closely to the Metro samples pack for Consumer Preview, there is a bunch of samples, mini-games...etc with a minimal framework to load textures...etc.

    Alexandre Mutel - SharpDX - NShader - Code4k

    Wednesday, March 14, 2012 9:39 PM
  • We have stopped all Game development on Miscorostt platforms, until we get some clarity on what the direction is.  XNA was perfect for us, as we invested in  C#  and were able to produce 3D games for Wp7 Marketplace.  We don't have C++,  and raw DirectX experience.  SharpDX may help us as Microsot don't seem to be interested.


    Newbie Indigo and SOA fanatic

    Saturday, March 24, 2012 12:30 AM
  • A good place to start would be Shawn and Chuck's DirectXTK: http://blogs.msdn.com/b/shawnhar/archive/2012/03/02/spritebatch-and-basiceffect-for-c-direct3d-11.aspx. It gives you some of the nice XNA types in native code, like standard blend states, SpriteBatch, the stock effects, and some generated primitives.

    For loading textures, take a look at the WICTextureLoader.h/cpp in DirectXTK. WIC is great for loading textures from many file formats if you want to load straight from PNG or the likes. There's also a DDS loader if you want to load DDS files which can be a bit more optimized but require that you convert to DDS before running the game.

    There's no SpriteFont included in there, but it's something I'm working on to give to Shawn since I know writing a text rendering system isn't high up on the list of "things game devs want to spend time doing." That said, I don't know when I'll be done with it but it's not too hard to write a little system on top of the SpriteBatch he has to render out some text using one of the many sprite font generating tools out there.

    Hope that helps!



    Monday, April 2, 2012 6:48 PM
  • hey, I actually made an CPP version of XNA which is very easy to change to metro. you can find it over here http://monstersandsprites.com/wordpress/?p=83 

    It copies the system in where you have inherit from the Game class and everything is setup automaticly. It only requires a port to metro directx

    Tuesday, April 3, 2012 11:38 AM
  • I
    understand your frustration and was also worried about future of XNA but it
    seems that Microsoft will keep supporting the XNA games for Windows Phone and
    XBOX 360. Also your XNA game will be able to run on windows 8 without Metro.

    I would suggest to not to stop your game development on Microsoft platforms and keep developing for
    WP7 and XBOX 360. I think start up books on Direct X like "Beginning
    DirectX®11 Game Programming" may help to get understanding of DirectX
    programming. XNA is also based on DirectX 9 and hope Microsoft will port it to
    DirectX 11 or newer for Metro style apps. All commercial high performance games
    for XBOX 360 are being build using Direct X 9 so it will really give your team
    better understanding on low level details although it has a learning curve but
    will pay later.

    I would strongly encourage Microsoft to start publishing videos and free books etc. to develop
    3D games using DirectX and C++ like the same way they did for Windows Phone and
    XBOX 360. I think that way Microsoft will win XNA game developers to move
    towards developing high performance 3D games using C++ and DirectX. That will
    be great if they can create C++ DirectX Game programming libraries including
    physics engine and particle systems etc. Windows 8 will also be great gaming
    platform therefore I hope Microsoft will invest to create free training content
    for developing games for windows 8.

    Will you be
    okay if C++ and DirectX offers same interfaces and features as were found in XNA
    but all written in C++? I will surely be happy. Also DirectX is com based
    interface so developers will also be able to use C#.

    Friday, April 13, 2012 9:24 PM
  • I am not convinced that our XNA Games will run on Windows 8 Metro Tablets.  I am Pretty sure they won't as things stand.  I guess you meant, that our existing XNA games will still (hiopefully) run on Windows Phone 8 (Apollo).  Although I am not sure if Microsoft will continue to support the XNA Development environment.  

    Anyway without a Content pipeline, and the fact that  coding in C++ is still rather difficult to learn, means that we will no longer be developing any Games for Windows 8/Windows Phone from now on.    MonoTouch for Android and Apple are much more promising for us now.  We can reatin our XNA skills and devleop for the most promising Platforms.

    I really don't know how Microsoft think their Windows 8 Games Store  is now going to be filled, by the loss of all us indie XNA Games Developers.   Loads of (XNA) Games on WP7, and much less on their Tablets is going to look really odd to the consumer.    I no longer care for the future os Microsoft as they no longer care for us.


    Newbie Indigo and SOA fanatic

    Wednesday, May 2, 2012 12:25 PM
  • I agree with you but XNA games can run on Windows 8 desktop PCs/Laptops. I hope Microsoft may come up with some kind of library similiar to XNA to help XNA developers. They may have to plan to port XNA from DirectX 9.0 to 11.0 or they may come up with version of XNA just specific to Windows 8 Metro. If they do that they will see great number of 2D/3D XNA apps for sure.

    XNA is really easy to use since it hides all the inner plumbing and provide re-usable library code which helps a lot.

    As being hobbyist I was thinking to start with simple 2D apps first in DirectX. I started looking at the DirectX books starting from 2000 to 2012 which cover 7.0,8.0,10.0 and 11 versions of DirectX). http://www.safaribooksonline.com/ is  a great resource also Amazon has very low cost used books.

    Learning Resources:

    Video:

    1) http://www.amazon.com/DirectX-11-Programming-Standard-Edition/dp/8293179031/ref=tmm_other_meta_binding_title_0?ie=UTF8&qid=1335997653&sr=1-6

    2) http://www.amazon.com/Shader-Programming-Premium-Edition-Holthe/dp/8293179058/ref=pd_sim_sbs_b_2

    Books/ Articles:

    1) http://www.amazon.com/Programming-Absolute-Beginner-Michael-Vine/dp/1598634801/ref=pd_bxgy_b_img_b

    2) http://www.amazon.com/Programming-Absolute-Beginner-Mark-Lee/dp/1598638750

    3)http://www.charlespetzold.com/pw5/

    4)http://www.amazon.com/Beginning-DirectX-Game-Development-Series/dp/1592003494/ref=sr_1_1?s=books&ie=UTF8&qid=1335997621&sr=1-1 (Old version)

    5)http://www.amazon.com/Introduction-3D-Game-Programming-DirectX/dp/1936420228/ref=sr_1_1?s=books&ie=UTF8&qid=1335997653&sr=1-1

    6)http://www.amazon.com/Beginning-DirectX-11-Game-Programming/dp/1435458958/ref=sr_1_2?s=books&ie=UTF8&qid=1335997653&sr=1-2

    7)http://msdn.microsoft.com/en-us/library/windows/apps/hh465061.aspx

    8) Microsoft Build and GDC 2012 videos


    Wednesday, May 2, 2012 10:38 PM
  • SpriteFont is there now...

    http://blogs.msdn.com/b/shawnhar/archive/2012/05/02/directxtk-now-includes-spritefont.aspx

    BTW, there is a FWLINK that will take you to the 'current' version of DirectXTK: http://go.microsoft.com/fwlink/?LinkId=248929

    Thursday, May 3, 2012 7:39 PM
  • Seems monoGame is now running on Windows 8 metro, so you can still develop in XNA for Win8 Metro (including tablets)

    MonoGame

    You can follow the progress of it in this thread:

    http://monogame.codeplex.com/discussions/353549

    Thursday, May 17, 2012 2:52 PM
  • Hi...  I'm one of the devs on the MonoGame port to Windows 8.  It uses Alexandre Mutel's excellent SharpDX under the hood for native access to DirectX and is pretty much a drop in replacement for XNA. 

    We're currently developing a port of our own game ARMED! to Windows 8 using MonoGame.  For us it is stable enough for day to day development and we anticipate it to be "feature complete" next month.  Active development is occurring in their develop3d branch at github.

    This post is a little old, but thought it would be useful.


    • Edited by Tom Spilman Wednesday, May 23, 2012 5:22 AM
    Wednesday, May 23, 2012 5:21 AM
  • Yeah  MonoGame is looking good for us XNA Game developers.  Especially the 3D Game stuff starting in development, as I understand we can import XNA compiled content ( .xnb files).

    Using our XNA Skills to boost the iOS and Android MarketPlace. Perhaps even the Windows 8 Metro store, but I am not so sure that I want to supporting Microsoft platforms anymore.


    Silverlight an XNA Fan

    Sunday, May 27, 2012 5:55 PM
  • > we can import XNA compiled content ( .xnb files).

    Yes... many times unchanged.  It is just in some cases like textures, sound, and music on non-Microsoft platforms that require the use of custom content processors included in MonoGame.

    >  I am not so sure that I want to supporting Microsoft platforms anymore.

    I can't really say I agree with this sentiment.

    Microsoft has limited resources and with the focus on a major rewrite of the flagship OS... fixing XNA to work under Metro (which would require API changes) was not a high priority.  It isn't like you are barred from using C# to develop games.... MonoGame is filling the gap with a solution that is at least equal in performance and capability as XNA4.

    I expect to see more from Microsoft on XNA or something that is XNA-like in the next year as we learn about the next Xbox.

    In the mean time Windows is installed in over 90% of all computers in the world.  If you include smartphones and tablets in that number Windows is installed on 85% of all computing devices in the world.  I cannot see a rational reason to overlook that gigantic potential market.

    • Edited by Tom Spilman Sunday, May 27, 2012 9:05 PM Formatting
    Sunday, May 27, 2012 9:04 PM
  • I think it is great that the community rises to the occasion to fill in holes created by Microsoft's recent architectural changes! At the same time, the trouble with hobbyist ventures is you never really know what you are hitching your cart to.  Will a project be around, and cared for throughout the next five years, and if not, can your company afford a switch technology stacks?  

    I would encourage Microsoft to consider the ramifications of not providing an officially supported managed interoperability layer on-top of DirectX.  Although I do not speak for other 'professional' users of XNA, I can speak for my company when I say that we cannot entertain using third-party free tools.

    The absense of a managed layer means that we have to revisit our technology stack and evaluate architecture decisions.  For example, if we go with Windows8 w/ unmanaged code, what is the cost of training developers and testing unmanaged code?  How do these costs compare to similar training for a different platform, such as iOS? 


    • Edited by S Tonstad Wednesday, May 30, 2012 4:37 PM
    Wednesday, May 30, 2012 4:35 PM
  • > I can speak for my company when I say that we cannot entertain
    > using third-party free tools.


    Does your company use Git? Subversion? Mozilla? PHP? Apache? Python? Linux?

    IMO it would be short sighted to discount MonoGame because it's community developed and maintained.   The fact you have all the code should be a reason to choose it over an equivalent closed source solution.

    The question is does it currently meets your needs and is it better than your alternatives? For us and others it beats returning to C++.

    Monday, June 4, 2012 12:41 PM
  • Have you folks tried DirectXTK, it seems pretty cool stuff:

    http://blogs.msdn.com/b/chuckw/archive/2012/03/02/directxtk.aspx

    http://blogs.msdn.com/b/shawnhar/archive/2012/05/02/directxtk-now-includes-spritefont.aspx

    C# and XNA help in developer productivity while C++ code is the

    performance booster if well written. I was trying some old DirectX 5.0/6.0 and 7.0 C++ code

    and was amazed that code still works and lives without problems (Thanks to COM).

    My old buddies Visual FoxPro (4-5) and Visual Basic (1-6) kind of died while

    Visual C++ (4.0-onward) is still thriving.


    Monday, June 4, 2012 6:30 PM
  • > Have you folks tried DirectXTK

    I haven't tried it, but I have looked at it.  Shawn and those XNA guys have done a great job there and its really nice for people that want to move to C++ and get some of the perks XNA developers have had.

    For me I've been coding in C++ for almost 20 years...  I prefer C# now and only dive into C/C++ when absolutely necessary.


    > I was trying some old DirectX 5.0/6.0 and 7.0 C++ code
    > and was amazed that code still works and lives without problems

    My first game development job in 1998 was porting an existing game using DirectX 3 "execute buffers" to the new DirectX 5 draw primitive API.  Now i'm writing DirectX 11 code in C# making command buffers. :)


    Monday, June 4, 2012 6:46 PM
  • Free Training if you have MSDN subscription. This training also includes Metro Style Apps using C++.

    http://www.pluralsight-training.net/microsoft/msdnoffer/courses
    Wednesday, June 6, 2012 5:08 AM
  • I know this is an old thread, but there's new things to add to it. DirectXTK has continued to evolve and develop (among other thing, it now has rudimentary support for 3D models via its Model class, with more features planned for the future).

    For programmers who are unfamiliar with C++ (or who are familiar with old C++ (lots of new and free keyword usage, no smart pointers, etc.)), there are several good resources. The "Welcome Back to C++ (Modern C++)" pages on the MSDN Library - http://msdn.microsoft.com/en-us/library/hh279654.aspx - are a great entry point for those who already know C++ but may not be familiar with the new features in C++ that let you write much more robust code. I wrote a free (registration required) book for Syncfusion Inc. called C++ Succinctly - http://www.syncfusion.com/resources/techportal/ebooks/cplusplus which was designed for programmers with some knowledge of a C-style language (e.g. C#) but no particular knowledge of C++. It includes 20 code samples you can build, step through, and experiment with. There's also http://isocpp.org/ which is a good collection of C++ articles, learning resource, standards committee updates, and everything else C++.

    For good starting points, there's the Visual Studio 3D Starter Kit - http://channel9.msdn.com/posts/Visual-Studio-3D-StarterKit ; the DirectXTK Simple Sample - http://code.msdn.microsoft.com/DirectXTK-Simple-Sample-608bc274 ; Fall Fury - http://channel9.msdn.com/coding4fun/articles/Fall-Fury-Part-1-Introduction ; and my own Windows Store DirectX C++ Sample Base - http://geekswithblogs.net/mikebmcl/archive/2013/01/31/windows-store-directx-c-sample-base.aspx . I'd recommend either Fall Fury or my own Sample Base since both provide a good base platform to work from. The other two are helpful but serve more as examples of how to do specific things.


    XNA/DirectX MVP | Website | Blog | @mikebmcl

    Monday, February 4, 2013 9:13 AM