Lab # Python Lab Report
Objective: Introduction to Python for Blender
Materials: Blender Game Engine with Python Console. Game Logic.
Methods:
It is important to understand that custom Python code can solve a lot of problems it keeps things from getting too complicated. Always make sure you are working in Blender game when using the console, consult the tutorials on blender to get API stuff. The code is organized in Modules, which are arranged in a heirarcy.
Sensors and actuators are listed, but not controlers – the code is the controller.
Everything is Game Logic (bge.logic)
Some things to remember:
-Constants never change.
-Call functions are like verbs
-Clicking around writing code can get old with the user interface, but with the scripts robots do it for you.
-The tutorial shows you how to grab sensors and actuators in code, you can make things happen on your own in real time.
-Be sure to balance the console and the logic editor, they are well integrated and if you are serious about it you must be proficient at both.
-Gives access to Matrices
-It has a dictionary that is saved between loading blend files so you can use it to store inventory and other variables you want to store between scenes and blend files. It can also be written to a file and loaded later on with the game load/save actuators.
-Python likes it when there is only one way to do things
-List of supported joysticks is an example of the stuff they store there
-General function (chunks of code that do things) is like a basic tool kit, things like start and end game. They follow the same function idea as the logic editor
-Python uses lots of functions, as opposed to java
-Some do – like Gets return, while setters change value, because it’s pre-coded you don’t have to worry about it doing something weird.
-Physics code tinkers and make things better, more efficient. The sound card is cool, so is the set physics – like the maximum lengths of time. The most important one for us is NEXT FRAME FUNCTION.
-Utility functions are useful too. You can get average frame rates so that you can debug better.
Results:
If I am making something I now know where to look.