> For the complete documentation index, see [llms.txt](https://dotsnet.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dotsnet.gitbook.io/docs/user-manual/server-and-client-worlds.md).

# Server & Client Worlds

DOTSNET creates a ServerWorld and a ClientWorld when starting:

![](https://lh4.googleusercontent.com/dd45UaNJe2keXVZPuaJ1ATSqy3nGd1eDjRvR4daYtUUYEeKlJpiuIStY2KtbnV-6JzV9Z5mQ-W0wDAi0zMHnSSxLMPgb1Y0Xt_6MjyADz2FNdjAGsw6gwfFjj5s85miEHf8oj1Jp)

### ConvertToNetworkEntity

ECS comes with a Convert**ToEntity** component that allows us to convert GameObjects to Entities in the Default World.

**DOTSNET** comes with a Convert**ToNetworkEntity** component that converts GameObjects to Entities in the **Server/ClientWorld**:

![](https://lh6.googleusercontent.com/2r1pvA-Y3-luM3xiAOtRsKxmqIXf1tGFuhlp6bU5uEzMvD8s76qBw2W2XTKgVyQGIhHJEDu2Gakvzfce_0OcNGXUaikFIpGYYapH3rLoIM0gUmlqaAYkvrDNtdArR-GC9OkoQ2iL)

Most entities will live in both worlds.

For example, a monster would live in both worlds so that the server can move it, then sync the position to the same entity in the client world.<br>

### World Attributes

You can put a system into the server world by using the `[ServerWorld]` attribute:

```csharp
using DOTSNET;

[ServerWorld]
public class ServerSystem : SystemBase
{
}
```

You can put a system into the client world by using the `[ClientWorld]` attribute:

```csharp
using DOTSNET;

[ClientWorld]
public class ClientSystem : ComponentSystem
{
}
```

A system can also be in both worlds:

```csharp
using DOTSNET;

[ServerWorld, ClientWorld]
public class ServerAndClientSystem : ComponentSystem
{
}
```

If a system has no attributes, then it’s only in the DefaultWorld.

DOTSNET entirely operates in the Server/Client world, not in the DefaultWorld.<br>

### Simulation System Groups

For convenience, **DOTSNET** comes with custom simulation system groups.

On the server, you can put a system into the Server**Active**SimulationSystemGroup, so it’s only updated while the server is active *(after NetworkServerSystem.StartServer was called, until StopServer is called)*. For example, monster movement should only be updated while the server is actually active:

```csharp
using DOTSNET;

[ServerWorld]
[UpdateInGroup(typeof(ServerActiveSimulationSystemGroup))]
public class MonsterMovementSystem : ComponentSystem
{
}
```

On the client, you can put a system into the Client**Connected**SimulationSystemGroup, so it’s only updated while the client is connected to the server *(after a successful NetworkClientSystem.Connect until Disconnect)*. For example, local player movement should only be updated while the client is actually connected:

```csharp
using DOTSNET;

[ClientWorld]
[UpdateInGroup(typeof(ClientConnectedSimulationSystemGroup))]
public class LocalPlayerMovementSystem : ComponentSystem
{
}
```

### Accessing Server/ClientWorld from the Outside

Use the static Bootstrap class to access Server/Client World systems from anywhere in Unity:

```csharp
using DOTSNET;

public class SomeClass
{
    void Example()
    {
        // log the names
        Debug.Log(Bootstrap.ClientWorld.Name);
        Debug.Log(Bootstrap.ServerWorld.Name);

        // find the server/client systems
        Bootstrap.ServerWorld.GetExistingSystem<NetworkServerSystem>();
        Bootstrap.ClientWorld.GetExistingSystem<NetworkClientSystem>();
    }
}
```
