Archived

This topic is now archived and is closed to further replies.

John Carmack - C/asm

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

I just read in another post that John Carmack ( if thats how you spell the name ) only uses C and assembly when making his games. I was wondering if anyone had ever read an interview or article by him saying why he prefers to use C over C++ ( please post a link if you have read one and remember where it was ). I am not posting this to start a C/C++ war over which is better, I am just looking for links to Carmacks reasoning behind using C/asm only for games. ao

Share this post


Link to post
Share on other sites
There was an article in Game Developer magazine called "How I spent my summer: What I learned working on Quake 3" by Brian Hook. In that article he talks about why id software choses to work with C/asm instead of C++. I think one of the main reasons he mentions in that article is the fact that, at least at the time of the article, most C compilers generated "more consistent" code that most C++ compilers because the ANSI C specification has been stable for some time now. Meaning that he could generate code with a C compiler and pretty much be able to guess what the asm would look like and things would be more consistent when they used another compiler on another platform (since everyone knows that id software games run on alot of different platforms). However, C++ compilers weren't as consistent. I don't know if things have changed since then, but this is what he said in the article. He also talks about alot of other interesting things, so I'd suggest trying to track down that article. I have no idea which issue it was, but by the title you should be able to get a rough estimate in order to track it down. Hope this helps.

-Dave

Edited by - dmiles96 on June 17, 2000 2:13:25 AM

Share this post


Link to post
Share on other sites
Well, thanks for the info. I went to www.gdmag.com to see if I could back order that issue ( It was in the January 1998 issue ). Looks like I''m out of luck because they are sold out. Oh well, I also searched the web for online interviews with Brian Hook but of course I didn''t find the interview that I was looking for.

ao

Share this post


Link to post
Share on other sites
On the topic of ANSI C vs. ANSI C++, it''s true that the ANSI C++ standard is still reasonably volatile, while the ANSI C one is rock-solid and set in stone. This does lead to a few compiler problems when using specialised features though I think the situation is probably better now than it was when John Carmack and consorts decided to stick with C and Assembler.

I think another reason for them to stick with C could well be experience. If they are all very skilled C programmers, there''s no need to go to C++, they can work well enough using their old language, without the trickiness of getting high-performance code with C++.

I think though, that slowly, as knowledge of C++, and the standard of implementation for compilers, gets better, people will move toward it more and more, even in high-performance applications.


Give me one more medicated peaceful moment..
~ (V)^|) |<é!t|-| ~

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Hey *ao* if u want that ARTICLE I have it in .PDF format, just post ur e-mail adress and I''ll send it to u.

Share this post


Link to post
Share on other sites
Hey could you send me the articel,too?
Would be very nice,XBTC!

P.s.:For my email-adress just click on the who? button.(In case you don´t know already)

Share this post


Link to post
Share on other sites
What about quake3 then?? is it all C and assembly? no windows component?? wouldn''t they use OpenGL (hence the drivers... and hint hint GLSetup) and use win32asm with it... or Visual C++

still C / C++ though

Share this post


Link to post
Share on other sites
Window''s and OpenGL functions are C functions. Of course, there are derivatives such as VB and Delphi...

---
www.crazycrackerz.org

Share this post


Link to post
Share on other sites
Would it be too much if I asked you to send me that article as well? I seem to have missed the main rush

E-mail is schizomusic@hotmail.com

J2xC (J. Connolly)

"Then study this: Borg provokes Klingon, Klingon breaks Borg's nose" Belanna Torres, Star Trek Voyager 5.11 "Someone to watch over me"

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
could u e-mail it to me
at limanewton@hotmail.com

Share this post


Link to post
Share on other sites
I wish the ANSI C++ standard was more volatile. I want subfunctions (functions defined inside of functions). It would be so cool if the local variables of the parent function became global variables to the inside function. I know how to do it in asm, but C++ doesn''t let me do it.

I tried emailing ANSI once about it, but of course they never even returned my email.

Also with C++ all of its OOP stuff is just fancy C stuff. It can all be done with structs, and down low level member functions are just regular functions with a hidden this parameter. You can even do some extra stuff with structs such as having an array at the end with a declared size of 1, but allocate a lot more space for the struct, and purposely go out of bounds. I know it works for classes too, but inheritance, constructors, and RTL mess it up sometimes.

Share this post


Link to post
Share on other sites
quote:
Original post by blue-lightning

Also with C++ all of its OOP stuff is just fancy C stuff. It can all be done with structs, and down low level member functions are just regular functions with a hidden this parameter.



If you think this, perhaps it''s better that you stick with C. In the end, C is just "fancy assembler stuff", and assembler is just "fancy hex code stuff", but it''s the fanciness that saves you ages of development time if you know how to use it right.

Things like inheritance, polymorphism, are very hard to simulate using C, and operator overloading is entirely impossible, as far as I know. You could do it all with functions, of course, but you lose the simplicity of being able to write fast, simple, readable, straightforward C++ code that even a MATHEMATICIAN can interpret (oooh, what an insult ).

In the end, what you are comfortable with is what you should use. If that''s C/Assembler, good for you. I prefer to go higher-level, and know how to leverage it to get great performance and great coding efficiency.




Give me one more medicated peaceful moment..
~ (V)^|) |<é!t|-| ~

Share this post


Link to post
Share on other sites
On the subject of John Carmack, C and Assembly, I read a quote about a month ago that was posted on www.voodooextreme.com in which Carmack said it was "impossible to justify using assembly on a modern project" and that the only assembly left in the Quake 3 engine was a few math routines left over from Quake 1. Just remember that''s his opinion and not mine.
Still i''d like to hear if anyone agrees.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Filpcode.com rip other people stuff all the time.

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
Filpcode.com rip other people stuff all the time.



Hmm oh yeah?
Well in that case, why don''t you point it out to us, so we can take it down.
First of all, it''s FlipCode, not Filpcode.
Second of all, before you post, pull your head out of your rear end and get informed.

Yep Muzza, gamedev cannot post the article up again, unless they have EXPRESS and direct permission from the original publisher. See www.graphicspapers.com for an example of what happens when you don''t get that permission.
*sniff* I liked that site.




Give me one more medicated peaceful moment..
~ (V)^|) |<é!t|-| ~

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
That Mad dude is absolutly right.

First if FlipCode had a copyrighted article posted, they would have got permission from the copyright owner to do that.

Second, NO I will not send IT to gamedev.net nor to anyone else here, because I beleive it is also illegal to do that too. It was just that *ae* was dying to have it. So if you want it go to www.gdmag.com and buy the CD wich contains all their articles from 95-99.

So please stop posting asking for it.

take care.

Share this post


Link to post
Share on other sites
I am going to get that CD. It will go nicely with my subscription to Game Developer. Those guys are just rolling in my money.

ao

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You are aware of course that you can get a Game Developer subscription free right? I haven''t paid for a subscription to that mag in the 2 years that I''ve been getting it.

Share this post


Link to post
Share on other sites
As far as I know that is only available for people in the USA or if you are a member of CGDA ( 75$/year american, more than the magazine sub./year ), of which I am neither.

ao

Share this post


Link to post
Share on other sites