what language is games written in?

stickybytes

Golden Member
Sep 3, 2003
1,043
0
0
doom 3, half life 2, starcraft, counter strike, c&c, etc. what language are these games programmed in?
 
 

itachi

Senior member
Aug 17, 2004
390
0
0
doom3 and counter-strike were written in c++.. hl2 not sure, but my guess is c++.. starcraft, pretty sure it was written in c. i don't think directx offers any functions that can only be implemented in one language (c or c++), so it doesnt' really matter which one you use.. but c isn't object oriented and is more "dangerous" with typecasting.. so c++ is the better bet if you're thinking of getting into programming.
 

uOpt

Golden Member
Oct 19, 2004
1,628
0
0
The Quake series was C (you can download Quake 1 and Quake 2 sourcecode), not sure Carmack switched to C++ and to what extend for Doom3.

Unreal was C++ from the beginning and they have their own scripting language that carries some high-level code.
 

bobsmith1492

Diamond Member
Feb 21, 2004
3,875
3
81
So, I"m guessing there's a lot more to C then what we learned in class last year..... wow, programming an entire game??
 

complacent

Banned
Dec 22, 2004
191
0
0
Originally posted by: jzietman
what's the difference between c and c++? whatever happened to c+?

There was never a C+.
C is a procedural language, and C++ is an object oriented language. There is Objective C, which is dead but was OO C. There is also C#, which is a safer version of C++ (it removed some features that can make C++ "dangerous"), and easier to learn. C# is Microsoft's answer to Sun's Java.
 

uOpt

Golden Member
Oct 19, 2004
1,628
0
0
[Nickpicking mode]

Objective-C isn't really dead, it is the language of choice for Apple's OS X GUI (inherited from NeXT). I was once pretty active with ObjC but in the end it wasn't complete enough for me (reasons on request).

C++ is most often not used in strictly object-oriented mode. It OO capabilities as such leave to be desired. However, it has powerful (if inconvenient to use) support for genereic programming (or compile-time computing). C++, when used as a multi-paradigm programming language as opposed to a strict OO language, is pretty powerful. You still have to write insane amounts of lines of code and tangle with more insane language lawyer stuff but the result is generic, changeable and fast code, if you know what you are doing.
 

uOpt

Golden Member
Oct 19, 2004
1,628
0
0
Originally posted by: bobsmith1492
So, I"m guessing there's a lot more to C then what we learned in class last year..... wow, programming an entire game??

C++ sucks in its own way. It is a very big language and you have to learn almost all of it. Plus until very recently almost all compilers sucked. And VC++ still doesn't implement nearly all template functionality. By now it's better but in 1996?

Plus, I hate to break the news, in performance-oriented programming and/or in programming near to computer science, nobody gives a hovering donkey about object-oriented programming as such. They use it to some extended, and you can do it decently in pure C.

OO as a design principle is pretty much neglectable at the level of programming we are talking about here. That doesn't mean it is useful, but if you know other paradigms equally useful it is just one tool of many. You don't switch to a language with practical disadvantages for it.
 

complacent

Banned
Dec 22, 2004
191
0
0
Originally posted by: jzietman
if i were a complete noob at programming, which language should i start with?

It depends on what you are interested in. Perl is a great scripting language. Visual Basic is good if you want to make applications for Windows. I personally would start by learning C, and by purchasing the book The C Programming Language by Kernighan and Ritchie This book is about $30 and encompasses all of the C language.

You could be brave and try a language called brainf*ck.
 

imported_Phil

Diamond Member
Feb 10, 2001
9,837
0
0
Originally posted by: itachi
doom3 and counter-strike were written in c++.. hl2 not sure, but my guess is c++.. starcraft, pretty sure it was written in c. i don't think directx offers any functions that can only be implemented in one language (c or c++), so it doesnt' really matter which one you use.. but c isn't object oriented and is more "dangerous" with typecasting.. so c++ is the better bet if you're thinking of getting into programming.

I did, of course, mean C++ :eek:

It's been a while.
 

iotone

Senior member
Dec 1, 2000
946
0
0
aren't some parts also written directly in assembly?? i could've sworn one of my profs mentioned that parts of a game engine that need to be highly optimiized are directly written in assembly...

thoughts on that??
 

Matthias99

Diamond Member
Oct 7, 2003
8,808
0
0
Originally posted by: iotone
aren't some parts also written directly in assembly?? i could've sworn one of my profs mentioned that parts of a game engine that need to be highly optimiized are directly written in assembly...

thoughts on that??

Generally speaking, the payoff these days for coding directly in assembler rather than C/C++ is rarely worth it. If you write good code, and your program is structured properly, you're not going to be able to do much (if any) better than a smart optimizing compiler. Coupled with the fact that debugging and maintaining assembler is MUCH harder than well-written C/C++, I couldn't see it being worth it except for maybe a few little inline subroutines or something like that.
 

uOpt

Golden Member
Oct 19, 2004
1,628
0
0
You can mostly forget about assembly just to replace existing C/C++ code, but there are exceptions.

MMX/3dnow/SSE are not in the normal scope of compilers, at least not when used as actual SIMD. While most use frontend macros to use these extensions that isn't too far off from inline assembly.

Sometimes it make sense to replace a single function, especially functions that have high memory throughput. You would then issue appropriate statements to trigger prefetching of memory, or the other way round, disable the CPU cache if you know you won't use it.

Last but not least some things that the CPU supports are not mapped to C/C++. An example is detection of integer arthmetic overflow. You have nothing in C, but the CPU has the carry tag. A single inline assembly instruction is sufficient to trap on overflow.

It's a long time since I've seen assembly routines longer than a single function. Also don't underestimate portability.

However, beginner who want to know how performance in modern computers come together must understand function calls, linlining, the stack, data in line versus data pointed to, and a short trip into assembly can help a lot.
 

Rami7007

Senior member
Dec 26, 2004
477
0
0
Start with C... I am taking C++ now in high school... But you cant just program a game like that... you have to have GREAT knowledge of the language... You cant try to program a game and say wait i have to go look for a tutorial, you have to know it very well. If you spend enough time on it though you can get it. I use macromedia flash a whole lot and i have really learned actionscript (i havent mastered it but i know it VERY well). I program games all the time on it and it is so simple now. If you know it really well it becomes so easy and you ask yourself why it was ever tough... I have programed gravity and realistic physics for sidescrolling games... Infact if you have ever played Soldat, i am making a side scrolling game like that based on counter strike. haha... so basically, start with C, move on to C++, but know your not just going to program a game like that. :)
 

siyan

Member
Dec 27, 2004
56
0
0
Best languages to start off learning are probably Visual Basic and C...

Cpp you can start with, but you would go nowhere near being able to harness the full power of the language. Most of the stuff you learn starting out in C is so painlessly transferrable to Cpp anyways.

Java and C# (and possibly even VB.NET) are also decent choices if you want to move to OOP.

Java would be more syntaxically familiar for a C/Cpp programmer, while VB.NET is obviously more familiar to a VB Programmer. C# is like Java syntaxically but with a few random VB-esque things thrown in.
 
Jun 18, 2004
105
0
0
C or C++ is the definate choice for games programming.

Also don't underrate the importtance of assembly it is still very useful in games programming I had to do alot of brushing up when it came to GBA and PS2 programming as over the years I let it slip, it also helps you better understand how things work if you know some assembly.
 

jzietman

Member
Dec 19, 2004
27
0
0
so, basically, if i were to get into any sort of programming (maybe games later on), starting with c would be my best bet, then later on learning c++, and if i'm REALLY into it, assembly?
 
Jun 18, 2004
105
0
0
C or C++ both make a good starting point and are good general purpose languages. It slightly depends on what you want to do C for example would be useless for net based stuff for that you would want java or something similar (not really sure have never used it) alot of people talk about visual basic being quite good but again I have not knowledge of this first hand. Assembly is a good thing to learn as it really helps you understand the inner workings which will pay off when using other languages.
 

siyan

Member
Dec 27, 2004
56
0
0
Originally posted by: Dopefiend
Originally posted by: mitch2891
C for example would be useless for net based stuff for that you would want java or something similar

Um...
C works fine for "net based stuff".

Yeah...just look at what GTK+ can do...