Jump to content
  • Advertisement
Sign in to follow this  
lizardpunch

How much C is enough to start programming games?

This topic is 2473 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!