Optimization

Davids 2025-08-10 05:13:12
Categories: > > Tags:

Global Level

Net Frequency

1
AdaptiveNetUpdateFrequency

Replication Pausing

Object Level

Rep Graph

Net Relevancy

Net Dormancy

Replication Keys

Property Level

Property Conditions

1
2
3
4
5
6
7
8
9
COND_None = 0							UMETA(DisplayName = "None"),							// This property has no condition, and will send anytime it changes
COND_InitialOnly = 1 UMETA(DisplayName = "Initial Only"), // This property will only attempt to send on the initial bunch
COND_OwnerOnly = 2 UMETA(DisplayName = "Owner Only"), // This property will only send to the actor's owner
COND_SkipOwner = 3 UMETA(DisplayName = "Skip Owner"), // This property send to every connection EXCEPT the owner
COND_SimulatedOnly = 4 UMETA(DisplayName = "Simulated Only"), // This property will only send to simulated actors
COND_AutonomousOnly = 5 UMETA(DisplayName = "Autonomous Only"), // This property will only send to autonomous actors
COND_SimulatedOrPhysics = 6 UMETA(DisplayName = "Simulated Or Physics"), // This property will send to simulated OR bRepPhysics actors
COND_InitialOrOwner = 7 UMETA(DisplayName = "Initial Or Owner"), // This property will send on the initial packet, or to the actors owner
COND_Custom = 8 UMETA(DisplayName = "Custom"), // This property has no particular condition, but wants the ability to toggle on/off via SetCustomIsActiveOverride

Fast Array Serialization

Rep Changed Trackers

Push Model

开启

1
2
// Server.Target.cs
bWithPushModel = true;

声明

1
2
3
4
FDoRepLifetimeParams Params;
Params.bIsPushBase = true;
**DOREPLIFETIME_WITH_PARAMS_FAST**
**DOREPLIFETIME_WITH_PARAMS**

标记

1
2
3
4
5
6
7
8
9
10
11
12
13
// PushModel.h

#define MARK_PROPERTY_DIRTY(Object, Property)
#define MARK_PROPERTY_DIRTY_STATIC_ARRAY_INDEX(Object, RepIndex, ArrayIndex)
#define MARK_PROPERTY_DIRTY_STATIC_ARRAY(Object, RepIndex, ArrayIndex)

// 标记动态数组、结构体、对象、普通变量
#define MARK_PROPERTY_DIRTY_FROM_NAME(ClassName, PropertyName, Object)
// 标记静态数组的某个元素(对于静态数组,每一个元素都有独立的ReplIndex, 所以可以只标记其中某一个元素发生了改变)
#define MARK_PROPERTY_DIRTY_FROM_NAME_STATIC_ARRAY_INDEX(ClassName, PropertyName, ArrayIndex, Object)
// 标记静态数组发生了改变
#define MARK_PROPERTY_DIRTY_FROM_NAME_STATIC_ARRAY(ClassName, PropertyName, ArrayIndex, Object)

对比

标记变量为dirty之后也会进行变量比较,会判断变量是否真的发生了改变,若改变才会进行同步。

Serialize Level

NetQuantize

Custom