Jump to content

  • Log In with Google      Sign In   
  • Create Account


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


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
16 replies to this topic

#1 Inuyashakagome16   Members   -  Reputation: 835

Like
0Likes
Like

Posted 23 April 2012 - 10:07 AM

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.)

Sponsor:

#2 ApochPiQ   Moderators   -  Reputation: 15164

Like
5Likes
Like

Posted 23 April 2012 - 10:25 AM

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.

#3 Inuyashakagome16   Members   -  Reputation: 835

Like
0Likes
Like

Posted 23 April 2012 - 10:38 AM

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.


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

#4 ApochPiQ   Moderators   -  Reputation: 15164

Like
1Likes
Like

Posted 23 April 2012 - 10:43 AM

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?

#5 Inuyashakagome16   Members   -  Reputation: 835

Like
0Likes
Like

Posted 23 April 2012 - 10:49 AM

Very true statement. I learn best by experience anyway :P Thank you sir.

#6 Washu   Senior Moderators   -  Reputation: 5042

Like
3Likes
Like

Posted 23 April 2012 - 11:30 AM

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?


If the bike were C++... I would first get one of these:
Posted Image
After which I would then gingerly approach said bike and very carefully attempt to peddle it. But then it would probably do this:
Posted Image

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.
ScapeCode - Blog | SlimDX


#7 SimonForsman   Crossbones+   -  Reputation: 6066

Like
0Likes
Like

Posted 23 April 2012 - 11:51 AM

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.
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!

#8 Inuyashakagome16   Members   -  Reputation: 835

Like
0Likes
Like

Posted 23 April 2012 - 12:10 PM


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.

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

#9 theo2005   Members   -  Reputation: 114

Like
0Likes
Like

Posted 23 April 2012 - 12:42 PM

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.

#10 Inuyashakagome16   Members   -  Reputation: 835

Like
0Likes
Like

Posted 23 April 2012 - 12:51 PM

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?

#11 SimonForsman   Crossbones+   -  Reputation: 6066

Like
1Likes
Like

Posted 23 April 2012 - 12:52 PM



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.

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. Posted Image


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.



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?

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.
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!

#12 Inuyashakagome16   Members   -  Reputation: 835

Like
0Likes
Like

Posted 23 April 2012 - 01:58 PM

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?

#13 yckx   Prime Members   -  Reputation: 1163

Like
1Likes
Like

Posted 23 April 2012 - 04:49 PM

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.

#14 SimonForsman   Crossbones+   -  Reputation: 6066

Like
1Likes
Like

Posted 23 April 2012 - 07:17 PM

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.
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!

#15 Inuyashakagome16   Members   -  Reputation: 835

Like
0Likes
Like

Posted 23 April 2012 - 07:37 PM


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.

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.

#16 ReaCaer   Members   -  Reputation: 160

Like
1Likes
Like

Posted 24 April 2012 - 05:51 AM

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

#17 Inuyashakagome16   Members   -  Reputation: 835

Like
0Likes
Like

Posted 24 April 2012 - 08:15 AM

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




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