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

# Guilds

Handles player guilds: capacity, permission roles, and which guild a player belongs to.




**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

Found a guild that every showroom visitor shares, or find one another visitor founded and join it. A guild either lets anybody join or has the master approve each request, and the master can answer join requests, hand the guild over, or disband it. A guild starts with room for 5 and can grow to 10, and each player belongs to one guild at a time.

## How to try it

1. Type a guild name into **Name your guild** under **Guild lobby**. To require approval, press **Join policy: anybody joins (press to change)** so it reads **the master approves**.
1. Press **Create a guild with this name**. The lobby shows the guild's name, head count and members (you as **master**), and **Your guild** shows **You are a member. The lobby above shows which guild.** and **Room for 5, up to 10**.
1. Open this demo in another browser (or a private window); the guild appears under **Guilds you can join**. Press **Join ...** for an open guild, or **Ask to join ...** for one that needs approval.
1. For an approval guild, the master sees the request under **Requests to join** and presses **Accept ...** or **Decline ...**.
1. A member leaves with **Leave the guild**. A master with other members presses **Hand over to ... and leave**; a master alone presses **Disband the guild**.

Guilds are shared by every showroom visitor, so guilds other visitors founded may also appear under **Guilds you can join**. Joins, leaves and requests reach the other player's page right away through notifications.

## GS2 services used

- [GS2-Guild](/microservices/guild/): GS2-Guild defines the guild kind `adventurers` (room for 5, up to 10, one guild per player) with two roles, master and member, and holds the guilds, their members and join requests. The master acts as the guild and can only answer requests, hand over and disband, as the master role's policy allows.

## Use it in GS2 Studio

In GS2 Studio's Simple mode, open **Add features** and press **Add** on **Guilds** 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-social-guild/packages/foundation-social-guild
```

- Owner: `gs2io`
- Repository: `gs2-studio-package`
- Subdirectory: `foundation-social-guild/packages/foundation-social-guild`

## Source code

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



