> For the complete documentation index, see [llms.txt](https://rocket-networking.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://rocket-networking.gitbook.io/docs/basics-of-rocket-networking/room-based-multiplayer-auto-state-sharing.md).

# Room based multiplayer (Auto State Sharing)

RNet has a rooms system where you can create a room with a name, for example "public" or "moon".\
These are independent from each other and you can have many rooms in your RNet server.

All players in the same room can 'see' each other. Players in RNet each share some data. Say their x and y coordinates in this global variable. All you need to do is share the information you want other players to see. They do the same.

```
global.sharedProperties = {
	_x : oPlayer.x,
	_y : oPlayer.y
}
```

This global variable can be updated from the object you control. For example if you have an oPlayer, then you can add this code to the step event of oPlayer.

Other players are automatically created and destroyed as they enter and exit the RNet room, making things simple to manage and understand.

```
//oOtherPlayer Step Event
x = SP._x
y = SP._y
```

What we did above is take the other person's shared properties and set the x and y to what was shared by the other player. This way, it comes full circle.

1. Everyone was sharing their x,y coordinates.
2. We took the general oOtherPlayer object and edited the step event so that we can use that shared information.

<https://www.youtube.com/watch?v=ggG769JidBU>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://rocket-networking.gitbook.io/docs/basics-of-rocket-networking/room-based-multiplayer-auto-state-sharing.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
