Scripting language proposal
Since the goal of the game is to teach kids how to program, it would be best to have 2 views of the code: one in the high-level scripting language, and the other in the Java code it translates to. Children can then see the effects of simple statements in the scripting language, and learn to construct real programs in Java.
There should be four sets of actions/properties:
The syntax of the scripting language should be similar to English. This makes it very readable, and easier to compose.
object – describes the object. Could be a name substitution.
action – could be either a change in the state of the object, (“not hungry”), or an action for the object to take (“walk”).
Actions correspond to the known action methods for that object. (i.e. a polly would have all the different ways of walking that it has defined.
arguments – depending on the action, arguments can be given to the action – “walk north”.
Most of these static attributes can be translated directly into Java code – setting the corresponding attributes of the objects in the world.
object – describes the object we’re dealing with. Could be a name substitution.
attribute – some proposed attributes : name (creates an alias for the given object), color, size, position, mood
If attribute is missing, then it the interpreter might try to deduce it from the value (i.e. “polly is red” implies that the attribute is color.)
value – depending on the attribute.
These are different from the Object Properties since they describe general behaviors that (possibly) apply to all actors/objects in the world. They take the form of conditional transitions in the state machines of actors or objects.
In Java they can be translated into methods that would apply to every object, and be checked at regular intervals.
when and if are interchangeable.
object class – any of the possible classes of objects – polly, furniture, house, etc.
is – refers to an equivalence condition (“if polly is red”. “if box is empty”)
wants to – refers to an internal state of the object (“wants to eat”)
condition – refers to an evaluation of the given condition (i.e. eat) against the internal state of the object. Some internal states could be predefined (i.e. “wants to eat” means “hunger > 0.5”. eventually users learn to use expressions like the latter to describe the condition, rather than the built-in defaults).
Conditions can have all the logical operations of Java (<, >, ==, <=, >=, !), and their text counterparts (greater, less, equals, ..etc)
Many defaults could exist depending on the complexity of the internal states of objects. (hungry, playful, shy, etc.)
result – should be an action statement (see above)
Structured just like the General properties (above), but refer to a specific object.
These can be constructed using specific properties (above).