python...

ive been making simple games in blender for a little while now, but now i wanna do something more, i want to make a first person shooter. i know all the basics, but i dont know python. and i dont just want to take someone elses fps script because i wont learn anything. i need to do many things with python, id like to have all of the movement done with it and use very little logic bricks. i need to have weapon switch, and health , and points. not to mention ammo : (. if anybody has a link to a tutorial, or some place that can help me, please post it. Ive been to many basic tutorials, but none give me info on how to get the postion of the mouse or do anything else but move in one direction… any help is much appreciated, thank you.

try looking into the “stickies”

There is nothing in the stickies (that I could find) that even resembles a BGE python tutorial.

It’s is really a shame that someone didnt make a nice little tutorial that explained how to use the python - blender API, with a few examples. There is barely anything on the matter, and the little stuff that exists explains concepts that are far too simple.

Explaining something like the mouse script, in detail, would be a good start, toward really documenting the proper usage of python within the BGE. Because as things are now, a new user is reduced to guessing what code does what.

There’s a python section here that should help you get started:

http://download.blender.org/documentation/NaN_docs/BlenderGameReference/

The gamelogic methods are here:

http://www.blender.org/modules/documentation/pydoc_gameengine/PyDoc-Gameengine-2.34/index.html

The only other thing you can do is ask questions here at elysium. Just don’t ask for a complete script unless it’s something simple.

Also, find some python language tutorials. You don’t need to get too heavy into it, but you need the basics. The if, elif, and else commands. Handling strings and numbers. The difference between a float and an integer. Things like that.

Start slow, ask questions, and don’t get upset when it doesn’t all snap into place at once. You shouldn’t be starting with a mouse script for a fps. You should start by filling in an actuator methods and adding it. Getting information from sensors, etc.

Ummm… from the sticky list

http://theboomshelter.com/hss.html

It’s just kinda redundant to just go through what all the functions do when the blender documentation does a relatively good job on it.
http://www.blender.org/documentation/pydoc_gameengine/PyDoc-Gameengine-2.34/index.html

Well assuming one can figure out how to read it. But once you get around to learning how to use the functions and script in the GE, it’s just like another reference document.

Jason Lin

Python I know, all I need is a guide on the BGE API, and examples on how to properly implement them.

God only knows how many times people have brought up the game docs whenever this question is asked, but they never include a tutorial on how to read those docs, or even better, examples on how to actually use all those functions.

Have you looked at Snailrose’s tutorial? I’m not sure it’s what you’re looking for, but I got a glance at it when I looked at his site for the new shader build. It’s a tut on how he creates an FPS with mostly Python code, if memory serves me. Check the shader build thread for a link.

But once you get around to learning how to use the functions and script in the GE, it’s just like another reference document.

Please just look over this python in GE tutorial http://theboomshelter.com/hss.html by Blengine. It does get all the basics across on how to use python in the GE and provides enough information on how to implement them. What people don’t realize is scripting is not that hard (then again it might just be all relative). The blender part of it is just mainly reading in sensors, actuators, manipulating object properties, setting actuator parameters, activating actuators, etc and using regular python to just get what you want.

Jason Lin

Besides that you can learn how python works in the game engine, it would be better to learn the basics about python first. Since when you don’t know anything about programming it’s good to know what modules are, statements, loops and much more.

I would suggest to learn python itself first and afther that getting started on the python inside blender.
Byte of Python is a very good free online book written by a python guru. It covers a lot of python on a very good way. Personally I’m a graphic designer, but because of this book I started to learn python and programming, afther that I started php, c and opengl, just because of this book.

If you’re 100% beginner or a advanced user, this book is awesome.
Here a link: http://www.byteofpython.info :slight_smile:

Btw, you can combine normal python as written in this book, with the blender game engine. Like you can write extensions to enable networking, script and external console, add video and more advanced sound support or even script your own external GUI for starting the game and a lot more. :smiley:

Python I already know.

I am way past that tutorial. It’s ok for the basics, but not much more. What I would like is a very detailed, and well explained mouse script tutorial. Do you know where I could find one?

What I am having problems with is the documentation, for example:

I wrote a menu script that would set a scene according to which option was chosen. The main piece of code that did that was scene.setScene(“scene2”).

In the documentation, that code was simply listed as: PyObject* setScene(char* sceneName), now how is a completely new user (at least when it comes to BGE python) suppose to figure out that the PyObject* is supposed to be the name of the scene actuator that is connected to the py script, and that in order for the whole thing to initialize, the addActiveActuator(Scene, 1) code has to be added after, or nothing happens.

If it was not for fireside (thank you), I would have never figured it out.

So thats my point. I believe that the documentation needs to present information in more detail than simply PyObject* setScene(char* sceneName) set the scene to switch to, so that BGE python API would be more accessible to new users.

Glad I could help. I think your points are completely valid. I think we need to add some tutorials to Blender3d noob to pro.
http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro

If you look at it. There are a lot of excellent tutorials until you reach the game engine section. Then there’s just a few. There are quite a few game engine tutorials around the net but many are pretty out dated. I think a tutorial that teaches a little python and helps people understand and use the game logic documentation would be great. Trouble is I’m makeing a game and I want to get the Blender source compiled and see if I can help with it. Hopefully I’ll need a diversion and give it a try or someone else will. Anyway, I think anyone that has become familiar with the game engine and has a little free time should think about trying a tutorial over there. Many of us complain about beginner questions but there really isn’t a place to go to really get those questions answered without doing searches that don’t work very well. Maybe the new board is better, but a good updated tutorial section would help a lot.

My thoughts exactly.

Now all thats required is a few volunteers who could help out and add to the wiki.

We could start a new thread called Blender Game Engine tutorials or something. Get in a small conference on what tutorials would be best to take someone new to the game engine up to speed. Then try to get volunteers for each tutorial. I’m having problems uploading information onto the net which might interfere, but I get things to upload sometimes. One thing we should stay away from is fancy models. There are modeling tutorials already. This should be how to make a game using logic bricks, ipos, actions, and python, textures and materials, etc. We could also reference some tutorials that are very up to date or get permission to put them on noob to pro. Like blending onlines text tutorial for instance. It’s too good to bother repeating. Some of the bricks should probably have their own section, like messages, and properties.

I would love that if you did, even though this thread is pretty old, there is not a lot of info on the game engine… alas for me