Game Development in C?

Started by
14 comments, last by TheUnbeliever 18 years, 8 months ago
I've not really done much in game development other than some Managed DirectX stuff from C#.NET and VB.NET. I'm in the process of learning C++, but I'm tight for time at the moment so I'm going quite slow (I've got most of it down now, just working on OOP which looks quite interesting). I've got a good deal of experience in C, and was wondering if game development really needs object-oriented stuff and if it would be possible to write a simple non-console game in C(I realise that it the answer is almost certainly no or yes, but it's very difficult)? It'd be an answer to satisfy my curiosity really, I've got another ongoing project at the moment but I'm interested to know.
[TheUnbeliever]
Advertisement
You could write a game even in assembler, oop isn't strictly necessary to write a game, it only make things easyer to manage and cleaner to write end edit and read.
If you have experience with C# and managed code, what is holding you to learn c++ ?
Yes you can!

Take SDL and OpenGL for examples that don't require C++. So you have everything you need to start writing your game in C.
“Always programm as if the person who will be maintaining your program is a violent psychopath that knows where you live”
No a game doesn't necessarily need it, and you are not forced to use OO & OO support provided by C++. C++ is a multiparadigm language and doesn't force into any particular style.

Personally i wouldn't touch pure standard C, not because it is hard or anything like that but because it's pain in the arse to work with and deals at a much lower-level than what you would like to work with in problem domains like games/apps.

So i'd say to use C# or C++ or any other language you feel most comfortable with.
That sounds good thanks for the informative replies guys. :)

The reason it's taking me a while to learn C++ is the OOP stuff is quite complicated-seeming, so I'm taking it slow. I know VB and C# are OOP as well, but I didn't really use complex OOP at all.

@snk_kid - Thanks for the advice... I might well use C#.NET a few times, I've come to like it quite a bit (and VB.NET only beats it as my favourite RAD language because VB.NET 2005 has a handy My namespace that saves the odd few lines of code) recently.
[TheUnbeliever]
I use C, dev-c++ and sdl and it works fine for what I want to do at the moment.
OOP just makes things easier, games are inherently OO because we usually have objects interacting in a game world.
Quote:Original post by TheUnbeliever
That sounds good thanks for the informative replies guys. :)

The reason it's taking me a while to learn C++ is the OOP stuff is quite complicated-seeming, so I'm taking it slow. I know VB and C# are OOP as well, but I didn't really use complex OOP at all.

@snk_kid - Thanks for the advice... I might well use C#.NET a few times, I've come to like it quite a bit (and VB.NET only beats it as my favourite RAD language because VB.NET 2005 has a handy My namespace that saves the odd few lines of code) recently.


If you do go down the C route you can always adopt a procedural approach in C++ (even a functional one is possible! FC++) the advantage of that for you would be; you are already familiar with C-ish languages (C and C#), there is always other features you can use any time that C doesn't have, save you time from reinventing unnecessary things and focus on the problem at hand instead. In C you have no standardized generic lists, vectors, sets, strings etc but C++ provides those kind of things (check here). So you all you need is a tiny bit of knowledge about templates (at least enough to be aware of them) and know about C & C++ standard library (which you are most of the way there already).

C# is great and has its own advantages aswell.
If you're happy with OO and find reason enough to use it and make your coding life more productive/easier etc....then Id say thats the way to go. I on the other hand program in C, it's my preferred language. I work for a developer and we use C all the time. Practically the whole gamecode for Lego Starwars was written in C and I find it easy to debug and quick to develop in.

GCoder
GCoder
I've seen both easy to follow x86 asm and C++ so hard to follow it brought tears to my eyes. Code quality has actually very little todo with language and quite much todo with developer skill and priority. That said some languages do promote good conventions and are better at convincing people to not abuse them.

But C is a viable choice for games alright, I myself prefer C++ for larger endouvers since it helps raise the abstraction level but each to his own.
HardDrop - hard link shell extension."Tread softly because you tread on my dreams" - Yeats

This topic is closed to new replies.

Advertisement