C++ game programming

Lazy8s

Golden Member
Jun 23, 2004
1,503
0
0
Ok first my rant about this book...

I just went through Beginning C++ Game Programming by Michael Dawson and MAN does the book suck!! It introduces some good topics when it comes to object oriented programming but it fails to explain how some of the operators work. For example:

friend ostream& operator<<(ostream& os, const Card& aCard);

I know I am overloading the operator but how? What does this do? WTF is ostream&? wtf does everything inside the parenthases mean? I am about to graduate as an undergrad CS major and I am VERY proficient in Java as well as most web-based languages. I figured this book would be a fun introduction to C++ for me and I could make some games to boot but no. I know know what to write if I want to do exactly what's in the book but I don't know what any of it means or how the heck it works.

Furthermore, he doesn't even include all the code in the book!! There is a "companion" CD-Rom that includes all the code which is nice, but what he does is tells you to read the book then compile the code on the CD. How is anyone supposed to learn like that honestly? I could look through the code but it's up to me to figure out what the 30% that he didn't explain in the book means. Sometimes it's easy to figure out but for the most part it's important things like includes, namespaces, datastructures etc. Of course I know what a vector is but what if I didn't? WTF is Clear();? What's included in <Algorithms> and why did you use it?

Anyways, if you know C++ you don't need the book cause it doesn't even cover a 1st semester programming class worth of information. If you don't know C++ you will be left thinking WTF?....

Does anyone have a good suggestion for learning C++? I am really interrested in the networking and GUI parts the most though I know I need to learn the basics first. I know almost all the datastructures I have encountered thus far and the algorithms won't be a huge deal. What I need to know is why the heck you put the & symbol after something, I googled the * and realized it was a pointer thank God. Also, in Java the for loop format is:

for (int i=0; i<10; i++)

but in C++ it's:

for (int i=0; i<10; ++i)

It's a subtle and rather unimportant difference I know, but it's important to know when the "i++ or ++i" part is executed. In Java it's executed at the very end. I know this is a basic example and I could figure it out playing with it and I did, but it's just an indicator of a larger problem with the book as a whole. Alot of important parts were not explored such as when variables bind, etc.

Anyways, it would be great if someone could suggest a good book. I could probably get away with just a reference guide so I can look it all up myself but I plan on doing this at my summer internship when I have some down time so it's alot easier to bookmark a page than create design documents myself, plus I'm certain I'll miss things I need later. Thanks in advance.
 

tfinch2

Lifer
Feb 3, 2004
22,114
1
0
In C++ you can have ++i or i++, but they are executed different.

++i is evaluated before the line of code is, and i++ is evaluated after.

i = 1;
cout<<i++; //will output 1

i = 1;
cout<<++i; //will output 2
 

Lazy8s

Golden Member
Jun 23, 2004
1,503
0
0
Heh I know what pre and post increment are. What I was saying is in Java you can pre or post increment i because it's not executed until the end of the for loop. The same holds true for C++ but the author doesn't explain it that way, he makes it sound like it HAS to be done pre-increment. To me it's pretty freakin important to know it can be done either way especially if you want to use i somewhere as a counter.

@RIP: I got this book using that technique. :-/
 

tfinch2

Lifer
Feb 3, 2004
22,114
1
0
Originally posted by: Lazy8s
Nope, only Barnes&Noble.

Well, you can read books there too. Go in, grab C++ books, find which one you like, write down the ISBN, find it on half.com, purchase, profit (learn)
 

fishbits

Senior member
Apr 18, 2005
286
0
0
From what I've seen, most "learn C++ game programming books" assume more proficiency with C++. Makes sense to me as there's little point in trying to teach game programming but adding all the extra overhead to the book by teaching C++ at the same time. Especially when there are so many fine C++ books out there (and even more less than great ones). Not to say it can't be done, but that's not the norm.
 

Lazy8s

Golden Member
Jun 23, 2004
1,503
0
0
Yeah this one says it's for people who never programmed before. You have to put into context the "games". They are a text based tic-tac-toe, text based hangman, word scramble, "guess the number" etc.
 

itachi

Senior member
Aug 17, 2004
390
0
0
Originally posted by: fishbits
From what I've seen, most "learn C++ game programming books" assume more proficiency with C++. Makes sense to me as there's little point in trying to teach game programming but adding all the extra overhead to the book by teaching C++ at the same time. Especially when there are so many fine C++ books out there (and even more less than great ones). Not to say it can't be done, but that's not the norm.
exactly.

if you're gonna pick up a book on programming for games.. at the very least, you should not be confused by the semantics used inside the book.
you'll also need some knowledge of algorithms (game) and data structures (mostly scene-graph).
 

Lazy8s

Golden Member
Jun 23, 2004
1,503
0
0
Originally posted by: itachi
Originally posted by: fishbits
From what I've seen, most "learn C++ game programming books" assume more proficiency with C++. Makes sense to me as there's little point in trying to teach game programming but adding all the extra overhead to the book by teaching C++ at the same time. Especially when there are so many fine C++ books out there (and even more less than great ones). Not to say it can't be done, but that's not the norm.
exactly.

if you're gonna pick up a book on programming for games.. at the very least, you should not be confused by the semantics used inside the book.
you'll also need some knowledge of algorithms (game) and data structures (mostly scene-graph).

I would agree except the book says
"This book is for anyone who wants to program games. It's aimed at the total beginner and assumes no previous programming experience."

Thus I assumed it would explain everything. Like I said it's not like I'm 15 and doing this while I'm going through highschool, I am actually going to graduate with a degree in 1 semester. Maybe the problem is the book is too basic and they thought more info would just further confuse newbies.
 

fishbits

Senior member
Apr 18, 2005
286
0
0
Well yeah, I'd be suprised to see things like friend operators in a book billed as needing no programming experience, except for a straight-up C++ book. If the author wanted folks to use things like this, they should be well-explained. Sounds like they just want the user to copy'n'paste "trust me, this should work." Not exactly a good teaching model, so it does sound on the surface like a poor book.
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
Sounds like it's a combination of a weak C++ book plus a weak game programming book. You might try again with _2_ books that tackle each part separately.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
In C++ you can have ++i or i++, but they are executed different.

++i is evaluated before the line of code is, and i++ is evaluated after.

Close, but it has nothing to do with the "line of code." The pre- or post-fix operators are applied before or after the value of the expression is taken.

int a = 1;
int b = ++a;

a == 2, b == 2

int a = 1;
int b = a++;

a == 2, b == 1

The reason I make this distinction is that you could take the value more than once on the same "line." C++ doesn't really deal in lines. It deals in statements. You can have multiple statements per line.

Does anyone have a good suggestion for learning C++?

First, any book on game programming in C++ is going to have to assume you know the basics of C++ to begin with. Otherwise it would have to teach C++ and game programming in the same book. Actually, that might be an interesting approach, but obviously this book doesn't work that way. I think it's reasonable of them to assume you understand operator overloading and other important concepts, and probably they say that in the foreward or intro somewhere.

C++ is like any other language: get a decent reference, some example programs, some basic tools, and start programming. C++ is a convoluted language. It was pretty simple and elegant back when there were 32 keywords. After standardization, with 60+ keywords, and proprietary extensions from groups like MS, it is less so. I started with it in 1988, and taught the language to corp. developers for awhile, but since I target Windows I would rather use C# these days. If you're targeting Windows and don't have x-platform concerns C#/VB and .Net are the way to go.

Of course, if this isn't just a hobby you probably do have x-platform needs, and so C++ is a better choice.
 

ngvepforever2

Golden Member
Oct 19, 2003
1,269
0
0
How can you be about to graduate with a CS Degree and not having ever touched C++? All of my CS Classes have been java based but there is also a big number of classes(such as systems architecture, Operating Systems) that require you to know C/C++. As an advice I'd advice you to get a good book on C++ and start from there. You may now JAVA very well but C++ can be a bit of a pain of advice to pick up initially.

A really good book to start would be C++ Primer Plus by Stephen Prata

Regards

ng
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |