Sign in to follow this  
Gasoline

Learning C++ or Python

Recommended Posts

Gasoline    115
Hello all, first post here.

Ive had very little experience with PHP, Java, C++ and Python in the past and I know some of the basics, Ive done a Hello World program in all of these that worked too. [img]http://public.gamedev.net/public/style_emoticons/default/tongue.gif[/img]
I am not sure whether I should pick up the 1000+ page C++ book that has been collecting dust in the bookshelf or should I dive into learning Python. I would like to write games as a hobby in my spare time. I would like to write small games and when I have some experience I would want to join an indie team and write something bigger and learn it further.

I know that Python is a lot easier to learn and would be good language to learn the basic game related algorithms with minimal effort and complications from language while C++ is a lot heavier and harder to learn.

I would like to hear your tougths on the matter. If you were a guy with the similar background as me and had a similar experience in the past, what did you choose and how did it work out?

Share this post


Link to post
Share on other sites
FelixK15    335
Both.

As far as I know (I didn't wrote one line in Python so far) Python is a script language whereas C++ is a 'real' programming language.

I recommend you to take a look at [url="http://www.lua.org/"]Lua[/url]. It's (like Python) a script language and is very popular within the game programming industry.
When Lua is used together with C++, one can do some serious shit.

Share this post


Link to post
Share on other sites
Gasoline    115
[font="arial, verdana, tahoma, sans-serif"][size="2"]What is easier to bind together: C++ and Lua or C++ and Python?[/size][/font]
[font="arial, verdana, tahoma, sans-serif"] [/font]
[font="arial, verdana, tahoma, sans-serif"][size="2"]// [/size][/font][url="http://www.gamedev.net/topic/375497-python-vs-lua-for-a-scripted-game-logic/"]F[/url]ound this topic on the matter: [url="http://www.gamedev.net/topic/375497-python-vs-lua-for-a-scripted-game-logic/"]http://www.gamedev.net/topic/375497-python-vs-lua-for-a-scripted-game-logic/[/url]

Share this post


Link to post
Share on other sites
NEXUSKill    475
If you aim at writing small games on your spare time, I would recommend neither, It might be much better suited for you to go into XNA C# or Unity.

These two frameworks already provide the basics and allow you to dive right into GAME programming, learning c++ will require a lot of time for programming the basic engine before even thinking of game code.

Flash might also be a good option, specially backed up by some framework as flixels.

Share this post


Link to post
Share on other sites
EvilTesla-RG    114
I've done game programming in flash, python and C++.


Flash sucks. Don't do it.


It is slow, horrible syntax, and has way too much going on in the background.

As such, I'm very skeptical of anything that is higher level than python. Havn't tried Unity, but it sounds WAY too much like flash for my taste.



Python is easy to learn, and easy to write.

With PyGame, game development is very easy. But, python is big and slow (not quite as bad as flash), don't expect to do anything complicated.


C++ isn't a whole lot harder to learn. But programming in it is like trying to jog through waist deep water. However, it is very small, very fast, and their is lots of support for it. Once you finally get into it, you could theoreticly build industry quality games. (Not possible with anything higher level).



Currently I'm using C++, as I want to write large games, but Python is a very good place to start.

Share this post


Link to post
Share on other sites
NEXUSKill    475
While there are attempts at making entire games out of python, its best fit is for scripting purposes, for that you'll need a strong c++ engine and game framework that uses the script, flash is very often integrated into c++ games to implement graphic interfaces, this is used in many AAA titles.

Flash is quite a bitch, I agree, but if you aim at small and simple games it is still a more direct approach than going full c++ without having a base engine.

Unity is nothing like flash, its more like game maker on steroids, its a fully game oriented edition tool heavily scripted with C#, free license, easy to learn and best of all, works on most conceivable platforms with little work other than designing your game to be playable on such platform.

Share this post


Link to post
Share on other sites
Storyyeller    215
I'm also making some games for fun. I started with C++ and have made several games, including one that I've been working on for almost two years. I haven't made any games in Python, but I do find it useful for automating other tasks involved in game development. For example, I wrote a script which takes in a description of a level and automatically generates the background image and collision data, which I can then put into my C++ game.

Python is really useful when you want to code stuff quickly and the task isn't performance intensive. I've heard there are ways to improve it, like Psyco or adding C modules, but I think these are way beyond the scope of a beginner. I haven't managed to do either of those successfully yet.

Share this post


Link to post
Share on other sites
Serapth    6671
Use [url="http://www.panda3d.com"]Panda3D[/url] free engine, and you can do both! Write the majority of your game logic in Python, but you can drop to C++ if performance becomes critical. As the engine composes most of the performant code, you should be able to do 99% of the work in Python.


As to interfacing Lua/Python with C++, both are fairly comprable. Its a relatively simple task, but can result in having to write a large amount of tedious "glue" code. You can use generators, but they tend to be problematic. That said, the glue code is horrifically easy to write, just as I said, tedious.

Share this post


Link to post
Share on other sites
DvDmanDT    1941
I would recommend against C++. It lacks way to much of newer language features and easy-to-use libraries (there are tons of libraries, but rarely as easy to use as in Python).

Python is very nice for small programs/games/apps but for larger projects it can it can easily become messy. That goes for most dynamic languages which is why they are usually used together with engines written in lower level languages, at least in gamedev. My engine is written in C# and features Python scripting through IronPython.

I would personally recommend C# though. Simple, powerful, great toolchains, great samples/libraries/documentations and quite popular.

Share this post


Link to post
Share on other sites
Gasoline    115
Thank you all for the replies. I am looking into C#. I had always the idea that C# is pretty much Microsofts thingie and running it on anything but Windows would be problematic however after some quick research it looks like it is the right thing for me - easy, fast, flexible.

Share this post


Link to post
Share on other sites
Zahlman    1682
[quote name='FelixK15' timestamp='1309351886' post='4829046']
Python is a script language whereas C++ is a 'real' programming language.
[/quote]

Never mind whether this is an accurate description of the languages in question: this distinction hasn't been meaningful for years, to be honest.

Share this post


Link to post
Share on other sites
rip-off    10976
If you are serious about learning to program, you won't learn a single language, you'll eventually learn a dozen. Your first programming languages isn't a final choice.

I generally advise against C++ as a beginner language. This is because the language is designed around the principle "The programmer is always right", and makes no attempt to shield or alert you to many common but subtle errors. This principle is never true for beginners, and rarely true in general.

I feel that Python or C# are better places to start writing games. They don't present the same burden to start with, while being full, capable languages that you'll continue to use throughout your career.

Ignore comments about "real", "powerful" or "fast" languages. These statements, where they aren't totally meaningless or irrelevant, are often highly dependent on the state of the art at a particular time (often, that time is 5 years ago, ignoring advances in tech since). Often overlooked is the fact that a beginner won't be making a game that should* tax the system for quite some time.

* [size="1"]Its possible to write atrociously slow games in any language, by using poor algorithms. Using a naive collision detection in a simple 2D game can slow down a computer, even if hand optimised using assembler.[/size]

Share this post


Link to post
Share on other sites
Storyyeller    215
That depends on what you're doing. If you're say writing a chess game, you probably want the AI to run as fast as possible. It's not actually that hard to run into performance bottlenecks, though using decent algorithms helps.

Share this post


Link to post
Share on other sites
Jianju    105
I'm in somewhat the same boat; getting back into programming as a hobby when my main gig was always art & animation. I wish to make games & simulations, meaning speed will be of the utmost importance, leading me to want to use C++.

OTOH, I am tempted by some newer languages (including C99, Lua, Monkey, Java, Go...) & am looking for smart ways to call the many great, fast C++ libraries out there (OGRE, Bullet, etc.) to do most of the deep kung-fu for me.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this