lectures‎ > ‎

L14: Python controllers

Screen recording: http://dennett.cs-i.brandeis.edu/talks/cs65a/L14/Resources

Today we begin with an introduction to particle effects and then start exploring python controllers as an alternative to logic bricks.

Particle Systems

A particle system is a graphics method for efficiently specifying and rendering thousands of copies of a single object with some variations in the shape and relative position of the copies.  The most common uses of particles systems are human hair, grassy fields, and precipitation.

The key ideas are that you specify a particle system by selecting a set of faces (as a named vertex group) and the particles will be emitted from those faces (or the hair-like particles will grow from those faces) according to parameters that you set. You can specify how many particles will be emitted in total, and how they will be spaced (randomly, evenly) and many other parameters.  For hair, their is a "particle mode" in addition to object, edit, and pose mode, which allows you to comb and style the hair. We will demonstrate some o these techniques in class but you can easily find video tutorials for Blender 2.5 online.


Python Controllers


A python controller is a powerful blender tool that allows the game designer to write a program which has access to the entire state of the blender system each time it is invoked. Since a python controller is part of a logic brick, it is associated to a particular object and has access to the sensors and actuators for that object.  It can read and modify the sensors and the actuators.  The controller can also change the state of the object directly without going through an actuator.

To be able to use Python Controllers effectively, the game designer will need to learn the Python programming language.  There are many thousands of programming languages, but Python is one of the most popular languages these days.  It is used in many contexts, including web applications, scientific computing, game design, computational linguistics, etc.

Today we will give an overview of how to use Python controllers and next week we will start looking at the language itself. The goal will be to teach you enough python that you can write your own python modules for use in your own games.


SplitScreen games

We started our introduction to Python scripting by showing how to use the ViewportsMin.py module to break up the screen into several Viewports where each viewport was associated to a particular camera.

ċ
Timothy Hickey,
Mar 14, 2012, 9:03 AM
Comments