Thread: C for games

  1. #1
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688

    C for games

    I have looked online for a answer to this but to no avail.

    question is this:

    Is it ok to do game programming in C? I have been learning it for 5 years and have become pretty good at it. The other issue I have is I cannot find any books on amazon that do C game programing, its all C++.

    More to back my theroy up is this:

    Doom was programmed in C
    Lemmings was programmed in C
    Earlier zelda games where coded in C ( i think )

    That shows me that good games can be made from the C language. I am wondering if you know of any advantages / disadvantges to using C as the core language for game development

  2. #2
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Learning enough C++ if you have a good grasp of C shouldn't be that hard.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  3. #3
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    I plan to use C for my next game. No reason, just I've always used C++. I think I might use Watcom C too. Yeah.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  4. #4
    vae victus! skorman00's Avatar
    Join Date
    Nov 2003
    Posts
    594
    There's nothing wrong with using C, or any other language for that matter. Books will usually use C++ code because it's more widely used, and object oriented design is easier to use when trying to explain techniques.

    Something else to point out is that there are very few things that C++ can do that cannot be simulated in C.

  5. #5
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Something else to point out is that there are very few things that C++ can do that cannot be simulated in C.
    In fact, the original C++ compiler just converted the C++ source to C.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  6. #6
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    Quote Originally Posted by ahluka
    I plan to use C for my next game. No reason, just I've always used C++. I think I might use Watcom C too. Yeah.
    Well I must be psychic because about an hour after having posted that I stumbled across acrticles about programming the GBA. It's interesting working at such a low level and I'm facing challenges I've never faced before.

    Observe where I am with displaying bitmaps (screenshot taken in VisualBoyAdvance emulator in case you were wondering):
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  7. #7
    Registered User
    Join Date
    Mar 2006
    Posts
    17
    I never really looked at C and C++ as different languages. I mean, look at the name, C++ would be the value of C plus 1.

    C++ is just C, with more features.

    Or atleast that's how I see it.

  8. #8
    ---
    Join Date
    May 2004
    Posts
    1,379
    Quote Originally Posted by howzer
    I never really looked at C and C++ as different languages. I mean, look at the name, C++ would be the value of C plus 1.

    C++ is just C, with more features.

    Or atleast that's how I see it.
    Not really. That's just a common misconception.

  9. #9
    Registered User
    Join Date
    Mar 2006
    Posts
    17
    then what's up with this:
    Code:
    #include <stdio.h>
    #include <iostream>
    
    int main(){
        int inputc;
        int inputcpp;
        std::cout << "C++ output" << std::endl;
        printf("C output\n");
        std::cin >> inputcpp;
        scanf("%d",inputc);
        std::cout << inputcpp << std::endl;
        printf("%d\n",inputc);
        return 0;
    }
    I'm still convinced that C++ is just an extension of C, and ultimately, they're the same language.
    After all, C++ is just a bunch of different header files for C.

  10. #10
    Yah. Morgul's Avatar
    Join Date
    Feb 2005
    Posts
    109
    What you have there is a mixing of C++ and C code. C++ is not just an extension of C, it is a different language for the most part. It has different standards and much better ways of doing things, plus all kinds of different features C doesn't have.
    Sic vis pacum para bellum. If you want peace, prepare for war.

  11. #11
    ---
    Join Date
    May 2004
    Posts
    1,379
    Quote Originally Posted by howzer
    then what's up with this:
    Code:
    #include <stdio.h>
    #include <iostream>
    
    int main(){
        int inputc;
        int inputcpp;
        std::cout << "C++ output" << std::endl;
        printf("C output\n");
        std::cin >> inputcpp;
        scanf("%d",inputc);
        std::cout << inputcpp << std::endl;
        printf("%d\n",inputc);
        return 0;
    }
    I'm still convinced that C++ is just an extension of C, and ultimately, they're the same language.
    After all, C++ is just a bunch of different header files for C.
    Redirect this post to the C forum and someone might be able to fill you in a little better.

  12. #12
    Registered User
    Join Date
    Mar 2006
    Posts
    9
    OMFG you guys...

    C was first created in the 60's then updated in the late 70's to standerd C. Then there were many languages with C as their core, but the one that caught on most was C++ which is an object oriented programing language that allowd the flexablity at cost of direction. Which is good for making more unique programs but requires more experimenting (alot more debugging).

    C++ is a variation of C...But so are many languages...C has nothing to do with C++, yet is a variation.

    C can make top of the line games....Its easier to make a gamer maker with C++ and then have VBS supported language and that will make it alot easier to make a game.

Popular pages Recent additions subscribe to a feed