# pros of sticking with directx(bad phraising)

This topic is 3653 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Even though a lot of my posts seem odd(going from xna to c++ to directx to c# help). There was reason for that. For one club we did c++ programming so I learned the specifics of c++(things I did not know with c#) and I found it pretty enjoyable. I was playing around with xna because it seemed very easy to use and pretty fun but with my new found knowledge of C++, I decided to take a look at win32 and directx programming. I borrowed some books from the library and it seemed pretty hard and some what long to do. (Not bashing it at all). I see a lot of people talking about it on the forums and was curious about directx and ways to get into it(I know you need a baring on win32 first). I know knowledge is never lost as well as time because you are learning something new, but with not many new books on it as well as microsoft's site mainly dedicated to xna, is it still a good idea for a hobbyist to get into directx? Thanks a lot

##### Share on other sites
Either way, you should avoid C++ and get stuff done. There is C# bindings for the straight DX stuff (google slimDX) if you're focusing more on eye candy demos than the game itself.

##### Share on other sites
Unless, as a hobbyist, you intend to go down the professional development route eventually, taking the DirectX route over XNA may not prove to be very fruitful or particularly enjoyable. One of the biggest hints is how Microsoft is treating hobbyists. Hobbyist work is shuttled down the XNA route with plenty of wonderful learning resources and forums and the like. C++ DirectX resources are very much geared for the serious game studio developer. So even if you get somewhere with C++ and DirectX, you need to ask yourself, in the end, as a hobbyist, so what?

##### Share on other sites
Quote:
 Original post by oler1sUnless, as a hobbyist, you intend to go down the professional development route eventually, taking the DirectX route over XNA may not prove to be very fruitful or particularly enjoyable. One of the biggest hints is how Microsoft is treating hobbyists. Hobbyist work is shuttled down the XNA route with plenty of wonderful learning resources and forums and the like. C++ DirectX resources are very much geared for the serious game studio developer. So even if you get somewhere with C++ and DirectX, you need to ask yourself, in the end, as a hobbyist, so what?

It is also important to note that some people do enjoy a challenge. Half the fun is in the learning as they say.

It took me ages to settle on C as my language of choice, but once I did I found it very rewarding.

##### Share on other sites
I don't understand this whole "C# is easier than C++" thing that everyone says, probably because I've never actually tried C#, but still C++ isn't really that intimidating. The only negative aspect I've encountered with C++ so far has been the ability to shoot yourself in the foot, whereas other languages I've tried (java, VB) try to prevent it. Once you get used to C++ I think it's a very nice, and makes going back to the other ones frustrating since you can't use pointers and know that it's wasting so much run time of stuff like making copies of entire objects.

As fir the DirectX vs XNA question, it's pretty much up to you. DirectX will be a harder learning curve, but it's got a lot of functionality and lets you do low level stuff. I've never used XNA myself, but it looked alright to me. Learn whichever one you want, it's not like learning either one won't benefit you, since most of the graphic techniques used are similar regardless of libraries.

##### Share on other sites
Edit

Forum's been acting strange for me, I clicked submit and got an error on page so I pressed back and submitted, which caused accidental double post.

##### Share on other sites
Quote:
 It is also important to note that some people do enjoy a challenge. Half the fun is in the learning as they say.It took me ages to settle on C as my language of choice, but once I did I found it very rewarding.

But nobody likes wasting their time fighting with complexity when they don't have to. If you want a challenge, work on a harder game/problem with the best tools available rather than tying one hand behind your back.

Quote:
 Original post by Mr_ThreepwoodI don't understand this whole "C# is easier than C++" thing that everyone says, probably because I've never actually tried C#, but still C++ isn't really that intimidating. The only negative aspect I've encountered with C++ so far has been the ability to shoot yourself in the foot, whereas other languages I've tried (java, VB) try to prevent it. Once you get used to C++ I think it's a very nice, and makes going back to the other ones frustrating since you can't use pointers and know that it's wasting so much run time of stuff like making copies of entire objects.

I think you've made a fairly large, incorrect assumption (beyond the fallacy that bald pointers are commonly used in modern c++). Copies of entire objects (other than numeric primitives) are very, very rare in Java and the .NET languages. class = expression; does not copy as it would in C++; it's a reference assignment. Just as much overhead as a pointer assignment with none of the danger.

##### Share on other sites
Quote:
Original post by Telastyn
Quote:
 It is also important to note that some people do enjoy a challenge. Half the fun is in the learning as they say.It took me ages to settle on C as my language of choice, but once I did I found it very rewarding.

But nobody likes wasting their time fighting with complexity when they don't have to. If you want a challenge, work on a harder game/problem with the best tools available rather than tying one hand behind your back.

True. But it is important to keep your ultimate goal in mind when picking a language. If you want to do low level system stuff, it seems rather silly to start with Visual Basic for instance.

C (for me at least) was a good choice given my ultimate goal.

##### Share on other sites
Quote:
 Original post by Mr_ThreepwoodI don't understand this whole "C# is easier than C++" thing that everyone says, probably because I've never actually tried C#

well then :)

Quote:
 but still C++ isn't really that intimidating. The only negative aspect I've encountered with C++ so far has been the ability to shoot yourself in the foot, whereas other languages I've tried (java, VB) try to prevent it.

All useful languages more or less allow you to shoot yourself in the foot. The problem with C++ is the difficulty of avoiding it. If you haven't been working with it as long as I (or other "established" posters) have, there's a quite high chance that you shoot yourself in the foot regularly without even realizing it. (If only in that you miss simpler ways to get things done.)

Quote:
 Once you get used to C++ I think it's a very nice, and makes going back to the other ones frustrating since you can't use pointers and know that it's wasting so much run time of stuff like making copies of entire objects.

Um, no. Try reading some of these.

##### Share on other sites
Quote:
 Original post by ZahlmanAll useful languages more or less allow you to shoot yourself in the foot. The problem with C++ is the difficulty of avoiding it. If you haven't been working with it as long as I (or other "established" posters) have, there's a quite high chance that you shoot yourself in the foot regularly without even realizing it. (If only in that you miss simpler ways to get things done.)

Ok thanks for the link, I was under the impression that the other languages used object copies by default when you passed them into functions doSomething(myObject), but I guess that was wrong.

I may very well be shooting myself in the foot regularly in C++, but in terms of getting it to compile and run without problems I haven't had any issues. I try to follow the logic used in programming books I have, but I'm sure I'm missing something. Another thing is I originally learned Java as a first programming language, so I often find myself trying to implement things in C++ the way I would in Java which sometimes requires unnecessary workarounds.

Still though, I haven't found the learning curve on C++ that overwhelming. The worst part for me so far was when I was first beginning with pointers, and getting OOP working right, after that it's just been "learn a bit here and there" when I'm working with it.

##### Share on other sites
Quote:
 Original post by Mr_ThreepwoodStill though, I haven't found the learning curve on C++ that overwhelming. The worst part for me so far was when I was first beginning with pointers, and getting OOP working right, after that it's just been "learn a bit here and there" when I'm working with it.

And want to bet on how much undefined behavior your code relies on, how many bad or dangerous practices you use?

You already mentioned one: Pointers. The fact that you use (rely on) naked pointers is a pretty big hint that you're not far *enough* along C++'s learning curve. Which means you might not be in a position to judge how steep it is.

And since you seemed unaware of some pretty fundamental stuff in other languages aswell (object copies), I doubt you're qualified to compare the relative steepness of *those* languages' learning curves. [wink]

##### Share on other sites
Quote:
Original post by Spoonbender
Quote:
 Original post by Mr_ThreepwoodStill though, I haven't found the learning curve on C++ that overwhelming. The worst part for me so far was when I was first beginning with pointers, and getting OOP working right, after that it's just been "learn a bit here and there" when I'm working with it.

And want to bet on how much undefined behavior your code relies on, how many bad or dangerous practices you use?

You already mentioned one: Pointers. The fact that you use (rely on) naked pointers is a pretty big hint that you're not far *enough* along C++'s learning curve. Which means you might not be in a position to judge how steep it is.

And since you seemed unaware of some pretty fundamental stuff in other languages aswell (object copies), I doubt you're qualified to compare the relative steepness of *those* languages' learning curves. [wink]

Alright fair enough, I'm definitely not qualified to judge the languages. Was just saying that from as far as learning C++ goes it's not out of the question to use it as a starting language.

I don't know what a naked pointer is, and it's hard to find a clear definition so I very well could be using them (I'm not using void pointers is all I know). Thinking back, I should have known about the object copying thing since when you pass an object to a method in Java you can change it and it stays changed out of the function scope, so it's a reference, whoops.

As far an undefined behavior goes, what do you mean? Is there a quick example that would show me?

After I work through my current book (Programming role playing games with DirectX) maybe I should just take some time to learn the language some more.

##### Share on other sites
(imo) C++ is out of the question as a starting language. It has its uses for some stuff, but providing a straightforward platform to learn programming is not one of them.

A naked/bald pointer is a nice plain normal C++ pointer. It's used to distinguish between them and smart pointers like boost::shared_ptr and the generic "pointer" which refers to anything that behaves like a pointer.

A nice simple contrived example of undefined behavior:

int x = 4;std::cout << x++ << --x << std::endl;std::cout << x << std::endl;

##### Share on other sites
It sounds like I would be more proficient in xna as well as being less complex. But from the sounds of some of it, does directx offer any benefits to a hobbyists with a pretty good understanding of the language or is it mainly for professionals who can be proficient in it?
Sorry once again for the bad phrasing.

##### Share on other sites
Quote:
 Original post by Telastyn(imo) C++ is out of the question as a starting language. It has its uses for some stuff, but providing a straightforward platform to learn programming is not one of them.A naked/bald pointer is a nice plain normal C++ pointer. It's used to distinguish between them and smart pointers like boost::shared_ptr and the generic "pointer" which refers to anything that behaves like a pointer.A nice simple contrived example of undefined behavior:*** Source Snippet Removed ***

Like all the stuff I've written about...

##### Share on other sites
Another thing is I am currently not on vista so I can't use dx10 but does dx9 and the directx sdk have anything over xna? What benefits are gained?

##### Share on other sites
On the question of picking whether or not to go (c++ / c#) DX9/10 or jump into (c#) XNA as a hobbyist. I would have to say c# only because of the ability to play your games on the XBox (ha-ha wow we can put our games on a console! thats new! ha-ha-ha).

The reality of it is that we have c++ jocks and c# jocks that always think that their language is better. Don't listen to 1/2 the people that just want to make their language community bigger, learn a language and then learn another one, and another one! c# is a very attractive language, but I would still pick c++ over c# any day. I will say this though, learn the language and how to be a programmer not how to make games. Games are just another form of software!

My main reason for staying with c++ over c# was the speed. After someone told me that the c# DX examples where running faster and with a better frame rate then c++, I had to see it for myself. The c++ code in those examples is horrible! If you take any code and code them both very efficiently, the c++ version will spank the c# version. Try it some day. I did on a radix sort with a binary merge of 16 million numbers on my colleges multiprocessor CPU's.

But if you want to be a hobbyist and not become of professional, learn C#. But if you ever want to make it into the game industry learn both languages and a few others.

Quote:
 I borrowed some books from the library and it seemed pretty hard and some what long to do. (Not bashing it at all).

Sometimes some languages are hard a first if your unfamiliar with language. But that passes in time as with all languages. No matter which graphics library you chose they will all be hard if you don't have the mathematics background to support your venture into 3d programming.

##### Share on other sites
I see what your saying about learning the language beyond the want just to design a game. A concern of mine is with directx though, is that it won't be update like xna(with it as the announcement and as a major release).

##### Share on other sites
XNA is not a DirectX replacement, though. They're similar, but they have very different goals and target audiences.

##### Share on other sites
Quote:
 Original post by mysockshurtI see what your saying about learning the language beyond the want just to design a game. A concern of mine is with directx though, is that it won't be update like xna(with it as the announcement and as a major release).

Xna is a fancy, high level wrapper around DirectX, so by definition this shouldn't be a concern.

You'll always be able to do more with directx than you can do with xna, just with more effort.