newbie coder desperate for advice!

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

    • newbie coder desperate for advice!

      Dead easy one this. I've a reasonable level in C programming and i'd like to get to grips with C++. I read Mikes book because i found it fascinating although the code may as well have been written in hieroglyphics. Could anyone recommend the best books to get me started, i'd like to try some (simple!) game coding but most beginner level books don't really touch it and the next level up is a big leap, Anything in-between?
      I notice that game coding complete is for intermediate in which case i'd love to see advanced! (raw sarcasm there).
      One last question, i run Windows and Linux but my Linux compiler (GCC) throws up errors on a simple hello world program whereas the same code in Windows works fine. Anyone know a good reason for this.
      Yes, i am very green in coding so please bear with me if i'm asking stupid questions.
      How about a beginners coding book Mike??
    • Welcome to the boards blastradius! I'm by far no Mr. Mike, but I'll do my best to give you some resources to look into.

      For someone who has prior C knowledge, I think you can check out cplusplus.com's C++ tutorial to get an overview of some of the key additional features in C++. Since you have a background in C, you may be able to jump straight to about section 4 and start reading up on classes, inheritance, and polymorphism.

      Also, if you're looking for a desktop reference book that covers C++, I highly recommend Deitel and Deitel's C++ How to Program. It's a bit on the expensive side (about $75), but I found it to be a very worthwhile investment. In my opinion, it's the one of the best sources of information that covers a very wide range of features in the C++ language, as well as additional topics covered in the case studies provided.

      Unfortunately, the jump from general C/C++ programming to (Windows) game programming is a rather large one because many topics and APIs get thrown at you all at once. Some resources I can recommend for you are the Game Programming Genesis series over at Gamedev.net (they're under the General subcategory). They cover the basics you need to set up a window and start using DirectDraw 7. Also over at Gamedev.net, you can check out their Hands-On Interactive Game Development tutorial. It guides a person through the process of creating a Tetris clone using DirectDraw. A few other websites you may want to just keep as bookmarks are flipcode, Gamasutra, and GameTutorials.

      For general Win32 programming info, Winprog is a decent site that will you get up and running with Win32. However, THE place to go to find out anything regarding Windows programming is MSDN. That site has a wealth of information.

      As for your question about compiling a simple hello world program, I wouldn't know what exactly the problem is without seeing the code and an error message. Some ideas off the top of my head, however, are that the include and/or library paths may not be properly set on your Linux compiler, or maybe you could be using a deprecated header that GCC wouldn't allow you to use (I wouldn't know since I've never used GCC)?

      Again, welcome to the boards, man. :D
    • Consider a copy of Thinking in C++ for a easy intro to OOPS and the C++ syntax

      GameProgrammer.org is a new site that may help a bit they've a few examples

      RedHat seems to have made a habit of packing the wrong compiler with the includes and libraries
      I don't know if they've stopped that but the last two versions I've tried did that

      good luck and welcome

      gb
    • RE: newbie coder desperate for advice!

      OK well if you only know C and want to start to learn some C++ and start game programming at the same time, then I suggest you change your mind. There is a huge gap between knowing C and programming windows games in C++ using DirectX.

      I suggest instead you try out Allegro as it's very good for beginners, easy to learn and you only need to know how to program in C.

      You can then learn how to program some games to keep yourself motivated, while learning how to program C++ (and then Win32 API followed by DirectX) on the side. One of the easiest and best books I've ever come across for learning C++ and OOP is (and I will probably be beaten up for saying this) C++ for Dummies. A lot of people didn't have nice things to say about that book (mainly because they didn't like the author saying that ppl need to know C before trying to learn C++), but I loved it.

      I'm not going to say what book I used for learning Win32 API programming, as I don't really feel like a second beating. However I will say that I can't understand why anybody (no offence MRom, I have your back on everything else ;) ) would like the Winprog tutorials, yet everybody seems to. To me they seemed crap in all ways possible and I didn't learn a thing from them. The errors alone should be enough to drive anybody crazy.

      Finally for beginners in DirectX, I loved "Tricks of the Windows Game Programming Gurus"... but if anybody has a problem with that then they can kiss my ass :D ;) cause it was brilliant.

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

    • RE: newbie coder desperate for advice!

      Good advice, y'all.
      Mr.Mike
      Author, Programmer, Brewer, Patriot
    • If you prefer something with a more structured / academic approach I recommend:

      Object-Oriented Programming Using C++ by Ira Pohl

      It is part of the AW Object Technology Series and is a solid piece of work. My only complaint is that it lacks detail on the STL -but this may have changed since 2nd Ed.

      I use this book first before tangling with Bjarne-y to answer my C++ questions. I guess what I'm saying is that it also doubles as a good reference.
      E3 2004 or bust!
    • Post it in a ZIP file - the web site blocks random attachments. If it is too big - send me a PM and we'll get it up here one way or another.
      Mr.Mike
      Author, Programmer, Brewer, Patriot
    • RE: newbie coder desperate for advice!

      I learned C++ from "C++ from the ground up," which really wasn't a great book (it was ancient at the time, anyway).

      Heh, when you linked to "Allegro" I thought you were talking about the Lisp program from Franz. I fucking hate that program.

      To be honest, I'm not as good in C++ as I should be, although in C I'm pretty solid, even in Unix. Just remember baby steps.

      For your compiler problem, you may need to tell gcc that you want it in c++ mode, which MAY be accomplished by appending your files in .cpp instead of .c (a fact I overlooked the inverse of in visual studio). I'd say program in Linux as much as you can, although that is mostly c.

      Also, don't be afraid to check out other languages. They may not be great for games (though I hear Thief 1 was written in JAVA), but the more you learn about other languages (LISP, Perl, JAVA, etc), the more you'll learn about good programming.

      Comments/thoughts?
      -Larrik Jaerico

      www.LarrikJ.com
    • RE: newbie coder desperate for advice!

      I have been learning Java recently, and for a long time i hated it... It was C++ but limited. Where you could do different things in C++ to accomplish the same task, Java forces you to do it a certin way. I understand how it forces you to be object-orentated, but C++ allowed that too. Another thing that annoyed the hell out of me is that you cant just simply make on variable equal to another... everything is a pointer..
      Ex: A=1; B=A; A++;
      since B is a pointer to A, B now equals 2... never simple...

      I've finaly come accross the single part of Java that i have liked... The Applet Creation. Applets are simple to make, easy to handel, and have already given me more of an understanding of even DirectX. I have already tought myself more about applets then my teacher knows, he's even asked me to put together a package of what i know, including buffering into the applet...

      I would definatly agree, the more languages you know, the better your understanding can become.
      Wort wort wort.

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

    • If you're open to the idea of learning a new language, then I've heard that you can use Python along with the pygame library to create games relatively quickly. I've used Python before, and it's real easy to learn on your own; however, I've never used pygame before, so I can't vouch for the library. If I had to make an assumption though, I'd say you're more likely to see results (i.e., progress towards making a full game) much faster using Python than if you were to go the C/C++ route and learn about the language, then learn the necessary Win32 API to get you started, then learn all you can about DirectX/OpenGL/SDL/Allegro/(insert graphics/game programming API of your choice here) just to create a game with C/C++.

      I'm not docking C/C++ any (it's what I use mainly), just saying that a person who hasn't had a whole lot of experience with programming for Windows might see results faster if they took the time out to learn Python and pygame.

      Last time I checked, latest version of Python is 2.3.3 and it, along with any documentation and/or tutorials you need, can be downloaded from here. The pygame library can be downloaded from this site here .
    • Originally posted by garbob
      I'd be very interested to find something the Java can do better than C++
      Slow down your computer? :D

      Na Java is portable and all that other crap and I'd probably like it a heck of a lot better if it allowed you to convert the code into machine dependant but faster code. ie. you post your portable Java app to the net, I download it, the first time I run it it's slow as because it has to be interpreted. But then the next time it's a heck of a lot faster because it has now a cached version of the intrepreted code.
      Isn't that possible?
    • Java is not really an "interpretted" language anymore, per se, at least not in the same regard that Python and Perl are. With the latest versions of Java, Java byte code is just in time (JIT) compiled, right before program execution into native instructions. .NET languages like C# and VB.NET are similar in that the MSIL is JITed right before program execution, and the compiled code is cached away on the system, so the 'major' speed hit would be at a program's start up.

      With that said, I can't say I've been too fond of Java. One of the glaring things I find missing is the total lack of an enumeration type. Regardless of what anyone says, enums are a major benefit, especially when coming up with a finate state machine or when making a set of error codes that could be returned by various methods. Sure, the same thing could be done with final static member variables, but just doesn't seem as elegant to me.

      Also, in my experience, a lot of floating point operations and methods in the Math class were abysmally slow. I was trying to prototype some ideas I had for some physics code that I was going to use in my C++ game, but even when just simulating a single particle falling due to gravity, it ran at piss-poor speeds when I used Math.sqrt method. I threw in a square root approximation instead, and it ran much better. I understand that sqrt's are costly operations, but I can't see any reason why it would cause the extraordinary performance hit I faced; using the sqrt method, the 'particle', represented by a couple drawn pixels, literaly moved a pixel every couple seconds, whereas the square root approximation ran as intended.

      Then it is my opinion that the whole Swing library (which was supposed to be a somewhat of a replacement for the standard AWT) is over-bloated and pretty freakin' slow. Not to mention I'm not particularly fond of Java's default "look and feel." UI response time seemed to be fairly laggy at times. I didn't experience much of an issue with this when using the regular AWT though.

      But what I think the most unforgiving thing is the way the API docs are arranged. I love using javadoc and other variants of it for smallish APIs, but for something as extensive as the whole Java API, it really just doesn't cut it, in my opinion. Everything is jumbled together, and when you're looking at a class that is deep down an inheritance line, you find yourself jumping to new pages to read up on the inherited methods.

      A lot of these issues are personal issues I have with Java, so there's maybe not a whole lot of objectivity to them. Regardless, unless portability was a real issue to me, I'd choose C# coupled with the .NET framework over Java with its Swing/AWT libraries any day of the week.

      edit: Fixed some grammatical and spelling issues, etc.

      The post was edited 2 times, last by MRom ().

    • yeah,

      I wish there Sun's system allowed for a Java to native machine code compiling with an optimizer. What would it hurt, your quick web site applet could still be interpretted and applications that are written in Java because its portable could run quickly.

      I don't care what they say, about JIT and caching serveral of the java applications I've used are slower than anything

      gb
    • Originally posted by garbob
      yeah,

      I wish there Sun's system allowed for a Java to native machine code compiling with an optimizer. What would it hurt, your quick web site applet could still be interpreted and applications that are written in Java because its portable could run quickly.


      Good, I'm glad I'm not alone on this one. :D

      As for when I said Interpreted and you said "Java byte code is just in time (JIT) compiled, right before program execution into native instructions.", yeah that's what I meant but I find it easier to just group it under the heading of "interpreted".
    • RE: Confused. ?(

      I'm not sure what you are confused about, but I'll try.

      Interpreted languages (Lisp is the easiest to see this in) are more like scripts, where there is a master program running, and you feed it your own code, which it executes. In fact, in Lisp, you can have the interpreter running, and actually type in the code by hand, which is cool.

      Just In Time compiling means that the master program, instead of reading it on the fly and running it as it says, instead compiles it into machine code as its own program, and sends the program off on its merry way.
      -Larrik Jaerico

      www.LarrikJ.com
    • Ok, i'm first going to start with the dumb question... what is an enumeration type?

      I've noticetd the slowdown's with java as well. When working with applets, just implementing a simple buffer causes a slowdown of almost 1/50.

      I very much dislike the forced object orentation and the anal retentiveness of the compiler, not to mention the pointers...

      Other than that, i kinda got use to the applets, almost liking them... probably cuse i dont really know how to make windows and all in c++ and DirectX but it was pretty simple to teach myself Java applets so i'm hoping it could be the same...

      Speaking of, anyone have some simple examples i could learn from? just graphics demos controll w/ directx, drawing circles and stupid stuff like that.
      Anything would be greatly appreciated.
      Wort wort wort.