Thread: Tutorial on making games in C

  1. #1
    Registered User
    Join Date
    Oct 2014
    Posts
    7

    Exclamation Tutorial on making games in C

    Hello. I have been searching around for a book or tutorial about programming a game in c. A lot of the stuff is describing the steps on how to make a game and not actually getting in to the code. Im also seeing a lot of stuff in my search results on other languages. So if anyone knows of a good recourse on making games in c I will appreciate it heaps.

  2. #2
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    O_o

    A lot of the stuff of game programming has nothing to do with code.

    A lot of the stuff of game programming isn't specific to C code.

    A lot of code on game programming is written with a specific library in mind.

    With that in mind, you'll probably benefit from searching for tutorials using specific libraries.

    The "Allegro" and "SDL" libraries are really common C libraries; you should search around for some tutorials.

    Soma
    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

  3. #3
    Registered User
    Join Date
    Oct 2014
    Posts
    7
    Ok where can I find some good stuff with allegro and c. All my searches are just bringing up c++ stuff.

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I feel like I have to put this out here.
    There's a reason most material is for C++ and that's because C lacks the necessary language features necessary for game development. Well, not "lacks" as they are not required, but when you write big complicated things like games, you are going to get overwhelmed with complexity and bugs unless you have good tools to mitigate them. C++ has a lot of these tools which C lacks.
    Now, I'm not saying you can't write a game in C. It can be done. But I wouldn't recommend it.

    Of course, you are free to choose whatever path you want. I don't know of any good resources for C, though, unfortunately.
    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.

  5. #5
    Registered User
    Join Date
    Oct 2014
    Posts
    7
    well Im doing c now because I am going to learn c++ in the future and knowing the base(c) is going to be better. I just want to make simply games for fun.

  6. #6
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    C is not a prerequisite for learning C++ and, in fact, it is recommended not to learn C as a prerequisite for learning C++.
    If you want to learn C, then that's perfectly fine.
    If you want to learn both C and C++, then that's also perfectly fine.
    But if you only want to learn C++ and learn C as a prerequisite, then that's not recommended. C and C++ are totally different languages, different paradigms, and do things very differently. Learning C in this case will only harm than do good.
    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. #7
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    well Im doing c now because I am going to learn c++ in the future and knowing the base(c) is going to be better.
    O_o

    I hate to being this up again for I fear MutantJohn and stahta01 will think I'm just picking on them.

    *shrug*

    In any event, Elysia is absolutely correct about the C to C++ transition.

    The transition isn't simply unnecessary. The transition has worked against beginner, good, and even great C programmers.

    Repeating on Elysia: if you want to learn C because you want or need to learn C, you should absolutely learn C programming. If your motivation is only as a transition, you should start with C++ from the beginning. They are very different languages with different idioms, best practices, and canonical code.

    To be clear, good C++ rarely looks anything like good C and the reverse is also true.

    Soma
    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

  8. #8
    Registered User
    Join Date
    Oct 2014
    Posts
    7
    Is is possible to make a game in c? should I use allegro? if so where can I learn to use allegro with c?

  9. #9
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by nicocannon1 View Post
    Is is possible to make a game in c?
    To answer your question about whether it's possible or not, it is possible, if that is what you want.
    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.

  10. #10
    Registered User
    Join Date
    Oct 2014
    Posts
    7
    Yeah so where can I learn it?

  11. #11
    Registered User
    Join Date
    Nov 2012
    Posts
    1,393
    Quote Originally Posted by nicocannon1 View Post
    should I use allegro? if so where can I learn to use allegro with c?
    Have you downloaded the Allegro source yet? In there are many examples of how to do different things using the library. Also there are on the docs page several tutorial resources:

    Allegro - Documentation - Tutorials -

    Also I think SDL was mentioned. There are many tutorials out there as well and they are generally written with C in mind. Sometimes some tutorials use some example in C++ but its normally just the language features that are be easily simulated in C anyway (simple classes, namespaces, function overloading, etc.). If you want you could rewrite them in C as an exercise.

  12. #12
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158
    Elysia is right in that it's far easier to write a game (and most software, actually) in C++ than in C. But it's certainly possible to write a good game in C if you insist on doing so; Quake is a great example.


    Quote Originally Posted by Elysia View Post
    it is recommended not to learn C as a prerequisite for learning C++..
    By you? I disagree, learning C before C++ is absolutely fine to do if you wish. I'm not recommending it, I'm simply saying that you can learn C before C++ or not, either way is totally fine.

  13. #13
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by Yarin View Post
    By you? I disagree, learning C before C++ is absolutely fine to do if you wish. I'm not recommending it, I'm simply saying that you can learn C before C++ or not, either way is totally fine.
    No, by most C++ experts, including most members on this board.
    I'm not saying it's a sin to learn C before C++ if you want to learn C. Totally okay. I'm saying it's not recommended to learn C before C++ is your goal is only to learn C++.
    If you want to learn both languages, then go ahead and learn both. The order probably won't matter.
    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.

  14. #14
    Registered User
    Join Date
    Oct 2014
    Posts
    7
    Guys I'm not learning c to learn c++. I'm just not learning c++ because that is what I am going to learn at uni later on. I'm learning c to become a better programmer.

  15. #15
    Citizen of Awesometown the_jackass's Avatar
    Join Date
    Oct 2014
    Location
    Awesometown
    Posts
    269
    There's no harm in using C all your life. Sticking to one language lets you actually do serious, skilled stuff. C *is* perfectly ok for big programs. See Apache or Fontforge for example, they're both 100000+ line C softwares.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Making Board Games...
    By Junior89 in forum Game Programming
    Replies: 28
    Last Post: 12-31-2005, 12:20 PM
  2. Making 3d Games
    By danepporambo in forum Game Programming
    Replies: 16
    Last Post: 12-01-2005, 10:17 PM
  3. going about making PS2 games
    By DarkViper in forum Game Programming
    Replies: 22
    Last Post: 02-03-2003, 04:31 PM
  4. making games
    By Unregistered in forum Game Programming
    Replies: 2
    Last Post: 02-23-2002, 02:23 PM
  5. best language for making games?
    By Unregistered in forum Game Programming
    Replies: 9
    Last Post: 11-09-2001, 05:37 AM

Tags for this Thread