Like Tree5Likes

C or C++ for games

This is a discussion on C or C++ for games within the Game Programming forums, part of the General Programming Boards category; Long before you choose the language you need to think about your game and what it is you want it ...

  1. #16
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    Long before you choose the language you need to think about your game and what it is you want it to do. I cannot make a suggestion relating to language until I know more about your game. Not all games are performance critical and not all games require super fancy engines.

    So what type of game are you making?

  2. #17
    Registered User BradyW's Avatar
    Join Date
    Aug 2011
    Location
    Maryland, USA
    Posts
    5
    Litarded is learning C# now apparently. I'm still using C because I find it a lot easier than any other language I've tried to learn. The reason I like C is because it's cross-platform and apparently fast.

    We have a friend who is an amazing C programmer (he's making a Multiplayer RPG engine at the moment) and he's the one who convinced us to use C instead of any other language. He's developing a new library for it and everything. He also uses Linux, which would probably explain why he hates C# so much.

    The problem is that I have no idea what my dream game would be. I've always envisioned a creative or God-like game like Civilization (obviously I won't be able to make something on that scale), Sims, or Minecraft (such a cliche). Creative games where you need to gain resources and create always fascinate me, but that doesn't necessarily mean that the game I end up developing will have those features. I don't like complex games, but rather games that are simple yet extremely enjoyable (thus indie games).

    My programming background isn't large, but I know the game development industry quite well. I used to play around with stupid scripting engines that mimic C, so C came as easy for me. I'm learning Java at my high school right now (we are both 15), although I absolutely loath Java because of how slow it is. I want to avoid OOP because it's apparently slow, which puts C++ out of the picture.

    I'm really stuck at the moment. I've heard that I should start with a simpler programming language before diving into C, but I don't want to learn a worthless language. I guess that I could wait til college to learn a better language, although I don't want to rely on a college to teach me; I'd rather be self-reliant. Since I'd rather be an Indie developer than work for EA (they have a few offices close to my house), I guess that C# would be better, but that still screws over the Mac and Linux users.

    Thanks for the input so far!
    -Brady

  3. #18
    Registered User
    Join Date
    Aug 2011
    Location
    US
    Posts
    6
    Well I decided to go with C# and XNA as Brady said above. I have had several people tell me several different reasons on why I should just do the language I want to do and use the correct tool.

    C# and XNA is nice because games can be put on the Steam Platformer as some people said above, and then it can go to the Xbox game arcade. I actually started working on a small framework for a platformer for my game, and hope to develop it as I get time to work on it. It also is decently easy to learn and easy to make small games.

    I didn't go with C because it's actually hard to make GUI applications and I don't see many tuts online.

    I didn't go with C++ because it look's stupid. I don't even wanna attempt these languages until I go to college. Hope this thread helps anyone that needs deciding what language they should use to make a game in C/C++/C#.

    Thanks
    Aaron

  4. #19
    Just a pushpin. bernt's Avatar
    Join Date
    May 2009
    Posts
    426
    I guess that C# would be better, but that still screws over the Mac and Linux users.
    Just to make it clear: XNA is the one that "screws over" Mac/Linux. C#, not so much - there are cross-platform implementations of C#, like Mono.
    Consider this post signed

  5. #20
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    There is a lot of bad info littered throughout this thread.

    I want to avoid OOP because it's apparently slow, which puts C++ out of the picture.
    Eh?

    Well I decided to go with C# and XNA as Brady said above.
    Again...eh?

    So C++ is too slow b/c of its OOP so you decide to go with C#/XNA? That makes no sense whatsoever. I can assure you that C++ is not slow and I've coded demos using Direct3D in pure C++ that beat equivalent C# / XNA versions by a factor of 2 or 3. Trust me when I say that if C++ is good enough for 90% of the retail games industry it is certainly good enough for you.

    Regardless of your choice you still have not explained adequately why you should even be choosing a language at this point when you have explained nothing about your game. I think you are way ahead of yourself and need to step back a bit. I wouldn't worry so much about the actual coding of the game as I would the design behind it. Poor design leads to poor code but good code almost never leads to good design. Moral of the story: coding is only about 5 to 10 percent of programming.

  6. #21
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,556
    Quote Originally Posted by Litarded View Post
    I didn't go with C++ because it look's stupid. I don't even wanna attempt these languages until I go to college. Hope this thread helps anyone that needs deciding what language they should use to make a game in C/C++/C#.
    WTF? "It looks stupid"?
    That would mean all other languages look stupid since pretty much all modern languages (OK, not all, but a lot) have their roots from C++.
    What is it that looks so stupid?

    Quote Originally Posted by BradyW View Post
    My programming background isn't large, but I know the game development industry quite well. I used to play around with stupid scripting engines that mimic C, so C came as easy for me. I'm learning Java at my high school right now (we are both 15), although I absolutely loath Java because of how slow it is. I want to avoid OOP because it's apparently slow, which puts C++ out of the picture.
    This is pure nonsense. OOP isn't slow, and C++ isn't slow. What makes things slow is bad implementations.
    C isn't usually used for games (game companies do not use C for games for a reason!).
    It all depends on what you want to do, your requirements and what you like.
    Last edited by Elysia; 09-03-2011 at 10:36 AM.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #22
    Registered User
    Join Date
    Jan 2010
    Posts
    412
    Quote Originally Posted by Elysia View Post
    This is pure nonsense. OOP isn't slow, and C++ isn't slow. What makes things slow is bad implementations.
    Exactly this. You cannot even measure the performance of the languages themselves. You can however compare language implementations against each other.
    The blanket statement that Java is slow is wrong. Saying that Sun's (now Oracle's) Java implementation is slow is a valid statement. Which is debatable, but at least it is a valid opinion.

  8. #23
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    You cannot even measure the performance of the languages themselves.
    What?

    The blanket statement that Java is slow is wrong
    Who mentioned Java?

    I feel like I have stepped into the twilight zone in this thread.

  9. #24
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,662
    Quote Originally Posted by VirtualAce
    What?
    You should read the next sentence for context.

    Quote Originally Posted by VirtualAce
    Who mentioned Java?
    BradyW mentioned Java in post #17:
    Quote Originally Posted by BradyW
    I'm learning Java at my high school right now (we are both 15), although I absolutely loath Java because of how slow it is.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  10. #25
    Registered User
    Join Date
    Jan 2010
    Posts
    412
    Quote Originally Posted by VirtualAce View Post
    What?
    What I'm saying is.. Read the specification documents for C, C++ & C# and based on that information alone tell me which language has the highest performance.
    It simply cannot be done, because the specifications has no mention of how many instructions/statements/whatever the languages should or will run at.

    A good c# compiler will produce faster code than a bad c compiler. And the same is true for the opposite. But that's all implementation details.

  11. #26
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    A good c# compiler will produce faster code than a bad c compiler.
    So name a bad C compiler that will produce slower code than the equivalent C# compiler. We are comparing apples to oranges here.

    The main problem with this thread is that the OP appears to have a few misconceptions about C++ and/or about programming in general. Performance in the context of this thread is a moot point. My main question about what type of game is being made has not been answered. This leads me to believe that the people in question are selecting language A or B before understanding the requirements of the game. My guess is the requirements are not understood because the game itself has not been thought out. So I am back at my initial point which was a lot of decisions are being made without having any logic to back them up. I think we are compounding the problem by making statements about language A or B when the real problem here is simply a lack of forethought into the development of whatever this 'game' is.

  12. #27
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,662
    Quote Originally Posted by VirtualAce
    My main question about what type of game is being made has not been answered. This leads me to believe that the people in question are selecting language A or B before understanding the requirements of the game.
    Agreed, though until the OP answers that question, there is little else to discuss that will definitely be helpful to the OP.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  13. #28
    Registered User BradyW's Avatar
    Join Date
    Aug 2011
    Location
    Maryland, USA
    Posts
    5
    Thanks guys, but just for the record, we are new to programming and heard all of this information from our friend. If he is wrong please inform us.

    The reason we are choosing C# over C or C++ right now is because making GUI applications is easier. Considering that we are new programmers, we don't want to step into the hardest languages first. I actually found that C had an amazingly easy and basic way of doing console apps, but after looking at some stuff explaining how to do GUI apps it became complicated.

    XNA looks like the best choice clearly right now. I would love it if some of you could challenge that and give us some more cross platform choices that are easy to use for beginners.

    Thanks,
    Brady

  14. #29
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,866
    Quote Originally Posted by BradyW View Post
    XNA looks like the best choice clearly right now. I would love it if some of you could challenge that and give us some more cross platform choices that are easy to use for beginners.

    Thanks,
    Brady
    The most important thing to do is to learn how to program. Regardless of the language and library you choose to go with first, learning the fundamentals of programming are skillsets which are portable and will allow you to create games on any given platform. Pick a language, and just start learning. The C#/XNA combo provide many advantages of rapid development by hiding the implementation of the hardware interfaces and routine programming software implementations that are required for game programming. Additionally, the SDK provided with the XNA framework is very well documentated with many code snippets and full working games to refer to.

    For begginners, the fact that you can write and test your games on XBOX360 is also a fun little thing that can help you stay motivated during your learning experience. If you really work at it you can have a small working game playable on the 360 within a couple of days.

    Just get out there and start learning; most of the questions you have posed on this thread will be answered during your studies.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  15. #30
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498
    Quote Originally Posted by BradyW View Post
    Thanks guys, but just for the record, we are new to programming and heard all of this information from our friend. If he is wrong please inform us.

    The reason we are choosing C# over C or C++ right now is because making GUI applications is easier. Considering that we are new programmers, we don't want to step into the hardest languages first. I actually found that C had an amazingly easy and basic way of doing console apps, but after looking at some stuff explaining how to do GUI apps it became complicated.

    XNA looks like the best choice clearly right now. I would love it if some of you could challenge that and give us some more cross platform choices that are easy to use for beginners.

    Thanks,
    Brady
    As some others said, you're probably rushing into this.
    Making a good game is not just making a 'gui app' easily and the gui is often the least important part of the game.

    Though I agree that it is a good idea to choose the 'easier' (and more enjoyable!) way now.

    But I myself(when in your position) would first become familiar with programming enough to make an intelligent choice, not one as superficial as "It is easier to make gui s with" .

    Btw.. Best of luck(and knowledge) on the way ahead.
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



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

Similar Threads

  1. DOS Games
    By ThLstN in forum Game Programming
    Replies: 26
    Last Post: 06-20-2008, 04:34 PM
  2. Games + C++
    By Nestor in forum C++ Programming
    Replies: 4
    Last Post: 06-19-2008, 12:53 PM
  3. c++ games comparable to psx games?
    By anarchyhollow in forum Game Programming
    Replies: 17
    Last Post: 01-08-2003, 07:49 PM
  4. Just Games IDE
    By JoshG in forum Game Programming
    Replies: 2
    Last Post: 06-24-2002, 02:58 PM
  5. C++ Games
    By NewbieVB in forum Game Programming
    Replies: 5
    Last Post: 04-14-2002, 09:33 AM

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