Utrecht University Crowd Simulation API
Getting Started 2: Using the API - GUI Demo

Table of Contents

This page explains how to use the UUCS API to run and visualize a crowd simulation experiment.

This tutorial is based on the GUIDemo project included in the UUCSDemos solution.

Angelos Kremyzas

To compile and run the demo described in this tutorial see Compiling the GUIDemo. It is recommended that you are familiar with the ConsoleDemo before reading this tutorial. See Getting Started 1: Using the API - Console Demo for the tutorial on the ConsoleDemo.

GUI Demo


The GUI demo employs three basic classes to implement the application:

  1. The InputHandler class, which is responsible for the interanction part of the application.
  2. The SimulationHandler class, which is responsible for the simulation part of the application. The SimulationHandler communicates with the UUCS API using a UUCSAdapter object. See The UUCSAdapter Class for more info.
  3. The Visualizer class, which is responsible for the visualization part of the application.

Additionally we have explicitly defined the Environment and Character classes for describing the virtual environment and the simulated pedestrians respectively in the GUIDemo program. These classes correspond to the EnvironmentData and CharacterStepData API definitions. In our demo program, the SimulationHandler uses these classes to store, update and visualize the simulation information.

The UUCSAdapter Class

For the purpose of the GUI demo we have created the UUCSAdapter class, which is a wrapper class for the UUCS API as defined in UUCS.h.

The UUCSAdapter provides functionality equivalent to the full set of the API functions, but is also enhanced with some auxiliary functionality. Most importantly, the UUCSAdapter::initializePipeline() function helps initializing the whole simulation pipeline by simply providing the corresponding SimulationSettings. The adapter also includes functions for getting version information for the API (UUCSAdapter::getMajorVersion(), UUCSAdapter::getMinorVersion(), UUCSAdapter::getPatchVersion(), UUCSAdapter::getVersion() and UUCSAdapter::isVersionAtLeast()). Finally, a set of member functions relevant to population and environment changes can help to efficiently keep track of simulation information (UUCSAdapter::hasCrowdCompositionChanged(), UUCSAdapter::setCrowdCompositionChanged(), UUCSAdapter::hasEnvironmentChanged() and UUCSAdapter::setEnvironmentChanged()).