Sign in to follow this  
Inuyashakagome16

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

Recommended Posts

I've been coming here for years, but finally I decided I’d become active and ask a question I’ve wondered for a long time;
What's really required for game programming? But let me explain a bit more what i mean. I already know C++ on a beginner and almost intermediate level. I've had classes for, python, C#, C++, and java. So I’ve seen a few languages and of course it comes back to C++ (for me at least) when it comes to game development.
So what do i really mean? When someone who's completely new to programming asks you "What's required to make a program?" you'll tell them a main function a variable (maybe) and some sort of print line for display. So I’m asking, do i need ____ in C++ game dev? Classes, functions, poly, inheritance, etc etc. What sections/subjects in C++ would one need to make a game? More or less because i know i need to brush up on C++ and I’ve found some good sources already, but I just wanted a general direction. I didn't want to jump into making a game/ learning Direct x and get lost and just quit.

(i'm guessing this subject is best suited for the beginners section.)

Share this post


Link to post
Share on other sites
[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.
[/quote]

Honestly i don't know what kind of game i'm really going for, more or less i just want to expand my knowledge and go for creating something C++ based graphics or not.
It would probably be easier to write a game like that :P but I wouldn't dare, because it would confuse me to the point where i would have to start over.
Pretty much just program till you hit a block or some sort of issue that just seems a bit much for what you currently know then just go out and learn something new? That's pretty much what i got out of that. :P

Share this post


Link to post
Share on other sites
ApochPiQ    23003
That's the gist of it, yeah :-)

The best way to learn is practice. If you wanted to learn to ride a bike, would you spend all your time reading books and magazines about cycling, or would you go buy a bike and roll up and down the street until you got the hang of it?

Share this post


Link to post
Share on other sites
Washu    7829
[quote name='ApochPiQ' timestamp='1335199427' post='4934151']
The best way to learn is practice. If you wanted to learn to ride a bike, would you spend all your time reading books and magazines about cycling, or would you go buy a bike and roll up and down the street until you got the hang of it?
[/quote]

If the bike were C++... I would first get one of these:
[img]http://www.fieldforensics.com/images/products/products-sps-3.jpg[/img]
After which I would then gingerly approach said bike and very carefully attempt to peddle it. But then it would probably do this:
[img]http://www.fieldforensics.com/images/explosion.jpg[/img]

Share this post


Link to post
Share on other sites
SimonForsman    7642
[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.
[/quote]

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.

Share this post


Link to post
Share on other sites
[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.
[/quote]

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. :D

Share this post


Link to post
Share on other sites
theo2005    114
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.

Share this post


Link to post
Share on other sites
[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.
[/quote]
Is windows API really that important?

Share this post


Link to post
Share on other sites
SimonForsman    7642
[quote name='Inuyashakagome16' timestamp='1335204624' post='4934184']
[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.
[/quote]

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. [img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img]
[/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='Inuyashakagome16' timestamp='1335207065' post='4934196']
[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.
[/quote]
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.

Share this post


Link to post
Share on other sites
[quote name='SimonForsman' timestamp='1335207147' post='4934197']
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.
[/quote]
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?

Share this post


Link to post
Share on other sites
yckx    1298
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.

Share this post


Link to post
Share on other sites
SimonForsman    7642
[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?
[/quote]

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.

Share this post


Link to post
Share on other sites
[quote name='SimonForsman' timestamp='1335230249' post='4934294']
[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?
[/quote]

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.

Share this post


Link to post
Share on other sites
caer    160
[url="http://www.gamefromscratch.com/page/Game-From-Scratch-CPP-Edition.aspx"]http://www.gamefromscratch.com/page/Game-From-Scratch-CPP-Edition.aspx[/url]

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(?)

Share this post


Link to post
Share on other sites
[quote name='ReaCaer' timestamp='1335268284' post='4934404']
[url="http://www.gamefromscratch.com/page/Game-From-Scratch-CPP-Edition.aspx"]http://www.gamefroms...PP-Edition.aspx[/url]

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(?)
[/quote]

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

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