Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


How much C is enough to start programming games?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
10 replies to this topic

#1 lizardpunch   Members   -  Reputation: 100

Like
0Likes
Like

Posted 29 February 2012 - 06:10 PM

I'm starting to learn C with plans to eventually start programming some games. I have background experience in Python and Java so I decided to go with K&R for learning purposes. I heard it's a great book and a better language introductory has never been written. This, in addition to providing a number of exercises, made K&R seem like a solid choice.

How much C is enough to start programming games, though? Will finishing this book leave me with enough know-how to start working on something simple (say, a breakout clone)? Should I pick through a book on algorithms and data structures or, perhaps, a more advanced C book before moving on?

NOTE: Yes, I know C++ is more popular for game development. Yes, I'm well aware that Python and C# are easier languages to learn. Yes, I'm going to stick with C. Comments concerning the previous statements will be ignored. Cheers!

Sponsor:

#2 TheUnbeliever   Members   -  Reputation: 961

Like
1Likes
Like

Posted 29 February 2012 - 06:39 PM

C itself is a pretty small language. Knowledge of it probably isn't going to be your limiting factor, but your knowledge of - as you say - algorithms and data structures, as well as experience of completing (or at least significantly progressing with) projects.
[TheUnbeliever]

#3 alnite   Crossbones+   -  Reputation: 2132

Like
0Likes
Like

Posted 29 February 2012 - 08:20 PM

C itself is only enough to make a text-based interface. If you want to make games with graphics that spin, twirl, and flash, you need access to an API, and that depends on which platform you want to use (Windows and Mac have different libraries).

If you use Windows, try using SDL.

#4 Álvaro   Crossbones+   -  Reputation: 13888

Like
0Likes
Like

Posted 29 February 2012 - 08:33 PM

If you use Windows, try using SDL.


Actually, SDL is available on many platforms (according to their website: Linux, Windows, Windows CE, BeOS, MacOS, Mac OS X, FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, IRIX, and QNX).

#5 lizardpunch   Members   -  Reputation: 100

Like
0Likes
Like

Posted 29 February 2012 - 11:19 PM

Is SDL code for Windows the same as SDL code for Linux? I prefer to develop under Linux, but I understand that eventually I will be making games for Windows.

#6 DarkRonin   Members   -  Reputation: 616

Like
0Likes
Like

Posted 01 March 2012 - 04:23 AM

Yes. SDL is SDL. :)

#7 NightCreature83   Crossbones+   -  Reputation: 3030

Like
0Likes
Like

Posted 01 March 2012 - 05:46 AM

So is OpenGL code under windows and Linux, with the only difference creating the context as far as I am aware, after that the code for rendering should be the same on win/linux/mac.
Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, Mad Max

#8 BeerNutts   Crossbones+   -  Reputation: 2998

Like
1Likes
Like

Posted 01 March 2012 - 12:33 PM

I too would suggest using SDL with C. I originally only made C games, and you can make some great games with it. While I now prefer SFML (which requires a C++ implementation), SDL is fine for what you are doing.

Good Luck!

BTW, learning from K&R (which I still have from my 1994 CS class) seems odd, as it's mainly a reference document. You might want to check out some C tutorials to help fill out your understanding of programming.
My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

#9 mhagain   Crossbones+   -  Reputation: 8275

Like
0Likes
Like

Posted 01 March 2012 - 01:01 PM

So is OpenGL code under windows and Linux, with the only difference creating the context as far as I am aware, after that the code for rendering should be the same on win/linux/mac.


That's more or less correct - the actual rendering parts of the API are completely OS-neutral. It's not the full story however as OpenGL is very hardware-dependent (on it's own OpenGL doesn't do anything aside from pass rendering commands to your graphics hardware, which is what does the actual drawing). By that I mean that you need to be aware of what features are available on the graphics hardware you're targetting and either code to a common baseline or implement workarounds where they're not available.

There is one exception to the "OpenGL doesn't do anything..." thing I mentioned, and that is where the driver reports support for a certain GL_VERSION, but features of that version are not available in hardware - in that case they must be emulated in software by the driver. Sometimes (not always) that can come at a performance cost, and sometimes (not always) that performance cost can be extreme. Generally the cost increases the deeper into the pipeline you go - pre-vertex-shader emulation will be cheap, fragment shader emulation will be expensive (may drop you to less that 1 fps).

You may also encounter buggy drivers and have to be aware of what the bugs are and what the consensus is for working around them.

So once you have your context up you can treat OS as being totally irrelevant, and focus on driver quality and hardware features as being the key differentiators.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#10 DarkHorseKnight   Members   -  Reputation: 143

Like
0Likes
Like

Posted 03 March 2012 - 03:43 PM

The easy route would be SDL for making 2d games for example "Side Scrollers,Puzzle Games,RTS,etc" and SDL and OpenGL for making 3d games "Amnesia the dark descent,Halo,Dear Esther,etc" or you could go the hard route learning WIN32 API for Windows for 2D games/3d games.

#11 daviangel   Members   -  Reputation: 600

Like
0Likes
Like

Posted 03 March 2012 - 10:58 PM

You might be able to make something like a breakout clone using ncurses as seen in this video


but don't expect to impress anyone as as mentioned since C itself doesn't have any sort of graphics support built in you are still going to have to learn more stuff namely an API like ncurses to get something on the screen other than text.
Don't talk about writing games, don't write design docs, don't spend your time on web boards. Sit in your house write 20 games when you complete them you will either want to do it the rest of your life or not * Andre Lamothe




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS