Skip to main content

Replication

Overview

note

This is only relevant to multiplayer games.

None of Stoch's classes handle replication on their own. However, this is not necessary and replicating distributions, loot tables, etc. is discouraged.

Why shouldn't I replicate Stoch Objects?

All stoch objects generate things which require sensitive data; it's highly recommended to store these objects (loot tables, distributions, etc.) on the server and replicate the results of generation back to clients.

Example

Let's look at a simple example using a loot table. Suppose you are generating a random item type from the following table:

Data Table Fruits
Row NameDisplay Name
AppleApple
BananaBanana

We have this loot table:

Compiled Loot Table A (Unlimited)
Ref TableRef Row NameWeight
FruitsApple100
FruitsBanana400

The data table would be the item 'registry', which contains item data. The loot table would contain the drop chances of each item. Both of these are sensitive information that you likely don't want players to find out. Thus, we recommend enabling Strip From Client Builds on them so they're not available client-side.

Next, suppose we sample Table: DT_Fruits, Row: Apple. We can invoke Get Data Table Row on this row to obtain the data for it on the server. Then we can replicate this row's data back to the client(s). For our example that's just a Display Name, but for your items that would include all item data which is available client-side.