LoginSignup
3
2

More than 3 years have passed since last update.

UE4のレプリケーション設定のNet Cull Distance SquaredとAlways Relevantの効果を確認してみる

Posted at

ActorのReplicationの設定にあるNet Cull Distance SquaredとAlways Relevantの効果を実際に確認してみたので内容を記録しておきます。
UE4.26.1で試しています。

capRepDistance.PNG

試してみたこと

プロジェクト作成からプレイまで

  • Blankプロジェクトを作成する
  • Config/DefaultEngine.iniに以下のような設定をいれる
    • この設定をいれないとNet Cull Distance Squaredは効果がなかった
    • アクタの関連性とプライオリティ にある「AGameNetworkManager が距離に基いた関連性を使用するように設定されている場合」にあたると思う
[/Script/Engine.GameNetworkManager]
bUseDistanceBasedRelevancy=true
  • Actorを作成してReplicationの設定を以下のようにする
    • Net Load on Client:チェック
    • Replicates:チェック
    • Net Cull Distance Squared:10000.0
    • ※ 100.0の2乗の値で100.0 UU(Unreal Units、デフォルト1UU=1cm)
  • 上記のActorをLevelにSpawnするようにする
  • Editor上で以下の設定でPlayする
    • New Editor Window(PIE)
    • Number Of Players:2
    • Net Mode:Play As Listen Server

プレイ結果

cldqx-vu3m9.gif

  • サーバーでは常にActorは存在
  • クライアントではNet Cull Distance Squaredで指定した距離離れて時間がたつとActorはDestroyされる
  • クライアントで再びNet Cull Distance Squaredの範囲内に入るとActorが生成される
  • Always Relevantにチェックをいれるとクライアントでも常にActorは存在
  • レベルに配置したActorはクライアントでも常に存在する、動的にSpawnしたActorのみ生成、破棄が行われる
3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2