User Interface Design

With both the fluidity and realism of the flocking simulation dependent on the large range of variables controlling everything from agent density to angle of perception, it is important to provide a user interface to allow for fast, dynamic control of all variable inputs. Java Swing offers a host of configurable input devices that can be used to control variable parameters. Device choice requires careful assessment of the type of underlying variable data involved and the level of control required.

The following "J" Components are available for use within the swing interface:
JComponentDescription
JCheckBox/JToggleButton Useful for controlling Boolean values
JComboBox User-friendly input providing a limited parameter selection
JList Offers a list of items similar to the combo box however JList allows for multiple selections at any one time. This may be a useful feature when choosing a subset of steering behaviors for flocking agents or predators to obey
JMenu A good way of dividing options between a series of categories or menu headings
JRadioButton A series of radio buttons can be combined to offer a limited number of options
JSlider Offers an analogue means of soliciting input from a user. JSlider can also be configured to include visible tick marks and labels
JTextFieldSupports direct user input and input validation mechanisms

Parameter assessment:
ParameterDescriptionData TypeData RangeSwing Component
initialNumAgents The number of flocking agents in the simulation at any given time. Dynamically decrementing this number should remove agents in reverse of the order they were added int 1 -> infinity JTextField
maxSpeed Limits the maximum speed (in pixels per second) of all agents in the simulation double 1.0 -> 20.0 JTextField
pRadius The radius of the perception area in pixels double 5.0 -> ~300.0 The dimensions controlling the area of perception of the agent would be easily manipulated using JSliders. The user should also be provided with a visualisation to monitor how the changes to the dimensions affect the shape of the area. This will require advanced swing coding therefore initially i shall use JTextFields to elicit input
pAngle The angle (in degrees) of perception that subtends from both sides of the agents current heading vector double 1.0 -> 180.0
current_weight These parameters are used to weight the importance of each vector component for use in the agent's navigational algorithm. It is not the discrete values of each weighting that are important, but the relationship between all four. To aid with the visualisation of this relationship and to avoid over complicating the user interface i will use a JSlider to control each of the weightings int 0 -> JSlider
sep_weight int 0 ->
coh_weight int 0 ->
alg_weight int 0 ->

Initial UI CSS Prototype

Agent Constraints
Number Of Agents
Maximum Agent Speed
pixels/second

Radius Of Perception
pixels
Angle Of Perception
degrees
Flocking Rule Weightings
CurrentHeading
20%
Seperation
60%
Cohesion
10%
Alignment
10%