I want to us Python in Blender, where do I start learning?

I’ve looked at many Python tutorials, but the workflow seems quite different from the way it’s operated in the Blender Game Engine. Plus, I asked one uploader of a specific video I watched if I could start programming a Blender game by the end of his video, and he said “no, sorry” I’m beginning to wonder if Python as a whole operates differently in the Blender Game Engine than it does traditionally, and if so, I was hoping to get directed to wherever I must go to begin learning.

Originally, I was watching a playlist of tutorials from a guy called Bucky Robert, but at this point, I just really want to be sure, because I’m trying to make the attached game file here.

I’m not gonna add anything else into the game until I have designed all of the basic movement animations and attack combos, but getting that to look natural is starting to look impossible without Python. I can’t get some animations to stop when others are going, I can’t get multiple different animations to play by pressing the same key more than once, I can’t even get a proper jump animation, let alone a double jump animation to play and sync with a landing animation. All I can show for right now is a rigged movable character, which isn’t much, and that’s not even touching up on the item system, level up system and shopping systems I want to integrate in as well. I have to face it, as much as I don’t want to, I NEED to learn Python, so please, tel me where I start.

Thank You.

Attachments

Project Lab Escape Prototype.blend (1.91 MB)

1 Like

Best and easy: http://bgepython.tutorialsforblender3d.com/

There are still a few things I don’t quite understand. For example, the following code for setting frames for actions
(animations)

# import bge
import bge

get controller

cont = bge.logic.getCurrentController()

get object that controller is attached to

obj = cont.owner

check if action is playing in layer 3

playing = obj.isPlayingAction(3)

I don’t know what those hashtags mean, so for example, let’s say my jump animation was named “first jump” how do I make sure that is placed in the code correctly? Since I don’t know how Python works, I wouldn’t know where to put the script, where the put the variables, controllers or actuators, not to mention how those “if” “and” or “then” things operate. I don’t want to have to rely on source code already made, I want to have a complete understanding of what it is I’m doing in Python.

Oh, I see you are not familiar with Python programming at all. Hashtags are just comments - you can write whatever you want after #

Well…then you might want to start from some site like this : https://www.python.org/about/gettingstarted/

achisp made a big collection of all kinds, including python tutorials.

What about these tutorials?

I was watching these before making this tread, but since I’m not quite sure why later on in the series, Bucky starts using a completely different program for simulating the software, I don’t know if this is representative of how it will operate in Blender. For example, I watched this tutorial a while back for a game I want trying to make, and my result was the same. I copied the script down to the letter and capitalization, and it wouldn’t work for me at all, and I think it was because I don’t know how to use Python, and he did things while writing that I probably wasn’t familiar with.

Internet is full of information about anything, “how to learn Python” including. I think, video tuts are not the best way to learn Python. However, no matter where you start…what you need to do is actually start learning hard. It takes time and efforts, there is no easy way.
Download some blender games, examine the code and how it works. Then change it a bit and see what it does, then change it again…and so on and on and on. You have to be determined to learn.

That’s How I learned. Similar to the way a baby learns it’s first language.

There are probably a number of reasons why, long ago, Blender’s implementors decided to use Python, but here are two:

(1) The Python language, in particular, has some unusual features which make it especially powerful for expressing the kind of maths needed for 3D graphics. (Python was heavily influenced by languages such as LISP, “but I digress …”)

(2) Python is also easy to integrate into application-specific environments such as Blender’s, where program-defined resources (such as bge) can readily be defined. Python also exposes a very “friendly” interface to the back-end (Blender …) code which must implement all of these things.

Blender Game Engine defines several facilities which are available to the Python interpreter – and therefore to the language – only when the script in question is running within Blender. Although the Python programmer need not be explicitly concerned with it, these are in fact interfaces into the “guts” of Blender.