# GameFeatureData

## Reality Game Feature Data

`Reality Game Feature Data` is a configurable asset used to add modular gameplay features.

> Use this asset when you want to add modular systems to a game without hardcoding them directly into the GameMode.

A feature can provide:

* client-side objects,
* globally replicated objects,
* team-specific objects,
* optional UI widgets,
* initialization and cleanup logic,
* hooks for player clients and team instances.

***

## Overview

| Feature          | Description                           |
| ---------------- | ------------------------------------- |
| Client Object    | Per-client feature object             |
| Global Object    | Shared replicated feature object      |
| Team Object      | Team-specific feature object          |
| Feature Widget   | Optional widget used by the feature   |
| Initialization   | Called when the feature starts        |
| Deinitialization | Called when the feature ends          |
| Client Hooks     | Reacts by client are added or removed |
| Team Hooks       | Reacts by team are created            |

***

## Object Types

A feature can spawn and manage different object types depending on where the logic should live.

### Properties

| Name                           | Type  | Description                                       |
| ------------------------------ | ----- | ------------------------------------------------- |
| Client Object Class            | Class | Feature object created for each client            |
| Global Replicated Object Class | Class | Shared replicated feature object                  |
| Team Object Class              | Class | Feature object created for each team              |
| Feature Widget Class           | Class | Optional widget that can be created on the client |

***

## Initialization Lifecycle

### Events

| Name                     | Type  | Description                              | Inputs |
| ------------------------ | ----- | ---------------------------------------- | ------ |
| Feature Initialization   | Event | Called when the feature is initialized   | —      |
| Feature Deinitialization | Event | Called when the feature is deinitialized | —      |

***

## Client Lifecycle

A feature can react when a new client is registered or removed.

### Events

| Name          | Type  | Description                                      | Inputs                |
| ------------- | ----- | ------------------------------------------------ | --------------------- |
| On New Client | Event | Called when a new client is added to the feature | Client, Client Object |
| Remove Client | Event | Called when a client is removed from the feature | Client, Client Object |

***

### Functions

| Name                      | Type     | Description                                                   | Inputs | Outputs               |
| ------------------------- | -------- | ------------------------------------------------------------- | ------ | --------------------- |
| Get Global Feature Object | Callable | Returns the shared replicated feature object                  | —      | Global Feature Object |
| Get Client Object Map     | Callable | Returns the mapping between clients and their feature objects | —      | Client/Object Map     |
| Get Client Objects        | Callable | Returns all feature client objects                            | —      | Client Object Array   |

***

## Team Lifecycle

If the game mode supports teams, a feature can also create team-specific objects.

### Events

| Name               | Type  | Description                                  | Inputs                    |
| ------------------ | ----- | -------------------------------------------- | ------------------------- |
| On New Team Object | Event | Called when a team feature object is created | Team, Team Feature Object |

***

### Functions

| Name             | Type     | Description                                                 | Inputs | Outputs                   |
| ---------------- | -------- | ----------------------------------------------------------- | ------ | ------------------------- |
| Get Team Object  | Callable | Returns the mapping between teams and their feature objects | —      | Team/Object Map           |
| Get Teams Object | Callable | Returns all team feature objects                            | —      | Team Feature Object Array |

***

## Feature Architecture

| Layer  | Description                             |
| ------ | --------------------------------------- |
| Client | One feature object per client           |
| Global | One shared replicated feature object    |
| Team   | One feature object per team             |
| UI     | Optional widget for client-side display |

***

## Typical Use Cases

| Use Case                                           | Recommended Setup                  |
| -------------------------------------------------- | ---------------------------------- |
| Add a modular replicated gameplay system           | Use Global Replicated Object Class |
| Give each player a feature-specific runtime object | Use Client Object Class            |
| Add team-based feature logic                       | Use Team Object Class              |
| Display feature UI to players                      | Use Feature Widget Class           |
| Run setup logic when the feature starts            | Use Feature Initialization         |
| Clean up the feature when it ends                  | Use Feature Deinitialization       |
| React when players connect to the feature          | Use On New Client                  |
| React when team feature objects are created        | Use On New Team Object             |

***

## Blueprint Events Summary

| Name                     | Description                                      |
| ------------------------ | ------------------------------------------------ |
| Feature Initialization   | Called when the feature starts                   |
| Feature Deinitialization | Called when the feature ends                     |
| On New Client            | Called when a client is registered               |
| Remove Client            | Called when a client is removed                  |
| On New Team Object       | Called when a new team feature object is created |

***

## Notes

| Topic              | Note                                                                  |
| ------------------ | --------------------------------------------------------------------- |
| Modular Design     | Features are intended to be reusable gameplay modules                 |
| Team Support       | Team objects are only relevant if the current GameMode supports teams |
| Client Support     | Client objects are useful for player-specific feature logic           |
| Global Replication | Global feature objects are ideal for shared replicated state          |
| UI Support         | Widget creation is optional and feature-dependent                     |

***

## Related Pages

| Page               | Description                                          |
| ------------------ | ---------------------------------------------------- |
| Reality Game Data  | Stores default game features                         |
| Reality GameMode   | Main GameMode that can use features                  |
| Reality Team       | Team instance that can store team feature objects    |
| Reality Game Phase | Can interact with modular features during phase flow |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://beyond-sandbox.gitbook.io/realitysdk/documentation/gamemode/game-feature-system/gamefeaturedata.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
