When a Swarm program is running in the GUI mode, what the user sees is controlled by the top level Swarm that we often call the observer swarm. The observer swarm adopts the GUISwarm protocol, which means that it has all of the features of a Swarm plus some "optional added extras." The file that contains the source that controls the user interface for a specific project may be called simply ObserverSwarm.m. In many examples, authors have customized the name of the file to include the name of their project, as in HeatbugObserverSwarm.m or ForestModelSwarm.m
The most prominent of the extra features of the observer swarm is the control panel. The control panel is the familiar set of buttons that can Start and Stop a swarm model. The control panel also can "step" the simulation through its paces one time-unit at-at-time using the Next button. The Save button on the control panel is intended to save the window positions of objects that are able to do so.
Apart from the control panel, what the user sees at run-time is completely dependent on the particular example that is being considered. It is probably safe to say, however, that if one stays within the Swarm library, without adding external support from the Graph library or other toolkits, then there two especially important kinds of display objects that can be created in ObserverSwarm.m. These two are:
The ZoomRaster. In just about any of the common swarm applications, there is some sense of geometry or spatial position. The ZoomRaster graph is the tool that is used to represent the positioning of agents and other objects in that space.
The Data Display Graphs. For the visual presentation of summary information, Swarm provides a set of tools for presenting information in graphic format. Two of the most common sorts are the histogram, which shows the relative frequency of various values occurring in a stream of data, and a line graph which displays the changes over time in one or more variables as a simulation progresses. These capabilities are provided by the Swarm protocols EZDistribution and EZGraph, respectively.
The following sections discuss the achitecture of these two classes of displays in greater depth. Most of the examples for discussion are taken from the Arborgames code provided by Melissa Savage.