Setting Up a Team/Clan/Party Including Chat

Introduction

GameSparks allows your players to easily create Teams which act as groups where players can:

This system can be used for Parties, Clans, Teams, and so on, and is very easy to set up. This tutorial shows you how to set up a Team through an owner, have another player join the Team, and how that new player can send a message to other Team members.

Setting Up a Team Type

To set up a Team Type:

1. Go to the Configurator > Teams.

2. Under Team Types, click to Add a new Team Type. The page adjusts:

3. Enter the configuration details for the new Team Type:

Once you're happy with your configuration, that's all you have to do to create a Team Type for your players to use.

4. Click to Save and Close the new Team Type.

More Details. For more details on Team Type creation and management, click here.

Creating a Team

Once you've created a Team Type, you can allow your players to create Teams as instances of that Team Type. A Team inherits the configuration you've set up for the Team Type and you enable players to create Teams using the SDK's API(CreateTeamRequest):

Request Default

    {
     "@class": ".CreateTeamRequest",
     "teamId": "",
     "teamName": "",
     "teamType": ""
    }

Request Example

    {
     "@class": ".CreateTeamRequest",
     "teamId": "GSTeam",
     "teamName": "GSTeam",
     "teamType": "BASIC_TEAM"
    }

Response

{
  "@class": ".CreateTeamResponse",
  "members": [
    {
    "displayName": "PLAYER_1",
    "externalIds": {},
      "id": "5792408c6cc8e27fffe92149",
      "online": true
    }
    ],
    "owner": {
    "displayName": "PLAYER_1",
    "externalIds": {},
      "id": "5792408c6cc8e27fffe92149",
      "online": true
    },
    "teamId": "GSTeam",
    "teamName": "GSTeam",
    "teamType": "BASIC_TEAM"
}

Joining a Team

Once the Team has been created other players can join it by simply using the JoinTeamRequest and passing in the teamId or ownerId. When the response comes back, it includes the data for the owner, team details, and Team members, which will now be the owner and the player that sent the JoinTeamRequest.

Request Default

    {
     "@class": ".JoinTeamRequest",
     "ownerId": "",
     "teamId": "",
     "teamType": ""
    }

Request Example

    {
     "@class": ".JoinTeamRequest",
     "teamId": "GSTeam"
    }

Response

{
  "@class": ".JoinTeamResponse",
  "members": [
    {
      "displayName": "PLAYER_1",
      "externalIds": {},
        "id": "5792408c6cc8e27fffe92149",
        "online": false
      },
      {
        "displayName": "PLAYER_2",
        "externalIds": {},
        "id": "579240d56cc8e27fffe92360",
        "online": true
      }
      ],
      "owner": {
        "displayName": "PLAYER_1",
        "externalIds": {},
          "id": "5792408c6cc8e27fffe92149",
          "online": false
      },
      "teamId": "GSTeam",
      "teamName": "GSTeam",
      "teamType": "BASIC_TEAM"
}

Team Chat

GameSparks allows players to send messages to the team easily using the native SendTeamChatMessageRequest, which sends a message to every player that is part of the Team. When the message is sent, it can be caught by listeners in the SDK and outputted to the player easily because it contains data about the sender, the Team, the message, and Team owner ID.

Request Example

    {
     "@class": ".SendTeamChatMessageRequest",
     "message": "Hi guys!",
     "teamId": "GSTeam"
    }

Message


{
  "@class": ".TeamChatMessage",
  "chatMessageId": "582301163a32df0491c47069",
  "fromId": "579240d56cc8e27fffe92360",
  "message": "Hi Guys!",
  "messageId": "582301163a32df0491c47075",
  "notification": true,
  "ownerId": "5792408c6cc8e27fffe92149",
  "playerId": "579240d56cc8e27fffe92360",
  "summary": "TeamChatMessage",
  "teamId": "GSTeam",
  "teamType": "BASIC_TEAM",
  "who": "PLAYER_2"
}

Did this page help you? Please enter your feedback below. For questions about using this part of the platform, please contact support here