Looking for an opinion on a book, please.

S

Silent Stone

Hello,

Have any of you folks ever taken a look at the "Beginning C++ Through
Game Programming" series of books by Michael Dawson? It is in its
third edition now: http://tinyurl.com/75ekx4a

All three editions have gotten a lot of favorable reviews on Amazon
from people who learned to write C++ with them, but I was hoping maybe
some experienced programmers could offer some opinions on it. Any
major errors, bad practices taught, or omissions of important features
and data... that sort of thing.

I want to learn to write games and graphical programs. I know this
book doesn't get into graphics libraries, but hopefully it will cover
the C++ I need to know first, maybe with an emphasis on game
programming idioms. I've dabbled in C a bit off and on, thinking that
I should learn it first before going to C++. Now I think that will
just be redundant effort.

While C and C++ are both capable languages, I get the impression that
if I want to go the games/graphics route pretty much any instructional
material or library set will cater to C++ over C. Am I right in this?

Just to note: programming is not a career path for me, this is all
just for my own entertainment.

Thanks for any advice and help.

-John
 
8

88888 Dihedral

在 2012å¹´2月14日星期二UTC+8下åˆ12æ—¶37分37秒,Silent Stone写é“:
Hello,

Have any of you folks ever taken a look at the "Beginning C++ Through
Game Programming" series of books by Michael Dawson? It is in its
third edition now: http://tinyurl.com/75ekx4a

All three editions have gotten a lot of favorable reviews on Amazon
from people who learned to write C++ with them, but I was hoping maybe
some experienced programmers could offer some opinions on it. Any
major errors, bad practices taught, or omissions of important features
and data... that sort of thing.

I want to learn to write games and graphical programs. I know this
book doesn't get into graphics libraries, but hopefully it will cover
the C++ I need to know first, maybe with an emphasis on game

C++ is an imperative static typed compiler based language that supports OOPdefferent from others.

C++ is also a free syle language somewhat like C
but not compentrated in hardware supports.

The idea language to support the DRAM industry
for the past 20 years.
 
N

Nick Keighley

在 2012å¹´2月14日星期二UTC+8下åˆ12æ—¶37分37秒,Silent Stone写é“:

I'm curious how it manages to write about games without doing any
graphics
C++ is an imperative static typed compiler based language that supports OOP defferent from others.

and so? Does that mean it is good or bad for games?
C++ is also a free syle language somewhat like C
but not compentrated in hardware supports.

and what, pray tell, is a "free style language"? What would be a non-
free-style langauge? COBOL? FORTRAN?
The idea language to support the DRAM industry
for the past 20 years.

I guess you meant "ideal". Are you claiming C++ (or C) generate
unnecessarily large programs? What would be better?

and their idiomatic usage is quite different. If your end goal is C++
then learn C++. The book "Accelerated C++" is quite nice.

dunno. But games tend not to be simple things and C++ has more
"programming in the large" features.
 
8

88888 Dihedral

在 2012å¹´2月14日星期二UTC+8下åˆ7æ—¶31分12秒,Nick Keighley写é“:
I'm curious how it manages to write about games without doing any
graphics


and so? Does that mean it is good or bad for games?
Oops, I typed a wrong word! "concentrated "
and what, pray tell, is a "free style language"? What would be a non-
free-style langauge? COBOL? FORTRAN?
C++ is free-style in the sense that a lot wiered expressions are allowed inherited from C.
I guess you meant "ideal". Are you claiming C++ (or C) generate
unnecessarily large programs? What would be better?


and their idiomatic usage is quite different. If your end goal is C++
then learn C++. The book "Accelerated C++" is quite nice.


dunno. But games tend not to be simple things and C++ has more
"programming in the large" features.

Just wait for C++ to chunk out an OS with a lot C++
shared libraries built in.

I waited for 20 years. Maybe it needs another 20 years.
 
J

Jorgen Grahn

I'm curious how it manages to write about games without doing any
graphics

You should check out Nethack ... I lost last weekend to that game, and
it's basically curses-based.

Anyway, judging from the table of contents, "Beginning C++ Through
Game Programming" seems to be an example-based tutorial, and the
"game" part is simply that the examples are small games, like hangman.

I guess the shallow game angle isn't really useful for games
programming, but maybe it can help (young) readers retain interest?

I can't really comment on the book. I don't "get" example-based texts.
Or maybe this one is task-oriented? I'm allergic to that too.

/Jorgen
 
S

Silent Stone

You should check out Nethack ... I lost last weekend to that game, and
it's basically curses-based.


What is your method of choice, Jorgen?


Nick Keighley sez:
and their idiomatic usage is quite different. If your end goal is C++
then learn C++. The book "Accelerated C++" is quite nice.

I just stumbled across accu.org (while trolling this group for a
recommended book list) and Accelerated C++ gets top honors. The
service that the site offers is what I was looking for.

As far as what language... That has been my struggle. I like the
simplicity of C (K&R2 is only 271.5 pages and is pretty
comprehensive), but I don't know what C++ will offer in my scenario
that is better than C. As I said, both languages are very capable-
the trick is using the right tool for the job. I know that C++ is
more popular for games programming and upper applications, yet most
systems programmers tend to use C for OSes and other lower-level
stuff. I don't know what makes one language better for one purpose or
the other. It is probably part factual and part convention/habit.

"C vs. C++" questions tend to start Holy Wars, though.

Thanks for the replies so far.
-J
 
N

Nick Keighley

On Feb 14, 4:57 pm, Jorgen Grahn <[email protected]> wrote:
As far as what language [to use for games and graphics] That has been
my struggle.  I like the
simplicity of C (K&R2 is only 271.5 pages and is pretty
comprehensive), but I don't know what C++ will offer in my scenario
that is better than C.

C++ tends to win out as programs get larger and more complex. (Though
plenty of large C programs have been written (eg. Linux)). And games
tend to be complex. Games also tend to consist of lots of semi-
independent "thingies" (the technical word is "objects") all
interacting with each other (aliens, soldiers, bricks etc.). This is a
good fit for Object Oriented Programming, which C++ supports. You can
do OO in C but you have to work harder. Graphics programming is also a
natural fit to OO.

C++ has other programming in the large featurs such as namespaces and
exceptions.

C++ supports generic programming via its templates. The C++ standard
library provides safe generic container classes (vector, string, map
etc.)

OTOH C++ is very large and tougher to master than C.
 As I said, both languages are very capable-
the trick is using the right tool for the job.  I know that C++ is
more popular for games programming and upper applications, yet most
systems programmers tend to use C for OSes and other lower-level
stuff.

the Linux people looked at C++ and decided against it. I think this
more to do with the state of the art of compilers than any actual
deficiency in the language.

C seems to get used for low level bit-banging, though in actual fact
there is nothing you can do in C which you can't do in C++.

If I progarm in C I find I miss many C++ features.
 I don't know what makes one language better for one purpose or
the other.  It is probably part factual and part convention/habit.
yes

"C vs. C++" questions tend to start Holy Wars, though.

oh yes!
 
J

Jorgen Grahn

On Feb 14, 4:57 pm, Jorgen Grahn <[email protected]> wrote:

[NK wondering how you can teach game programming without graphics]
What is your method of choice, Jorgen?

For winning Nethack, or learning C++? Those are mutually exclusive ;-)

If you mean game design, I don't do that.
Nick Keighley sez:


I just stumbled across accu.org (while trolling this group for a
recommended book list) and Accelerated C++ gets top honors. The
service that the site offers is what I was looking for.

As far as what language... That has been my struggle. I like the
simplicity of C (K&R2 is only 271.5 pages and is pretty
comprehensive), but I don't know what C++ will offer in my scenario
that is better than C. As I said, both languages are very capable-
the trick is using the right tool for the job. I know that C++ is
more popular for games programming and upper applications, yet most
systems programmers tend to use C for OSes and other lower-level
stuff. I don't know what makes one language better for one purpose or
the other. It is probably part factual and part convention/habit.

Speaking as a C and C++ programmer who prefers C++: using C today is
99% "habit", if you include reasons like being stuck with a C code
base, bad tools for an exotic platform, or people who don't know C++
.... those are perfectly valid reasons to use C today.

But there is no area where C is technically better.
"C vs. C++" questions tend to start Holy Wars, though.

Not so much in comp.lang.c++. Most people who don't like C++ are
polite enough to stay away from this group.

/Jorgen
 
S

Silent Stone

C++ tends to win out as programs get larger and more complex. (Though
plenty of large C programs have been written (eg. Linux)). And games
tend to be complex. Games also tend to consist of lots of semi-
independent "thingies" (the technical word is "objects") all
interacting with each other (aliens, soldiers, bricks etc.). This is a
good fit for Object Oriented Programming, which C++ supports. You can
do OO in C but you have to work harder. Graphics programming is also a
natural fit to OO.

C++ has other programming in the large featurs such as namespaces and
exceptions.

C++ supports generic programming via its templates. The C++ standard
library provides safe generic container classes (vector, string, map
etc.)
C seems to get used for low level bit-banging, though in actual fact
there is nothing you can do in C which you can't do in C++.

If I progarm in C I find I miss many C++ features.


Jorgen Says:
Speaking as a C and C++ programmer who prefers C++: using C today is
99% "habit", if you include reasons like being stuck with a C code
base, bad tools for an exotic platform, or people who don't know C++
... those are perfectly valid reasons to use C today.
But there is no area where C is technically better.


This part of the conversation is actually very helpful to me right
now. I know some C so I have some loyalty to it, but I was struggling
to find some compelling reasons to choose C++ over C other than
"everyone else is doing it". Most "comparisons" between the two
languages I've read were pretty much Holy Wars or flamefests. Lots of
passion but no real substance. These examples are factual and
informing. Thankyou.
OTOH C++ is very large and tougher to master than C.

Indeed it is. I notice most C++ books are huge. My other problem is
that I don't have a lot of time most of the year between work, school
and a girlfriend. Summer is better, but to some degree I can only
pick up bits here and there and my learning rate (in spite of
enthusiasm) will always be limited. K&R2 is great at having those
"small bits" that I can read about in a short time and think about
throughout the week. When it comes to the book "Accelerated C++",
will this (unfortunate) approach work? I know I won't turn into a
master overnight, and I have no delusions.
the Linux people looked at C++ and decided against it. I think this
more to do with the state of the art of compilers than any actual
deficiency in the language.

I had always wondered about that, actually.
For winning Nethack, or learning C++? Those are mutually exclusive ;-)
If you mean game design, I don't do that.

Don't worry about Nethack- I've actually got a good number of hours
under my belt with that (and some of its derivatives). I'm also old
enough to have spent a good amount of time in text adventures as
well ;-)

What I was actually asking was not about game design, but just
learning a language. I was just curious.

Thanks again, folks.

-John
 
J

Juha Nieminen

Silent Stone said:
I know some C so I have some loyalty to it, but I was struggling
to find some compelling reasons to choose C++ over C other than
"everyone else is doing it". Most "comparisons" between the two
languages I've read were pretty much Holy Wars or flamefests. Lots of
passion but no real substance. These examples are factual and
informing. Thankyou.

If you have no other compelling reason to choose C++ over C, then
I would say that the standard library is a pretty good one.

The C++ standard library (even the C++98 one, not to talk about the
new one) offers quite many extremely useful and usable tools. Of course
it can't offer everything, but what it does offer is quite useful.

Many C hackers and C++ dissenters claim that the standard library is
practically useless, and that all programmers end up implementing their
own data containers and algorithms anyways, but that's just simply not
true. There's probably not a single C++ program I have made (at least if
it has more than a hundred lines) where I wouldn't have found some
standard library component useful. They are generic, efficient (unlike
the dissenters want to claim) and easy to use (likewise). Of course you
have to know a bit about their inner working in order to know when and
where to use them in the most efficient way (there are, of course,
situations where using one container instead of another is not the
most efficient solution), but once you get the hang of it, it's really
handy, and your code will become simpler, easier to write and understand,
and efficient.

Just as an example, the other day I had a situation (in an actual
work-related project) where I had a vector of unsorted elements (or
rather, they were sorted by a different rule) and was wondering if
there was a ready-made algorithm in the standard library to copy the
n smallest elements to another vector (without modifying the original).
Well, what do you know, there is (namely, std::partial_sort_copy). It
was a one-liner to use, and it's efficient (O(n log n), which is more
laborious to implement by hand than the naive and much slower O(n^2)
solution).
 
J

Jorgen Grahn

Jorgen Says:




This part of the conversation is actually very helpful to me right
now. I know some C so I have some loyalty to it, but I was struggling
to find some compelling reasons to choose C++ over C other than
"everyone else is doing it". Most "comparisons" between the two
languages I've read were pretty much Holy Wars or flamefests. Lots of
passion but no real substance. These examples are factual and
informing. Thankyou.

Please quote more carefully (or skip the idea of replying to many
people in one posting -- a nice idea, but noone else is doing it).

I didn't write that last part, and don't necessarily agree with it.

/Jorgen
 
J

Jorgen Grahn

If you have no other compelling reason to choose C++ over C, then
I would say that the standard library is a pretty good one.

The C++ standard library (even the C++98 one, not to talk about the
new one) offers quite many extremely useful and usable tools. Of course
it can't offer everything, but what it does offer is quite useful.

Yes! I think the standard containers are the most compelling reason to
use C++.

Not "just" because they gives you the data structures most people expect
in a programming language ... I find it helps you to design your
classes too. The small ones to fit in containers, and the large ones
to have sane semantics because their contents are containers which do.

/Jorgen
 
N

Nick Keighley

Please quote more carefully (or skip the idea of replying to many
people in one posting -- a nice idea, but noone else is doing it).

I am
I didn't write that last part,

me again!
and don't necessarily agree with it.

I've used both and that was my experience. Though maybe I don't
remmber how tough C was !
 
S

Silent Stone

"Accelerated C++" is relatively thin and expresses the spirit of C++ quite
well, so I would say there is a good chance it might work. Just try to
forget any knowledge of C temporarily, it is of no help when reading this
book (as it should be as C++ is a totally different language).

Cheers
Paavo

Accelerated C++ has now been recommended multiple times. ACCU gives
it great reviews as well. I'm going to pick it up (or more likely,
order it) this weekend.

Thanks everyone for all your help and suggestions.

-John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top