Skip to content

Commit

Permalink
Add SSC docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hakusaro committed Oct 19, 2022
1 parent 449d573 commit ee2d9de
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 3 deletions.
7 changes: 5 additions & 2 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
* [☕️⚡️ TShock documentation home](/)
* [Changelog](/changelog.md)
* [Command line parameters](/command-line-parameters.md)
* [Tile providers](/tile-providers.md)
* [Message of the day](/motd.md)

* Subsystems
* [Tile providers](/tile-providers.md)
* [Message-of-the-day](/motd.md)
* [Server-side characters](/ssc.md)

* Field definitions
* [Permissions](/permission-descriptions.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/ssc-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The starting default health for new players when SSC is enabled.
## StartingInventory
The starting default inventory for new players when SSC is enabled.
* **Field type**: `List`1`
* **Default**: `System.Collections.Generic.List`1[TShockAPI.NetItem]`
* **Default**: `System.Collections.Generic.List\`1[TShockAPI.NetItem]`

## StartingMana
The starting default mana for new players when SSC is enabled.
Expand Down
96 changes: 96 additions & 0 deletions docs/ssc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
Unlike many games (e.g., Minecraft), Terraria, by default, allows players to bring characters from single-player or from other multiplayer servers with them server-to-server. This has benefits and drawbacks. While players can enjoy the freedom of finding items and working with their friends in co-op, it poses obvious security questions. After all, if a player can get items from anywhere, that means they can bring those items into worlds that haven't yet reached that point in game-progression yet. Worse still, they may have acquired the items through illicit means.

Introduced through a collaboration between Zidonuke and Re-Logic, Terraria supports the concept of server-side characters, with a compatible server replacement. The base game supports server-side characters, but does not implement the storage backend or synchronization system. When enabled, game clients no-longer persist data to disk, and give the server authority over many aspects (but not all) of the local data.

When enabled in TShock, SSC takes over control of inventory management for a player. In this mode, players are given a starting inventory, described by the server owner, and then they retain that inventory only as long as they're connected to the server. When they disconnect, their original character data will still be saved locally, ensuring they don't lose local data.

For developers, TShock's SSC implementation should be considered the reference implementation. More things are possible with this system than what TShock does.

## Setting up SSC

To setup SSC, simply change `Enabled` to `true` in `sscconfig.json` in the `tshock` config folder.

An example configuration file is provided:

```json
{
"Settings": {
"Enabled": true,
"ServerSideCharacterSave": 5,
"LogonDiscardThreshold": 250,
"StartingHealth": 100,
"StartingMana": 20,
"StartingInventory": [
{
"netID": -15,
"prefix": 0,
"stack": 1
},
{
"netID": -13,
"prefix": 0,
"stack": 1
},
{
"netID": -16,
"prefix": 0,
"stack": 1
}
],
"WarnPlayersAboutBypassPermission": true
}
}
```

In this example configuration, the `StartingInventory` manifest describes the starting items that each player has when they join. In this case, it's bronze equipment. You can customize this by adding additional entries. For example, the updated configuration file after this block adds the `Zenith` as a starting item for new players.

```json
{
"Settings": {
"Enabled": true,
"ServerSideCharacterSave": 5,
"LogonDiscardThreshold": 250,
"StartingHealth": 100,
"StartingMana": 20,
"StartingInventory": [
{
"netID": -15,
"prefix": 0,
"stack": 1
},
{
"netID": -13,
"prefix": 0,
"stack": 1
},
{
"netID": -16,
"prefix": 0,
"stack": 1
},
{
"netID": 4956,
"prefix": 0,
"stack": 1
}
],
"WarnPlayersAboutBypassPermission": true
}
}
```

## Playing as an admin

If you're playing as an admin, make sure that you're in the `owner` group or a similar group. We really don't suggest playing as `superadmin`. `superadmin` and other users who have the `tshock.ignore.ssc` permission won't use server-side characters. This means that they'll be able to bring items in from their personal character files, and data won't be saved to the server at all.

If a TShock player has `tshock.ignore.ssc`, and `WarnPlayersAboutBypassPermission` is set to `true` in the configuration file, you'll see warnings in your server console indicating that players aren't being saved correctly.

## Uploading data

Sometimes, you want to import player data from players that join your server. For example, if you trust your friends not to bring hacked items in, you can import their data into the system. This is done with the `/uploadssc` command.

The `/overridessc` command can be used to upload SSC data from a given player. The difference between this command is that `/uploadssc` uploads their data from when they joined, whereas `/overridessc` will just save whatever their current state is to the database.

## Limitations

Currently, SSC does not support loadouts (1.4.4.x content).

0 comments on commit ee2d9de

Please sign in to comment.