views:

2400

answers:

29

I have heard that C++ and Python are two of the most used languages.

Which one should I choose?

And in Python - version 2 or 3?


I am looking at basic game development (like a car racing game, for example) and NOT flash/iphone/browser games.

Also I do not want to jump to C#.

C++ vs python is what I am considering...


also, it would be helpful, if you could let me know some online resources to start off from.

+7  A: 

It depends what kind of games. I don't think there are many 3D graphics games programmed purely in Python. C++ is used for 3D graphics since it is very fast at the numerical computations necessary. Python can't compete with it. If you want to make a 3D graphics car-racing game like Mario Kart, you need to learn C++, not Python.

However, as San Jacinto says, the question is a little moot at this stage.

Kinopiko
Not really true: http://www.vrplumber.com/py3d.py
MitMaro
Several 3d engines have bindings for python. E.g `SDL` at http://pygame.org and `Ogre3` at http://python-ogre.org/Also, `numpy` at http://numpy.scipy.org/ makes numeric programming with python feasible.
gnud
I'm sure there are lots of 3D graphics libraries in Python, but is there a 3D graphics game engine competitive with C++ ones?
Kinopiko
dynamic typed hash tables versus static pointers... hummm?
Matthew Whited
The overhead for coding your overall logic in python is minimal. All the heavy lifting is done is c/c++, in both of the engines I linked. Have a look at http://wiki.python-ogre.org/index.php/Projects_using_OGRE for some users of the python bindings to Ogre.
gnud
But how many professional games are programmed in Python (games that people actually buy)? I would bet... not many.
Ed Swangren
@Ed Swangren thats somwthing i wanted to know.
Amoeba
I think that number is about 0. C++ is by and large the most popular, and for console programming you may even need to use some assembler.
Ed Swangren
Sure, for professional development, but how many games are built by a one-man team? Game is already difficult enough that using a framework to do the heavy lifting is maybe the only hope for a small team on a casual project... I went down this road and I really appreciated the XNA framework, there is already so much to think about!
Matthieu M.
Yeah, for one man teams and hobby projects you can use a lot of different technologies, but the OP want to learn about "game development", and I took that to mean *professional* game development.
Ed Swangren
@MitMaro: That list consists of mostly C/C++ libraries that have python bindings. I like Python BTW...
Malkocoglu
5* studio games don't write their own engines; they license one. For like $200k. And they have dozens of graphic designers churning out assets that take advantage of the engine's features.
Dustin Getz
Two big professional games that use Python heavily Civ 4 and EVE.
Philip T.
Why does it matter "how many professional games" use it? Professional games have different criteria. For example, they need something that is supported on consoles. They need something that works with their many million lines of existing C++ code. They're in a very different situation, and their insistence on C++ doesn't mean it's the best choice for everyone else.
jalf
python is def capable of mario kart.
Dustin Getz
@Dustin: OK please show evidence.
Kinopiko
+11  A: 

It all depends on what your goals are. As a beginner, pick whichever you think is easiest and start learning. You need to learn to program before you worry about what language to use for what.

When you are mature enough to list the pro's and con's of each on your own, then you are mature enough to ask this question (and despite how that sounds, it isn't circular logic).

San Jacinto
+1 your answer is better than mine.
Kinopiko
yes, i just thought that i should start good. and not realize those things later which I should know now.
Amoeba
+20  A: 

Depends on the type of game. For the "big" games, certainly C and C++ as that's what the big engines and middleware are written in (e.g., Gamebryo, Unreal, id tech, FMOD Sound System, the RAD Game tools stuff etc.).

Python is used in some games as a scripting language (for game logic, missions, sometimes AI), but there is also LUA and possibly many others, but python certainly is used here.

For "casual" games you might also consider Flash/ActionScript (Browser Games are also games, and it's a big market) or C#/XNA (although that did not really take off).

If you want to develop games for the iPhone, Objective-C is your best bet as the alternatives (Flash and MonoTouch) have yet to prove themselves.

What do you actually want to do in game development? Do you want to work on a Graphics engine? Or Sound? AI? Game Logic?

Michael Stum
Flash games/browser games/iphone games - not for me... i am looking at developing some basic games... i have some ideas, just need to implement them.
Amoeba
If you want to develop the whole game on your own, then I'd say C# with XNA, but as I am a C# developer I am naturally biased.
Michael Stum
@Michael Stum, I am a C++ developer, but I fiddled with XNA (and the XBox) enough to appreciate its environment and the libraries / content already available!
Matthieu M.
A: 

C++ since that is the widely used one for game programming and you will get lot of samples for c++ games to look at. As other answer said, there aren't many phython 3d programs.

VNarasimhaM
+1  A: 

I would start with C++ which is the language of choice for most games created today. There are a number of games being developed on DirectX using C# in a managed environment, using the XNA frame work. Check out this site. XNA Developer Center

Lukasz
A: 

The game concept is more important than the language you chose. Use whichever language you are most comfortable with. All but the most complex 3D graphics games will run fine with even interpreted languages.

My advice is to minimize the number of unknowns. I assume you are new to game programming and you state you are new to python. My personal bias is to approach a new domain (games) with a familiar language (C++) or approach a known domain with a new language. Approaching a new domain with a new language is tough challenge.

Andrew
i already know C++, but have never done any game programming in it. on the other hand, i dont know python, but i have heard that its good...
Amoeba
+2  A: 

If performance is critical use C++.

Many games write the core engine in C++ then have bindings to python for less performance critical code (game logic, missions, AI). A good example of this is Civilization 4. This also makes the game expandable.

I would personally recommend C# / XNA for a new developer and using a framework such as Ogre.

Ryu
+6  A: 

Wanting to "Learn game development" is very, very vague.

If you want to develop your own, small games, for fun, while learning how to structure the application, go with python.

If you want to learn more hard-core graphics programming, or gain experience towards working in the industry, I would have to say go with c++.

I think the answer depends very much on your current skillset and goals. Note that I'm certainly no expert in the field.

gnud
like a car racing game (not as rich as NFS, but you knowm something more simple, for example)
Amoeba
if you are talking arcade type (like Atari) go for python. If you want complex games like NFS... you will want C/C++ (or C#/.Net which you discounted)
Matthew Whited
@Matthew Whited okay, thanks
Amoeba
+1  A: 

C++ is the language used to actually write the game, at least for the graphically-intensive complex games like World of Warcraft. Languages like Python are often used for scripting behaviors within the game.

On the other hand, a major category of games is the "casual" games category, which includes simpler games like Sudoku games or simple puzzle solving games. These might be written in a very high level language like Python.

More likely than Python, however, lightweight games are usually written in Flash, using the scripting language in Flash (ActionScript). It turns out that this is actually a flavor of Javascript. Javascript, in turn, is much like Python.

So, my suggestion is that you learn Python, and then learn Javascript. Then write some simple games in your choice of PyGame, Flash, or even in-browser Javascript. Then if you still want to learn C++, go on and learn that, but keep playing around with game design in your spare time, writing casual games.

steveha
thanks @steveha. what resources do you suggest for game basic game developement in Python?
Amoeba
I'd start with Pygame: http://www.pygame.org/ There is an introductory book for Pygame: http://www.willmcgugan.com/blog/tech/2007/10/7/table-of-contents-for-pygame-book/ If you want something even simpler: http://blog.doughellmann.com/2009/07/book-review-hello-world.html
steveha
A: 

I think one of the quickest and most rewarding game development languages is ActionScript 3.0 using the Flex SDK. The ability to create a game and release it on the web to a huge audience is a very rewarding experience.

ActionScript Reference material can be found here and Emanuele Feronato has a great blog for beginner game developers.

Andrew Garrison
thanks @Andrew Garrison, but i do not want to touch ActionScript right now... C++/python is what I am considering.
Amoeba
A: 

Most modern games are not built from scratch but use some pre-existing game/graphics engine.

Flash games are quite popular. Although most games written in Flash tend to be simple, the language is geared towards graphics and you will really learn at the higher level.

C++ is really widely used, but it is unlikely that building a game engine from scratch is a viable idea.

Look at www.GarageGames.com for a good place to find both a ready game engine and a community of developers writing games.

Boris
+3  A: 

Which language do you know best? If your goal is to learn game development, don't make the process that much harder by also trying to learn C++.

Pedro Estrada
Excellent suggestion. I would not suggest learning two new and complicated things at the same time.
David Thornley
In a comment on my answer "Use whatever language you are already familiar with" he states that he already knows C++.
Andrew
A: 

You might want to consider starting with casual games. This depends of course on your desires but casual gaming is a little more accessible to both developers and users. The tools are easier to learn as well: Flash/Flex and Silverlight are both very available and a lot of fun to use.

Dave Swersky
+3  A: 

if you want to be hired in the industry, get good at C++. Real good. Like, godly.

if you want to Get Things Done and ship a small game with a small team (e.g. just you), use python, C++ is a premature optimization.

Python2 has better library support for game stuff -- PyGame will set up your window and give you 2D operations, PyOpenGL to do fancier stuff, Panda3D, etc.

Dustin Getz
thanks for the links.
Amoeba
+1  A: 

I think your best approach is to start with a language that you are familiar with. Learning about game development requires you to be at ease with your tools and to focus on the specific challenges that comes with the field, rather than the language.

Start with the fundamentals: how do you manage your game loop, how do you load external resources, how to you save and restore state, how to you manage your artificial intelligence and which pathing algorithms are more efficient for your needs? As you start learning, you'll see architectural and functional patterns emerge.

As your project grows, you'll start tackling new challenges such as networking, optimization and the usage of frameworks to make game development more efficient.

So in general, I'd say go for something easy that you are comfortable with, like Python (there are wonderful libraries and frameworks available). Learn the core fundamentals there, and from then on you can explore other options like C++ (seriously used in the industry) and their existing frameworks. I'd stick to non-mobile, non-flash development for now, as developing in those environments introduces extra challenges and constraints which are fairly specific.

Bushibytes
+1  A: 

I'm of the mind that you want to know lots of languages, and how the same "program" looks in different languages. Then you can make better decisions about what parts of a program should be in which languages. You can use any language to write a game. The concepts themselves behind organizing data to execute are more important than the language, and practicing different languages helps you become comfortable with those concepts. Then you can "pick up" and get a feel for new languages quickly without much re-learning.

So I think that it doesn't hurt to try to learn and practice multiple languages at once, even as a beginner. C++ is certainly widely used in industry game programming (where it's survived more than in many other programming domains). OpenGL usually comes along with that for high performance 3d programming. Python has libraries for writing games, is considered 'easy' syntactically (personally I agree). You might skip C++ for now and focus on C and python, and return to C++ after studying Object-oriented.

You want to learn the concepts behind what your code does, and efficiency trade-offs. To write more complex games you simply need more knowledge - knowing which data structures are most efficient for the requirements. How to structure your programs so that they don't fall apart in your head when you want to fix a bug or add a feature. With a bit of rudimentary programming knowledge and Python you can write a pretty good game without graphics for practice. And there is PyGame and other libraries for graphics, sound etc.

cmang
A: 

Game programming is not different in C++ than Python. You already know C++, so the answer is: Learn Python. Why? Because it's a bloody cool language.

You'll also learn a lot of game programming by doing it in Python, even if you need to switch to C++ for doing heavyweight 3D engines.

So the answer is really.... BOTH! :-)

Lennart Regebro
A: 

Go with C++, It's the main language in the industry; and you'll learn all the bits and bobs of game development. Using C++ also gives you another benefit, you can implement a scripting language such as LUA or Python for for instance Game Logic!

Chaoz
A: 

I would say this depends on your programming experience, if your used to C like syntax and think that way, i.e curly brackets, semicolons, strong typing, go with the C++, its fast, and its the language you know.

However if you comfortable with programming languages as a whole, then python is not a bad alternative, and I would highly recommend the panda3d 3d engine (I consider this more of a 3D engine, rather then a game engine in the sense you still have to build game specific logic), it uses python and I think the newest python 2.6.xx version is your best bet. As far as performance, unless your running an older machine, interpreted languages such as python can run nearly as fast a compiled languages such as c/c++.

+1  A: 

It depends on your target.

For instance, if you ever want to develop games for the Xbox 360, you need C# and the XNA Game Studio.

XNA Game Studio is a set of C# projects and libraries made for use with Visual Studio (any edition, including Express) for creating both Xbox 360 and Windows/DirectX games.

R. Bemrose
A: 

I think that C++ is the best choice, I made some small games using free engines like Ogre or Irrlicht, especially Irrlicht because it's very easy to learn.

Also for 2D games you can use HGE.

But if you want to go whith Pyton try Blender a 3D modeling an animation tool, whith Blender you can make cool games and you have all the things you need to make a game in the same sotware, Blender uses Python for programing, but you can make games whithout knowing programing just using logic blocks.

andreeib
+1  A: 

The simplest and fastest way to learn game programming is with Python/PyGame.

Python is a cross platform, byte code compiled, easy to learn programming language with a really clean syntax that maximises readability. It has a ton of libraries and documentation written for it.

PyGame is a 2D game development framework written in python which is really simple to learn, with lots of tutorials and documentation written for each. Each year a PyGame context is held where people over the word submit their PyGame games. Python is interpreted language ( but you can also package it in an standalone executable) , so when you download a game to play you can also see its source code and change it.

Nikola Stjelja
Probably worth looking at Pyglet too (I've played with both Pygame and Pyglet and far preferred Pyglet).
timday
+1  A: 

If you don't already know exactly why you are forced to use C++, you don't need it.

Dustin Getz
A: 

I'm thinking that if you want 3D graphic games then C++ with DirectX is the best

Davit Siradeghyan
A: 

Target platform? To Flash or not to Flash (vector based graphics)? To bitmap or not to bitmap?

Based on some of those types of questions you can arrive at a smaller range of possibilities.

For example, target platform XBox 360: code: C++ team needed with publishing deal: yes (if you work at a game co. this is easier :)

Same holds true for Playstation platforms or older XBox, etc. Pretty much any console based games you're going to do need a dev kit and that only happens if you have a deal with the manufacturer or a publisher.

So, let's skip console for now.

That leaves several options still most online based or iPhone based. But you've already said you don't want to do Flash, iPhone, or browser based games.

So next up is Mac or PC. If you want to get onto console eventually Widows based games is a great way to go. You can learn the graphics libs, DX, there and then later use something similar on XBox 360 for example. Or, if you want to go cross platform look at Open GL... and should you decide to lower yourself to a platform that has "2 billion" downloads, lets you sell your game worldwide right now, and only costs $99 to have access to as a developer, well Open GLES is right there as a subset of Open GL.

In the Windows and Mac and even iPhone cases, C++ will work. C definitely will.

// :)

Spanky
A: 

if you are looking for a 2d racing game, i would suggest using AS3(Flash) with Box2d. -easier to get started -larger audience

best of luck to you, what-ever language you choose!

SketchBookGames
+1  A: 

If you're making an Indie game(i.e. 2d, in a team of less than ten people, low budget), then pygame is your best bet.

There are many libraries in http://pygame.org that make development a snap. There's in-game GUI, networking, pathfinding... Python 2 is better, for now. You won't need the P3000 stuff just yet.

Lua is also a very popular choice, but that's mostly for big, professional games. They often choose Lua because of its can't fail philosophy. You can pass more or less arguments than a function takes and it won't complain. Pretty much anything can crash, and it will still run on average.
Also, it has very powerful (kind of)threads. There's no race conditions. Ever. And there's Lambdas. And it's extremely moddable. It's basically Lisp with less parentheses. It should go without saying, Lua programmers are very, very careful people.

Anyway, no matter what you hear, know this:
Games are written in script languages.
Engines are written in C++.

If you "want to learn game development", you probably want to write games. Also, for both python and Lua there's a pretty simple way to write a script and then ship an .exe. Search elsewhere for "Embedding %s" % language_name, but it's basically just

#include
...
python_run_file("main.py");

x10
+2  A: 

Given that you want to learn game development and don't have a lot of experience with it, I would recommend starting with Python 2 and use the latest version that PyGame supports.

http://www.pygame.org/

There are an awful lot of games, written in Python with PyGame, that are available as source code to download and study. If you ever get a job programming games, chances are that the game engine that they use, will not be one that you have used before, so you will need to translate your experience into their engine and API. Therefore, Python will not handicap you in any way. In fact, because it frees you from a lot of the gritty details, you can focus on learning game development, not pointers and structs and syntax and compile errors etc.

Later on, you can move into C when you already have the game programming concepts down pat. Or, you may find that you prefer digging into the internals of a game engine and tweaking the drivers etc. In that case, stick with PyGame and work on improvements and enhancements.

I would give different advice to a skilled programmer who wanted to make a career move into game programming.

Michael Dillon
A: 

I am not sure what your prior programming experience is. If you wish to get up to speed quickly, I would recommend Python. Others have recommended PyGame, which is the defacto standard for Python. There are other alternatives (like a modified version of the Verge engine called Ika that is under slow development, http://ika.sourceforge.net/news.php) but PyGame is very solid.

Since you asked about a resource to get started, I would recommend Invent with Python (http://inventwithpython.com/chapters/). It uses Python 3 and PyGame, and starts real basic. In the next month or so you will be able to buy the book if you so desire (the author mentioned to me that a publisher took an earlier version of the book and made a very poor paper version -- so if you see that on Amazon, avoid it!).

torial