> For the complete documentation index, see [llms.txt](https://help.diarkis.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.diarkis.io/diarkis-modules/room.md).

# Room モジュール

## 概要

Diarkis Room モジュールは、遠隔地にいる複数のユーザーがパケットを送受信できるデジタル空間を作ることができます。これは、サーバ・リレー・システムであり、テンポの速いゲームが可能です。

一つの Diarkis サーバーに、Diarkis Room で作成された複数のルームを持つことができます。各ルームは何人のユーザーを参加させるかを決めることができます。

技術的な詳細については、サーバー [APIドキュメント](https://docs.diarkis.io/docs/server/current/diarkis/room/index.html) をお読みください。

Diarkis Room は、Diarkis P2P (peer-to-peer) フォールバック用の [TURN](https://en.wikipedia.org/wiki/Traversal_Using_Relays_around_NAT) としても使用されます。

## Diarkis Room とは

Diarkis Room は、リモート・ユーザーがサーバーを介してパケットを交換できるようにする中継サーバーです。サーバーはカスタマイズ可能で、受信パケットを検証したり、サーバー上のパケットを好きなように操作することができます。

## Diarkis Room で出来ないこと

Diarkis Room は専用のゲーム・サーバー（Dedicated Game Server）ではありません。サーバー上でゲームを実行することはありません。サーバー上でゲームのロジックを実装することは可能ですが、物理演算やコリジョン判定などの実装には基本的には不向きです。

## Diarkis Room の特徴

メンバーが自由にメッセージを送受信（ブロードキャスト）することができます。また Property や State を共有することができます。それらは、メンバーが自由に追加・変更・削除できるルームに付随する値です。

Property は任意のタイミングでルームの状態を保持、同期します。ルームのメンバーと自動的に同期したい場合は State を使うことで一定間隔でルームの状態を同期することが可能です。

## Diarkis Room のパケット交換図（ブロードキャストとメッセージ）

下図は、Diarkis Room のブロードキャストとメッセージの仕組みを説明したものです。

Diarkis Room には、ルームのメンバー間でパケットを交換する2つの方法があります。

ブロードキャストは全ルーム・メンバーにメッセージを送信し、メッセージはルームの選択されたメンバーにメッセージを送信します。

<figure><img src="/files/zeBOmSJ6eHgF8RSXDvNQ" alt=""><figcaption></figcaption></figure>

## Diarkis Room Property（状態の保存）

Diarkis Room は、Property でルームの状態を保持することができます。同期は任意のタイミングで行うことができ、Room に関連する低、中頻度の情報のやりとりに適しています。

## Diarkis Room State（状態の同期）

また Diarkis Room には、State を使ってメンバーと自動的に状態を同期する方法があります。Room に配置しているオブジェクトなど、これから入室するメンバーを含めてすべてのメンバーに自動的に同期したい場合に最適です。

<figure><img src="/files/VYGOQWTkJYbwuJD4dxKG" alt=""><figcaption></figcaption></figure>


---

# 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://help.diarkis.io/diarkis-modules/room.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.
