Transition from programmer to video game programmer <book suggestions>

Member
Posts: 21
Joined: 2009.05
Post: #1
Greetings everyone,
I tried to make my thread title as descriptive as possible, and I hope this is the correct place to post this thread. I posted a thread about a week ago, looking for suggestions on how to learn the C programming language. I got the suggestion to get two books:

Learn C on the Mac - Dave Mark
The C Programming Language - Brian W. Kernichan & Dennis M. Ritche

I now own both books, and have nearly finished the first book. I have skimmed here and there of the second book, though it mostly looks like it covers a lot of the same content.

My problem is trying to move from knowing how to program (beginner), to knowing how to make games. I was also given the suggestion to check out:

Pangea Software's Ultimate Game Programming Guide for Mac OS X

Which is another book I just got in the mail. However, as I read the first two chapters, it doesn't make too much sense. Thus, I feel I may be missing a step here. Should I finish up the first book (Learning C on the Mac), read the second book (C programming language), play with some code, and then jump into Pangea's book? Or should I be looking at a whole new book?

How did you all transition from programmers to video game programmers? Thank you for your time and help! Smile

~Achi
Quote this message in a reply
Apprentice
Posts: 19
Joined: 2004.10
Post: #2
Achithyn Wrote:Which is another book I just got in the mail. However, as I read the first two chapters, it doesn't make too much sense. Thus, I feel I may be missing a step here. Should I finish up the first book (Learning C on the Mac), read the second book (C programming language), play with some code, and then jump into Pangea's book? Or should I be looking at a whole new book?

I would tell you the most important thing you can do now is experiment in C. Try to build some simple programs. The code/run/debug cycle is the most important thing you can learn right now. If you're new to C (and particularly, if you're new to pointers), you need at least a couple of weeks to let things all sink in.

For example (and this isn't the easiest thing), start with a program that reads a string and reverses it.

Code:
% echo "Hello World" | myprog
dlroW olleH
%

Do the program first as a while loop, then do it recursively. If you can get your head around pointers, function, memory management and recursion (which will take time), you should then spend a little time on data structures. Learn about things like:

Code:
typedef struct
{
  float x, y;
} MyPoint_t;

Write some programs that need data structures. For example, write a little phone book application that stores peoples names and phone numbers. Have it store the data in a file.

If you can get all these concepts, you're ready to tackle starting game coding.

Again, the most important things you need to learn are pointers, functions, memory management, recursion, and data structures. Get comfrotable in C then think, "GAMES GAMES GAMES." Personally, I think when you're ready for that, repost.
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #3
Achithyn Wrote:I have skimmed here and there of the second book, though it mostly looks like it covers a lot of the same content.
Remember that K&R is used mostly as a reference, not so much as a learning tool. The most used part of that book in my experience is appendix B.

Ultimate Game Programming Guide for Mac OS X assumes you have familiarity with Carbon and OpenGL. Definitely not for beginners. It'll be useful later on, but for now it'll only give you an idea of where you're headed. Eventually you will learn to draw graphics using OpenGL, but that is a mighty steep hill to climb if you're just learning C.

After you have mastered most of the concepts in Learn C on the Mac it would probably be wise to learn a system API such as Carbon or Cocoa. My personal recommendation would be Cocoa (although you'll additionally have to learn some objective-c, which is worth the effort IMHO). Through either Cocoa or Carbon you'll get access to Quartz, which is Apple's 2D graphics API. It isn't fast enough to make high-performance games, but it should suffice for beginners. It is real easy to use, and it makes beautiful anti-aliased graphics.

After you've done that for a while then you should be skilled enough to move on to OpenGL. You *could* try poking around with some OpenGL using GLUT as soon as you'd like, just to get a taste for it, but I doubt it will make much sense to you at this point.
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #4
AnotherJake Wrote:Remember that K&R is used mostly as a reference, not so much as a learning tool.
I didn't find that to be the case. I spent at least as much time reading it the first time through when I was first trying to learn the language as I did using it as a reference. I found it to cover pretty much everything I needed to know about the language in a perfectly logical order.

If only they'd release a new edition that would cover C99...
Quote this message in a reply
Member
Posts: 21
Joined: 2009.05
Post: #5
Quote:I would tell you the most important thing you can do now is experiment in C. Try to build some simple programs. The code/run/debug cycle is the most important thing you can learn right now. If you're new to C (and particularly, if you're new to pointers), you need at least a couple of weeks to let things all sink in.
I was thinking I was going too fast, you've just confirmed that. I will finish my current book on C and then start digging into a lot of little projects.

Little Projects:
--Tic Tac Toe (half way done with)
--Reverse print
--Phone Book (with save to file ability)

Feel free to add to this list so that I can be a c programming monster. Rasp If I need practice, then I will practice all that I can in the next two weeks. (Setting little time deadlines so that I don't get lazy.)
Quote:After you have mastered most of the concepts in Learn C on the Mac it would probably be wise to learn a system API such as Carbon or Cocoa. My personal recommendation would be Cocoa (although you'll additionally have to learn some objective-c, which is worth the effort IMHO).
I read the game intro post here, and found that a lot of programmers like to program games in C. Thus, I decided that I would just do everything in C and not worry about all the other languages. Should I learn C and Objective-C? I really don't mind, if, in the end, it proves to be something worth while.

If you prefer using Cocoa, then that sounds good to me. Objective-C and Cocoa will likely be two books I will need to pick up, right? If so, what do you all feel would be the best for a newbie such as myself?
Quote:I didn't find that to be the case. I spent at least as much time reading it the first time through when I was first trying to learn the language as I did using it as a reference. I found it to cover pretty much everything I needed to know about the language in a perfectly logical order.

If only they'd release a new edition that would cover C99...
Even though a lot of the same material is covered, I find it interesting learning from two different preferences. Each other has pros and cons, and I think it would be a good learning experience to read / skim this book as well as my current C book. I also picked up a Programming C FAQ book from the library - so, hopefully I am set. Smile

Well, thank you all for the feedback. I will get to finishing this book and practicing programming. Smile

~Achi
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #6
As for learning Cocoa, go with Aaron Hillegass' book. Pure gold.
Quote this message in a reply
Member
Posts: 21
Joined: 2009.05
Post: #7
Cocoa® Programming for Mac® OS X (2nd Edition) looks like a promising book. I will definitely be out looking for it at the book store. Smile What about Objective-C? Thanks for the feedback!

~Achi
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #8
Achithyn Wrote:Should I learn C and Objective-C? I really don't mind, if, in the end, it proves to be something worth while.

It's really hard to say from just my perspective. I would hate to suggest that you put in the extra effort for something that you wouldn't find worthwhile. If it were me on the other end of where I'm at right now, I'd bite the bullet and do it, and know without a doubt that I'd be very happy I put in the extra effort, but... We're all different in reality, and almost always have different goals, so you're going to have to research that and make your own call. How's that for ambiguous? Sorry...

Your assessment of needing to learn C if you want to do more than `script' games is dead-on correct (and I don't mean that in any offensive way to scripters because scripting, or even programming BASIC, are high challenges in their own respect). There is no practical path that will allow you to program demanding applications or games without a knowledge of C. From there you can move on to C++ and/or Objective-C, not to mention making use of many third-party APIs. Learning C is needed in any direction. That's an easy call.

If you go for Cocoa, Fenris is right, we all pretty much agree that Hillegass' book is THE one to have if you don't get anything else. However, it doesn't really delve into objective-c as much as a beginner might need. There are two decent sources for picking up obj-c that I have encountered, in addition to apple's obj-c guide: Learning Cocoa with Objective-C (great, but not totally up to date with the dev tools), and O'Reilly's Cocoa Dev page (also great, but not totally up to date with the dev tools) -- be sure to start at the bottom of the page and work up. There are probably other sources of equal or greater value, but I have not encountered them myself so you might ask around more.

Achithyn Wrote:I read the game intro post here, and found that a lot of programmers like to program games in C. Thus, I decided that I would just do everything in C and not worry about all the other languages.

That would be a reasonable expectation, and one that we all probably thought at one time, but the reality is that a system or windowing API of some sort is also needed if you want to do anything more than command-line apps. Again, Carbon is almost all accessed in C so you wouldn't have to learn any more language stuff, but it just isn't as easy to use as Cocoa. I did things the old way with Carbon (or the Toolbox as it was known before OS X) for at least ten years before Cocoa came along. I say Cocoa is THE way to go (as do most others), but there are still many hold-outs, and for many different reasons.

It is important to note again that using SDL or GLUT doesn't really require any knowledge of Cocoa or Carbon. Pursuing that route would be valid as well, and might likely get you where you want to go. The only serious drawback is that they don't give you the flexibility of making whatever authentic OS X menus and widgets you might want -- well, and, you have to wait for updates if there is a new bug (or architecture to support). Instead, you are confined to what they provide -- which may or may not be a bad thing, depending upon what your ultimate goals are. The *massive* bonus with SDL especially is that it provides a professional, ready to sell, cross-platform API to develop your games within. Unreal uses SDL on the Mac. It's really good stuff. But you'll be battling against learning OpenGL that route too. Maybe somebody has a different opinion to offer with SDL and beginners, but my sense is that... I'm not sure... I'd be afraid of going that direction solely as a beginner. You should ask around more, and maybe someone could offer better advice on it.
Quote this message in a reply
Apprentice
Posts: 9
Joined: 2005.05
Post: #9
Achithyn Wrote:Cocoa® Programming for Mac® OS X (2nd Edition) looks like a promising book. I will definitely be out looking for it at the book store. Smile What about Objective-C? Thanks for the feedback!

"Progamming in Objective-C" by Stephen Kochan is an excellent book on the Obj-C langauge. It also dedicates a whole section to the Foundation framework. A good companion to Hillegass' book.
Quote this message in a reply
Member
Posts: 21
Joined: 2009.05
Post: #10
Shady994 Wrote:"Progamming in Objective-C" by Stephen Kochan is an excellent book on the Obj-C langauge. It also dedicates a whole section to the Foundation framework. A good companion to Hillegass' book.
It seems I am now set for the next few weeks. Smile I will practice my coding in C, then read Programming in Objective-C, mess with Objective-C a small bit and then check out Cocoa. When I am done toying around and have a bit more experience under my belt, I will jump head first into game development! Smile Thank you all for your time and assistance. Have a good one!

~Achi

EDIT: I didn't mean to ignore your post, AnotherJake. I found what you said very close to how I feel. I trust that you all are giving advice that would best benefit me in the long run. If, for some reason, I don't tread down the path you have left me, then at least I will know for sure, for me, that the path was not the one I wanted. I see programming as one big life-time learning experience. You will never know it all, just what you need at the time you need it. Thanks for your feedback and help!
Quote this message in a reply
Moderator
Posts: 335
Joined: 2002.04
Post: #11
As far as transitioning to writing games. The first step is to think of a game you can write using whatever your current knowledge of programming is at the moment, even if it's just a simple text adventure using string input and if statements. As you learn more about programming you'll have more and more games you'll be able to write and you'll start being able to look for what areas you need to learn in to make your next game possible.
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #12
> I didn't mean to ignore your post, AnotherJake.

No problem at all! I wouldn't have taken it that way regardless -- I tend to blab too much sometimes. Wink

Good luck!
Quote this message in a reply
Member
Posts: 21
Joined: 2009.05
Post: #13
@Zwilnik
I believe you - right now I am programming Tac Tac Toe and have learned a lot by trying to get it to work the way I want it to. I've started to see a pattern in the warnings and errors I get, and am more able to resolve them quickly... than stomp my feet in frustration. Rasp

I think in order to be a good programmer, you just need to code a lot and have some sort of reference you can look to learn new things. If you don't have a reason to learn something, you will likely forget it by the time you need to use it.
AnotherJake Wrote:> I didn't mean to ignore your post, AnotherJake.

No problem at all! I wouldn't have taken it that way regardless -- I tend to blab too much sometimes. Wink

Good luck!
Ah, you weren't rambling! Rasp I just didn't have much to say in reply; I understood what you were saying and feel that is the right path for me right now. Anyway, thanks for all your help, everyone! Smile

~Achi
Quote this message in a reply
Post Reply