# Gamedeploymenttemplate

The GameDeploymentTemplate indicates which \[game server] [ApplicationBuilds](https://docs.i3d.net/game-hosting/elements/application/applicationbuild) you want to have deployed within a [Fleet](https://docs.i3d.net/game-hosting/elements/deploymentenvironment/fleet).

<figure><img src="https://3255620342-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTxqXHcEUC6lhXmjD6wE0%2Fuploads%2Fclis0j0zywfVnc615jQe%2FDeploymentConfigurationOverviewGameDepTempl.png?alt=media&#x26;token=5aaaf4e0-8eba-4319-bc77-dd1581ab2a4a" alt=""><figcaption></figcaption></figure>

Figure 1: Highlighting where the GameDeploymentTemplate elements belong in the overview

## Usage

A GameDeploymentTemplate is used by a [Fleet](https://docs.i3d.net/game-hosting/elements/deploymentenvironment/fleet) and defines which ApplicationBuilds (of type Game) will be deployed for that Fleet. A single GameDeploymentTemplate can define more than one ApplicationBuild by adding multiple [GameDeploymentTemplateBuild](#gamedeploymenttemplatebuild-element-structure) elements. Each of these defines a single (ApplicationBuild (of type Game).

Each ApplicationBuild defined in a template will be treated like individually scalable builds. If you set a Fleet's operational status to ["Automatic Deployment"](https://docs.i3d.net/processes/automatic-deployment#automatic-deployment_1), each build will be deployed individually according to the [DeploymentProfile.minimumCapacity](https://docs.i3d.net/processes/automatic-deployment#minimum-capacity-deployments) value. Similarly, when you set the Fleet's operational status to ["Automatic Scaling"](https://docs.i3d.net/processes/automatic-deployment#automatic-scaling), each build will be automatically scaled individually. In short, each ApplicationBuild in the GameDeploymentTemplate is treated individually. No relationship between the defined ApplicationBuilds exists.

You can create as many GameDeploymentTemplates as you like within the platform. However, a Fleet can only point to one GameDeploymentTemplate at a time. A GameDeploymentTemplate can be shared (re-used) across multiple fleets though.

## Element structure

| Property                    | Value type                                                                       | Required  | Description                                                                                                          |
| --------------------------- | -------------------------------------------------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------- |
| id                          | string                                                                           | Read-only | Unique identifier of this element                                                                                    |
| fleetIds                    | \[int]                                                                           | Read-only | List of [Fleet](https://docs.i3d.net/game-hosting/elements/deploymentenvironment/fleet) IDs this template is used in |
| name                        | string                                                                           | Yes       | Name of the template                                                                                                 |
| inUse                       | boolean                                                                          | Read-only | Indicates whether this template is actively being used in a Fleet                                                    |
| createdAt                   | int                                                                              | Read-only | A unix timestamp of when this element was created                                                                    |
| gameDeploymentTemplateBuild | \[[GameDeploymentTemplateBuild](#gamedeploymenttemplatebuild-element-structure)] | Yes       | List of GameDeploymentTemplateBuild elements, pointing to ApplicationBuilds                                          |

Table 1: GameDeploymentTemplate element structure

## GameDeploymentTemplateBuild element structure

| Property           | Value type | Required | Description                                                                                                                      |
| ------------------ | ---------- | -------- | -------------------------------------------------------------------------------------------------------------------------------- |
| applicationBuildId | string     | Yes      | Identifier of the [ApplicationBuild](https://docs.i3d.net/game-hosting/elements/application/applicationbuild) you want to deploy |

Table 2: GameDeploymentTemplateBuild element structure

## API example

Create a new GameDeploymentTemplate within your i3D.net account.

[Full API reference](https://docs.i3d.net/api/api_one#v3-deploymenttemplate-game)

#### HTTP request

[`POST /v3/deploymentTemplate/game`](https://docs.i3d.net/api/api_one#v3-deploymenttemplate-game)

#### Request body

```
{
  "name": "MyGameDeploymentTemplate",
  "gameDeploymentTemplateBuild": [
    {
      "applicationBuildId": "3776948653267321543"
    }
  ]
}
```

#### Response body

```
[
  {
    "id": "6537333393893172977",
    "fleetIds": [
      0
    ],
    "name": "MyGameDeploymentTemplate",
    "inUse": 0,
    "createdAt": 1573060361,
    "gameDeploymentTemplateBuild": [
      {
        "applicationBuildId": "3776948653267321543"
      }
    ]
  }
]
```

## Attach GameDeploymentTemplate to a Fleet:

[Full API reference](https://docs.i3d.net/api/api_one#v3-fleet)

#### HTTP request

[`PUT /v3/fleet/{fleetId}`](https://docs.i3d.net/api/api_one#v3-fleet-fleetid)

#### Request body

```
{
  "gameDeploymentTemplateId": "6537333393893172977",
}
```

#### Response body

```
[
  {
    "id": "string",
    "name": "string",
    "deploymentEnvironmentId": "string",
    "deploymentProfileId": "string",
    "gameDeploymentTemplateId": "6537333393893172977",
    "utilityDeploymentTemplateId": "string",
    "operationalStatus": 0
  }
]
```

## Related topics

* [Orchestrator Overview](https://docs.i3d.net/game-hosting/game-integration/orchestratoroverview)
* [Game Deployment Quick Start Guide](https://docs.i3d.net/game-hosting/overview/quick-start)
* [i3d.net API documentation](https://www.i3d.net/docs/api/v3/all/)
