Jump to content
  • Advertisement
Sign in to follow this  
Melpomene

Looking for C++ Advice and Books

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I come asking advice about C++. About a year ago, I picked up a copy of “Teach yourself C++ in 21 days” and read a few online tutorials, sometime back when gametutorials was free. My little spurt of fun lasted about a month, and I soon programmed my own little pong game. I was working on an a little isometic scrolling engine that I was very proud of, until I quit for lack of intrest. I’ve been playing with ruby for a few days, but I don’t understand much. All I can remember is the basic of structure of the hello world program: some includes, a main, cout, return… I’ve recently been trying to program again, but I’ve been running into a few, erm, troubles, mostly similar a guy in a post I can’t find right now . The gist of the thread is that he is in the situation where he hacks together bits of code and tries to interpret C++ as some kind of natural language ( using expressions from math like 3434< y <4643). I really don’t “understand” C++. I can hack together rendering code, sure. I can read a simple OpenGL spinning cube program, no problem. But when it comes to actually knowing what the parts like pragma expressions, operator preceedence, or advanced objects, or low level details do, or even writing the simplest of code, I fail. I simply know C++ superficially, I don’t know how the compiler works, or what the heck inheritence is. Templates and exceptions are beyond me. Forgive me for any misuse of internet slang, but I’m a script kiddy. I don’t know what the toys I’m playing with do on the inside, all I know is that if I put them together I get pretty colors. And I can’t debug at all, but that’s another problem. My goal is to get to the point where I’m one of the grizzled veterens who hangs out in IRC correcting stupid standard library string errors for people like myself and bragging about programming a compiler and OS. I have no delusions, I know that learning anything takes a tromendous amount of work, but if someone could point me to some books or online resources that would ease the learning process, I would be really thankful. For reference, my level of C++ is just above a fresh n00b, I understand loops and conditional structures, and other things, but when it comes to classes and pointer I understand them in theory, but implementing them nontrivially in code and not making typos is another problem. I should probably go back and program a few simple programs right now, just to make sure I remember the syntax. I read code much better than I write it. I also plan on learning bits and pieces of Perl and assembly sometime, I really want to know how Unix/Linux works scripting-wise, and I’m very interested in what happens low level in the registers. I’m mainly writing this because I was looking for intermediate to advanced books on “how things work” and classes and advanced things and such. I don’t want to go through hello world again. Thank you all for your help. Besides any book reccomendations, does anyone have any advice or warnings?

Share this post


Link to post
Share on other sites
Advertisement
I think I can help you a bit. I use only one book for leaning C++ and none other. It's called "C++ How to Program" by Deitel (Cost me over $90 for the 4th edition). It has everything from hello wold to data stuctures, and exception handling, etc... and concepts are explained very well in there. Dont get me wrong though, it's not perfect, but its very well done. There is also an optional Case Study in there, which is developed throughout the book. You wont start to actually programming it until you get to classes. Before then, you develope it. Yes its a big project(I havent gottan to it yet:D). I would suggest you do it. And of course there are excersises there. To the short answer excersises there, the answers are included, but the ones where you have to write a complete code to, you dont have answers. You may think this sucks, and it does, but this way, you are not tempted to look at it. You wreck your brain and actually learn something. The good news is that there is an answer key to the Case Study which you may reffer to after you work so hard that your brain doesnt work anymore.

P.S. Since you are into C++, you might also want to look into C. Check out
"The C Programming Language" by Brian W. Kernighan and Dennis M.Ritchie, the creators of C.

Hope this helps.

Share this post


Link to post
Share on other sites
Quote:
Original post by DeepPurple25
I think I can help you a bit. I use only one book for leaning C++ and none other. It's called "C++ How to Program" by Deitel (Cost me over $90 for the 4th edition). It has everything from hello wold to data stuctures, and exception handling, etc... and concepts are explained very well in there. Dont get me wrong though, it's not perfect, but its very well done. There is also an optional Case Study in there, which is developed throughout the book. You wont start to actually programming it until you get to classes. Before then, you develope it. Yes its a big project(I havent gottan to it yet:D). I would suggest you do it. And of course there are excersises there. To the short answer excersises there, the answers are included, but the ones where you have to write a complete code to, you dont have answers. You may think this sucks, and it does, but this way, you are not tempted to look at it. You wreck your brain and actually learn something. The good news is that there is an answer key to the Case Study which you may reffer to after you work so hard that your brain doesnt work anymore.

P.S. Since you are into C++, you might also want to look into C. Check out
"The C Programming Language" by Brian W. Kernighan and Dennis M.Ritchie, the creators of C.

Hope this helps.

Thank you very much! Though, I question how much of that would be in-depth explanation, or just beginner introduction? Can you tell me more about the depth and style of the text?


Also, could anyone more experienced give more reccomendations or advice? I take it that you are still learning C++, and no offense, but I would still like to get a view from someone who's been programming for a long time...

Share this post


Link to post
Share on other sites
None taken. The explanations are pretty detailed, you are explained a consept, then gicen an example code pretaining to that concept, which then, is explained to you (pretty much line by line). This book was recommended to me by my uncle who is a C++ veteran :D. Anyhow, go check out their website here:

http://www.deitel.com/books/cppHTP4/cppHTP4_tob.html

for a tour of the book. You can also download some code examples from their site.

Share this post


Link to post
Share on other sites
Quote:
Original post by Melpomene
Thank you very much! Though, I question how much of that would be in-depth explanation, or just beginner introduction? Can you tell me more about the depth and style of the text?


Also, could anyone more experienced give more reccomendations or advice? I take it that you are still learning C++, and no offense, but I would still like to get a view from someone who's been programming for a long time...


Well, im an old fart, does that count? I've been programming professionally ( aka, for money ) for a little over a decade. That said, I rarely if ever use C++ anymore so you might want to keep that in mind! ;)

C++ in a nutshell is a great book at explaining C++ in terms mortals can understand. After that book, pick up C++ Programming by Bjarne Stroustrup (sp?), he is the guy that created C++ and a decent writer to boot. There is a bargain basement book called something like C++ Template Design and Structure, or something to that effect. It does a great job of explaining the hows and whys of templates.

Template programming is one of the most powerful features of C++, but also one of the most misused, abused and confusing parts aswell. People will tell you memory management is the hardest thing in C++ ( the use of pointers, memory alloc and deallocation ), I say BAH to that. Templates are! I could explain to a newer programmer how to deal with memory in a safe and efficent manner about 5 times easier then I could explain how the BOOST libraries work or the gist of meta programming.

Follow the books I advised in the order I advised them and you should have a pretty good foundation. My biggest piece of advice is be project oriented, learning something, but not using it, is a difficult way to learn. Start with small projects that use the skills you learned. It goes a long way towards understanding what you are doing and is good at keeping you motivated. Make each project marginally more complicated then the last. But watch out for one huge gotcha. When you learn something new ( like say templates ) the old expression "When you have a hammer, everything starts to look like a nail". Be careful not to do things "just because you can".

My closing piece of advice is, I rarely use C++ anymore and their are good reasons for that. I am not going to get into them and I am not condemning C++ as a language, but when it comes to programming... if what you are doing in C++ doesnt feel "right", it might be time to pick up another language skill. For example, you could code web pages in C++. It would be about as fun as writing all your emails backwards though.

Share this post


Link to post
Share on other sites
Quote:
Original post by Serapth
Quote:
Original post by Melpomene
Thank you very much! Though, I question how much of that would be in-depth explanation, or just beginner introduction? Can you tell me more about the depth and style of the text?


Also, could anyone more experienced give more reccomendations or advice? I take it that you are still learning C++, and no offense, but I would still like to get a view from someone who's been programming for a long time...


Well, im an old fart, does that count? I've been programming professionally ( aka, for money ) for a little over a decade. That said, I rarely if ever use C++ anymore so you might want to keep that in mind! ;)

C++ in a nutshell is a great book at explaining C++ in terms mortals can understand. After that book, pick up C++ Programming by Bjarne Stroustrup (sp?), he is the guy that created C++ and a decent writer to boot. There is a bargain basement book called something like C++ Template Design and Structure, or something to that effect. It does a great job of explaining the hows and whys of templates.

Template programming is one of the most powerful features of C++, but also one of the most misused, abused and confusing parts aswell. People will tell you memory management is the hardest thing in C++ ( the use of pointers, memory alloc and deallocation ), I say BAH to that. Templates are! I could explain to a newer programmer how to deal with memory in a safe and efficent manner about 5 times easier then I could explain how the BOOST libraries work or the gist of meta programming.

Follow the books I advised in the order I advised them and you should have a pretty good foundation. My biggest piece of advice is be project oriented, learning something, but not using it, is a difficult way to learn. Start with small projects that use the skills you learned. It goes a long way towards understanding what you are doing and is good at keeping you motivated. Make each project marginally more complicated then the last. But watch out for one huge gotcha. When you learn something new ( like say templates ) the old expression "When you have a hammer, everything starts to look like a nail". Be careful not to do things "just because you can".

My closing piece of advice is, I rarely use C++ anymore and their are good reasons for that. I am not going to get into them and I am not condemning C++ as a language, but when it comes to programming... if what you are doing in C++ doesnt feel "right", it might be time to pick up another language skill. For example, you could code web pages in C++. It would be about as fun as writing all your emails backwards though.


Ah, many thanks! If you could answer something else though:
If I took the time to learn how to use low level C, assembly, and VGA programming, and read through the book by Micheal Abrash entitiled "The Graphics Programming Black Book", which teaches low level graphics programming and how to make basic 3d engines, would it be worth the time in learning? Or should I spend that time make inventive action, arcade and puzzle games and practicing my C++?

The book is freely available at : http://www.byte.com/abrash/ .

Also, could you suggest a few cool projects for programming that aren't run of the mill aracade games? Maybe a game with something experimental like worms/Scorched Earth with dissapearing terrain, or some cool project like a compiler or OS? Well, maybe not as hard as a compiler, but still, after a while pac man gets boring.

Puzzle games would be easy and fun too, hmm. Do you know of any addictive classic puzzles that I could modify to make a fun game?

Share this post


Link to post
Share on other sites
Hey Melpomemne. Try to create a simple console application which finds the nth prime number for the user. It sounds like you've gotten the graphics side OK. This should really test (and hopefully improve) your maths, debugging and problem sovling ;)

Hint: you'll need to use the mod opperator.

Share this post


Link to post
Share on other sites
Quote:
Original post by Melpomene

Ah, many thanks! If you could answer something else though:
If I took the time to learn how to use low level C, assembly, and VGA programming, and read through the book by Micheal Abrash entitiled "The Graphics Programming Black Book", which teaches low level graphics programming and how to make basic 3d engines, would it be worth the time in learning? Or should I spend that time make inventive action, arcade and puzzle games and practicing my C++?

The book is freely available at : http://www.byte.com/abrash/ .

Also, could you suggest a few cool projects for programming that aren't run of the mill aracade games? Maybe a game with something experimental like worms/Scorched Earth with dissapearing terrain, or some cool project like a compiler or OS? Well, maybe not as hard as a compiler, but still, after a while pac man gets boring.

Puzzle games would be easy and fun too, hmm. Do you know of any addictive classic puzzles that I could modify to make a fun game?


Thats an easy answer. No. That book would have a horrible return on investment. I own it, atleast in its first iteration. At the time it was published ( in the DOS days ) you could almost consider it a bible. The man is brilliant and the book is very good. Its just that what it teaches just isnt relevant anymore. DirectX, OpenGL and HLSL all abstract away any concept of dealing directly with the hardware.

Heres a hint, if you ever think to yourself... Hmmm... maybe I should do this in assembly to increase the speed. Step back, you made a mistake somewhere. Now, down the road, by all means, take the time to read that book. It will go a long ways towards helping you understand some of the underlying concepts and math behind 3D programming. Right now though, it would be a horrible waste of your time.


As to cool projects, there is a game I have in mind to write, but cant because I am working on a book project at the moment. You would need to have a pretty good idea of 3d math to pull it off though, but other then that, its simple as simple gets.

You ever play one of those games ( like... made of wood or plastic games ), where you tilt the game around to make a ball roll down a hole to win? Thats just begging to be made into a simple arcade still game. You would just need four analog controls... tilt board left, forward, right and down. Then, based on angles and the physics behind it, you try to steer a ball through a maze.

Then, as levels change, you can increase the difficult by having more complex levels. For example, you could have a multi teired level, a level where gravity is lighter, or heavier. A level with magnets that push or pull your ball... whatever. Basically, its like Marble Blast, but instead of controlling the marble, you control the world around the marble.

Oddly, I think it would be strangely addictive and relatively easy to do. But get your basic programming down first. Do something pongish, then pongish with physics, then 3d pong with physics. At that point, you know everything you need to make the game I described. Oh, and if you are a C++ programmer ( or C#, I think there are bindings ) check out ODE, it would make the job alot easier.

Editted because me no spelz too gud

Share this post


Link to post
Share on other sites
Quote:
Original post by CzarKirk
Hey Melpomemne. Try to create a simple console application which finds the nth prime number for the user. It sounds like you've gotten the graphics side OK. This should really test (and hopefully improve) your maths, debugging and problem sovling ;)

Hint: you'll need to use the mod opperator.


He's already done pong and an isometric game. Going back to console programming would be painfully boring, but your suggestion is a good one for people working on algorithm skills.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!