Talk:Blender 3D: Noob to Pro/Python Platformer: Creation

...I don't know why you're introducing stuff you only need for Blender scripting, but this is all you need to do to move a protagonist around an area, in the BGE. Simplified and commented:

That's (almost) straight from the tutorial I started work on, but if you're going to be covering basic BGE Python, I'll move on the slightly more advanced stuff.


 * FFFffFF I was going to do that!! Oh, and I believe there's an alternate way of registering a key press, but this seems more efficient and/or less likely to make Blender explode. I'll work this code in with an explanation, but I should note which parts you did and which parts I did when I produce the script at the end. Anyway, while yes, you only use this particular code set for Blender scripting, to replicate the conditions we set forth in the other tutorial set, they deal with essential principles of object-oriented game programming. It's showing how one sets up that framework with the Blender-Python affair in particular. My motive for sidetracking the tutorials to Python is that later on I'm going to start introducing AI routines for enemies and such, which will really require Python scripts to be anywhere efficient. Also, it gives me an error if I try to import GameLogic. Why is this? Loki Clock (talk) 01:27, 12 March 2008 (UTC)


 * Well, first of all, I've never had blender explode as a result of this sort of keypress checking, although you are right in saying that there are better ways to do it. Second, with regard to the importing error... What version of Python are you using?  Also, importing GameLogic is not needed, as the game engine automatically does that, but if you don't want to type "GameLogic" every time you need to call a method of it, importing with a shorter name is nice.  So try removing that bit of code and replacing every 'gl' with 'GameLogic'.  And I think a better way to introduce people to OOP and its applications to game programming would be swaroop's section on OOP, perhaps supplemented by some Pygame programming.  There are lots of good OOP introductions out there; why re-invent the wheel?  Especially considering that you can make some pretty decent games with simple procedural programming, there's no good reason to start a set of tutorials with Objkect Oriented Programming.  OOP is generally saved for later, more advanced tutorials.  Anyways, that's my two cents.  What do you think about concentrating more on actually learning GameLogic, rather than going on about Python scripting and OOP?--Malaz (talk) 17:49, 15 March 2008 (UTC)


 * I have 2.5. It doesn't even work when the only line is "import GameLogic". And the tutorials aren't designed to introduce people to OOP, they're designed to tell you the code to set it up in an OOP way. So if someone knows how to build a game with, say, Actionscript, it will teach them how to apply those techniques learned to their Python programming. So when I show how to create a character object linked to a pre-existing mesh, I'm telling the Actionscript people how to do the equivalent of creating an object linked to a graphic. They will understand the point of this because, Python is an OO language and so they are very likely OO programmers, and acts analogous to that are found in most OO game programming situations, anyway. So in a way, it's not a tutorial to teach people OO programming, but more a tutorial for people who ALREADY know it, but that others might be able to see the practicality of, or at least discover said practicality when they realize how much they would have to change to get X to work if Y wasn't given a name to be referred to at the beginning of the series.Loki Clock (talk) 07:41, 18 March 2008 (UTC)


 * Still, I think conventional approaches to learning the Game Engine are easier for people new to the blender API. These tutorials are very much about OOP, but do not teach anything to do with normal pyblender API (ie for mesh scripts).  I feel that this simplifies the learning process, and those interested in conventional Python scripting can take a look at some of the excellent tutorials out there (some of which are in this wikibook).  You are very much right in saying that the OO angle is important to those wishing to make a game (image writing a game using entirely procedural programming!), however I don't think that mesh python is needed to create an elementary game.


 * But if you're going to do that advanced tutorials as well, go ahead. I'll leave this stuff to you, if you think you're doing it the right way, and don't want any help with the normal GameLogic tutorials. --Malaz (talk) 06:11, 23 March 2008 (UTC)


 * By the way, I just made a quick 'proof of concept' for the jump test thing. You can just use a ray sensor; it's much simpler and less of a hack.  I'll upload the .blend somewhere if you want to see it.  It's 144KB, so should be easy to upload somewhere...
 * I could still help with the GameLogic tutorials, but we shouldn't neglect the Python path of things. I'd love to see your jump fix, and I'll probably incorporate it into the official blend for the Platform Fixes tutorial. Loki Clock (talk) 00:10, 30 March 2008 (UTC)
 * And I'm now downloading the special Python 2.5 version, hoping that will fix the gl import problems.
 * It didn't.
 * Okay, according to this thread I can't test GameLogic related affairs with ALT-P, I have to run the normal sim in the 3D view.
 * I'll send the quick jumpTest .blend to you. It'll need some tweaking to make it fully usable within your game, and I would recommend converting it to python to reduce clutter (as I did it in gamelogic to demostrate that it was possible).  Unless you have some hosting, I'll need an e-mail address to send it to.  Also, the majority of the people on that thread are wrong.  There is a GameLogic module, and there is official documentation for it.  Normal GameLogic scripts can be tested by starting the game (PKEY), and looking at the terminal output--make sure to run blender from a terminal (command is blender in linux, depending on your environmental variables).  GameLogic scripting is completely different and seperate from Python scripting, and trying to make a Blender game with the normal Python API is nigh impossible.--Malaz (talk) 00:37, 10 April 2008 (UTC)
 * That will be lokiclock at the place with the gmail and the dot com at the end! Loki Clock (talk) 09:22, 26 April 2008 (UTC)