Differences between revisions 12 and 13
Revision 12 as of 2021-02-25 08:42:45
Size: 1210
Editor: zbjxb
Comment:
Revision 13 as of 2021-02-25 08:48:13
Size: 1736
Editor: zbjxb
Comment:
Deletions are marked like this. Additions are marked like this.
Line 25: Line 25:
{{{
Gameplay state and flow are generally driven through the '''GameMode actor'''. Only the server contains a valid copy of this actor (the client doesn't contain a copy at all).
To communicate this state to the client, there is a '''GameState actor''', that will shadow important state of the GameMode actor. This GameState actor is marked to be replicated
to each client. Clients will contain an approximate copy of this GameState actor, and can use this actor as a reference to know the general state of the game.
}}}

参考

UE4的多人在线游戏采用的是client-server模型。意味着有一个单独的server负责游戏状态的裁判,同时所有其他remote终端都维持一份本地相对server的近似。

Server是多人里重要的一部分,它做出所有重要的决定:

  • 所有状态控制任务
  • 处理remote client连接
  • 切换新关卡
  • 负责游戏流程:开局、结束等
  • etc...

Starting a Server

基本命令行(这些命令use the editor,因而不依赖cooked data):

Type

Command

Listen Server

UE4Editor.exe ProjectName MapName?Listen -game

Dedicated Server

UE4Editor.exe ProjectName MapName -server -game -log

Client

UE4Editor.exe ProjectName ServerIP -game

Server Gameplay Flow

The server is in charge of driving the flow of gameplay. It is the server's job to notify clients that it is time to travel to a new map, when gameplay starts and ends, along with actor replication updates, etc.

主要的游戏框架超出本文的范畴,这里只是简单提及一些:

Gameplay state and flow are generally driven through the '''GameMode actor'''. Only the server contains a valid copy of this actor (the client doesn't contain a copy at all).
To communicate this state to the client, there is a '''GameState actor''', that will shadow important state of the GameMode actor. This GameState actor is marked to be replicated
to each client. Clients will contain an approximate copy of this GameState actor, and can use this actor as a reference to know the general state of the game.

UE4-Networking-And-Multiplayer/Client-Server Model (last edited 2021-11-02 03:48:14 by zbjxb)