Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am a first year college student in India and want to make a small game as a this semester project.

I am quite good at C and am learning it rapidly but I wanted to ask if developing a game entirely in C (no C++ or C#) I'd love to use these but for college projects, we have strict requirements of using only C.

What I am looking for is a simple top view driving game. It won't have anything fancy and even the visual things will be powered by simple characters. For example, user controlled car can be represented by ▓ and edges of road by series of |'s. What do you think?

share|improve this question

closed as not constructive by Nicol Bolas, Tetrad Jan 13 '13 at 7:36

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
related: gamedev.stackexchange.com/questions/371/… –  Tetrad Feb 14 '11 at 22:37
4  
SDL is written in C. OpenGL is C. What more do you need? –  The Communist Duck Feb 15 '11 at 17:34
1  
Also, Quake is all done in C. –  The Communist Duck Feb 15 '11 at 20:35
    
Do yourself a favour and use the Allegro libraries ;) alleg.sourceforge.net –  Lohoris Feb 16 '11 at 10:01
1  
RollerCoaster Tycoon was done almost in pure assembly, so why not? –  Ramon Zarazua Feb 16 '11 at 21:16

10 Answers 10

up vote 18 down vote accepted

Writing games in C is possible. For example, Quake II is written purely in C, so writing other games in C should be no problem at all. It may be the better choice if you're more proficient and comfortable in C than in C++.

share|improve this answer
2  
@Ishan Sharma: Actually, a lot of game (engine) development is still don in C, or at least very C:ish C++. Nothing says that your C++ game will be better (or even better written) just because it's C++. –  void Feb 15 '11 at 9:41
4  
@void: That's only true if the programmer in question has no idea about how to use C++ effectively. C++ programs written where the writer has a basic grasp of object orientation are far more secure and reliable than equivalent C programs. –  DeadMG Feb 15 '11 at 17:58
6  
@DeadMG [citation needed] –  Bob Somers Feb 16 '11 at 7:36
5  
@Bob Somers: Easy. Compare std::string to char*. std::string always cleans up it's own memory in any situation, allocates the right amount every time. char*, you might forget to free, or double free, or not allocate enough memory. Whoops. Basic logic says that C++ programs are better and more secure than C programs. –  DeadMG Feb 16 '11 at 12:17
6  
@DeadMG A good programmer can write good, secure code in any language. Conversely, a bad programmer can write awful, insecure code in any language. A poor carpenter blames his tools. –  Bob Somers Feb 20 '11 at 3:57

I work on a AAA MMORPG codebase that is pure C, so yes.

share|improve this answer
4  
I guess that puts you at Cryptic. Do you use a scripting language of any sort? –  Dan Olson Feb 15 '11 at 20:18
3  
We have an internal expression language that used by designers for basically everything, and we use a mix of Python and Lua for some stuff (offline processing, map-reduce on game DBS for stats), but no Real Scripting Language in the game itself. –  coderanger Feb 15 '11 at 21:49

Yes, it's perfectly possible. Many OS-level APIs like POSIX and Windows, DirectX and OpenGL all have C-compatible interfaces.

share|improve this answer
    
Thanks for quick answer. –  Ishan Sharma Feb 14 '11 at 22:50

Fabien Sanglard has written an article about his 3d engine in C. On reddit, this article has created an interesting debate.

Languages are only tools... So use them wisely. To create a good game, it can be easier to use XNA or Unity3D. Mastering C is a good first step, but you must learn C++, D, python, lua ... C++ is a very difficult langage. So use it carefully.

share|improve this answer

Without a doubt. A lot of libraries useful in game development (such as SDL, PhysFS, etc...) have C APIs, which helps a lot.

You may wish to look into embedding a scripting language such as lua if you wish to do any extensible, high-level programming. Many people are beginning to see the appeal in programming a C framework that uses lua for things such as AI, events, etc...

Good luck.

share|improve this answer

Simple answer for this question is: You can do simple text based game like this in every programing language. Even pascal, basic or x86 assembler :]

(and do not need anything else)

share|improve this answer

C is great for game development.

I'm working on a 3D platformer, and I've never had any problems with the language. The only problems are collision detection and shading, I just know nothing about them, they would still occur in any other language.

In fact, I find it much easier than languages like C# and Java. I always iterate on entities using pointers (an example from my code), and fread saved a lot of time making the map loader.

If you want object orientation and modularity, you can make structures of function pointers.

share|improve this answer

Yes it is possible, but it may not be the most desirable course of action. A number of people recognize these days that C and C++ both aren't ideal for a number of tasks, and high level game logic often falls into that category.

If you insist on C instead of C++ (which makes no sense to me, but to each their own), you may be best off using Lua in conjunction with C.

For your college projects that require C this won't be an option, but for spare time projects it would be a good way to learn.

share|improve this answer
    
Lua is good at development time, but before the release everything should be ported to a native language for higher performance. –  SiPlus Sep 10 '12 at 11:00

Of course you can. Many games have been programmed in C (DOOM comes to mind). SDL is a game programming library written in C.

Of course, it may be a little more difficult than using C++ for a big project, but it's possible.

share|improve this answer

I think it is possible to make a complete c games. I have made a game ( which is similar to 'space impact' of nokia 1110 mobile ) in my 2nd semester project using turbo c compiler. I think you can try this way ( as a first year college student ) without knowing any others.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.