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). All the projects live at the root of the gama repository and are built by Maven/Tycho from gama.parent.

Vocabulary

  • 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 a project containing only 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 of the developer tools (see 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. They can be imported with GAMA > Install GAMA sources > Install community plugins... (see Installing the development version) or 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 is simplified from the Require-Bundle headers (Eclipse and third-party bundles are omitted, as well as most transitive edges).

graph BT
annotations[gama.annotations]
processor[gama.processor] --> annotations
dev[gama.dev]
dependencies[gama.dependencies] --> dev
dependencies --> annotations
api[gama.api] --> dependencies
api --> processor
compiler[gaml.compiler] --> api
core[gama.core] --> api
core --> compiler
workspace[gama.workspace] --> api
ext["gama.extension.*"] --> core
headless[gama.headless] --> core
headless -.-> ext
uiapp[gama.ui.application] --> core
uiapp --> workspace
uishared[gama.ui.shared] --> uiapp
editor[gama.ui.editor] --> uishared
editor --> compiler
navigator[gama.ui.navigator] --> uishared
experiment[gama.ui.experiment] --> uishared
displays["gama.ui.display.*"] --> experiment
grammar[gaml.grammar] -. generates .-> compiler

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​

graph LR
subgraph gui[gama.product]
fcore[gama.feature.core]
fdeps[gama.feature.dependencies]
flib[gama.feature.library]
fext[gama.feature.extensions]
fimg[gama.feature.extension.image]
fsnd[gama.feature.extension.sound]
fstats[gama.feature.extension.stats]
fui[gama.feature.ui]
fuideps[gama.feature.ui.dependencies]
fedit[gama.feature.ui.editor]
fexp[gama.feature.ui.experiment]
fexport[gama.feature.export]
end
subgraph headlessp[gama.headless.product]
hcore[gama.feature.core]
hdeps[gama.feature.dependencies]
hlib[gama.feature.library]
hext[gama.feature.extensions]
himg[gama.feature.extension.image]
end
FeaturePlugins
gama.feature.coregama.annotations, gama.processor, gama.dev, gama.dependencies, gama.api, gaml.compiler, gama.core, gama.workspace, gama.headless, and the extensions batch, maths, stats, traffic, network, database, osm, gml, kml, geopackage, dataframe, rds
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.ui.export
gama.feature.copilotGitHub Copilot for Eclipse (published on the update site, not included in the product)

The feature files are the reference: check gama.feature.*/feature.xml for the exact current lists.

Minimal configuration​

What is needed to run GAMA follows from the products:

  • Headless (gama.headless.product): the plugins of gama.feature.core, gama.feature.dependencies, gama.feature.extensions, gama.feature.extension.image and gama.feature.library. The strict minimum to compile and run a simple model is gama.dev, gama.annotations, gama.dependencies, gama.api, gaml.compiler, gama.core, gama.workspace and gama.headless together with the extensions it requires.
  • Desktop (gama.product): all the features listed above.

In a development workspace, start with GAMA > Get started... to check the environment, register JDK 25, install sources, build and configure a launch. The individual GAMA > Install GAMA sources > Install core plugins... command is also available. It imports the projects of gama.parent/pom.xml plus gama.annotations, gama.processor and gaml.grammar (required when missing). GAMA > Check workspace... reports projects or target-platform bundles missing for the desktop product. See Installing the development version.

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):

sequenceDiagram
participant C as CoreActivator (gama.core)
participant L as GamaBundleLoader (gama.api)
participant R as Extension registry
participant G as GamlAdditions
C->>C: initializeFactories()
C->>L: buildContributions()
L->>R: plugins contributing to "gaml.extension"
L->>G: loadGamlExtensions(gama.api), then (gama.core)
loop other plugins, ordered by their dependencies
L->>G: loadGamlExtensions(bundle): new gaml.additions.{shortcut}.GamlAdditions().initialize()
end
L->>R: delegates: gama.create, gama.save, gama.draw,<br/>gama.event_layer, gama.metadata, gama.server_command, ...
  • 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.