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[p] time_value
- time_value : this can be either an absolute value, in seconds
-- i.e. 0, or a relative value to the last command (using the timep keyword
-- time plus). The time stays active for all following commands until the
next time[p] 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, trigger when.
- args : these are arguments, one or more, depending on the
attribute.
object number attribute args
- number : this is the number of the object. It is subject to
command substitution via the define directive (above)
- attribute : this is a keyword. Valid keywords are : type,
factor, position, color, size.
- args : these are arguments, one or more, depending on the attribute.
- type takes one of the following attributes: block, ...
(more to come) ...
- factor takes two arguments: integer index and double
value which gives the "want" factors associated to a given object.
- postion, color, size -- same as for "actor" above
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 2 values (theta, phi) 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 :
timep 5 # 5 seconds later
actor 1 direction PI/4 # 45 degrees
actor 1 action swagger # start walking
And stop some time later
timep 10
actor 1 action idle
Questions, comments, etc : Lev Iserovich