Fusion Core とは?

概要

Fusion Coreは、Photon Fusion 3の中核をなすゲームエンジン非依存の C++ ネットワーキングSDKです。 コンパクトなシングルスレッドAPIを通して、状態レプリケーション・リモートプロシージャコール(RPC)・関心領域(AoI:Area-of-Interest)管理を提供します。 このSDKは、 C++20 コンパイラを搭載するあらゆるプラットフォームで実行可能です。また、薄いバインディングレイヤーを記述することで、あらゆるゲームエンジンと統合することができます。

SDKは、2つのモード・3つのトポロジーで動作し、接続・オブジェクト概念・RPC・関心領域のAPIが共通化されています。 共有権限(Shared-Authority)モード(SimulationMode::Shared)では、各クライアントが自身のオブジェクトを所有し、シミュレーションを実行します。Photonサーバーは、ゲームステートのキャッシュを保持し、途中参加者の自動的な同期やインタレストマネジメントを行います。 クライアントサーバー(Client-Server)モード(SimulationMode::Authority)では、シミュレーションサーバー主導となります。ObjectOwnerModes::PlayerPredictedオブジェクトは、指定プレイヤーからの予測入力を反映し、SDKのOnPredictionResetコールバックを通して予測ミスを修正します。 両方のモードとも完全に統合することが可能なため、利用者はどちらのモードを使用したゲームもリリースできます。モードはルーム設定によってセッションごとに選択されます。 モードとトポロジーの仕組みについては、Modes and Topologiesをご覧ください。

次のステップ

ドキュメントセクション

統合ガイド

ゲームエンジンとの統合を構築するための実践的なパターンです。

ドキュメント 詳細
Quick Start Guide 統合の最小限の骨組み:logging, construction, connection, frame loop, object creation, sync, shutdownを紹介します。完全に動作するコードを示します。
Object Sync Patterns Sync loop, Words buffer layout, type-to-word mapping, float bit-cast, 64-bit splitting, arrays, strings, shadow/dirty detectionを説明します。
Sub-Objects ObjectChild creation flow (authority and remote), pending queue pattern, dual handle pattern, required objects, per-object string heapsを説明します。
Engine Binding Object::Engine pointer, bidirectional registry keyed on ObjectId, type hash convention, spawnable type registry, spawner/factory patternを説明します。

落とし穴

ドキュメント 詳細
Pitfalls 18個の致命的な落とし穴を正誤コード例と共に紹介します:ObjectTail writes, iteration order, header inclusion, string leaks, spawn data strings, frame loop order, threading, CRT linkage, multi-map ordering, predicted-input ordering, FusionCAPI event-queue lifetime, MSVC runtime mismatchなど。

ヘッダーとドキュメントのマッピング

SDKヘッダー 主なドキュメントページ
Client.h Quick Start Guide, Object Sync Patterns, Sub-Objects, Engine Binding, Pitfalls
Types.h Object Sync Patterns, Sub-Objects, Pitfalls
RealtimeCore/Matchmaking/RealtimeClient.h Quick Start Guide, Pitfalls
RealtimeCore/Common/Broadcaster.h Quick Start Guide, Pitfalls
RealtimeCore/Common/SubscriptionBag.h Quick Start Guide, Pitfalls
RealtimeCore/Common/Task.h Quick Start Guide, Pitfalls
RealtimeCore/Common/Result.h Quick Start Guide, Pitfalls
Buffers.h Object Sync Patterns
StringHeap.h Object Sync Patterns, Sub-Objects, Pitfalls
RealtimeCore/Common/LogOutput.h Quick Start Guide

読み進め方の推奨

初めてFusion 3 SDKを新規ゲームエンジンに統合する場合は、以下の順で読むことをお勧めします:

  1. Quick Start Guide -- End-to-end minimal working example: logging, client construction, connection via RealtimeClient, the frame loop, creating an object, syncing a property and shutdown.

  2. Object Sync Patterns -- Deep dive into the Words buffer: how to map types to words, compute offsets, write/read floats and vectors, handle arrays and manage string properties via the StringHeap.

  3. Pitfalls -- The 18 most common mistakes. Read this before writing production code. Each pitfall includes wrong/right code examples and a clear prevention rule.

  4. Engine Binding -- How to connect SDK objects to engine objects: the bidirectional registry, type hash conventions, spawnable scene registration and the spawner/factory pattern.

  5. Sub-Objects -- Advanced topic: creating child objects, handling the two-step creation flow, the pending queue for out-of-order arrivals, the dual handle pattern for authority checks and required objects.

これらを読了すると、Fusionとの完全な統合を構築するための基礎が身につきます。 実装中は、必要に応じて各ガイドを読み返してください。

Last updated on

Back to top