ZZT-oop

From Academic Kids

ZZT-oop is an early in-game scripting language. It was designed by Tim Sweeney as the scripting language used for his computer game ZZT.

Contents

Overview

ZZT-oop is object-oriented and event-driven. A ZZT game is composed of a set of objects, each of which has an attached script. Scripts are executed concurrently (one command being taken in turn from each script running on the current screen), and objects communicate by passing messages to one another.

Peculiarities and limitations

Shortcomings

The ZZT-oop language is very limited in application to say the least. It was designed for simplicity rather than flexibility. Boolean flags are the only type of variables, making arithmetic nearly impossible, forcing the programmer to be creative with algorithms, often relying on physical movement, possibly in invisible (but still physically present) objects rather than arithmetic calculations. Although ZZT-oop is object oriented, objects are not instantiable due to their physical nature, meaning that one needs to duplicate much code to create complex systems. ZZT-oop also lacks functions, and routines are likely to be interrupted—by rogue messages including ones sent by the object itself when it is shot or touched—and never completed. One can overcome this crudely using state flags or using the lock and unlock commands during important routines; however, this is likely to cause the object to miss out on signals. ZZT-oop is wholly run-time interpreted with no pre-parsing. No lexical analysis is performed before running, nor is any byte code translation applied. This means that any errors are reported in a cryptic way during run-time, and this can make debugging consuming and frustrating.

Strengths

However the language does have some advantages, its simplicity and intuitiveness for one, its lack of mathematical operators and integration within a fun game makes it very nonthreatening to budding programmers at any stage of life. The physical nature with a concrete geographic position makes objects far easier to visualise than abstract data types, and the parallel operating multi thread design is easy for one to think about in terms of a dynamic environment.

Syntax

The syntax of the language is simple, there are 4 categories of instructions:

  • Unprefixed instructions, cause the object to open up a message window and display text to the player
  • Directions are prefixed with a / or a ?, they instruct an object to physically move north, south, east, west or idle for a cycle.
  • Commands are prefixed with a # and they specify all interactions with the environment, whether it be shooting, setting a flag, sending a message or processing an if statement. There are hundreds of commands, but listing them is beyond the scope of this document.
  • Messages are similar to a goto statement in primitive languages, the only difference is that they may optionally be sent to another object and cause that other object's own execution path to jump to that point in the script. The points that may be jumped to are prefixed with a : and are used to denote both what the name of the message is, and where it should jump when that message is received.
  • Flags are global boolean variables used for conditionals that may only be set or cleared with commands, if the #if command is called the flag will be evaluated and if it is set to true, the message listed after will be sent, causing the script to jump to that point.

Closing Thoughts

ZZT-oop provides a great stepping stone into programming for anyone with limited knowledge of such things. It can provide one with many hours of fun, but very little else.

External Links

Online version of the ZZT-OOP reference included with the game. (http://dave2.rocketjump.org/rad/zzthelp/langref.html)

Navigation

Academic Kids Menu

  • Art and Cultures
    • Art (http://www.academickids.com/encyclopedia/index.php/Art)
    • Architecture (http://www.academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (http://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (http://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)

Information

  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Toolbox
Personal tools