> For the complete documentation index, see [llms.txt](https://kinematicsoup.gitbook.io/reactor/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kinematicsoup.gitbook.io/reactor/architecture/data-syncing.md).

# Automatic Client Data Syncing

## Summary

How server state reaches clients: properties, transforms, sync groups for visibility, and the client prediction that keeps it smooth. It is part of the [Reactor Technical Overview](/reactor/architecture.md).

## Properties

Properties are one way state syncs. A property is a value keyed by a numeric id, attached to a room, player, or entity. Property values use [`ksMultiType`](/reactor/architecture/ksmultitype.md), which has implicit conversions to and from many basic data types and their arrays, so you read and write with plain C# types:

```csharp
// Server, or a client that owns the entity with PROPERTIES permission
entity.Properties[Prop.SCORE] = 10;

// Anywhere
int score = entity.Properties[Prop.SCORE];
```

The server tracks which properties changed and sends only those on the next sync, not the whole set. On the client, a property change raises an event you can handle:

```csharp
entity.OnPropertyChange[Prop.SCORE] += (oldValue, newValue) => { /* react */ };
```

## Transforms

An entity's transform syncs the same way. Set position, rotation, and scale on the server through `entity.Transform` (or `entity.Transform2D`), and the client receives them. On the client, `entity.Transform` gives the smoothed value the game renders, while `entity.ServerTransform` gives the raw server value.

**Precision** is configurable per entity as a quantization step. A larger step sends fewer, smaller updates; a step of `0` keeps full precision. A **teleport** flag marks a discrete jump so the client snaps to it instead of interpolating.

## Sync Groups

Sync groups control which entities a player receives, so a large world does not send every object to every client. An entity belongs to a single sync group, while a player can be added to many sync groups at once. Group `0` is the default for entities, and every player is in it. For any other group, a player receives its entities only after being added to it:

```csharp
player.AddToSyncGroup(3);       // this player now sees group 3 entities
player.RemoveFromSyncGroup(3);  // and stops seeing them
```

Removing a player from a group destroys those entities on that client, and the client's entity destroy event carries a reason of `ksDestroyReason.SYNC_GROUP_REMOVAL`. Sync groups are Reactor's interest-management tool. See [Interest Management via Sync Groups](/reactor/tutorials/syncgroups.md).

## Client Prediction

State arrives less often than the client renders. **Predictors** decide how an entity moves between server updates. Assign one per entity to match how it behaves:

* **`ksLinearPredictor`**: blends toward each new server transform. The default, suited to entities the local player does not control.
* **`ksClientInputPredictor`**: drives the entity from local input and ignores server transforms. Needs a controller.
* **`ksConvergingInputPredictor`**: predicts from local input, then eases toward the server's authoritative position as updates arrive. Needs a controller.

Can be assigned in code with `entity.NonInputPredictor` or `entity.InputPredictor`, and configure smoothing rates on the predictor. Predictors can also be assigned per entity in the `ksEntityComponent`, or as a default for all entities in the `ksRoomType` component. Prediction changes how an entity looks between updates, not what the server decides, so the visible state converges back to the server's truth. See [Motion Prediction](/reactor/examples/predictors.md).

> *On the client, a property or transform can carry both a predicted display value and the raw server value. Read the server value when you need the authoritative number rather than the smoothed one.*

## Where to Go Next

* [Ownership and Authority](/reactor/architecture/ownership-and-authority.md): who is allowed to change synced state.
* [Messaging and RPCs](/reactor/architecture/messaging-rpcs.md): send events instead of syncing continuous state.
* [Networked Properties and RPCs](/reactor/tutorials/properties_and_rpcs.md): properties and messaging in practice.
