Need help learning C++ for Game Coding

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Need help learning C++ for Game Coding

      Me and my partner just started learning C++ about a week ago, we put several hours a day into learning it. The kinda things we want to create our own online games such as MMORPGs.

      We some of the basis thanks to the book we just finished on it (C++ Programming by Mike McGrath), unfortunatly we didnt understand everything due to the way the writer did not explain in detail.

      What would be the best way for us to learn C++ and get into game coding? for instance certain books or something else.

      ADDED: We live in the UK and no collleges near us offer any courses in C or C++.

      The post was edited 1 time, last by Drucygoddess ().

    • RE: Need help learning C++ for Game Coding

      Hi,

      The guys here are real programmers, I'm not (thank god). They might be able to answer your question. I learned most programming from google! I took a class in my collage days and only have two intro books on the subject.

      As far as comparison between VS 03 and VS 05, they are pretty much the same. The only real change is the DOT NET part. I also have VS 2003 and was thinking of upgrading, but I was told that there is not a big change in the C++ thingy stuff. (If I'm wrong someone correct me.)

      Rez mentioned "Effective C++, More Effective C++, and Effective STL". I was informed about thses books a few months ago, and they very good and easy to follow. ( I have one of Meyers books now) I would certainly follow his recomendatoin and get these books. You also might want to check out gotw.ca/ . This is a very nice site, with some very good material! Its been very helpful for me :)

      S.
    • Visual Studio 2005 has more bells & whistles. I like a lot of things better about it, and hate other things. If you're just starting out as a programmer, you probably won't notice the difference. For me, the biggest advantage to 2005 is the debugger.

      First off, do you have any experience with programming in general, or are you just starting out? If you're just starting out, you may want to suppliment your coding skills with some books on design. When it comes to working on large projects (especially games), you have to have a good understanding of design & architecture. Mike's book is excellent at teaching good game architecture, but there is so much more to learn. A good start would be Design Patterns by the gang of four (Gamma, Helm, Johnson, and Vlissides). In my opinion, this book is essential. I have it on my shelf at work right now. The bottom line here is that you have to be able to write code that will stand the test of time. Mike's story about how the random number generator in Ultima was used for like 10 years is inspiring. That's the sort of reusability you should strive for, and design patterns help you realize that goal.

      It would probably be worthwhile to learn some UML, since this helps teach design and lets you toy with ideas before writing code. Some people may disagree, but I use it pretty often when I'm toying with ideas. Something about physically drawing the diagram on paper makes my brain think about it in a different way, and usually makes me say "uhh, that's lame, a better way would be...." In my opinion, Engineering is about solving problems, not coding.

      One thing that's crucial to game development (and really any serious programming endeavor) is a solid understanding of common data structures & algorithms. If you don't know what linked lists, trees, or hash tables (aka hack tables ;) ) are, you should learn. I wrote my own version of the STL just to force myself to learn these data structures backwards & forwards. If you don't know them at all, Data Structures for Game Programmers by Ron Penton is a very good intro. He has a light-hearted writing style and the demos on the CD are excellent. They walk you through each iteration and show you exactly (and visually) what the algorithm is doing. There's another book called Introduction to Algorithms (I forget the author) that's pretty standard, but it's very dry and not for the faint of heart. There are a lot of proofs which cause me incredible amounts of boredom.

      Finally, the one thing that has had the biggest impact on my growth as a programmer is my job. I sit in a room with 6 other engineers. One has a PhD in 3d graphics and 4 have Masters degrees in various CS subjects. They're also older and more experienced than me by at least 5 - 10 years. And they're all very happy to teach me whatever I want to know. Having such a vast array of knowledge at my disposal has been truly enlightening. I guess that's one advantage to working for such a tiny company. I became the AI programmer simply by showing an interest. How cool is that?

      Feel free to post any questions you may have on this board. This is one of the most helpful boards I've ever been on and it's small enough that we don't really get trolls. Except for Kain.... watch out for that guy.....

      -Rez
    • Originally posted by Sabrina
      Is it worth the upgrade from VS 03 to 05 if your only using the C++ part of it? What do you think MrMike? Anyone? Bueller?, Bueller?, Bueller?, Bueller?....

      My company felt with was important enough to upgrade, but I wasn't there for any of the discussions so I don't know the logic behind it. When I went to GDC, I talked with the Microsoft developers about the problems I've been having and most of them are fixed now. I love the debugger but to be honest, I can't recall if some of my favorite features were in 2003. Namely, the ability to easily walk through STL structures, data breakpoints, and the ability to hover over an object in debug mode and see it's members. There are many more nifty features, but these are the ones I use pretty much every day. Is it worth the upgrade? Well, if you have the cash to burn, it might be. I don't know if they have a trial version but I would suggest looking into it before dropping that kind of money. If it were just for me, I probably wouldn't have upgraded. The cash:benefit ratio isn't really high enough.


      As Rez somewhat gets into, learning C++ and learning how to program are two radically different things.

      Yes, that's absolutely right. Here's another question for you, Drucygoddess. Are you looking at doing this as just a hobby, or do you plan to get into the industry one day?

      -Rez
    • Originally posted by rezination
      Yes, that's absolutely right. Here's another question for you, Drucygoddess. Are you looking at doing this as just a hobby, or do you plan to get into the industry one day?



      Both me and my partner have a passion for MMORPG's and we want to be able to build our own, we have quite a bit of time to put into it and we are both very interested(enthuisiastic - if thats how its spelled).
    • That's a huge undertaking. Is this your first foray into the world of computer programming?

      -Rez
    • MMORPGs aren't great learners projects (says the guy who is about to start developing one of his own...). You might want to start with something you can see the result on sooner. Starting small and tweaking your way to something a bit bigger will teach you a lot about writing code. Fact is, a lot of times you are going to look at what you've written, think it's horrible, and start with a blank project again.

      Still, write something you'll want to work on. That's the most important part.
      -Larrik Jaerico

      www.LarrikJ.com
    • I don't want to discourage you, but Larrik is right. MMORPG's are incredibly complex pieces of software. They are created by large teams of dozens, sometimes hundreds of people. There are so many tiny little things you have to worry about in the world of Game Programming that for two people it can seem overwhelming.

      That having been said, here's what I suggest. Start with Teapot Wars. Get to know it backwards and forwards. Add new types of enemies, powerups, maybe a small kitten that wanders around looking for food, and anything else you can think of. Once you have a good handle on it, it's time to move on to something else. Create another completely different game. I would suggest making something simple, like cloning an old arcade game (centepede, asteroids, etc.) Use the Game Coding Complete engine if you like, but all the game-specific code should be very different.

      The reason for doing all this is to try and get a better understand for what goes into a game. Mr. Mike or anyone else can stand here and talk about all their experiences in the gaming industry, but there's no better teacher than sitting down and doing it. Even these simple games probably make very poor choices for first programs, although my first program ever was a game so I'm not one to preach about that. ;) I wrote it when I was just a 16 year old college nerd. It's called Farmer Bill's Almond Farm, and is the perfect example of what not to do in a program. I think the whole game contained five or six classes, each of them with a single object instantiated. The level logic was one big switch statement. Everything was hard-coded and I didn't even split up the program into different modules; it was just one big file called opa.cpp that was like 5500 lines. Still, doing such a huge project by myself forced me to learn little tricks that I remember fondly, and I learned quite a bit. My second project was considerably less confusing because of it. :) I remember that I couldn't get the Sound Blaster drivers to work (this was back in the DOS days) so I wrote an Assembly Language sound system that used the PC speaker by writing out the frequency to the PC speaker's hardware address. Such hacky work-around are somewhat common in the game industry. Believe it or not, the game still runs and plays sounds (well, mostly).

      Anyway, I'll stop rambling now. Sometimes I think I talk too much. ;)
      bleachkitty.com/images/ratrace/delia_bitch.JPG

      Oh, if you're interested in seeing Farmer Bill's Almond Farm, go here:
      bleachkitty.com/downloads/opa.zip

      The source code was lost in a tragic harddrive accident, but I've made a couple tweaks using a hex editor. When I have a weekend to kill, I'll reverse engineer it and fix some of the more annoying bugs.

      -Rez
    • I just bought microsoft visual 2005 and noticed when you are writing a c source code, after building it, if theres errors it doesn't give you a link directly to the line at the bottom of the screen like visual 2003 .net does, instead it gives you a line number, i imagine if you have 5000 lines of code, finding the right line would be a tough job.

      Is there a way to make 2005 link you straight to the line with the error like 2003 .net does? If there isnt, is there a way to go directly to the line number with the error, or locate the line number without manually counting every single line? There has got to be a simpler way around this.
    • If it's a compile error, just double-click on it. It should drop you right to that line.

      -Rez
    • I am going to chime in with this:

      Programming Multiplayer Games or Developer's Guide to Multiplayer Games (they're effectively the same book, the first uses PHP and the second uses Perl for it's web interface system) have some good stuff for handling your standard multiplayer games. They have pretty good coverage of sockets programming under Linux and Windows, SQL programming and database administration and just about everything else that you need to get persistent multiplayer games going. It doesn't cover anything that would really directly translate to MMO type games, but it's probably a good start.

      There is also a book out there that claims to deal with programming an MMO - but I haven't read it and it seems awfully small to be anything near definitive on the subject. Don't recall the exact title but it's from Charles River Media.

      Programming Role Playing Games with DirectX covers single and multiplayer games as well and hands you a fairly nice groundwork of utility classes as well, but it's strictly Windows-centric. MMO's are (from what I understand) almost always built with the server on a flavor of Linux/Unix for stability and the client on whatever platform the devs think there is demand for.

      I'm gonna get on the bandwagon with the other guys and point out that an MMO is an undertaking that is best described by the very titile of the genre - "Massive." It is an old saw, but "you have to learn to walk before you can run." Try smaller projects - write a chat program that will allow you to get people together in an AOL-style or IRC-style chat to learn your network stuff. Build a game of break-out or pong (single and multiplayer - woohoo!). I'm just a hobbyist, but I can tell you that if you start something and can never see it finished, it is discouraging. It's generally better to take smaller steps and to try to fully understand each step along the way. This way you will build the knowledge to be able to design and implement progressively larger and more complex systems.

      And, if it's just the two of you, you both should start learning about 3D modeling, 2D paint and art programs, sound and music, architecture, botany, geography, history and political science, psychology, writing and composition, etc. All of these will be helpful in creating compelling content for your MMO and other projects along the way.

      Rich
      "Your job is not to die for your country. Your job is to make some other poor sod die for his."
    • Hey man, for a while the majority of polygons in Barbie were due to pink boxes and red cones.

      "Tia's purse? Where the hell is that?"
      "Oh, it's the pink box just to the left of the couch."
      "Couch?"
      "Err, yeah. Those blue boxes over there."

      -Rez
    • Hey! I may not be Paul Steed, but I'm pretty handy with 3DS MAX. Not half bad with a pencil and pad either.

      And my tunes are amateurish but original.

      Like I said, though, this approach is only for those of us who are one, two or three-man bands.... If you have real artists, modelers, composers, designers, musicians, historians, architects, psychologists, engineers, zoologists and anthropologists handy, let 'em do their jobs.

      Swing by my site and check out the programmer art in the (braggingrightsproductions.com/Photo+Gallery/default.aspx) Photo Gallery! Not awe inspiring, but better than pink boxes and red cones....

      Rich
      "Your job is not to die for your country. Your job is to make some other poor sod die for his."
    • Originally posted by Nebuchadnezzar
      Hey! I may not be Paul Steed, but I'm pretty handy with 3DS MAX. Not half bad with a pencil and pad either.

      And my tunes are amateurish but original.

      Like I said, though, this approach is only for those of us who are one, two or three-man bands.... If you have real artists, modelers, composers, designers, musicians, historians, architects, psychologists, engineers, zoologists and anthropologists handy, let 'em do their jobs.

      Swing by my site and check out the programmer art in the (braggingrightsproductions.com/Photo+Gallery/default.aspx) Photo Gallery! Not awe inspiring, but better than pink boxes and red cones....

      Rich


      Those are some nice pictures/models you created there, what programs will i need to buy and what will we need to learn to start doing stuff like that, assuming thats the way we need to go that is, we are looking at doing our own graphics for now, havent a clue where to start.
    • For 3D modeling, the industry standard seems to be Maya. For textures, it's Photoshop. These are the two programs my company uses as well as the companies of various artists I know (which isn't a lot).

      That having been said, I seriously doubt you want to drop that kind of money. I have no idea what indie developers typically use for modeling since I don't do 3D art myself, but I've heard good things about Blender. It's opensource, so you can't beat the price. :) For 2D artwork & textures, check out The Gimp (also open source). It's pretty sweet, though I haven't quite figured out all the various features. I tend to use MS Paint for very simple 2D work like pixeling and moving stuff around since it's incredibly easy to use. All the real tweaking I do is in The Gimp.

      Rich, your programmer art is considerably better than anything I can do. I don't have the patience for creating artwork. Ironically, that's exactly what an artist said to me about programming. ;)

      -Rez