• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
thomasvantroyen

difference between xna 4 or directx 10 HLSL?

5 posts in this topic

Hi,

i've been using Xna 4 for quite a while now (2D mostly), but with the rumours about xna disappearing I thought to check out the real stuff (c++ & directX 10 sdk) and learn more about the 3D using the very good "Introduction to DirectX 10 game programming" book.

Doing this I discovered something weird (to me, that is). The HLSL in my book on DirectX 10 is different than XNA 4's. I'm starting to think XNA 4 is not directX 10, but then again i'm quite certain my XNA 4 games won't run on WinXP machines, so DirectX 9c is not supported.

Anyway, when i try to compile HLSL code from my DX10 book in XNA 4, i must change these things until it compiles:
* "technique10" should be "technique"
* SetGeometryShader must be deleted, it errors about the shader version that's not supported
* the VS and PS version stated in the technique, are not supported (only <= 3_0 works)

So, why is there a difference, what am I missing between native DX10 and XNA 4? And if it's DX9c after all, why doesn't XNA 4 work on WinXP?

Sample: (DirectX 10 effect)

[font="Consolas"][size="2"][font="Consolas"][size="2"]cbuffer cbPerObject[/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]{[/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]float4x4 gWVP; [/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]};[/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]void VS(float3 iPosL : POSITION,[/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]float4 iColor : COLOR,[/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]out float4 oPosH : SV_POSITION,[/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]out float4 oColor : COLOR)[/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]{[/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]// Transform to homogeneous clip space.[/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]oPosH = mul(float4(iPosL, 1.0f), gWVP);[/size][/font][/size][/font]

[font="Consolas"][size="2"][font="Consolas"][size="2"]// Just pass vertex color into the pixel shader.[/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]oColor = iColor;[/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]}[/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]float4 PS(float4 posH : SV_POSITION,[/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]float4 color : COLOR) : SV_Target[/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]{[/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]return color;[/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]}[/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"][color=#B22222]technique10 [/color]ColorTech[/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]{[/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]pass P0[/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]{[/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]SetVertexShader( CompileShader( [color=#B22222]vs_4_0[/color], VS() ) );[/size][/font][/size][/font]
[color=#B22222][font="Consolas"][size="2"][font="Consolas"][size="2"]SetGeometryShader( NULL );[/size][/font][/size][/font][/color]
[font="Consolas"][size="2"][font="Consolas"][size="2"]SetPixelShader( CompileShader( [color=#B22222]ps_4_0[/color], PS() ) );[/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]}[/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]}[/size][/font][/size][/font]

[font="Consolas"][size="2"][font="Consolas"][size="2"] [/size][/font][/size][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"]thanks[/size][/font][/size][/font]
0

Share this post


Link to post
Share on other sites
XNA 4 is built on D3D9. It absolutely works on Windows XP. XP is there in the [url="http://msdn.microsoft.com/en-us/library/bb203925.aspx"]list of supported operatoring systems[/url]. If your game doesn't work on XP, then there must be a problem with your game or how you're deploying it.

D3D10 brought some [i]huge[/i] changes when it came out, and a lot of them had to do with Shader Model 4.0 which brought a lot of new shader features. There were also changes to the [i]effect framework[/i] (which is seperate from core shaders), which is why you had to change "technique" to "technique10".

If you want to learn D3D10/D3D11, then I'm afraid you're going to have to actually use those API's. XNA is limited to a subset of D3D9-era functionality, which means you're going to get to a point in your book where there's no way to translate it back to XNA and SM3.0. If you want to know what you're missing out on by sticking with SM3.0, there's some info in the documentation:

[url="http://msdn.microsoft.com/en-us/library/windows/desktop/bb172268%28v=vs.85%29.aspx"]http://msdn.microsof...v=vs.85%29.aspx[/url]

[url="http://msdn.microsoft.com/en-us/library/windows/desktop/bb694530%28v=vs.85%29.aspx"]http://msdn.microsof...v=vs.85%29.aspx[/url]

[url="http://msdn.microsoft.com/en-us/library/windows/desktop/ff476342%28v=vs.85%29.aspx"]http://msdn.microsoft.com/en-us/library/windows/desktop/ff476342%28v=vs.85%29.aspx[/url]
0

Share this post


Link to post
Share on other sites
thanks, after googling around a bit more, i indeed found out it's actually DX9 but with some non-standardized features (in hidef profile) that only work by DX10 supporting hardware. that's probably the reason why it's not working on xp machines, they often don't have DX10 hardware.

But thanks for clarifying even more.

So, i guess I'll have to learn C++ with all the difficult COM syntax and macro's. I'm a pro .NET guy for about 8 years, but damn, advanced C++ is hard to learn in absence of decent code completion and helping descriptions popping up everywhere. pitty c++ hasnt changed much the last decade. Even c++11 doesn't bring much improvement on the usability-domain imho. The IDE is just not very helpfull, like c# or any more mainstream language.

Ah well, i guess my hobby-games will have to settle with DX 9 :) It's more about the AI to me anyway.

thanks
0

Share this post


Link to post
Share on other sites
Yeah you also have the option of managed wrappers like SlimDX and SharpDX. They fully expose D3D10/D3D11, so you don't lose out on anything that you would have by using native C++.
0

Share this post


Link to post
Share on other sites
i'm speechless...

you just made my day, or probably even my year :)

i already wondered why there wasn't anybody making some .NET interop of DX, but i figured XNA (what i thought to be DX10 before today) made any such attempt obsolete and that explained why no decent interop project existed.. but apparently they DO exist !!

thank you for your service but please close the door behind you, XNA :)

thanks a whole lot!
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0