> For the complete documentation index, see [llms.txt](/llms.txt)

# Characters

Handles character ownership, level, and experience.




**About this demo**

The demo signs in automatically with an anonymous account. The account is shared across every demo in the showroom, so items and currency you get in one demo carry over to the others. Loading takes a moment. If the frame is too small, open the demo in a new tab.

## Overview

Recruit any of four characters (`knight`, `mage`, `archer`, `healer`) for free, then train them to gain experience and levels. Every recruit uses one slot of your roster and appears as its own row under **Train a character**. Each character keeps its own experience and level, with a level cap of 10.

## How to try it

1. Under **Recruit a character**, press **Recruit** next to **Recruit knight** (or another character) to get one of that character.
1. **Slots** under **Your characters** goes up, for example to `1 of 20 used`. Recruiting the same character again adds a separate copy.
1. A row for the new character appears under **Train a character**, with its name in **Id** and its level and cap in **Level**, such as `1/10`.
1. Press **Train** on a row to give that character alone 40 experience; the gauge fills, and the level goes up each time a threshold is passed.
1. Keep training and the level stops at the cap of 10.

## GS2 services used

- [GS2-Inventory](/microservices/inventory/): GS2-Inventory's `Character` inventory defines the roster (20 slots to start, 100 at most) and an item model per character, and holds the characters the player owns. Each stack holds one character and multiple stacks are allowed, so two knights are two rows.
- [GS2-Experience](/microservices/experience/): GS2-Experience's experience model defines each character's experience, level, level cap (10 by default, 30 at most) and the experience thresholds. Experience is tracked per character item set.
- [GS2-Exchange](/microservices/exchange/): GS2-Exchange rate models define the buttons: **Recruit** acquires a character (`Gs2Inventory:AcquireItemSetByUserId`) and **Train** adds experience to the pressed character (`Gs2Experience:AddExperienceByUserId`), each run server-side as a free transaction.

## Use it in GS2 Studio

In GS2 Studio's Simple mode, open **Add features** and press **Add** on **Characters** to bring this feature into your own project. To point at the package directly, choose **Add from GitHub** and enter the package below.

```text
https://github.com/gs2io/gs2-studio-package/tree/main/foundation-economy-character/packages/foundation-economy-character
```

- Owner: `gs2io`
- Repository: `gs2-studio-package`
- Subdirectory: `foundation-economy-character/packages/foundation-economy-character`

## Source code

- Demo project: <https://github.com/gs2io/gs2-studio-package/tree/main/foundation-economy-character/live-demo>
- Feature package: <https://github.com/gs2io/gs2-studio-package/tree/main/foundation-economy-character>



