Skip to main content
GameDev.net gamedev.net
🔒 Locked

Is C still useful in gamedev?

Started by nsf Oct 26, 2007 at 8:26 AM 79 replies 18.2k views
Original Post
nsf
nsf
Just curious. Are there programmers in gamedev who still using only C (without ++)? If yes, then why they do that? How big their games are? Which platform (win32/nix/other) they use? Personally I prefer C instead of C++, but I'm a small hobbyist programmer. By the way, I started programming in C++ and only then switched to C.
rk_theone
rk_theone
i Think C++ requires a lot of time to before you actually write anything :) i mean a lot of preplanning for the object thing. But for a C programme that is not a big issue.
RobTheBloke
RobTheBloke
Quote:
Original post by nsf
Just curious. Are there programmers in gamedev who still using only C (without ++)?


Not likely. The GBA was C only for the most part, not sure about the DS, but i suspect they use C++.

Quote:
If yes, then why they do that?


With a decent C++ compiler there is no need. Might as well use C++.

Quote:
How big their games are?


Not likely to be that sucessful.

Quote:
Personally I prefer C instead of C++, but I'm a small hobbyist programmer.


C doesn't scale well to a large project. Get back into C++.... it is worth your while (or use C# which is nicer than both C and C++ imo).

Lovens
Lovens
Started in C++ then switched to C???

Read a book on C++ (read it)... Any good book... Then read one on design patterns. If you still want to stick with C that's your choice but the fact is, in my opinion, programming is WAYYYYYYY more fun with objects. When I was in C it came to a point where programming was a chore and no more fun.

Lovens
________Lovens "CAPONE" WecheProgrammer
RobTheBloke
RobTheBloke
Quote:
Original post by rk_theone
i Think C++ requires a lot of time to before you actually write anything :)


All languages do.

Quote:
i mean a lot of preplanning for the object thing. But for a C programme that is not a big issue.


Rubbish. You can write bad code in either that suffers from lack of planning. The amount of work required to re-factor a C program will be no less that it would for a C++, perl, java, C#, asm {insert favourite language here} program.

nsf
nsf
Quote:
Original post by Lovens
Started in C++ then switched to C???

Read a book on C++ (read it)... Any good book... Then read one on design patterns. If you still want to stick with C that's your choice but the fact is, in my opinion, programming is WAYYYYYYY more fun with objects. When I was in C it came to a point where programming was a chore and no more fun.

Lovens

I read almost all C++ books ;) From classic Stroustrup to Alexandrescu's "Modern C++ Design" and Abrahams/Gurtovoy "C++ template metaprogramming". I wrote things on C++ for 4 years. And now I see the new C++0x standard from Bjarne and others and starting realize that this is the end of C++. Don't want to speak much about OOP. But really, with objects you just have "fun", not programming.

I think the best choice here is to use C for low level programming and other (which? python/lua/perl/C#/D?) language for high level [object oriented] (if really needed) programming.

But I feel myself alone right now ^_^. I know there are such fanatic C coders like me, but not in gamedev.

So, if there is at least one programmer who thinking my way, drop a note, I will be glad to hear it :)
Quote:
Original post by RobTheBloke
C doesn't scale well to a large project. Get back into C++.... it is worth your while (or use C# which is nicer than both C and C++ imo).

Maybe it is programmer's fault? Linux kernel seems very big, GCC also.
Ravuya
Ravuya
Quote:
Original post by rk_theone
i Think C++ requires a lot of time to before you actually write anything :) i mean a lot of preplanning for the object thing. But for a C programme that is not a big issue.
You should be doing a lot of pre-planning for any language, especially something with as little room for improvisation and as much fragility as C.

I see this argument all the time, honestly. Sure, you have to have more domain-irrelevant boilerplate with a small OO program, but as the complexity of your code increases you spend a hell of a lot less time working around stupid deficiencies that the computer should be taking care of.

Maybe it's just my Smalltalk and Hypertalk education talking, but I guess if you use C++ all day C must seem like a simple and liberating experience.
cdoty
cdoty
Quote:
Original post by RobTheBloke
Quote:
How big their games are?


Not likely to be that sucessful.


Huh? How would the choice of a language affect how sucessful a game is?

That comes down to design of a game and luck. None of which are affected by choosing C++ over C.


Also keep in mind, in C++ you can choose the 'amount' of C++ in the code. You can stick to using classes, but avoid inheritance. Or, you can have instances of all of your classes as globals. And, as you see the need to evolve your code, you can adopt more C++.
Check out Super Play, the SNES inspired Game Engine: http://www.superplay.info
RobTheBloke
RobTheBloke
Quote:
Original post by cdoty
Huh? How would the choice of a language affect how sucessful a game is?


write me a ps3 game in LISP....

Promit
Promit
Quote:
Original post by RobTheBloke
Quote:
Original post by cdoty
Huh? How would the choice of a language affect how sucessful a game is?


write me a ps3 game in LISP....
That would be easy. Really easy, in fact.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
cdoty
cdoty
Quote:
Original post by RobTheBloke
Quote:
Original post by cdoty
Huh? How would the choice of a language affect how sucessful a game is?


write me a ps3 game in LISP....


We were talking C versus C++. Not 'random language that has little use as a game development language' versus C++.

But, going with your suggestion, with a group of competent LISP programmers a game could just as easily be developed. The language doesn't replace the need for programmer intelligence.

Bad example though, LISP has been used as a scripting language in at least one AAA game.. I want to say Jak and Dexter, but I could be wrong. It was discussed in an older Game Developer magazine.
Check out Super Play, the SNES inspired Game Engine: http://www.superplay.info
jpetrie
jpetrie
Quote:

Huh? How would the choice of a language affect how sucessful a game is?

Choice of language affects the final product signifigantly. Remember we're talking about projects that have budgets, schedules and ship dates here.

The language choice influences the tools and libraries you have available, it influences programmer productivity (in terms of natural verbosity of the language itself, its paradigm orientation(s) and the familiarity of the programmers with that language), and deployability (factoring in real-world concerns).

These sort of things can result in a team spending more time fixing bugs, reimplementing functionality that may exist for them elsewhere, working on infrastructure, et cetera. Instead of actually building cool features and improving stability. Given a fixed timeframe, this means you'll end up with less features and less stability. This frequently translates into poor sales (or whatever other metric of "successful" you'd like).
Paradoxia
Paradoxia
Quote:
Huh? How would the choice of a language affect how sucessful a game is?

That comes down to design of a game and luck. None of which are affected by choosing C++ over C.

I have to agree here, Quake, Quake 2 were all written in straight C and many great games were made with that source including Half-Life.

Quote:
(or use C# which is nicer than both C and C++ imo)

Give me a break. I like C# but not at all for game programming. If you need any low-level functionality or inline ASM you'll be back to C/C++ in the blink of an eye. C# is nice with objects and all that but the CLR is an overhead that's not useful for games.

Game programming is not restricted to D3D/OpenGL, don't limit yourself to it with .NET.
Thanks, Eddy
ToohrVyk
ToohrVyk
Quote:
Original post by RobTheBloke
Quote:
Original post by cdoty
Huh? How would the choice of a language affect how sucessful a game is?


write me a ps3 game in LISP....


So you'd spend a few weeks writing a LISP-to-PS3 compiler in LISP... big deal [smile]
RobTheBloke
RobTheBloke
Quote:
Original post by nsfMaybe it is programmer's fault? Linux kernel seems very big, GCC also.


The linux kernal is supposed to be small is it not?

As for gcc, ah, you got me there. a traditional C style approach works well for compilers and parsers (and raytracers). OOP just gets in the way. (and if you consider that tools like yacc and bison will generate C code for you, there seems little point to actually write a compiler at all, let alone in C++).

But in general, since we are talking about games development - which follows a very heavy data-driven paradigm - an OOP approach does help to maintain some semblence of order within a large code base.

Ravuya
Ravuya
I don't think I'd use GCC as an example; the code is pretty raunchy in there, and I assume most of it is auto-generated.

It's like claiming that wood is a suitable building material because there are some ramshackle slum buildings in third world nations which occasionally don't fall down and kill the inhabitants.
akluzz
akluzz
Quote:
Original post by cdoty
Quote:
Original post by RobTheBloke
Quote:
Original post by cdoty
Huh? How would the choice of a language affect how sucessful a game is?


write me a ps3 game in LISP....


We were talking C versus C++. Not 'random language that has little use as a game development language' versus C++.

But, going with your suggestion, with a group of competent LISP programmers a game could just as easily be developed. The language doesn't replace the need for programmer intelligence.

Bad example though, LISP has been used as a scripting language in at least one AAA game.. I want to say Jak and Dexter, but I could be wrong. It was discussed in an older Game Developer magazine.


Actually whole Jak and Daxter game was written in their custom version of Common Lisp called GOAL. It wasn't used just for scripting. Here's wiki page about it: Game Oriented Assembly Lisp
lubby
lubby
C is still used in game development a lot more than it seems most people realise. In a quick breakdown most games themselves are written in C++ as the whole object orientated approach lends itself really well to the implementation and management of game entities. When it comes to lower level programming, game engines that perform well on anything but a PC you will find C tends to be used a lot. Not necessarily in every module, but a hefty chunk of modules. Of course, C++ also lends itself very well to certain lower level parts and without being specific at all you will probably find some C++ classes in even Carmacks code. I have not looked but I really would not be shocked.

So to answer your question directly, yes, C is alive and well in game development, although you are more likely to see it in the lower level code than the game implementation itself.
cdoty
cdoty
Quote:
Original post by jpetrie
Choice of language affects the final product signifigantly. Remember we're talking about projects that have budgets, schedules and ship dates here.

The language choice influences the tools and libraries you have available, it influences programmer productivity (in terms of natural verbosity of the language itself, its paradigm orientation(s) and the familiarity of the programmers with that language), and deployability (factoring in real-world concerns).

These sort of things can result in a team spending more time fixing bugs, reimplementing functionality that may exist for them elsewhere, working on infrastructure, et cetera. Instead of actually building cool features and improving stability. Given a fixed timeframe, this means you'll end up with less features and less stability. This frequently translates into poor sales (or whatever other metric of "successful" you'd like).



That's only partially true, the choice of a library and experience using the libary are probably bigger factors. And, many libraries can be used across a bunch of different languages (TrueVision3D supports 6).

The factors you mention have little to do with a language, and more to do with picking the right technology. If C++ was the language of choice, I could easily meet every one of you listed factors by choosing the wrong compiler. For example, choose Borland C++ Builder versus Visual Studio, and you now have limited your choice of libraries and affected programmer productivity.

Of course, you can't use an interpretted language and expect to develop a cutting edge game, but most development teams are smarter than that. But, C vs. C++ could be a realistic choice.

And, a few years ago, C was favored over C++ in many Japanese game development companies. Probably due to the experience in using C.
Check out Super Play, the SNES inspired Game Engine: http://www.superplay.info
Kwizatz
Kwizatz
Quote:
Original post by cdoty
Bad example though, LISP has been used as a scripting language in at least one AAA game.. I want to say Jak and Dexter, but I could be wrong. It was discussed in an older Game Developer magazine.


Abuse used LISP.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.