Plugins and Extension Data #

Plugins and extension data are the backbone of Pragma Engine customization. They allow users to implement rich features with custom data and logic within the full fledged capabilities of the engine.

Plugins #

Plugins are defined as a Kotlin interface with an annotation specifying it as a plugin. Generally the engine will define a plugin to support a specific service, and it can then be implemented by users and configured for use within the plugin section of the config file. The engine handles loading and initializing plugins at runtime.

Plugins support custom configuration, allowing users to define their own configuration parameters.

Examples
  • The MatchmakingStrategy plugin allows users to define specific matchmaking rules.

  • The ItemInitializer plugin allows users to supply custom instance data for their player inventory data.

Extension Data #

Extension data is closely tied to plugins and provide a standard way for users to define custom structured data within the engine.

Extension protobuf types are predefined by the engine and placed in a shared directory with no defined fields. This allows Pragma Engine code to reference, serialize, deserialize, store, and retrieve extension data. Engine code never inspects the internal fields, which allows them to be defined and managed by users with game-specific details.

In this way the engine handles validation, routing, and storage while the user is responsible for defining their game-specific data and features for their game-specific logic.

Example

When a match is completed, the game server sends a MatchEnd payload to the platform for processing. MatchEnd includes engine-defined fields for granting inventory and granting rewards. It also includes an ext field that contains game-specific data defined by the user. In this example, we’ll assume it includes heroId and heroXp fields to support player progression.

When the engine receives the payload, it parses and validates the data and forwards it to various services. The Progression service then defines a plugin that receives the MatchEnd payload.

Users then implement a plugin with strongly typed access to their heroId and heroXp fields. These fields are then used to calculate and save level up events. The engine takes the results of the plugin and opaquely stores the player data in the database.