Jump to content

  • Log In with Google      Sign In   
  • Create Account


Game programming in (SlimDX / XNA)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 Memories are Better   Prime Members   -  Reputation: 769

Like
1Likes
Like

Posted 03 February 2012 - 04:41 PM

Hi

I have been playing around with XNA for quite some time and although it is nice I decided I would give SlimDX a go for many reasons really. Sadly there arent many resources or examples out there for SlimDX, however it seems learning DirectX would directly benefit me in SlimDX (a common statement on App hub and SlimDX homepage).

I decided to open a few beginner examples in the DirectX SDK and was surprised to see a shocking amount of files being opened, sadly I have no C++ knowledge so I guess it is no surprise that external dependency folder and other folders flooded with headers confused me.

I figured they were as the name suggest external things I could ignore, or at least I hope so, anyway the main part of these apps had an enormous amount of code, making it feel like I was going to see something 'cool', sadly when I ran it is very basic stuff (I say that in a XNA sense of what one could do with that many lines of code). Now I dont particular understand the code and I am not criticising C++ in any way, but if learning DirectX would help me with SlimDX would that mean game programming on SlimDX would be just as verbose? I am thinking no but then comments like "SlimDX is a DirectX wrapper, if you can code in DirectX you can code in SlimDX" is worrying me.

I had the chance to look at the SlimDX examples, they were very simple but didnt have massive amounts of code, of course I cant really compare the examples to DirectX, I guess in a way my question is if I written a game in SlimDX would it be just as verbose as C++/DirectX?

Sponsor:

#2 Gavin Williams   Members   -  Reputation: 646

Like
1Likes
Like

Posted 22 February 2012 - 11:43 PM

[This is a copy of my reply to your post on AppHub]

C++ and C# are not the same language, so the experience of programming in each is going to be different. I was programming in XNA until the end of last year, when I realized how far behind current tech XNA had fallen, and that it is most probably going to be killed off, considering that it hasn't matched DirectX for about 6 years, I would consider that it is already dead and people just haven't caught on yet. I started learning SlimDX and after a couple of months my evaluation of SlimDX is that it is better and more current that XNA, and I would recommend to anybody programming in XNA that they should switch to SlimDX. I actually find the experience of programming in SlimDX very similar, because remember that a lot of your code is just C#. Yes, there are a few things that seem a bit daunting at first, text is horrid ! But they are small humps to overcome compared to the pleasure of working with something that is actually current.

In comparing SlimDX to Direct X, there is no comparison if you are a proficient C# programmer. You would NOT use C++ and DirectX, that path is a nightmare compared to using SlimDX and C#, and the only people who need to use DirectX are people that want to work for AAA studios, the rest of us can make everything we want using managed code. The verbosity of SlimDX might be comparable to DirectX but SlimDX is written as a managed and C# styled framework, so it beats DirectX hands down. And the verbosity is actually what gives you power over the pipeline and resources. Get your hands on a book 'Practical Rendering & Computation with Direct 3D 11', read it and use it as a reference. But remember that you're not using it to learn C++ and DirectX, you're using it to learn about the Direct X 11 framework at a conceptual level. Don't waste your time learning the syntax and object names in DirectX.

I've been studying C++ a little more and put together a basic DirectX window. Using DirectX & C++ is not enjoyable IMO (although i do kinda like some C++ stuff) and I came to the conclusion that it was probably a waste of time, simply because SlimDX offers everything it offers, with the overwhelming advantage that it is a C# framework. Sure C++ has some novel low level power, but it's becoming less and less relevant, while C# is at least maintaining popularity if not growing, along with Java.

If i were to answer your last question, I would say that using SlimDX is more similar to using XNA than Direct X, because you will be using C# : our language of choice :)

#3 meeshoo   Members   -  Reputation: 508

Like
0Likes
Like

Posted 23 February 2012 - 05:04 AM

@Dynamo_Maestro
What platforms are you targeting with your game?

I realized how far behind current tech XNA had fallen, and that it is most probably going to be killed off, considering that it hasn't matched DirectX for about 6 years, I would consider that it is already dead and people just haven't caught on yet


XNA projects should be able to run on Xbox 360, and the console supports DirectX 9 only, so that is why it hasn't matched more recent DirectX versions, far from being dead.

the only people who need to use DirectX are people that want to work for AAA studios


Not true, and it will become more obvious when people will start making games for the upcoming Windows 8 tablets.

Using DirectX & C++ is not enjoyable IMO (although i do kinda like some C++ stuff)

Sure C++ has some novel low level power, but it's becoming less and less relevant, while C# is at least maintaining popularity if not growing, along with Java.


It seems to me that you are saying DirectX is ugly because you are not yet proficient with C++ and COM technology. As I personally am familiar with those technologies, I can say there is nothing difficult about them once you get used to how they work. However, it looks like C++ and COM technology have been revived by Microsoft, again, for programming performance critical applications on their upcoming Win 8 tablets, so it might become a requirement to know these technologies even for us indie devs.

#4 kunos   Crossbones+   -  Reputation: 2203

Like
0Likes
Like

Posted 23 February 2012 - 06:57 AM

Sure C++ has some novel low level power, but it's becoming less and less relevant, while C# is at least maintaining popularity if not growing, along with Java.


How I wish that was true. Actual evidence suggest exactly the opposite (in the game programming world) , C++ is alive and kicking.. I have been wishing for a C# adoption has the language for game developing just as it happened before with C vs ASM and with C++ vs C .. but it didn't happen and it isn't happening either.
Stefano Casillo
Lead Programmer
TWITTER: @KunosStefano
AssettoCorsa - netKar PRO - Kunos Simulazioni

#5 Memories are Better   Prime Members   -  Reputation: 769

Like
2Likes
Like

Posted 24 February 2012 - 05:44 AM

I saw this thread and clicked it hoping to reply with "Pick SlimDX", then I noticed I started the thread haha.

So much has happened in 20 days, it feels like a lifetime since I posted this question. The question was answered shortly after in a different question, but for the sake of things I thought I would mention some things based on replies; before I start, I, in no way will be making a comparison war because A I havent used C++ a lot (even though I seem to be reading more C++ code these days) and B comparison wars suck.

When I started playing with SlimDX/DirectX I thought "wtf is this, why do I have to write an essay just to do one thing?", but I stuck with it and within a few painful hair pulling days things made sense, the way I see it, the GPU is an alien with artistic talents but with the brain of Homer Simpson and you just have to describe everything you want it to do even if it is obvious that you want it to do that.

Anyway after the device, buffer, swap chain, rendering stage, etc. Programming with DX started to feel a lot like XNA just with extra describing requirements, in fact I would even go as saying it was on par with XNA on ease (well once you have your device running and working).

As for C++, out of all the lower level languages I experimented with, C++ is the only one I didnt enjoy using, I wont go over the reasons here as theres far too many and they are just my opinions anyway, I can accept people like it and use it a lot. I enjoyed C a lot, to a point where I would rate it is as my second language of choice (even higher than F#), even assembly rated high but C++, lol yeh thats something I probably wouldnt want to use anytime soon, it is nothing to do with complexity either as I have the same distaste for PHP too.

For the sake of projects, C++ was only on my list of languages to learn for the sake of DirectX, which has become somewhat pointless now because of SlimDX, I will eventually learn it but I doubt it will be anytime soon, C and ASM oddly enough have many more reasons to learn, mainly because of advance learning and major open source projects I would like to be involved with in the future which oddly enough are all written in C

In terms of learning, I would say I have learnt more about graphics programming in the past month via directx than I did with XNA, the issue with XNA was half of the time I was in "copy / paste this here and change a variable / parameter" and learning HLSL was limited to 'copy / paste this'. With DX it was "this single line will affect this area of your app by doing this to the GPU". After a while the verbosity makes sense, its usually the same thing over and over again but in a nice way, typically this builds up but you can make your own nice library out of  it that reduces repetition.

Several reasons of why I wont go back to XNA (Note: I never had any intention ever of making games on a console / phone anyway).

1. Learning SlimDX requires learning DirectX and to an extent C++ (for the sake of converting code from C++ to C#), in a way you are learning 3 things, for me this is a great thing, the learning curve (although initially was intimidating) is nice.

2. SlimDX is flexible in its use, I can use it in WPF or WinForm and make use of the UI features too. At present I am not sure if this is a good way of doing UI components in a DX game, so far I havent had any issues at all and I am making use of many WPF UI controls that require very little code to work with the game. For graphical apps I would say this is a brilliant feature, I cant stress how simple it is to make UI controls which also work in fullscreen too Posted Image and those WPF controls are hot stuff

3. The future of XNA is uncertain, I personally think a XNA 5.0 will come out but since I am making PC games it wont really have much of an impact on me

4. DX10/11, at present XNA only supports DX9, after having a taste of what a geometry shader can do I dont really want to go back to the stone age. Theres tessellation and DirectCompute too but I havent bothered with them yet :baby steps:

5. After the device, buffer, swap chain and renderer are made it feels like you are programming in XNA, things are straight forward and easy after this.

6. In the unfortunate event of needing to use C++/DX you can make use your SlimDX knowledge (you'll still need to learn DX again because of pointers and crap but you will at least know what everything does)

7. Async / Await, although I havent played around with SlimDX in VS11, I believe game programming in SlimDX will require even less time when C#5 comes out, this applies to XNA too but I thought I would mention it anyway.

8. Full control over your app / game, I didnt get along with the content pipeline at all

Anyway as for the A vs B drama, they are old, annoying and after a while never really make sense, I for one picked C# and stuck with it for a million and one reasons that for some stupid reason never even get mentioned in these wars. I could list them all but im secure with my language and dont need to sell C# to people, thats what MS are for Posted Image

#6 LanceJZ   Members   -  Reputation: 108

Like
0Likes
Like

Posted 11 December 2012 - 06:14 PM

I'm in your boat Dynamo_Maestro, I've reached a point I want to grow. I do this as a hobby, but I also enjoy to share what I learn. This is something that is rare it would seem. My last hurdle is the mesh. Getting it form a file, to the screen. Learning C++ makes my head hurt, as does reading it. I've read all the samples, and the suggested DIrectX tutor sites, and they were not really much help for me. I need wait it seems to find someone who is able to explain things some one like me can understand. No one has yet, that I found, made a blog on learning SlimDX, or SharpDX. I chose SharpDX because it is currently supported. I hope I end up enjoying talking to the GPU directly soon. The time and energy it takes to figure it out is daunting. Having XNA do all the work for me, made me lazy. I think I understand game programming, I even made a simple game engine tutorial using XNA that took me about three months to complete. I'm at the point now that I'm getting so frustrated that I'm losing my motivation. I could use some good news from someone who has been where I am.
Any tips would be appreciated!
Thank you for your time, and game on!
if (Try()) Do();
else DoNot();

#7 laztrezort   Members   -  Reputation: 955

Like
0Likes
Like

Posted 11 December 2012 - 08:35 PM

I'm at the point now that I'm getting so frustrated that I'm losing my motivation. I could use some good news from someone who has been where I am.
Any tips would be appreciated!


I would start by going through the Rastertek tuturials, which have also been helpfully ported over to SharpDX (http://sharpdx.org/f...ials-in-sharpdx). Go through the tutorials slowly, making sure you understand the key elements - you'll soon learn that there isn't a whole lot of difference from XNA on a basic level, just that you have to provide the framework & glue code yourself.

Also, even without a background in C++, you will likely pick up enough while going through those to help you continue to learn the DirectX API (through C#) from any C++ based tutorial site/blog/book or the examples given in the SDK.

EDIT: while I would still suggest doing the above to learn the low level stuff, note that SharpDX is now providing a "toolkit" that looks (from just quickly looking at source) very XNA-like.

Edited by laztrezort, 11 December 2012 - 08:37 PM.


#8 Memories are Better   Prime Members   -  Reputation: 769

Like
0Likes
Like

Posted 12 December 2012 - 07:17 AM

Aww memories, it feels like a lifetime since I started using DirectX.

A few things I feel I should mention (even though I never expected this thread to be necroed :S) as this thread reflects my opinions back in Feb this year and not my present ones

1. I very much take back pretty much everything I ever said bad about C++. I use it heavily WITH C# now and C++11 very much changed my opinion on the language, both C++ and C# get criticisms that I think are too unfair at times
2. I ended up moving on to SharpDX, mainly because of the Windows 8 features, its not really different from SlimDX but it has Win8 features
3. This is probably going to get me some criticisms but honestly I think it was a great choice I made doing things at such a lower level, tasks are only difficult the first time around, once you work things out you almost never have to deal with that issue again. Granted, theres a lot of problems and the learning curve is steep but its well worth it imo. As for the verbosity, you get use to it and things become very easy to read after a while, it can be intimidating at first but after a while not only do you understand whats going on you appreciate and respect the design and why so much is required
4. Minus a short break during tax season I have stuck to my projects and still having far too much fun, its the like the honeymoon period is never going to end :)
5. WPF doesnt support 'true fullscreen' and having no direct access to the internal SwapChain makes certain game tasks (fullscreen, AA etc) difficult, yet it is flawlessly brilliant as an editor.


I'm in your boat Dynamo_Maestro, I've reached a point I want to grow. I do this as a hobby, but I also enjoy to share what I learn. This is something that is rare it would seem. My last hurdle is the mesh. Getting it form a file, to the screen. Learning C++ makes my head hurt, as does reading it. I've read all the samples, and the suggested DIrectX tutor sites, and they were not really much help for me. I need wait it seems to find someone who is able to explain things some one like me can understand. No one has yet, that I found, made a blog on learning SlimDX, or SharpDX. I chose SharpDX because it is currently supported. I hope I end up enjoying talking to the GPU directly soon. The time and energy it takes to figure it out is daunting. Having XNA do all the work for me, made me lazy. I think I understand game programming, I even made a simple game engine tutorial using XNA that took me about three months to complete. I'm at the point now that I'm getting so frustrated that I'm losing my motivation. I could use some good news from someone who has been where I am.
Any tips would be appreciated!
Thank you for your time, and game on!


The 3 main resources I worked with that taught me enough about the pipeline (after that it was really, maths (in and out of shaders) and programming) were.

Ultimate Game Programming with DirectX, Second Edition - It's in DirectX10 but DX10 can be converted to DX11 easily.
Introduction to 3D Game Programming with DirectX 10 (DX11 Version Out Too) - It covers a lot of the remaining areas you need to know, picking, stenciling, heightmaps etc There are some really nice basics to read up on before moving on to advance rendering techniques

After that it was the DX SDK which was very difficult to understand before reading the above books

For rendering and effects

GPU Gems Series
Real Time Rendering
DX SDK

The books typically contain C/C++ code, but its very easy to convert

You dont have to rush through all the books either, after Ultimate Game Programming, I spent a good few months working with a single cube, a few textures and a few shader files even when working with animations, physics, input and AI. I probably would recommend using Collada until you are using your own types, its very easy to work with using xml.linq

Oh and when something seems 'difficult', just remember that everyone went through that, you will come across many obstacles but its the same ones people have crossed and had the same issues, it may take time to find a solution but you only need to find a solution once. I would recommend starting with DX11, DX10 are helpful even in this case, theres very little you need to change, I think the DeviceContext, new shader stages / features and no text / font class were the only things that were new with DX11 but they shouldnt cause any issues




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS