Language Comparisons
Guest1234: What's the best language for programming games in?
Guest5678: What's the best language for learning (game) programming?Some poor, misguided newbies in #gamedev (on irc.afternet.org)
There is no best language.
It'd be nice if there were, but unfortunately, the field of (game) programming is new enough and broad enough that, eventually, you're going to be forced to make a tradeoff. Even for deceptively simple questions as quoted above, the tradeoffs involved are complicated enough that without more information, there is no clear cut winner. Instead, I'll try to list some of the pros and cons of a variety of languages here, which you can then weigh yourself.
Table of Contents
|
C
Pros
- Portable (has implementations on more platforms than any other language, probably)
- Interoperable (many languages have the ability to build extensions made of C code, or otherwise interoperate with the language)
Cons
- Dangerous (prone to buffer overflows and other memory management related mistakes)
- Extremely low level (basically portable assembly code)
Current roles
- Driver or OS writing
- Libraries which must reach a wide audience (file formats and network protocols, for example) more than lend themselves to easy use (usually accomplished by wrappers over the library in question)
- Screwing over newbies with outdated tutorials showing horrible coding practices, and "optimizations" from 1985 that may actually worsen performance in the modern day (and are almost certainly at best a waste of time spending programmer time on).
C++
Pros
- Portable (implementations on most modern desktop, and notable modern console platforms)
- Interoperable (many languages have the ability to build extensions made of C interfacing code, or otherwise interoperate with the language)
- Industry standard (can be used to access the huge libraries of C and C++ code out there, including modern game engines with the appropriate licensing)
Cons
- Dangerous (same manual memory management pitfals of C)
- Low level (what few metaprogramming facilities do exist (templates) are inconsistently implemented across C++ compiler implementations)
- Obtuse (no C++ compiler correctly implements 100% of the standard, plenty of nonsensical inconsistencies, large amounts of compiling code have no official defined behavior, other than "undefined behavior" (as opposed to "implementation defined" behavior, which indicates something sane will likely be available).
Current roles
- High performance code in the core of AAA games which can afford big engines (or to develop them).
C#
Pros
- Can interface with C++ code as needed
- Higher level language
- Garbage Collection / Automatic memory management
- XNA
Cons
- JIT overhead (probably not an issue if you're not a AAA title, as it takes much effort for this to become your limiting bottleneck in a way unique to the language).
- Limited portability (Windows/Linux for desktop environments, and the XBox 360 only for consoles)
Current roles
- Learning the actual skills involved in programming instead of C or C++'s kludges
- Tool building
- Experimental C++ alternative for games in AAA titles1
Python
Pros
- Can interface with C++ code as needed
- Higher level language
- PyGame
Cons
- Interpration overhead (probably not an issue if you're not a AAA title, as it takes much effort for this to become your limiting bottleneck in a way unique to the language).
- Limited portability (fine for desktop environments, but not available for consoles currently)
Current roles
- Learning the actual skills involved in programming instead of C or C++'s kludges
- Scripting language for AAA games2
Ruby
Pros
- Higher level language
- Ruby on Rails
Cons
- Piss poor C++ interoperability at the moment3
- Limited portability (fine for desktop environments, but not available for consoles currently)
Current roles
- Website scripting/programming
page revision: 28, last edited: 05 Feb 2007 20:01