iDevGames Forums
Starting from scratch? (PHP Background) - Printable Version

+- iDevGames Forums (
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: Starting from scratch? (PHP Background) (/thread-5201.html)

Pages: 1 2 3

Starting from scratch? (PHP Background) - Dan Potter - Aug 7, 2005 08:25 PM

AnotherJake Wrote:If C is good enough for John Carmack to get all the way to Quake3, it's good enough for... well, any game you can imagine.

I think that's beside the point Smile

Both C and C++ are turing-complete languages, as are pretty much any other modern programming language. You could write object oriented assembly for that matter. But why subject yourself to the extra pain of doing it by hand when the compiler is there to do it for you? I think that's what they meant.

After all, C++ just started out as a C preprocessor that adds a hidden "this" argument to method calls, and function pointers for virtuals.

Starting from scratch? (PHP Background) - AnotherJake - Aug 7, 2005 10:11 PM

Dan Potter Wrote:I think that's beside the point

The argument I attacked is that "C isn't as good as C++ for games" and I offered a pretty logical counter.

Dan Potter Wrote:But why subject yourself to the extra pain of doing it by hand when the compiler is there to do it for you?
How is using C++ not "doing it by hand"? Rolleyes

Starting from scratch? (PHP Background) - Leisure Suit Lurie - Aug 7, 2005 10:57 PM

(waits for thread to get ugly)

Starting from scratch? (PHP Background) - Dan Potter - Aug 7, 2005 11:08 PM

Leisure Suit Lurie Wrote:(waits for thread to get ugly)

Hah! I really couldn't care less about the subject. Perhaps it'd be better to pretend I didn't comment.

It's just that there are two common rants between "C people" and "C++ people". The one AnotherJake already covered ("C can't do stuff C++ can!!") with a good rebuttal. The other, "there's no good reason to use C++ for games because Mr. X-and-Foo didn't" is what I was covering. The C++ compiler inserts "this" pointers and handles the function pointers for you, so you might as well use it. That's why it's less manual. Whether that's a good thing or not is a whole other debate... Smile Arguably it's more intuitive though to do:

robot->move(2, 10);


robot->move(robot, 2, 10);

Anyway, ignore me.. back to your regularly scheduled new game code help. Smile

Starting from scratch? (PHP Background) - AnotherJake - Aug 7, 2005 11:49 PM

Ignore me too. No ugly thread needed.

Dan Potter Wrote:Arguably it's more intuitive though to do:

robot->move(2, 10);


robot->move(robot, 2, 10);
"Arguably" being the operative term here. It does suck that "this" has to be passed to the object for it to have a sense of "self" with C. I guess I'm just saying that it can be done to good effect with C regardless. You nailed the central theme though. Things get twitchy right there. Built-in flexibility with C vs. built-in functionality with C++? For those who don't know, please don't pee on C for it's *apparent* lack of functionality.

Starting from scratch? (PHP Background) - OneSadCookie - Aug 8, 2005 01:11 AM

I'd rather stick to good ol' dependable C than get stuck in a quagmire of multiple virtual protected inheritance with templates, operator overloading and copy constructors in C++ Wink

Starting from scratch? (PHP Background) - Dan Potter - Aug 8, 2005 09:25 AM

OneSadCookie Wrote:I'd rather stick to good ol' dependable C than get stuck in a quagmire of multiple virtual protected inheritance with templates, operator overloading and copy constructors in C++ Wink

Heheh... C++ certainly does give you plenty of rope to hang yourself. Then again the existence of raw pointers in both kinda does that. Smile

Starting from scratch? (PHP Background) - akb825 - Aug 8, 2005 09:56 AM

I love C and have done Object Oriented in it. However, I still think C++ is better suited for large game engines. Besides, it would take a much more experienced programmer to do such a thing in C rather than C++.

For my upcoming game engine, I have no doubt that I could write it in C. However, with C++, it will have a much smaller source, be easier to debug, and be easier to add other objects, since I'd like the classes to not only hold the models, but also the AI etc. Sure, it is possible in C, but it's more efficient and less prone to mistake in C++.

Starting from scratch? (PHP Background) - aarku - Aug 8, 2005 11:17 AM

Why is it so hard to read the question asked in this thread, form an answer, post it, and avoid squabbling over what flavor of ice cream we all like best?

The guy has a strong PHP background, and has used GameMaker before. That should be the greatest influence to a response, I think.


Starting from scratch? (PHP Background) - atek3000 - Oct 22, 2005 06:32 PM's one for you guys.

I'm a Civil Engineering student. I doodle/draw/paint in my spare well as play video games. I did a very rudimentary C++ course during one of my first engineering semesters and loved it. I want to try and find a gaming industry job when I finish my degree in the next 2.5 years so I'm taking courses in art to improve my "skittles" and am looking to learn about game programming.


Very little coding experience...alot of enthusiasm...own a Powerbook. Where do you guys think I should start?

I've been looking online and around this forum for the past few days and I'm coming across terms like "API", "game engine", "OpenGL"...and others. I know what these things are, but nothing about how they come together to make a game.

Any directions people could point me?

Starting from scratch? (PHP Background) - Byron Clarke - Oct 22, 2005 09:22 PM

I'd suggest you start small.

There's no real easy way to get into it, at least none that I know of. If you enjoy engineering than my guess is that you will be able to pick things up fairly quickly. Programming is kind of like virtual engineering. If you're serious about game development, I'd suggest picking up a few books... OpenGL for 3D, any of the C flavours (c, obj-c, c++)... mind you I am in no way an expert on the subject

Starting from scratch? (PHP Background) - emilmont - Oct 23, 2005 03:53 AM

If you want to see a simple example of "Object Oriented C" you can take a look at:

By the way, to start a new game without a well organized team of developers, I suggest to develop in Java and not in C Smile

Starting from scratch? (PHP Background) - unknown - Oct 23, 2005 05:11 AM

And most importantly get something finished and presentable as often as you can, otherwise you will just learn how to program but not what you can do. Which is a lot more satisfying.

Starting from scratch? (PHP Background) - atek3000 - Oct 25, 2005 08:10 AM

Wow...thanks for actually responding guys. Smile

I knew learning a programming language would be the obvious place to start, and it seems there is C, C++, ObjC, and Java to pick from. So, I guess my next question is, "Of these, which would be the most beneficial for me to know?".

With school, art, and life...I don't have all the time in the world to devote to learning to program, so I'd like to start out by learning something that will allow me to create a tangible game in the next 2 or 3 years. ..which will be understandably rudimentary...but a game nonetheless.

I don't want to start any wars between purists...hahaha...just wondering which one would be the easiest to learn and let me do cool stuff.


Starting from scratch? (PHP Background) - AnotherJake - Oct 25, 2005 09:18 AM

Java doesn't have much API support in the game industry and is not widely recommended for games. The best scenario would be to learn all three of C, C++, and Objective-C. C++ is a "superset" of C, but it's harder to pick up than just plain C. Objective-C requires you to know C first, but it's really easy to learn after that. So my recommendation is to learn C first and then Obj-C and C++ later - although you can easily make powerful games without Obj-C or C++, all the id games up to Quake3 are pure C if you have any doubts. I should note that C++ is a little more popular for game development these days and you'll see lots of example code using it, so the argument *could* (and probably *will*) be made that you might want to jump in at the deep end and go for C++ right away, but I personally think it's overkill, especially for beginners. Also, most support APIs used with games (OpenGL, OpenAL, etc.) have a C public API so you can utilize those with just plain C skills. For graphics the standard API on the Mac is OpenGL. The quickest way to get into OpenGL is GLUT. If you can learn C and do some stuff with GLUT you will be well on your way.

Another short descriptive comparison of the C family of languages:

C - the basis of it all. It's the fastest and most flexible, but does not have any built-in object orientation facilities which can be seen as a major bummer. However, that does not mean that it cannot be used in an object-oriented fashion as many seem to believe.

Objective-C - is C with object orientation added. It's primarily used on Mac OS X for use with the Cocoa API. Cocoa is Apple's wiz-bang user interface API for making powerful menus and windows, etc. Objective-C is pretty efficient and is fast enough to be used for entire games but many of us just use it for the user interface and leave the faster graphics code in C or C++.

C++ - the focus of bitter debate between lovers and haters. C++ is probably the king of all programming languages today. It's object-oriented and very powerful and basically as fast as C for all intents and purposes. The new id games such as Doom3 and Quake4 use C++ as well as virtually every other major game in the industry. C++ also has the characteristic ability of encouraging programmers to write virtually unreadable code. Make no mistake about it C++ can be *very* complex and can take quite some effort to learn versus other languages, but many would argue the benefits outweigh the drawbacks.