C++ programing book and game developing

Started by
30 comments, last by xREXISx 10 years, 9 months ago

If you're a beginner I say start with C++ Primer Plus for a C++ book. http://www.amazon.com/Primer-Plus-Edition-Developers-Library/dp/0321776402/ref=sr_1_1?ie=UTF8&qid=1371615847&sr=8-1&keywords=c%2B%2B+Primer+Plus

If you want to learn 3D Graphics I suggest for DirectX any book by Frank D. Luna http://www.amazon.com/Introduction-3D-Game-Programming-DirectX/dp/1936420228/ref=sr_1_1?s=books&ie=UTF8&qid=1371615896&sr=1-1&keywords=3d+game+programming+with+direct+x

Or the OpenGL SuperBible 6th Edition (I've read the preview edition best OpenGL book for beginners): http://www.amazon.com/OpenGL-SuperBible-Comprehensive-Tutorial-Reference/dp/0321902947/ref=sr_1_1?s=books&ie=UTF8&qid=1371615959&sr=1-1&keywords=Opengl+Superbible

OpenGL DirectX tutorials online: www.rastertek.com

OpenGL 4.0 Tutorials:

opengl-tutorial.org

http://ogldev.atspace.co.uk/index.html

Opengl 4.2 Tutorial:

http://antongerdelan.net/opengl/

An indepth look at computer graphics using opengl 3.3: http://www.arcsynthesis.org/gltut/

You'll need some math books but both the directx and opengl book will point you in the right direction for that in the reference section. Make sure you focus on learning the language c++ first though, and write some small applications yourself (practice) They don't have to be complicated, but make sure you understand those concepts as you're learning. Programming is a big undertaking and it goes much deeper than what you'll get form your first book C++ Primer. But this will be enough to get you started Good LUCK!!!

The key to immortality is to live a life worth remembering.
Advertisement
Accelerated C++ and C++ Primer Plus sixth edition

Hey,

I am looking for a book (or more) for c++ that teach me the language from the beginning to the point where i should be an "expert" on it. (does not matter if i need more then one book i will learn it smile.png )

And if you guys could give me a book that would be good on game developing (I will use Opengl if that matter) that would help me move on.

i know that basics of c++ but i dont think i know enough, I really want a book that cover's everything that i should know.

thanks a lot for your help!

try this it's very good and easy but doesn't have examples
http://www.cplusplus.com/doc/tutorial

Hello guys, first post here and what a nice community you have :)

I would like to ask your opinion about another new kid in the block, called "Jumping Into C++" by the creator of cprogramming.com. Would you recommend this book to a starter?

stay awhile and listen

Hello guys, first post here and what a nice community you have smile.png

I would like to ask your opinion about another new kid in the block, called "Jumping Into C++" by the creator of cprogramming.com. Would you recommend this book to a starter?

Looks pretty bad, to be honest:

- introducing C-style arrays and manual memory management with pointers before std::vector is a profoundly bad idea for a book that's supposed to be for a beginner.

- similarly, using all this cruft to implement a linked list instead of demonstrating std::list first is a similarly bad idea.

- I've also noticed "using namespace std;" in the very first (hello-world-style) source code -- a pretty strong sign the book itself is probably written by someone who could use some C++ lessons himself (while the using directive may have its uses, introducing it immediately -- in the very first program -- before even mentioning its potential downsides -- like namespace pollution -- is a recipe for disaster).

Definitely avoid.

Hello guys, first post here and what a nice community you have smile.png

I would like to ask your opinion about another new kid in the block, called "Jumping Into C++" by the creator of cprogramming.com. Would you recommend this book to a starter?

Looks pretty bad, to be honest:

- introducing C-style arrays and manual memory management with pointers before std::vector is a profoundly bad idea for a book that's supposed to be for a beginner.

- similarly, using all this cruft to implement a linked list instead of demonstrating std::list first is a similarly bad idea.

I someway agree on this. I do agree beginners really need to know about std::vector, std::list and smart pointers and use them in production code.

But I fully believe it is important to understand at least the basics of how the are implemented. I think beginner books SHOULD mention and teach users about raw pointers. Fact is they are still in code. I don't want to see a book just go "this is a row pointer, ok now use this." IMO if a beginner book doesn't properly teach pointers then it's missing something very important. Raw pointers still have some use and they are still used in code. You don't need to wait till late in your C++ career to learn them.

Though I guess it can be said what you want to do. OP wants to be an expert in C++ it sounds like he will need to know and learn raw pointers fast. If you go to school you will absolutely be implementing your own basic version of std::vector and std::list using raw pointers without being allowed to use any of the standard library.

Hello guys, first post here and what a nice community you have :)

I would like to ask your opinion about another new kid in the block, called "Jumping Into C++" by the creator of cprogramming.com. Would you recommend this book to a starter?


Looks pretty bad, to be honest:
- introducing C-style arrays and manual memory management with pointers before std::vector is a profoundly bad idea for a book that's supposed to be for a beginner.
- similarly, using all this cruft to implement a linked list instead of demonstrating std::list first is a similarly bad idea.
I someway agree on this. I do agree beginners really need to know about std::vector, std::list and smart pointers and use them in production code.

But I fully believe it is important to understand at least the basics of how the are implemented. I think beginner books SHOULD mention and teach users about raw pointers. Fact is they are still in code. I don't want to see a book just go "this is a row pointer, ok now use this." IMO if a beginner book doesn't properly teach pointers then it's missing something very important. Raw pointers still have some use and they are still used in code. You don't need to wait till late in your C++ career to learn them.

Though I guess it can be said what you want to do. OP wants to be an expert in C++ it sounds like he will need to know and learn raw pointers fast. If you go to school you will absolutely be implementing your own basic version of std::vector and std::list using raw pointers without being allowed to use any of the standard library.


I don't think anyone is disagreeing with you on this.

However, it's the order they are presented that is critical. If a text is rolling its own list before introducing std::list or using naked pointers before presenting smart pointers, it failed.

For the record a ton of books are pure fail, simply because they were started 20 years ago and the author is being lazy when updating,

Hello guys, first post here and what a nice community you have smile.png

I would like to ask your opinion about another new kid in the block, called "Jumping Into C++" by the creator of cprogramming.com. Would you recommend this book to a starter?


Looks pretty bad, to be honest:
- introducing C-style arrays and manual memory management with pointers before std::vector is a profoundly bad idea for a book that's supposed to be for a beginner.
- similarly, using all this cruft to implement a linked list instead of demonstrating std::list first is a similarly bad idea.
I someway agree on this. I do agree beginners really need to know about std::vector, std::list and smart pointers and use them in production code.

But I fully believe it is important to understand at least the basics of how the are implemented. I think beginner books SHOULD mention and teach users about raw pointers. Fact is they are still in code. I don't want to see a book just go "this is a row pointer, ok now use this." IMO if a beginner book doesn't properly teach pointers then it's missing something very important. Raw pointers still have some use and they are still used in code. You don't need to wait till late in your C++ career to learn them.

Though I guess it can be said what you want to do. OP wants to be an expert in C++ it sounds like he will need to know and learn raw pointers fast. If you go to school you will absolutely be implementing your own basic version of std::vector and std::list using raw pointers without being allowed to use any of the standard library.


I don't think anyone is disagreeing with you on this.

However, it's the order they are presented that is critical. If a text is rolling its own list before introducing std::list or using naked pointers before presenting smart pointers, it failed.

For the record a ton of books are pure fail, simply because they were started 20 years ago and the author is being lazy when updating,

Exactly, it's not about the content, it's all about the order.

IMO, beginners will be unable to discriminate between the cases when it's appropriate to use raw pointers and the cases when it's not (and, because they'd seen them first, they'll end up abusing them -- there's an unfortunate, persistent bias to assume that features introduced in the early chapters are somewhat "simpler", while in fact often the opposite is true). I think it's this instilling of bad practices from the start that's already a major problem on its own -- I have never seen a good "legacy-first" book for C++. Not a single one. And it's not just "IMO" -- this is what we often see in the "For Beginners" forum. I fell the same about "using namespace std" from the start.

As a matter of fact, I don't think I've ever encountered a book in which this was a problem:

"I don't want to see a book just go "this is a row pointer, ok now use this." IMO if a beginner book doesn't properly teach pointers then it's missing something very important. "

// Well, of course depends on what one means by "properly", since in my view this actually includes an extensive introduction to std::unique_ptr, etc. -- and, in this way, 99% of the books I've seen failed, and failed badly biggrin.png

For instance, "C++ Primer" (which I think is the one percenter here), has you implement your own String class using specialized memory allocator operating on raw/uninitialized memory for performance, making use of placement new, etc. Here are two example exercises:

Exercise 13.44: "Write a class named String that is a simplified version of the library string class. Your class should have at least a default constructor and a constructor that takes a pointer to a C-style string. Use an allocator to allocate memory that your String class uses."

Exercise 19.2: By default, the allocator class uses operator new to obtain storage and operator delete to free it. Recompile and rerun your StrVec programs (§ 13.5, p. 526) using your versions of the functions from the previous exercise.

The thing is, these exercises are way later, in the advanced part of the book, after you've already become a productive C++ developer who has written several non-trivial projects (and has obviously used std::string a lot, so has a fairly good idea on how to solve these exercises with a well-designed program).

The other books? Sure, they'll talk about raw pointers, new/delete, etc. -- but most (all?) of them won't even get into placement new and specialized allocators (<--- which is exactly where you'd use raw pointers when, say, writing a game engine -- so this omission is all the more frustrating here, really) anyway, so they're all kind of useless.

At the same time, I see dozens of books with this problem:

"If a text is rolling its own list before introducing std::list or using naked pointers before presenting smart pointers, it failed."

And, unfortunately, I see dozens of beginners making simple, perfectly avoidable mistakes by overusing raw pointers and manual memory management, wasting time on debugging trivial errors -- all of this is completely unnecessary for someone who's just beginning the path of game development.

Unavoidably, later on too many of them become demotivated and complain that "C++ is complex" (not that it's wholly untrue, be back to this in a moment) and become discouraged from programming. While, in fact, you can introduce C++11 in a "simplified" way (simple / automatic / modern stuff first and foremost, complex / manual / legacy stuff later), akin to C#, if you just get the order right. The problem is that 99% of the books and, I think, 100% of on-line tutorials don't.

In my opinion, in this day and age, telling a beginning game programmer -- who's just trying to pick up C++ for the first time and really wants to make some games -- to learn raw pointers first is analogous to telling a comparable beginner using C# to start learning by delving deep into the uses of unsafe keyword. As in: not helping.

Why do I believe the order is important?

Because learning-by-doing is crucial!

Going through a book (let alone "reading a book") is merely a necessary condition, NEVER a sufficient condition (and I include doing the exercises in "going through the book" -- I don't think merely reading will make anyone a programmer, let alone a good programmer). In addition to going through a book, you have to create lots of mini-projects on your own, ideally corresponding to where you want to be -- so, for a gameplay programmer, lots and lots of (text-based for starters) mini-games. And you will be able to get there much faster if you can rely on things like std::vector from WEEK ONE. Any single day you spend on a book that talks about syntactical trivia (like wasting time on "const char *" vs. "char const *", and drilling through examples in the "exercises" that only really show that these are just different ways of spelling the exact same thing) takes you away from the goal of becoming a gameplay programmer.

Note how this also fits with the career progression in gamedev -- i.e., it's good to have an experience of a gameplay programmer using existing game engines (and libraries with things like std::vector) before starting to write your own game engine (with, say, your own custom allocators / memory pools, thread pools, etc. -- and that's assuming that rolling your own engine is what's best, which is not always the case) -- so, a book which introduces topics in the order optimized for this is going to be perfect, IMO.

So, the bottom line, in my view: any book that wastes time on introducing raw pointers and manual memory management before std::vectors is not good enough -- and ultimately useless (well, perhaps it can be placed under a broken table as a support or something ;]).

// On a side note, I have a *lot* of issues with how programming is often taught at schools/universities, but perhaps that's a topic for another rant... ;]

// Or, I'll just leave this link for starters: http://cacm.acm.org/magazines/2010/1/55760-what-should-we-teach-new-software-developers-why/fulltext

// And this snippet:

In many places, there is a disconnect between computer science education and what industry needs. Consider the following exchange:

Famous CS professor (proudly): "We don't teach programming; we teach computer science."

Industrial manager: "They can't program their way out of a paper bag."

15 edits? ;)

15 edits? ;)

Yeah, and still see some areas for improvement ;-)

// E.g., "now make it shorter" :D

This topic is closed to new replies.

Advertisement