It seems that all use c++ for game programming

This is a discussion on It seems that all use c++ for game programming within the Game Programming forums, part of the General Programming Boards category; Hey guys and gals, I am just curious, but i am interested in making a simple game perhaps one day, ...

  1. #1
    nai
    nai is offline
    Registered User
    Join Date
    Jul 2004
    Posts
    3

    It seems that all use c++ for game programming

    Hey guys and gals,

    I am just curious, but i am interested in making a simple game perhaps one day, but i keep reading that c++ is the preferred language. I actually would like to stick to doing a game in c. The only problem, is that how do you even begin or is it mainly used to write game engines and not the graphics.
    how do you even get characters drawn to be in the game to move around, etc.

    I know that this may sound crazy, but where on earth would someone like myself even start to understand the graphics, 3d engines, terrains, backgrounds and then joining them all together?

    Any help would put my head at ease.

    thankx,

    nai

  2. #2
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    University of Waterloo
    Posts
    1,903
    This question has been answered many a many a times.

    Here's the links to some of the other threads i've found:

    Beginning Game Programming
    I want to learn how to program games
    Newbie alert
    Needing Expert Advice Please
    Simple, non 3d games - what to use??
    12 year old in need of game programming advice
    Beginner...

    *note to one of the mods*
    is this question in the faq? if not, i vote we put it in there....

    Hopefully some of those links will help you out, you can always check the following sites out:
    http://gamedev.net
    http://nehe.gamedev.net
    http://cprogramming.com
    http://google.com
    http://gametutorials.com

    And to answer your question, it's really a matter of preference whether you want to use C++ or C. When it comes down to it, if I were to make a big engine, I'd definitely use C++ because it allows you to gather your code together much more effectively.

    However, just starting off learning, I'd suggest going with C, as the OOP mechanisms of C++ can tend to wrap your brain in one heck of a mess. Not saying you should avoid C++, just don't let it intimidate you too much right away, cuz it's definitely not easy when you're just learning the language.

    -Hope that helps

  3. #3
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    I agree with what jverkoey said except about learning C first. I can't speak from experience, but I've heard that it is hard to break habits that you learn in C when you switch to C++. It's something to consider anyways.
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  4. #4
    vae victus! skorman00's Avatar
    Join Date
    Nov 2003
    Posts
    594
    I second that this question should be in the FAQ.

    C is the weapon of choice for most console games. If not, they use C++, but only so they can have class and member functions (for the most part).

  5. #5
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,586
    I cannot code a game anymore in pure C. My code almost always use classes and other extremely powerful C++ constructs. They are there for you....why not use em?

    Make sure you are staying away from C++ for the right reasons. I can't think of any right reasons right now but I'm sure there are some. Incidentally being unable to program in C++ is not a right reason. Buy a book on C++ and you'll never look back.

    Quite simply, C++ rocks.

  6. #6
    nai
    nai is offline
    Registered User
    Join Date
    Jul 2004
    Posts
    3

    darn - sorry i asked

    Hey all again,

    now i got to unlearn c to do game programming. Sounds kinda dumb huh?

    Anyway, i always have c under me belt. c++ seems so daunting though.

    thanks for all the replys,

    nai

  7. #7
    Registered User
    Join Date
    Aug 2003
    Posts
    1,197
    Why unlearn C? You can still do games with C just as well as you can with C++. Use the language you are comfortable with.

  8. #8
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    University of Waterloo
    Posts
    1,903
    Arg, don't go thinking C and C++ are two different languages. When it comes down to it, C++ is C with classes and a few other language improvements. Everything you code in C will compile as a C++ program.

    If you want to make games, simply put, learn how to use C++. When learning C++ you are basically learning C right off the bat anyways, until you start learning about the lovely thing called OOP (Object-Oriented Programming) with classes. That's when things start getting a little bit more complicated, but if you work at it, you'll eventually understand it inside and out.

    You do not have to "unlearn" C to learn C++. Actually, you should never have to unlearn a language when it comes down to it. Every language you know can only help you more in the end!

  9. #9
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,586
    And since C++ is a superset of C, it is not a different language.

  10. #10
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,344
    It's only a semantic superset, not a syntactic superset
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  11. #11
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Everything you code in C will compile as a C++ program.
    Really?
    Code:
    int b = 5;
    void *a = &b;
    int *c = a;
    So that will compile using c++?

  12. #12
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    University of Waterloo
    Posts
    1,903
    ok thantos so there are some exceptions then....lol

  13. #13
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >so there are some exceptions then....lol
    Not to mention subtle problems with constructs that do compile, but give different results. Pretending that C and C++ are even close to the same language is bad for your health.
    My best code is written with the delete key.

  14. #14
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    Although I should point out that the original name for C++ was actually "C with classes"

    And just to add my two cents on the matter, I will say that I think C++ is definately easier for game programming (having done none of it myself). Although you could get the job done just as well eventually with C, OOP lends itself to modelling the real world, so C++ would be a good investment for such applications.

  15. #15
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,586
    They are the same 'language', perhaps you could think of C++ as a dialect of C.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21