• Advertisement
Sign in to follow this  

Is C still useful in gamedev?

This topic is 3767 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

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.

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites
Quote:

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.

You've just agreed with me. Languages are are subset of "technology." When you select a language, you limit yourself to related technology. Yes, some of that technology can be used from multiple languages, but that isn't the point. The point is, since the language affects your choice of tools, and tools clearly affect the final product in some fashion, than a language selection has an impact on the final product.

Share this post


Link to post
Share on other sites
Hidden
Quote:
Original post by 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?
I do, and it's because I think C is easier than C++. My game is cross-platform and pretty big/complex (it's an online action RPG). My opinion is that you should use whatever language you want, as long as you feel you're able to develop things with it. If you feel the progress it too slow, then maybe it could be useful to try another language. But if you're doing just fine with C, it's not like you're gonna produce a lesser quality game just because it's written in C and not C++. The one common argument every know-all here has is "C++ is industry standard", and I think that's pretty stupid. Most people here are not in the industry and will never be, so what difference does it make.

Quote:
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.
Good! Fight the power!

Share this post


Link to post
As for the religious wars going on here, I demand not to take part, but everyone here who thinks that C is less scalable or less powerful or less useful that C++ is wrong. After all C++ is not standardized..even after so many years, and there are hundreds of C++ implementations, but C has only a single implementation. C is simpler and less prone to unusual bugs. Also it is possible to program object oriented style in C, and you don't need to add any special libraries - you just have to be creative. C would be my first recommendation. C++ contains no more or less functionality, it just seems to have a ton of pre-written libraries that nobody uses :(

There are probably tons of things that are huge written entirely in C - for example Linus Torvalds refuses to implement the Linux kernel in C++, though it could be done - that's a pretty massive project AND it scales.

Looks like a lot of people agree with me.

Go for C! It's much more stable.

Share this post


Link to post
Share on other sites
Quote:
Original post by nathandelane
C++ contains no more or less functionality, it just seems to have a ton of pre-written libraries that nobody uses :(


wait... what?
C++ has a plenty 'more' it in that C does, if it didn't it would kinda make the language somewhat pointless wouldn't it?

Plenty of people use the C++ Standard Library, that's something C doesn't have and any conforming C++ implimentation will have.
The whole class system (virtual, constructors, destructors et al) while writable in C sure is in C++ as standard.
Templates... good luck finding those in C (no, macro hackery doesn't count as it's not safe by a long shot).

There is plenty of other things I'm sure and yes, C does have some things C++ doesn't have but that's another matter but extra functionality as standard very much weighs in C++'s favour.

Share this post


Link to post
Share on other sites
Quote:
Original post by nathandelane
everyone here who thinks that C is less scalable or less powerful or less useful that C++ is wrong.


Both languages are equally capable. With modern C++ implementations, the difference between the two is typically programmer efficiency and source maintainability.

Quote:
After all C++ is not standardized


What?

Quote:
hundreds of C++ implementations but C has only a single implementation.


What?

Quote:
C is simpler and less prone to unusual bugs.


Evidence?

Quote:
Also it is possible to program object oriented style in C


True, but it takes significantly more work

Quote:

There are probably tons of things that are huge written entirely in C - for example Linus Torvalds refuses to implement the Linux kernel in C++, though it could be done - that's a pretty massive project AND it scales.


OS kernel development is so completely different to User Mode application developement that you can't meaningfully compare the technologies such implementers choose to use.

Quote:
It's much more stable.


What?

Share this post


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

  • Advertisement