Jump to content

  • Log In with Google      Sign In   
  • Create Account

Blender and Python: Objective Opinions Sought


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
9 replies to this topic

#1 3Ddreamer   Crossbones+   -  Reputation: 3165

Like
1Likes
Like

Posted 25 August 2012 - 04:06 PM

Good day, everyone

Recently I have been leaning toward Python as my next language after I learn and explore C# for a while. I want to work with C# getting at least the fundamentals in hand and maybe add Python in my course of learning later. Meanwhile, I will continue working with Blender in preparation for later things. I decided to make Blender my main base for animating. There are reasons why I started with C#, but I really don't want to go there with this thread, please.

I did a lot of reading here at gamedev and elsewhere, but I want to get viewpoints on the following questions here so I can make a final decision on Python with the help of objective opinions.

Questions:

1) a. Is Python a good or great language for game performance, specifically frames per second and smoothness in 3D scenes? The reason I ask this is because Python appears to be a very adaptable language but I wonder if it could be "too good to be true" in the sense of maybe game performance might be the price to pay for all that language adaptability, especially the syntax expressiveness. I don't know but there seems to be some doubt out there about performance.

b. How does Python compare to C++ for game performance, all other things being about equal?


2) Is Python better for people of lesser experience to learn it compared to C++?

3) With all the flexibility of Python, what are it's strengths and weaknesses for games?

4) How do I deal with the issue of an IDE for Python? Is Blender going to be a dead end in one sense of needing an IDE eventually?


Please keep in mind that I do understand how personal preference and experiance play a major role in these issues, but I want to look at them apart from personal aspects. I'm sure that a few people will wonder why I don't ask these things in a Blender or Python website, but I want to get more objective opinions.


As always, any and all comments, questions, and criticism of my writing is welcome in my threads, but please stay on topic.

3Ddreamer


P.S. ll Note to Administrators: No more than two Tags are being allowed to save at this time in my post for some reason.

Edited by 3Ddreamer, 25 August 2012 - 05:04 PM.

Personal life and your private thoughts always effect your career. Research is the intellectual backbone of game development and the first order. Version Control is crucial for full management of applications and software.  The better the workflow pipeline, then the greater the potential output for a quality game.  Completing projects is the last but finest order.

 

by Clinton, 3Ddreamer


Sponsor:

#2 Goran Milovanovic   Members   -  Reputation: 1104

Like
4Likes
Like

Posted 25 August 2012 - 08:24 PM

Before I answer your questions, I should mention that I have a series of Blender Game Engine video tutorials, and an upcoming Python 3 video series.

They seem like relevant resources in the context of this thread, and show some of my background, which could be used to better judge my objectivity (or lack thereof).

1) a. Is Python a good or great language for game performance, specifically frames per second and smoothness in 3D scenes? The reason I ask this is because Python appears to be a very adaptable language but I wonder if it could be "too good to be true" in the sense of maybe game performance might be the price to pay for all that language adaptability, especially the syntax expressiveness. I don't know but there seems to be some doubt out there about performance.

b. How does Python compare to C++ for game performance, all other things being about equal?


Python is an interpreted language, so it's inherently slower than compiled languages like C++. However, in many cases, the speed difference is negligible, for any of the following reasons:

  • Python libraries typically call C code for performance critical operations.
  • The CPU is not the bottleneck.
  • Performance problems can usually be solved with better algorithms (and if not, you can write that part in C).
  • Python is more than fast enough for what you're trying to accomplish (this is the most common, in my experience).

2) Is Python better for people of lesser experience to learn it compared to C++?


"Better" is arguable, but I think it's definitely easier to learn.

3) With all the flexibility of Python, what are it's strengths and weaknesses for games?


I would say that it's faster to develop in Python, and not just because you don't have to worry about lengthy compilation times: Automatic memory management, clear/expressive high-level structures, and an extensive standard library all play their part to make programming a pleasure, as opposed to merely "hard work".

As for the weaknesses: Most people will say that it's slow, and technically that's true (relative to compiled languages), however, as I already explained, it's largely negligible.

4) How do I deal with the issue of an IDE for Python? Is Blender going to be a dead end in one sense of needing an IDE eventually?


Blender is software that provides a Python API. It doesn't really care what you use to write the Python code.

You can use an IDE, if you want, but I don't think it's necessary: A good text editor is all you really need.

+---------------------------------------------------------------------+

| Game Dev video tutorials  ->   http://www.youtube.com/goranmilovano |
+---------------------------------------------------------------------+

#3 3Ddreamer   Crossbones+   -  Reputation: 3165

Like
0Likes
Like

Posted 25 August 2012 - 08:56 PM

Hi,

The CPU is not the bottleneck.


Is this because the memory management prevents a CPU bottleneck? In the meaning of memory management, do you mean video memory management? In that case, I can see the benefit of automatic memory management.

Memory management is a huge issue in many games, I know. Do you happen to know if Python supports preprocessing of video frames? Perhaps this is included in automatic memory management.

By an interpreted language, in the case of Python is it the case that the program data is more video memory and GPU focused than that of a compiled language? I hope that I am getting this. I know it to be much easier to prevent stuttering in a game in general with graphics based solutions where possible rather than facing CPU lob jams, but this might have changed recently with CPU advances.

3Ddreamer

Personal life and your private thoughts always effect your career. Research is the intellectual backbone of game development and the first order. Version Control is crucial for full management of applications and software.  The better the workflow pipeline, then the greater the potential output for a quality game.  Completing projects is the last but finest order.

 

by Clinton, 3Ddreamer


#4 Goran Milovanovic   Members   -  Reputation: 1104

Like
5Likes
Like

Posted 26 August 2012 - 12:21 PM

When I said "for any of the following reasons", I meant that at least one of them is likely to make Python performance a non-issue, but ultimately, it all depends on your circumstances. If updating the state of your game is a relatively trivial operation, in terms of processing time, but you have a whole lot of geometry that your GPU is not fast enough to handle, then the CPU is not the bottleneck - Or, in other words: You're not going to increase your frame-rate by using a faster language like C++ (in that circumstance).

The benefit of automatic memory management is that you don't have to do it yourself. Python will allocate the required memory as needed, and free relevant blocks accordingly.

Video frame pre-processing is not a language feature ...

I write the following with nothing but the utmost respect:

The questions you ask, and the overall nature of your post would imply that you're extremely inexperienced. For someone who knows so little, the performance characteristics of any given language are truly irrelevant; You need to make a few simple games (memory-match, worm, tetris) to learn the basics of game development, and for such games, you don't need every available CPU cycle.

Also, it would make more sense to worry about performance when you actually have a game that runs slow, rather than waste your time and focus on some hypothetical performance issue that you could potentially encounter in the future.

+---------------------------------------------------------------------+

| Game Dev video tutorials  ->   http://www.youtube.com/goranmilovano |
+---------------------------------------------------------------------+

#5 3Ddreamer   Crossbones+   -  Reputation: 3165

Like
2Likes
Like

Posted 26 August 2012 - 06:25 PM

Goran Milovanovic,

Right you are that I am very inexperienced and I know it.

As a matter of conscience, I must get enough information in order avoid months or years of learning things which will never be needed again, so I am choosing my path carefully. I know what I want in a very general sense and I am looking for a system which will be a good match to my goals both short term and long term.

Thank you very much for your help! Posted Image


3Ddreamer

Personal life and your private thoughts always effect your career. Research is the intellectual backbone of game development and the first order. Version Control is crucial for full management of applications and software.  The better the workflow pipeline, then the greater the potential output for a quality game.  Completing projects is the last but finest order.

 

by Clinton, 3Ddreamer


#6 nfries88   Members   -  Reputation: 259

Like
2Likes
Like

Posted 27 August 2012 - 05:53 AM

1) a. Is Python a good or great language for game performance, specifically frames per second and smoothness in 3D scenes? The reason I ask this is because Python appears to be a very adaptable language but I wonder if it could be "too good to be true" in the sense of maybe game performance might be the price to pay for all that language adaptability, especially the syntax expressiveness. I don't know but there seems to be some doubt out there about performance.
b. How does Python compare to C++ for game performance, all other things being about equal?

Depends. The worst answer in the world to give a newbie, but it's also almost always the right answer. Python gets very reasonable performance for a scripting language, but it is a scripting language. For a typical 2D game (such as a pac-man clone), it would perform very well. If you're hoping to make Crysis 3, you will most likely find Python insufficient. The issues with using scripting languages over C/C++ or even C#/VB.NET for game development is that you not only gain interpretor overhead, but also lose the ability to play directly with OS interfaces.

As Goran mentioned, on newer hardware, and written by a good programmer, the CPU (interpretor overhead) is not likely to become the bottleneck of any game, it will be GPU, but I feel the need to mention interpretor overhead anyway. I'm old-fashioned.

2) Is Python better for people of lesser experience to learn it compared to C++?

Yes, Python is simple to learn relative to C++ and even C#. Not only is it easier to learn, but you will get faster results when creating from (essentially) scratch, which is great for encouraging newbies (and why very few newbies stick with C++ after realizing such alternatives exist). I highly recommend using Python or a similar scripting language to familiarize yourself with programming, even if it winds up being insufficient for the purposes of making your game.

3) With all the flexibility of Python, what are it's strengths and weaknesses for games?

Strengths
Easy to use
Easy to learn
Fast results
Portable
Many bindings available for open-source game development APIs
Reasonable performance
Boost.python provides excellent C++ bindings to python, making it easy to use for scripting events, should Python prove to not be performant enough to do all game functionality in.

Weaknesses
Interpretor overhead
No direct access to OS and hardware features
Most game programming tutorials are still in C++, few serious game developers use Python

4) How do I deal with the issue of an IDE for Python? Is Blender going to be a dead end in one sense of needing an IDE eventually?

There is no IDE for Python -- well, okay, I'm sure somebody's made one by now. But there is no need for an IDE for Python. Python is a scripting language that does not need to be compiled or linked to be run (it is run by an interpretor), so the only use for an IDE in the case of Python would be syntax highlighting, in which case you should find Notepad++ quite suitable.


The unasked question: Is the Blender API good for making games?

Blender is a great tool for making 3D models, and it is awesome that they provide a method to easily see those models in action.
I do not think any serious game studio would use it for its entire game. But I'm sure there's someone who has disproved me.



Also, on your last post:
As a matter of conscience, I must get enough information in order avoid months or years of learning things which will never be needed again, so I am choosing my path carefully. I know what I want in a very general sense and I am looking for a system which will be a good match to my goals both short term and long term.

Whoa, bro. The only re-learning in game development is between various APIs (X11 vs Win32, OpenGL vs DirectX, etc); and even then, it's more like learning an alternative than it is re-learning; you don't want to dump the old knowledge, only gain the new.
All programming experience is a positive thing. Even if your software is a steaming pile of crap that doesn't run, crashes sporadically and frequently, and every now and then even leaves you with a BSoD, at least you have the experience of making that crap.
All programming experience improves you, as a programmer, as long as you actually learn from it. I look back at code I wrote in '06/'07 and laugh at my inexperience.
Learning Python is never a waste of time, and every bit of experience in Python will carry over to C++ (or whatever language you use next), even despite their vast differences. Painting may not be sculpting, but programming is programming, period.
Unless I'm missing something and there's some urgent reason why you must finish your game in the next couple years, like it's your dream and the doctor told you that you only have three years to live or something, take it slow and experiment. Nobody can tell you the best route to take, we're all still learning too.

Personal Recommendation:
Start with Python, use it to make a nice simple game like a pac-man clone. This will likely take you a few months. That should give you perspective enough to decide your next step. Ultimately, I would recommend C# and XNA -- XNA is a great API, C# is a great language, and the .NET framework is probably the greatest I've played around with. Unfortunately, XNA is not portable, and will only work on Windows and XBox360, and I found some requirements of using XNA (not the API itself) to be aggravating after knowing the unbounded freedom of developing games in C++. These requirements will certainly not bother someone who has never had that experience.

Edited by nfries88, 27 August 2012 - 06:09 AM.

Looking for paid or open-source C++ programming work. Been programming since 2005. No degree.

#7 LorenzoGatti   Crossbones+   -  Reputation: 2773

Like
2Likes
Like

Posted 27 August 2012 - 11:53 AM

1) a. Is Python a good or great language for game performance, specifically frames per second and smoothness in 3D scenes? The reason I ask this is because Python appears to be a very adaptable language but I wonder if it could be "too good to be true" in the sense of maybe game performance might be the price to pay for all that language adaptability, especially the syntax expressiveness. I don't know but there seems to be some doubt out there about performance.

Compared to other scripting languages, the CPython interpreter is high on the "object tax" scale (dynamic lookup of everything, every time) but it has two advantages: superb support for arrays (particularly with additional libraries like numpy) and reference-counted garbage collection (causing ugly pauses only if you do something stupid).

b. How does Python compare to C++ for game performance, all other things being about equal?

Probably you are going to use better algorithms in Python, your skill and effort being equal.

2) Is Python better for people of lesser experience to learn it compared to C++?

Python should be easier to learn for just about anyone, but every language has its place.

3) With all the flexibility of Python, what are it's strengths and weaknesses for games?

None in particular, but you might write something grossly inefficient because it seems natural. Which is a much better deal than writing something subtly and dangerously wrong in C++ because of a momentary lapse from paranoia.

4) How do I deal with the issue of an IDE for Python? Is Blender going to be a dead end in one sense of needing an IDE eventually?

The appropriate mode for Emacs or Pydev for Eclipse are good, and Blender has its own Python editor. There is no issue and no dead end.
Produci, consuma, crepa

#8 3Ddreamer   Crossbones+   -  Reputation: 3165

Like
0Likes
Like

Posted 27 August 2012 - 03:56 PM

okay, I chewed that. I will need to spend more time on it, but that is a good next area where you guys lead me.

Today I continued doing hours of reading in different sources.

Long term, I want to create my own game source code in order to customize the game as an executable program. In the case of Blender and Python, I have yet to realize how I can learn with them and be able to eventually create my own game engine and separate executable game. Blender has the game engine integrated with it, so I am concerned down the road about the end user of my games having to install Python scripts in order to play my games. I will want them to get the game as an executable program only with no need for downloading anything else as I have experienced myself on rare occasion with games. Perhaps Blender actively supports the game developer in creating source code and separate executable games, but I have yet to get there in my research. Surely for these issues I must read more thoroughly the Blender institute information and begin to ask questions in the Blender forums.


3Ddreamer

Personal life and your private thoughts always effect your career. Research is the intellectual backbone of game development and the first order. Version Control is crucial for full management of applications and software.  The better the workflow pipeline, then the greater the potential output for a quality game.  Completing projects is the last but finest order.

 

by Clinton, 3Ddreamer


#9 LorenzoGatti   Crossbones+   -  Reputation: 2773

Like
2Likes
Like

Posted 28 August 2012 - 01:25 AM

I am concerned down the road about the end user of my games having to install Python scripts in order to play my games. I will want them to get the game as an executable program only with no need for downloading anything else as I have experienced myself on rare occasion with games.

There are several tools to automatically bundle your code, libraries and a stripped down Python interpreter into an executable, for example Py2exe (http://www.py2exe.org/) or PyInstaller (https://github.com/pyinstaller/pyinstaller).
Produci, consuma, crepa

#10 3Ddreamer   Crossbones+   -  Reputation: 3165

Like
1Likes
Like

Posted 28 August 2012 - 05:52 PM

LorenzoGatti,

Thanks for saving me some searching. I read some poster in a thread in the Blender Artists forum talking about it, but no link was given. I really am not trying to take any lazy way about this, but sometimes saving time is a good thing.

The idea of designing a game engine to use another language for certain performance demanding issues is very interesting to me, however I am a long way from handling that kind of thing. It would, it seems, allow Python to really be competitive in high performance characteristics if another language is incorporated effectively.

I am a 2D and 3D artist, so the art aspects of Blender are very attractive to me. Realistically, having a complex game created by me is probably years in the future, so I best get moving on it real hard! Posted Image

Decision on what system I will start to use will come by the end of this month - Friday. I'll find some way to let the people who helped me know.


3Ddreamer

Personal life and your private thoughts always effect your career. Research is the intellectual backbone of game development and the first order. Version Control is crucial for full management of applications and software.  The better the workflow pipeline, then the greater the potential output for a quality game.  Completing projects is the last but finest order.

 

by Clinton, 3Ddreamer





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS