Skip to main content
Version: 🚧 Alpha 🚧

Architecture of GAMA

GAMA is an Eclipse RCP application made of OSGi bundles (Eclipse plugins), grouped into features that are assembled into two products (desktop and headless). The projects are organized at the root of the gama repository; the main Maven/Tycho build is coordinated by gama.parent, while gama.annotations and gama.processor are built separately beforehand.

  • A plugin (bundle) is a Java project with a META-INF/MANIFEST.MF (and often a plugin.xml). Its dependencies are declared in the Require-Bundle header of the manifest.
  • A feature is an Eclipse project centered on a feature.xml that lists plugins and other features. Features are the units installed by the update site.
  • A product (gama.product/gama.product, gama.product/gama.headless.product) lists the features that make up a runnable application.

To create a new plugin, use the New GAMA Plugin wizard supplied by the GAMA Developer Tools Eclipse plugin. The GAMA menu and GAMA-specific toolbar buttons are recommended shortcuts added by that plugin; without it, create and configure the plugin manually as described in Developing Plugins.

The projects​

Language and core​

ProjectRole
gama.annotationsThe Java annotations (@operator, @skill, @species, @symbol, @type, @doc, ...) used to declare GAML elements, and gama.annotations.constants.IKeyword. Has no dependency and targets JavaSE-21, as it is also loaded by the annotation processor inside Eclipse.
gama.processorThe annotation processor. It reads the annotations of each GAMA plugin at compile time and generates gaml/gaml/additions/<shortcut>/GamlAdditions.java (plus documentation and tests). It is used through the prebuilt gama.processor.jar, referenced by the .factorypath of each plugin.
gama.devLow-level developer utilities used everywhere: gama.dev.DEBUG (logging, timers) and gama.dev.FLAGS (system properties).
gama.dependenciesBundles the external Java libraries used by GAMA (JTS, GeoTools, JGraphT, StreamEx, Fory, JFreeChart, ... in libs/). Plugins must reuse them rather than embed their own copies.
gaml.grammarThe Xtext grammar of GAML (src/gaml/grammar/Gaml.xtext) and its MWE2 generator (Generate_GAML_Artefacts.mwe2). It is only needed to regenerate the parser, which is written into gaml.compiler/src-gen and gama.ui.editor/src-gen (GAMA > Repair GAMA plugins > Regenerate Xtext grammar). It is not part of the runtime.
gama.apiThe public API: interfaces (IAgent, IScope, IShape, IList, IType...), the static factories (GamaListFactory, GamaPointFactory...), the types (Types), the runtime entry point gama.api.GAMA, and the loader of language extensions (gama.api.additions.GamaBundleLoader). It also declares the extension points used by the other plugins. See Introduction to the GAMA Java API.
gaml.compilerThe GAML compiler (parser, validation, scoping, descriptions, expressions), built on Xtext. Depends on gama.api.
gama.coreThe implementation: agents, populations, simulations and experiments, topologies, outputs, and most of the built-in GAML operators (gama.gaml.operators), statements (gama.gaml.statements), skills (gama.gaml.skills) and architectures. Its activator (gama.core.CoreActivator) installs the concrete factories into gama.api and loads all the language additions.
gama.workspaceIntegration with the Eclipse workspace: GAMA project natures, models manager, status messages.
gama.headlessThe runtime without user interface (batch, server mode, tests). Defines the gama.headless.product application.
gama.libraryThe models library (examples, tutorials) and model tests shipped with GAMA.
gama.documentationTools that generate the GAML reference documentation. Not part of the products.

Extensions​

gama.extension.* plugins add GAML vocabulary (operators, skills, species, types, file formats...) on top of the core. They usually depend on gama.core, gama.api and gama.dependencies:

PluginContents
gama.extension.batchExploration and calibration methods for batch experiments
gama.extension.bdiThe BDI (Belief-Desire-Intention) architecture
gama.extension.databaseSQL databases access
gama.extension.dataframe, gama.extension.rdsData frames and R data files
gama.extension.fipaFIPA communication between agents
gama.extension.imageThe image type and image manipulation
gama.extension.mathsDifferential equations and solvers
gama.extension.networkNetwork communication (TCP, UDP, MQTT, WebSockets, HTTP, serial)
gama.extension.osm, gama.extension.gml, gama.extension.kml, gama.extension.dxf, gama.extension.geopackageGeographic file formats
gama.extension.pedestrian, gama.extension.trafficPedestrian and traffic skills
gama.extension.physicsPhysics engine
gama.extension.serializeSaving and restoring agents and simulations
gama.extension.soundSound
gama.extension.statsAdvanced statistics

Community plugins (R, Weka, Matlab, the graphical editor...) live in separate repositories, mostly in the gama-platform-plugins organization. With GAMA Developer Tools installed, they can be imported with GAMA > Install GAMA sources > Install community plugins... (see Installing the development version); without the plugin, import a cloned repository with Eclipse's File > Import... > Existing Projects into Workspace. Community plugins can also be installed in a release (see Using extensions).

User interface​

PluginRole
gama.ui.applicationThe Eclipse application (gama.ui.application.Application), workbench setup
gama.ui.sharedShared UI components, preferences, dialogs, the IGui implementation (gama.ui.shared.utils.SwtGui)
gama.ui.editorThe GAML editor (Xtext UI)
gama.ui.navigatorThe models navigator
gama.ui.viewersViewers for files (images, shapefiles, CSV, ...)
gama.ui.experimentExperiment views: parameters, inspectors, consoles, monitors
gama.ui.display.java2d2D displays
gama.ui.display.opengl, gama.ui.display.opengl43D displays (opengl4 is the OpenGL 4.1 shader-based renderer)

Export, features and build​

ProjectRole
gama.export, gama.ui.exportExporting models as stand-alone simulation launchers (see Exporting projects). gama.export.DocumentApplication is the application started by the desktop product: it opens documents and delegates to gama.ui.application.
gama.feature.*The features (see below)
gama.productThe product definitions (gama.product, gama.headless.product), launcher icons and plugin_customization.ini
gama.p2siteThe p2 update site (category.xml)
gama.parentThe Maven/Tycho parent POM. Its <modules> lists every project of the build. gama.annotations and gama.processor are built separately, before it (see Creating a release of GAMA).

Dependencies between the main plugins​

The graph below shows selected direct Require-Bundle relationships; Eclipse and third-party bundles are omitted, as are most transitive edges. Extension plugins vary in their requirements: some depend on gama.api, some on gama.core, and some on both.

Notes:

  • gama.api does not depend on gama.core. Plugins that only use interfaces and factories can depend on gama.api alone; plugins that subclass implementation classes (e.g. gama.core.population.AbstractPopulation, gama.core.object.GamlObject) also need gama.core.
  • gama.headless requires some extensions directly (gama.extension.traffic, maths, database, network).
  • Some UI plugins require extensions for their viewers (e.g. gama.ui.navigator requires gama.extension.osm and gama.extension.gml; gama.ui.display.java2d requires gama.extension.image).

Features and products​

FeaturePlugins
gama.feature.coreCore runtime, compiler, workspace, processor and standard extensions such as batch, maths, statistics, traffic and data access plugins
gama.feature.dependenciesgama.dependencies and the third-party bundles it needs
gama.feature.extensionsStandard extensions: bdi, fipa, physics, pedestrian, serialize, ...
gama.feature.extension.image / .sound / .statsOne extension each
gama.feature.librarygama.library
gama.feature.uigama.ui.application, gama.ui.shared
gama.feature.ui.dependenciesEclipse UI bundles needed by GAMA
gama.feature.ui.editorgama.ui.editor, gama.ui.navigator, gama.ui.viewers
gama.feature.ui.experimentgama.ui.experiment, gama.ui.display.java2d, gama.ui.display.opengl, gama.ui.display.opengl4
gama.feature.exportgama.export
gama.feature.ui.exportgama.ui.export

The feature and product files are the reference for their exact contents: check gama.feature.*/feature.xml and gama.product/*.product. The diagrams below summarize those declarations; they do not show every transitive dependency.

Product feature sets​

The product files list the features assembled into each application:

  • Headless (gama.product/gama.headless.product) lists gama.feature.core, gama.feature.library, gama.feature.extensions, gama.feature.dependencies, gama.feature.extension.image only.
  • Desktop (gama.product/gama.product) lists gama.feature.core, gama.feature.library, gama.feature.extensions, gama.feature.dependencies, gama.feature.ui, gama.feature.ui.editor, gama.feature.ui.experiment, gama.feature.ui.dependencies, gama.feature.export, the image/sound/statistics extension features.

In a development workspace, the GAMA Developer Tools plugin adds the GAMA > Get started..., Install GAMA sources and Check workspace... commands. These are recommended shortcuts. Without the plugin, follow the manual setup in Installing the development version: import projects into Eclipse or build them with Maven, then configure a launch. The source installer imports the projects in gama.parent/pom.xml plus gama.annotations, gama.processor and gaml.grammar when required.

How language extensions are loaded​

A plugin contributes to GAML by declaring the gaml.extension extension point (defined in gama.api/plugin.xml) in its plugin.xml, e.g. gama.extension.stats/plugin.xml:

<plugin>
<extension point="gama.standard.distribution">
</extension>
<extension point="gaml.extension">
</extension>
</plugin>

(gama.standard.distribution marks plugins that are part of the standard GAMA distribution.)

At compile time, gama.processor generates, for a plugin whose symbolic name ends with <shortcut> (the last segment of the name), the class gaml.additions.<shortcut>.GamlAdditions in the gaml/ source folder (e.g. gama.extension.stats/gaml/gaml/additions/stats/GamlAdditions.java). This code registers every annotated operator, skill, species, type, statement... Never edit it: it is regenerated at each build (GAMA > Clean GAMA plugins deletes and regenerates all the gaml/ folders).

At startup, gama.core.CoreActivator initializes the factories, then calls GamaBundleLoader.buildContributions() (gama.api/src/gama/api/additions/GamaBundleLoader.java):

  • gama.api and gama.core are loaded first; if they fail, GAMA exits. A failing additional plugin is reported and skipped.
  • In headless mode, the display plugins are not loaded.
  • Other extension points declared by gama.api let plugins provide implementations of delegates: gama.create (create from new data sources), gama.save (new file formats for save), gama.draw, gama.event_layer, gama.display (display surfaces), gama.experiment, gama.constants, gama.metadata and gama.server_command.
  • Models placed in the models/ folder of a plugin are added to the library; tests in models/Tests are added to the tests.