What sections of C++ do you need to know?

Started by
15 comments, last by Inuyashakagome16 11 years, 12 months ago

[quote name='SimonForsman' timestamp='1335203467' post='4934177']
[quote name='ApochPiQ' timestamp='1335198329' post='4934143']
That depends on the game, and it depends a lot on your personal coding style. You can write a complete game in conformant C++ without using a single structure or class. That may not be the cleanest way to write it, but it can be done.

My personal recommendation is to not worry about pre-learning concepts in programming. Go write a bunch of programs (games even) and when you find something that seems awkward or difficult, see if there's a tool or technique that can make it easier. Generally there will be.


My first graphical game: a 2D shooter written in Pascal used only goto, global variables and the borland graphics functions (everything was made by filled rectangles or lines) so it is definitly possible to write a game with little to no knowledge of the language you use or even programming in general. (As long as you are persistent), Ofcourse i only managed to make 3 levels (hardcoded as i really didn't understand file I/O) before things got unmanagable but it was a game, i made it and at the time i was insanely proud of it.
[/quote]
That's really impressive i think. I was just worried I would get to far in and I wouldn't be sure how to advance forward whether graphically or just base programming wise. But if you were able to do that with only a few things that i'm not really worried. biggrin.png
[/quote]

Just start small and you'll be fine (Pong is a great starting place), These days getting help is easier than ever aswell so don't be afraid to ask for help if you get stuck.



[quote name='theo2005' timestamp='1335206556' post='4934193']
After I've done lots of learning and periodically quitting, I've stumbled upon direct X and I was disappointed that not
even half of what I've learned was needed. What I really should have studied instead of console programming is
windows API.

But then again, lots of mistakes done and fixed, experience gained and style developed. It was "kind of" worth it.

Is windows API really that important?
[/quote]
No its not, it used to be when it was the only way to develop Windows applications but these days there are good cross platfrom wrapper libraries that take away most of the pain of dealing with the operating system directly.

I'd recommend avoiding the Windows API until you run into a situation where you have to use it. (For DirectX you probably have to use the Windows API to create a window and handle events but thats all and a decent tutorial will cover that for you) (If you go with OpenGL or a 2D graphics library you can avoid the Windows API entierly)

The Windows API is old, clunky and downright awful just like the X11 API for *nix and both of them have more or less been replaced by more modern APIs like .Net, Cocoa, QT, GTK, etc.
[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

No its not, it used to be when it was the only way to develop Windows applications but these days there are good cross platfrom wrapper libraries that take away most of the pain of dealing with the operating system directly.

I'd recommend avoiding the Windows API until you run into a situation where you have to use it. (For DirectX you probably have to use the Windows API to create a window and handle events but thats all and a decent tutorial will cover that for you) (If you go with OpenGL or a 2D graphics library you can avoid the Windows API entierly)

The Windows API is old, clunky and downright awful just like the X11 API for *nix and both of them have more or less been replaced by more modern APIs like .Net, Cocoa, QT, GTK, etc.

Okay. I had planned on at some point diving into Direct X just because of how supported it is, but if you had to choose between Direct X and OpenGL to start with, what would you choose?
Ideally you should develop a working familiarity with the entirety of C++, including classes, templates, STL, and all the rest. But it's a bit ridiculous to expect working knowledge before you ever begin coding. Code first, then use that experience to identify problem areas.

IIRC the commonly recommended project path is something like: a console guess-the-number game; [perhaps a more complex console game;] pong; Tetris; Pac-Man; a 2D platformer. Some people like to throw Space Invaders into the mix. Each one is a bit tougher than the last, and they all offer valuable experience, and are challenging yet tackleable projects for the aspiring hobbyist.

When you make the jump to graphics, strongly consider SFML; it has a windowing, events, and 2D graphics API that you can use without bothering with OpenGL, DirectX, or Win32 (which are all good to learn, but there's no need to learn two disparate things at the same time. Focus your efforts.)

As you code, you'll come across bits that you don't like how you solved them. Mark those bits so they're easily noticeable. Then when you finish your project (and not before, unles you've really and truly coded yourself into a corner) return to them and look for a better approach. Once you're satisfied, move on to your next project.

Then one day you'll wake up and realize that you've become a good programmer.

Okay. I had planned on at some point diving into Direct X just because of how supported it is, but if you had to choose between Direct X and OpenGL to start with, what would you choose?


These days they are similar enough that it is an irrelevant choice for learning purposes, DX might be easier to learn properly as there isn't as many bad tutorials for it as there is for OpenGL (Alot of OpenGL tutorials cover the now deprecated immediate mode and as a beginner it might be hard to find the good ones).

Personally i would choose OpenGL anyway since it is more widely supported but my need for my code to run on non Microsoft platforms is fairly irrelevant for you. (If you do decide to learn OpenGL first then i strongly suggest that you ask for tutorial and/or book recommendations in the OpenGL section of the gamedev forums)

There are 2 things you need to be aware of when choosing a 3D graphics API:

1) DirectX is only for Windows. (OpenGL works on Windows, Mac, Linux, BSD, Solaris and a bunch of other systems. OpenGL:ES(Which is very similar) works on iOS and Android and many smaller mobile and embedded platforms)
2) Intels OpenGL drivers are worse than their D3D drivers. (You might only get OpenGL 2.x support on a Intel GPU that supports D3D10 for example).

That said: Don't jump into a low level 3D API yet, start with something like SFML.
[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!

[quote name='Inuyashakagome16' timestamp='1335211129' post='4934211']
Okay. I had planned on at some point diving into Direct X just because of how supported it is, but if you had to choose between Direct X and OpenGL to start with, what would you choose?


These days they are similar enough that it is an irrelevant choice for learning purposes, DX might be easier to learn properly as there isn't as many bad tutorials for it as there is for OpenGL (Alot of OpenGL tutorials cover the now deprecated immediate mode and as a beginner it might be hard to find the good ones).

Personally i would choose OpenGL anyway since it is more widely supported but my need for my code to run on non Microsoft platforms is fairly irrelevant for you. (If you do decide to learn OpenGL first then i strongly suggest that you ask for tutorial and/or book recommendations in the OpenGL section of the gamedev forums)

There are 2 things you need to be aware of when choosing a 3D graphics API:

1) DirectX is only for Windows. (OpenGL works on Windows, Mac, Linux, BSD, Solaris and a bunch of other systems. OpenGL:ES(Which is very similar) works on iOS and Android and many smaller mobile and embedded platforms)
2) Intels OpenGL drivers are worse than their D3D drivers. (You might only get OpenGL 2.x support on a Intel GPU that supports D3D10 for example).

That said: Don't jump into a low level 3D API yet, start with something like SFML.
[/quote]
SFML looks amazing. O_O i looked up a few games people have made with it and it looks very nice.
From the sounds of it, between DX and OpenGL its pretty much a double edged sword, either one is nice and unsupported or one that's supported but mostly on windows. >_> But i will for sure use SFML once I get a good handle on what I'm doing in C++ again. :) I'm started work on basic stuff far as C++ goes and little games so hopefully that'll advance into SFML soon.
http://www.gamefromscratch.com/page/Game-From-Scratch-CPP-Edition.aspx

Its a good starting point, you'll be using C++ and SFML.
Its pong. But its a good structured version of pong that will put you in the right track to move into a more complex project once you're done with the tutorial.

Im quite a beginner but I suppose that SFML could be a better starting point than DX or OpenGL(?)

http://www.gamefroms...PP-Edition.aspx

Its a good starting point, you'll be using C++ and SFML.
Its pong. But its a good structured version of pong that will put you in the right track to move into a more complex project once you're done with the tutorial.

Im quite a beginner but I suppose that SFML could be a better starting point than DX or OpenGL(?)


That's a really nice tutorial thank you. :D I hope to go through that tutorial myself here soon. :D

This topic is closed to new replies.

Advertisement