# CSAR (Clustered Server Authoritative Ruler) モジュール

## 概要

**CSAR** (/zɑːr/ ツァーㇽ) は Clustered Server Authoritative Ruler の略で以下を意味しております。

* Clustered: Diarkis サーバーとコミュニケーションを取ることができる
* Server Authoritative: サーバーが権威を持つ＝サーバーでロジックを実行できる＝チートに強い
* Ruler: 支配者＝Authoritative と同義

CSAR を使うことで以下のようなことが実現できます。

* Client-Hosted タイプ と DGS タイプ の ゲームの開発することができます。
  * Diarkis CSAR を利用することで、クライアントの中の１つが ホスト役（オーソリティ）も担う Client-Hosted タイプ と、 Dedicated Game Server (専用ゲームサーバー、以降DGS) が ホスト（オーソリティ）を担う DGS タイプのゲームを開発できるようになります。
* Client-Hosted タイプでは、クライアントの一つがホスト役とクライアント役を担い、他のクライアントはクライアント役のみを担います。
  * ホスト役が切断したりゲームから抜けたときは、ホストがマイグレーションする機能にも対応しています。
  * ゲームで、ホスト役 と クライアント役 の役割を分けてゲームをロジックを開発し易くなります。
* DGS タイプでは、Diarkis クライアントを Diarkis サーバークラスターの一部として動作させることができます。
  * これにより、クラスター内の他の Diarkis サーバーと直接通信し、データを共有することが可能になります。
  * Kubernetes 上で Agones のように ホスティングとスケーリング管理できます。
  * Diarkis CSAR SDK はC++ と C# をサポートしており、Unreal Engine や Unity などの一般的なゲームエンジンや独自のゲームエンジンでも利用できます。
  * これによりチート耐性の強いゲームを開発できるようになります。
* P2P と サーバーリレー の通信経路を意識せずに、堅牢な通信環境を提供いたします。

  * P2P (Peer to Peer)  で通信できるクライアント間とは P2P で通信を行い、P2P で通信できないクライアント間  (ホールパンチに失敗した時など) では Room モジュール を使用した サーバー経由の リレー通信 を組み合わせて最適な通信経路が自動的に使用されます。
  * P2P 接続後も、通信中に P2P の接続が切れたとしてもフォールバック機能でリレー通信に切り替えたり、P2P で送信していた RUDP パケットを リレーサーバー経由で再送する機能に対応しており、堅牢な通信が実現することができます。

Diarkis クライアント で提供されている CSAR の機能について

[CSAR (Clustered Server Authoritative Ruler)](/diarkis-client/csar-clustered-server-authoritative-ruler.md)

***


---

# Agent Instructions: 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:

```
GET https://help.diarkis.io/diarkis-modules/csar.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
