Scripting Language for Animating Polly's (SLAP)
This describes a simple language for creating animations based on Polly.
It assumes (for now) a created environment in which the action will take
place.
Therefore, it can be included in a larger scheme, where this language will
be used only for short local interaction in specific locations (scenes).
It is well suited for this task, since it tries to keep the syntax and possibilities
simple, and fairly low-level.
It does :
- Provide a simple interface to the underlying polly engine
- Enables scripting scenes with multiple Polly actors
- Can be read and written by humans (uses defines and named commands)
- Can be easily read/written to by higher-level tools (the syntax is
well-defined and unambiguous)
The most important directive (the comment) is the # character, till end of
line. (in the style of Unix scripting languages). Example :
define idle 0 # this describes the idle action
The scripting language includes support for simple word substitution --
this is to facilitate using actual words instead of numbers as parameters.
The given word will be replaced by the given value when the given word appears
as an argument to another directive. (i.e. a time directive -- see below)
For example, we can define Polly's actions :
define idle 0
define scamper 1
define swagger 2
define broadjump 3
define prowl 4
define lumber 5
define dejected 6
define no 7
define yes 8
define hotfeet 9
define sprint 10
define hop 11
The language is centered around time, rather than actors. This helps coordinate
all the actors.
The main directive is the time directive. It sequences the following commands
to a certain frame.
time time_value
- time_value : this can be either an absolute value, in frames
-- i.e. 0, or a relative value to the last command -- +10. Relative values
must start with + (i.e. only motion forward in time). The time stays active
for all following commands until the next time directive.
actor number attribute args ...
- number : this is the number of the actor. It is subject to
command substitution via the define directive (above)
- attribute : this is a keyword, (which directly corresponds
to the Java method to be called). Valid are : action, direction,
position, color, size.
- args : these are arguments, one or more, depending on the attribute.
- action takes one integer argument : the index of the action of the
polly to take
- direction takes one double argument for the angle the actor should
turn to
- position takes two double arguments, as the 2-dimensional position
(x and z axis) of the actor
- color takes three double arguments for the R, G, B values of the
color
- size takes one double argument, describing the size of the actor
camera position direction
- position : set of 3 values (x y z) for the position of the
camera. Can be substituted with the define directive.
- direction : set of 3 values (x y z) for the vector direction
of the camera. Can be substituted with the define directive.
Simple mathematics is also available for the arguments :
define PI 3.1416
actor 1 direction PI/4
We can initialize the scene by setting time to 0 :
time 0
define red 1 0 0
define green 0 1 0
actor 1 position 0 0 # in the middle
actor 1 color red
actor 1 size .9 # the larger actor
actor 1 action idle
actor 2 position 2 0 # to the right by 2 units
actor 2 color green
actor 2 size .6 # the smaller actor
actor 2 action idle
We can then have actor 1 move diagonally :
time +500 # 500 frames later
actor 1 direction PI/4 # 45 degrees
actor 1 action swagger # start walking
And stop some time later
time +1000
actor 1 action idle
Questions, comments, etc : Lev Iserovich