PlayNetMode

定义:

1
2
3
4
5
6
7
8
9
10
UENUM()
enum EPlayNetMode
{
/** A standalone game will be started. This will not create a dedicated server, nor automatically connect to one. A server can be launched by enabling bLaunchSeparateServer if you need to test offline -> server connection flow for your game. */
PIE_Standalone UMETA(DisplayName="Play Standalone"),
/** The editor will act as both a Server and a Client. Additional instances may be opened beyond that depending on the number of clients. */
PIE_ListenServer UMETA(DisplayName="Play As Listen Server"),
/** The editor will act as a Client. A server will be started for you behind the scenes to connect to. */
PIE_Client UMETA(DisplayName="Play As Client"),
};

PIE_Standalone

本地端, 没有远端. 没有DS, 只有本地一个端在跑.

PIE_ListenServer

创建一个GameInstance, 它即当DS, 又作为客户端. 并且允许多个独立的客户端与它相连.

可以看到, 其就有两个world: editor, Client+DS.

PIE_Client

分别创建两个GameIntance, 客户端GameInstance+DS GameInstance.

可以看到, 其有三个World, 分别是editor, DS, Client. 这种模式下, Actor会有ROLE_AuthorityROLE_AutonomousProxy以及ROLE_SimulatedProxy对应的实例.

image-20231012144447532

创建关键函数

这里不做详细解析. 只是暂时标注, 后续有时间会有详解.