🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Tricks of the Windows Game Programming Gurus

Started by
8 comments, last by Ernie 22 years, 8 months ago
Yo, I just bought Tricks of the Windows Game Programming Gurus after reading many reviews about it, and when I start reading I am unsure of whether I need to know C, C++, or both. I know the basics of C and more about C++, but which one should I focus on? I have C++ How to Program and the Absolute Beginners Guide to C for books.
Advertisement
Focus on C++, since it is C, but with more capabilities (you can do essentially everything in C that you can in C++, but the C++ compiler makes it a hundred times easier (especially with virtual functions, templates, etc.)).

Either way you can still code games. Wolfenstein 3D was coded in C (you can find the source if you search a little) and I know that Half-life was coded in C++ (If you look at the manual on the last page, I think, it has some C++ OOP code dealing with a soda can or something).

I personally prefer C++, but you need to learn C to program in C++ (since they are related to each other).

Good LUCK!
You can get through Tricks with C knowledge. Infact, some of the things Lamothe does is with C (like opening text files, since there is a C way, and a C++ way). If you know C, that should be enough as long as you have a compiler that can handle DX (like MSVC++). And I remember a part or two where he said a segment would look foreign to a C programmer, but he explains it so you shouldn''t have problems.


If you can read this, All your base are belong to us!
quote: Original post by Viscous-Flow
...but you need to learn C to program in C++...


Lies!

The thought processes and mental approaches (which are what really define programming) for the two languages are totally different. Learn them both if you want to.

quote: Original posy by SirSmoke
Infact, some of the things Lamothe does is with C ...

LaMothe actually programs in C, but dips into convenient C++ features every now and then. If you''re trying to learn proper programming practice, don''t focus too closely on the code of "the greats" (like Carmack, whose code is horrible!) Andre has gone as far as saying not to use C++ (which is junk).

In any case, to answer the original poster: either one will do you fine.
Vicious-Flow, don''t takes that as a personal attack. I was just trying to counter a stereotypical notion.
Andre has moments when he says a given segment would look good in a class (hinting in some entertaining ways), Lol!

If you can read this, All your base are belong to us!
quote: Original post by Viscous-Flow
I personally prefer C++, but you need to learn C to program in C++ (since they are related to each other).


That''s not neccessarily true. In fact it might hurt you when you learn C and then try to learn C++ afterwords, because to use c++''s OOP features correctly you have to program in a different style than you do in straight C. It probably helps more often than not, but for someone who''s never used OOP before, it might be a hindrance.

I learned "C++" in high school. Well, it was really C with a C++ function here or there. I personally hated C++ and OOP and all of that. It just seemed like so much more work for nothing. Then I got to college and took a class on C++ data structures (STL data structures to be more exact) and now that I actually understand OOP, I love it and I wouldn''t go back to coding in C unless I was getting paid some major cash to do it.
a lot of people just starting out don''t see any big difference between C and C++ - I sure didn''t. But the thing to remember is that C++ is an Object-Oriented Programming language, whereas C is not. Once you learn and understand OOP you''ll realize what people mean when they say "different mindset" for using the two languages. In my opinion, if you don''t know OOP then you don''t know C++, just C.

Besides I can check but I coulda sworn that LaMothe both states what you need to know and has a C(++?) primer in the back of the book anyways.

_________________________________________________________________

Drew Sikora
A.K.A. Gaiiden

ICQ #: 70449988
AOLIM: DarkPylat

Blade Edge Software
Staff Member, GDNet
Public Relations, Game Institute

3-time Contributing author, Game Design Methods , Charles River Media (coming GDC 2002)
Online column - Design Corner at Pixelate

IGDC - the International Game Developers Chat! [irc.safemalloc.com #igdc]
NJ IGDA Chapter - NJ developers unite!! [Chapter Home | Chapter Forum]

Drew Sikora
Executive Producer
GameDev.net

You only need to know C for that book, there might be a few lines of C++ code specific, and he goes to length to explain them. He also declares macros to make using C++ classes like calling C functions (which drove me absolutely nutz).

C is a a subset of C++ (close enough, don''t argue), so if you "start right into C++", you have to learn C syntax before you even start learn C++ syntax. However, you could skip learning the C standard library functions if you did just C++ - which would be bad because there''s code all over earth that uses stdlib.h and you''ll want to know what it does.

How can you understand how C++ virtual functions work, if you don''t know how C pointers work?

Magmai Kai Holmlor
- Not For Rent
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Ernie, the current trend towards programming is leaning towards Object Orientated programming and the next big trend which is hitting is patterns. In the end you will have to learn both c and c++. c++ is in fact a superset of c. I believe learning C first is the way to go, because only then can you fully appreciate the facilities offered through C++. I personally bought that book to, taking my understanding of C and then applying it to C++, I was able to put all the graphics routines LaMothe mentions and wrap it into a class.
Also like other''s have mention, the way you approach a problem requires two very deferent thinking techniques. C works on structural programming techniques, C++ focuses on Object orientation programming techniques. Each has it advantages in various situations and sometimes a mix of both will produce the optimal solution.
Live by the code, die by the code

This topic is closed to new replies.

Advertisement