XNA Creators Club Online
Page 1 of 1 (3 items)
Sort Posts: Previous Next

Dx - General Design Questions

Last post 10/5/2009 3:44 AM by D3000. 2 replies.
  • 9/29/2009 3:48 AM
    • (0)
    • premium membership
    • Posts 2

    Dx - General Design Questions

    Hi Guys,

    (This is partial duplicate post from the mobile development forum where I've stripped / modified it to only display the Dx specific questions...

    I'm new to Mobile Development and I want to make a couple games / graphical applications to target the 6.5 mobile market.

    I've created some basic games using GDI+, however, I want to try it using Dx. I have a lot of questions around: "great I got some of my code working in Dx; but is what I implemented the best way to do it?" or "How would I do that in Dx?"

    Utimately, I'd love to understand enough DirectX to hammer out a simple game on any platform. The prospect of being game developer / designer is what got me in my current career to begin with (Applications Developer for 13yrs) =)

    For 2 dimensional games / programs:

    • Is there benefit to coding 2d games in Dx over GDI+?
    • When loading images should I embed them in resource files or from file/stream? What is the best technique?
    • How have others handled rendering images for different resolutions? Did you create multiple image sets or simply stretch the images to fit the device?
    • For buttons or interactive menus is it better to render an image or to draw the rectangle / text? What's easier or more efficient on memory / performance?
    • I'm finding DirectX difficult to learn, more so the terminology such as Surface, Sprite, Texture, etc...I did find great examples detailing how to "make a game" but nothing which says "this is the best way to render a 2d scene and perform animations" (everything seems 3D). Has anyone found a great resource detailing why you would use one class over the other classes provided? Or detailing where you would use 3d over 2d; best practices?
    • in GDI+, to display nicely animated scenes / rendering such as flying or bulging text, I have to hammer out lots of "scene movement code"; does Dx have an easier way to handle 2d animations like the image or text scaling based on a time line like WPF or Silverlight has?
    • Would it be beneficial to code the game menu in GDI+, but switch to Dx for gameplay? Or just stick to one tech right through?
    Best Regards, D.

    PS Could someone point me to sample code for a game menu rendered (preferably 2d) in Dx with some basic animation? I learn best by hacking around with well commented code. Or even if you could suggest an excellent detailed 2d Dx game development book? Or more preferrably a start to finish example, like the old fashioned "How to make the Lady Bug Game" on Commodore 64 / Vic 20.

    Thanks guys!


  • 9/30/2009 6:44 PM In reply to

    Re: Dx - General Design Questions


    • D3000:
      Is there benefit to coding 2d games in Dx over GDI+?
    Yes GDI is not always hardware accelerated so some effect will have to run on the CPU instead of the GPU, this takes processing power away from your application. In D3D you can achieve 2D rendering by rendering with an orthographic projection, rendering in 3D is faster as the GPU is designed to do this.

    • D3000:
      When loading images should I embed them in resource files or from file/stream? What is the best technique?
    In PC applications you can load your textures from disc and put them in a managed pool, the DX runtime will then keep a copy in local sysmem and for the active textures a copy in AGP or GPU memory. I believe that most tripple A games only keep a copy on the GPU and us it.
    • D3000:
      How have others handled rendering images for different resolutions? Did you create multiple image sets or simply stretch the images to fit the device?
    Rendering for different resolutions is handled by mipmaps of the textures and the type of texture filtering you use, the GPU can do this stuff for you. Gpus prefer power of 2 based texture widths and hieghts.
    • D3000:
      For buttons or interactive menus is it better to render an image or to draw the rectangle / text? What's easier or more efficient on memory / performance?
    To render an image to screen in D3D you need to send a piece of geometry off that contains the edge points and texture coordinates for that geometry. It is faster to render an image then to actually render the same image as geometry. you can draw quads to a screen for this.
    • D3000:
      I'm finding DirectX difficult to learn, more so the terminology such as Surface, Sprite, Texture, etc...I did find great examples detailing how to "make a game" but nothing which says "this is the best way to render a 2d scene and perform animations" (everything seems 3D). Has anyone found a great resource detailing why you would use one class over the other classes provided? Or detailing where you would use 3d over 2d; best practices?
    The reason why everything is done in 3D is because current GPU's are highly optimized to render 3D scenes. 2D can be achieved by rendering a 3D scene with an orthographic projection and keep one coordinate axis the same for any gemotry. Bare in mind that you can also render 3D geometry in an orthographic view it will just look 2D on the screen.
    • D3000:
      in GDI+, to display nicely animated scenes / rendering such as flying or bulging text, I have to hammer out lots of "scene movement code"; does Dx have an easier way to handle 2d animations like the image or text scaling based on a time line like WPF or Silverlight has?
    No in D3D you will still have to write similar types of lines.

    Sample code can be found on Codesampler
  • 10/5/2009 3:44 AM In reply to
    • (0)
    • premium membership
    • Posts 2

    Re: Dx - General Design Questions

    Heya NightCreature,

    Thank you!

    Your post was very insightful and it got me rolling with a few things.

    Thanks again.

    Best Regards, D.
Page 1 of 1 (3 items) Previous Next