How do I start C++ game programming?

Started by
18 comments, last by Emmanuel Deloget 17 years, 1 month ago
Quote:Original post by Dunge
-snip-
Still, for commercial games OpenGL is kinda dead. Nearly every games today use DirectX and if you want to learn something why not start with the real thing?
-snip-


How much did microsoft pay you to say that ?

virtually every single game for the PS3 and MacOSX Platforms use OpenGL or OpenGL:ES while DX is only fully supported by Windows Vista. (Not even the 360 has full DX support).

Other than those simple facts OpenGL has the exact same features as D3D10 (Except with OpenGL you can access those features on WindowsXP, MacOSX, GNU/Linux and any other system that has appropriate drivers for the hardware).

Thus claiming that DX is "The real thing" is pure ERASED - I know you're a valuable guy, but try to restrain your vocabulary when you discuss with younger guy/girls.

[Edited by - Emmanuel Deloget on March 25, 2007 8:18:03 PM]
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!
Advertisement
Quote:Original post by rogierpennink
Also, OpenGL requires you to either know how to create windows for a certain platform (winAPI for windows, XLib for UNIX systems...) or use external libraries that set up windows for you. SDL doesn't have all these sources of confusion - SDL handles all that itself so it's much quicker to get started with game coding, rather than 'set-up' coding.
Just to clarify this a little, SDL can create an OpenGL rendering context for you; you don't need to write any platform-specific code yourself in order to use OpenGL with SDL.
I went through all the opengl tutorials on nehe's sight and never looked back. so far i've been able to do everything that i want in opengl with no problems. and as people have mentioned above, it's a lot easier to use SDL to set up the window than to do it yourself. (although you can also use the NeHeGL files to handle the window). so i'd highly recommend opengl.
for sound i use "fmod" which is quite easy to understand. "bass" is also good but it takes more steps to load a song and play it then fmod.
Good Luck, and have fun!
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the internet, we know this is not true." -- Professor Robert Silensky
SDL is actually pretty... er... C-like from what I've seen. It's workable, but it really could use some wrappers. Seems like everyone who uses it ends up either writing the same "managers" and RAII wrappers etc. as everyone else, or goes around in circles getting nothing of consequence done.

Then again, it seems like most 2D graphics APIs are like that. x.x

I'm tempted to do a full set of wrappers and do it really right, using Lazy Foo's tutorials as a checklist. But I don't really have the time :(
Quote:Original post by Zahlman
Seems like everyone who uses it ends up either writing the same "managers" and RAII wrappers etc. as everyone else, or goes around in circles getting nothing of consequence done.
You are right about that (except perhaps for the 'getting nothing of consequence done' part :).

Still, building a decent object-oriented framework around SDL will in most cases be a less time-consuming task than writing an OO framework and writing oodles of platform-specific code for windowing, events, sound, image loading, and so on, so in my opinion using SDL is a still a clear win.
I'd suggest the OP go a more middle route. I suggest doing 2D graphics with a 3D api. There are lots of tutorials out there showing how to render 2D sprites and such in opengl and direct3d. Despite what another poster said, setting up the projection matrix for 2D rendering isn't THAT hard (glOrtho). And this'll give enough of an intro to the api that moving over to 3D will be less painfull.

If you stick to c++, I recommend opengl and sdl, and following nehe's tutorials. OpenGL and SDL give a much more gentle introduction: it takes much less code to get a window created and to render some triangles. And direct3d's c++ api is very daunting to a new programmer.

If you decide to try c#, I recommend managed directx or xna. Both are much simpler and cleaner than their c++ counterpart.

[off topic]

Quote:Original post by SimonForsman
How much did microsoft pay you to say that ?

virtually every single game for the PS3 and MacOSX Platforms use OpenGL or OpenGL:ES while DX is only fully supported by Windows Vista. (Not even the 360 has full DX support).

Other than those simple facts OpenGL has the exact same features as D3D10 (Except with OpenGL you can access those features on WindowsXP, MacOSX, GNU/Linux and any other system that has appropriate drivers for the hardware).

Thus claiming that DX is "The real thing" is pure ERASED - I know you're a valuable guy, but try to restrain your vocabulary when you discuss with younger guy/girls.


I'm not a microsoft fanboy, but most of what you say here is totally false. I don't mean to drive the thread off topic, but I hate to see flagrant misinformation go uncorrected.

First of all, DirectX isn't only supported on vista. It works for XP and a number of other versions. Yes OpenGL works on non-windows platforms, but those make up a much smaller portion of the market (not counting consoles of course). I'm not going to argue that one is better than the other, but the fact is that there are vastly more direct3d games out there than opengl ones.

The xbox 360 does support Direct3D, except that it lacks the fixed function pipeline. You just have to use shaders for everything. And modern games do that anyways.

At the moment opengl does not have all the features of direct3d 10. There are similarities, for example direct3D 10 no longer does kernel mode switching, something it has in common with opengl. But does opengl support geometry shaders or a unified pipeline? Nope, not yet. I'm sure it will though.

Let's not spread false information just because you don't like Microsoft, which I suspect is the case with you, judging from your first sentence.

[/off topic]
Quote:Original post by gharen2
I'd suggest the OP go a more middle route. I suggest doing 2D graphics with a 3D api. There are lots of tutorials out there showing how to render 2D sprites and such in opengl and direct3d. Despite what another poster said, setting up the projection matrix for 2D rendering isn't THAT hard (glOrtho). And this'll give enough of an intro to the api that moving over to 3D will be less painfull.

If you stick to c++, I recommend opengl and sdl, and following nehe's tutorials. OpenGL and SDL give a much more gentle introduction: it takes much less code to get a window created and to render some triangles. And direct3d's c++ api is very daunting to a new programmer.

If you decide to try c#, I recommend managed directx or xna. Both are much simpler and cleaner than their c++ counterpart.

[off topic]

Quote:Original post by SimonForsman
How much did microsoft pay you to say that ?

virtually every single game for the PS3 and MacOSX Platforms use OpenGL or OpenGL:ES while DX is only fully supported by Windows Vista. (Not even the 360 has full DX support).

Other than those simple facts OpenGL has the exact same features as D3D10 (Except with OpenGL you can access those features on WindowsXP, MacOSX, GNU/Linux and any other system that has appropriate drivers for the hardware).

Thus claiming that DX is "The real thing" is pure ERASED - I know you're a valuable guy, but try to restrain your vocabulary when you discuss with younger guy/girls.


I'm not a microsoft fanboy, but most of what you say here is totally false. I don't mean to drive the thread off topic, but I hate to see flagrant misinformation go uncorrected.

First of all, DirectX isn't only supported on vista. It works for XP and a number of other versions. Yes OpenGL works on non-windows platforms, but those make up a much smaller portion of the market (not counting consoles of course). I'm not going to argue that one is better than the other, but the fact is that there are vastly more direct3d games out there than opengl ones.

The xbox 360 does support Direct3D, except that it lacks the fixed function pipeline. You just have to use shaders for everything. And modern games do that anyways.

At the moment opengl does not have all the features of direct3d 10. There are similarities, for example direct3D 10 no longer does kernel mode switching, something it has in common with opengl. But does opengl support geometry shaders or a unified pipeline? Nope, not yet. I'm sure it will though.

Let's not spread false information just because you don't like Microsoft, which I suspect is the case with you, judging from your first sentence.

[/off topic]


The current version of D3D (Version 10) (The only one that supports modern hardware) is only avaliable on Windows Vista.

if we should keep talking about deprecated API:s i could claim that DX works on any OS (as Wine does handle old DX versions (DX7 for example) very well.

OpenGL has geometry shaders through the
NV_geometry_program4
and
NV_geometry_shader4
extensions.

There are also new extensions for fragment(pixel) and vertex shaders.

The unified architecture is 100% driver managed and isn't really an issue.

so yes. OpenGL has support for those features if you have a card that support them.

And more importantly, OpenGL has support for those features on Windows XP (Which is the most important market right now). D3D doesn't. (As only obsolete D3D versions are avaliable for that OS (The same is true for the 360, though its not a big issue there as its D3D version is enough for its hardware)).

i have nothing against microsoft or their products, however i strongly dislike their attempts to convince the general public that you need Vista and D3D10 to use modern hardware. (Which is an outright lie)

I even use Windows XP daily, it is my favourite system for gaming and my main development OS. As such i wouldn't recomend an API that doesn't give that system full access to the latest hardware.

FYI , OpenGL had extensions for all G80 hardware features before D3D10 was released.
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!
Ok, you have good points. The one about the unified architecture being driver managed is certainly a valid one. And I agree, opengl will probably go through another golden age, as it will indeed allow direct3d 10 features on xp. Haha, I wouldn't be surprised if this causes microsoft to release an updated version of direct3D9 for xp.

I hadn't realised nvidia had implemented a geometry shader extension. That's pretty cool. The question is, how long will it take the ARB to accept it?

I personally still see Direct3D10 as "upcoming", rather than "modern". It's going to be a long time before Direct3D10 cards are a household item, and my money says it'll be a couple years before we see Direct3D10 only games. And vista also supports Direct3D9, so I don't consider it deprecated. Especially for new programmers like the OP.

Regardless, we're way off topic. Although I'm still inclined to disagree some, I think we both have valid points. I just think you're getting ahead of yourself. OpenGL games running on XP using Direct3D10 hardware being commonplace is probably a couple years off.

PS - I should mention that I too use XP, and when working in c++ I prefer opengl.

Anyways, /me shuts up now.
Quote:Then there's XNA Game Studio, Microsoft new baby for beginners. It force you to code in C# and use DirectX underneath but it's a lot easier.


I we're think that, I have trained my C++ a lot and win32 api skills some.
Like making windows and so on. But I wondered did I lost all my time for praticing those, If i want to move on XNA Game Studio and code on C#.

I Thought C++, win32 and DirectX is what it need to pratice, and I use
MS Visual Studio 2005.

Quote:Original post by Ubernt
Quote:Then there's XNA Game Studio, Microsoft new baby for beginners. It force you to code in C# and use DirectX underneath but it's a lot easier.


I we're think that, I have trained my C++ a lot and win32 api skills some.
Like making windows and so on. But I wondered did I lost all my time for praticing those, If i want to move on XNA Game Studio and code on C#.


Kmowledge is never lost.

You'll find similar concepts in C#. Of course, C# doesn't use the Win32 API (at least, not in a visible way), but with the API knowledge comes the implicit knowledge of how things are done - plus some training to learn how to learn, which is never bad.

Quote:I Thought C++, win32 and DirectX is what it need to pratice, and I use
MS Visual Studio 2005.


Anything should be an occasion to practice. But don't take the mean for the end. As a beginner programmer, the end is to learn how to program, and the mean is to make programs that satisfy your curiosity, so that you can enjoy practicing. When you're no more a beginner (ro when you are a professionnal), the end is to make programs that works, and the mean is to sharpen your programming skills.

Best regards,

This topic is closed to new replies.

Advertisement