Skip to content

Commit 6c7d047

Browse files
committed
custom game mode changes to russian and schienese localizations
1 parent 9e21559 commit 6c7d047

2 files changed

Lines changed: 115 additions & 97 deletions

File tree

docs/content/russian/Multiplayer/custom_game_mode.md

Lines changed: 57 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ weight = 10
77
#### Prerequisites
88
To make a custom MP game mode, you first need to create your module’s folder under the `Modules` folder of your games installation. Inside your module’s folder, you need to create a `bin` folder for your DLL files and a `SubModule.xml` file for your module’s definition and additional data.
99

10-
For programming, you need to have .NET Framework development tools installed. To do that, download Visual Studio 2017 Community Edition and install .NET Framework 4.7.2 support. After that’s done, create a new Class Library project. For the client side, add references to DLLs located in the `Win64_Shipping_Client` folder of your Mount & Blade II: Bannerlord installation. For the server side, add references to DLLs located in the `Win64_Shipping_Server` folder of your Mount & Blade II: Dedicated Server installation.
10+
For programming, you need to have .NET Framework development tools installed. To do that, download Visual Studio 2022 Community Edition and install .NET 6 support. After that’s done, create a new Class Library project.\
11+
12+
For the client side, add references to DLLs located in the `Win64_Shipping_Client` folder of your Mount & Blade II: Bannerlord installation. \\
13+
For the server side, add references to DLLs located in the `Win64_Shipping_Server` folder of your Mount & Blade II: Dedicated Server installation.
1114

1215
Make sure the output directory of your project is:
1316

@@ -65,63 +68,68 @@ In the XML file, you can define the following so your game mode’s name show up
6568
Make sure IDs match up with the ones you defined in your code and module definition files.
6669

6770
#### GameMode Class
68-
To make the server start the mission with your game mode, you need to create a new class that inherits `MissionBasedMultiplayerGameMode`. In this class, override `StartMultiplayerGame` method like this:
71+
To make the server start the mission with your game mode, you need to create a new class that inherits `MissionBasedMultiplayerGameMode`. In this class, override `StartMultiplayerGame` method like this **for your client module**:
72+
73+
public override void StartMultiplayerGame(string scene) {
74+
MissionState.OpenNew("BountyMP", new MissionInitializerRecord(scene),
75+
missionController => {
76+
return new MissionBehavior[] {
77+
MissionLobbyComponent.CreateBehavior(),
78+
new MissionMultiplayerBountyMPClient(),
79+
new MultiplayerAchievementComponent(),
80+
new MultiplayerTimerComponent(),
81+
new MultiplayerMissionAgentVisualSpawnComponent(),
82+
new MissionLobbyEquipmentNetworkComponent(),
83+
new MultiplayerTeamSelectComponent(),
84+
new MissionHardBorderPlacer(),
85+
new MissionBoundaryPlacer(),
86+
new MissionBoundaryCrossingHandler(),
87+
new MultiplayerPollComponent(),
88+
new MultiplayerAdminComponent(),
89+
new MultiplayerGameNotificationsComponent(),
90+
new MissionOptionsComponent(),
91+
new MissionScoreboardComponent(new BountyMPScoreboardData()),
92+
new MissionMatchHistoryComponent(),
93+
new EquipmentControllerLeaveLogic(),
94+
new MissionRecentPlayersComponent(),
95+
new MultiplayerPreloadHelper(),
96+
};
97+
}
98+
);
99+
}
100+
101+
In this class, override StartMultiplayerGame method like this for your server module:
69102

70103
public override void StartMultiplayerGame(string scene) {
71104
MissionState.OpenNew("BountyMP", new MissionInitializerRecord(scene),
72105
missionController => {
73-
if (GameNetwork.IsServer) {
74-
return new MissionBehavior[] {
75-
MissionLobbyComponent.CreateBehavior(),
76-
new MissionMultiplayerBountyMP(),
77-
new MissionMultiplayerBountyMPClient(),
78-
new MultiplayerTimerComponent(),
79-
new MultiplayerMissionAgentVisualSpawnComponent(),
80-
new SpawnComponent(new BountyMPSpawnFrameBehavior(), new BountyMPSpawningBehavior()),
81-
new MissionLobbyEquipmentNetworkComponent(),
82-
new MultiplayerTeamSelectComponent(),
83-
new MissionHardBorderPlacer(),
84-
new MissionBoundaryPlacer(),
85-
new MissionBoundaryCrossingHandler(),
86-
new MultiplayerPollComponent(),
87-
new MultiplayerAdminComponent(),
88-
new MultiplayerGameNotificationsComponent(),
89-
new MissionOptionsComponent(),
90-
new MissionScoreboardComponent(new BountyMPScoreboardData()),
91-
new MissionAgentPanicHandler(),
92-
new AgentHumanAILogic(),
93-
new EquipmentControllerLeaveLogic(),
94-
new MultiplayerPreloadHelper(),
95-
};
96-
} else {
97-
return new MissionBehavior[] {
98-
MissionLobbyComponent.CreateBehavior(),
99-
new MissionMultiplayerBountyMPClient(),
100-
new MultiplayerAchievementComponent(),
101-
new MultiplayerTimerComponent(),
102-
new MultiplayerMissionAgentVisualSpawnComponent(),
103-
new MissionLobbyEquipmentNetworkComponent(),
104-
new MultiplayerTeamSelectComponent(),
105-
new MissionHardBorderPlacer(),
106-
new MissionBoundaryPlacer(),
107-
new MissionBoundaryCrossingHandler(),
108-
new MultiplayerPollComponent(),
109-
new MultiplayerGameNotificationsComponent(),
110-
new MissionOptionsComponent(),
111-
new MissionScoreboardComponent(new BountyMPScoreboardData()),
112-
new MissionMatchHistoryComponent(),
113-
new EquipmentControllerLeaveLogic(),
114-
new MissionRecentPlayersComponent(),
115-
new MultiplayerPreloadHelper(),
116-
};
117-
}
106+
return new MissionBehavior[] {
107+
MissionLobbyComponent.CreateBehavior(),
108+
new MissionMultiplayerBountyMP(),
109+
new MissionMultiplayerBountyMPClient(),
110+
new MultiplayerTimerComponent(),
111+
new SpawnComponent(new BountyMPSpawnFrameBehavior(), new BountyMPSpawningBehavior()),
112+
new MissionLobbyEquipmentNetworkComponent(),
113+
new MultiplayerTeamSelectComponent(),
114+
new MissionHardBorderPlacer(),
115+
new MissionBoundaryPlacer(),
116+
new MissionBoundaryCrossingHandler(),
117+
new MultiplayerPollComponent(),
118+
new MultiplayerAdminComponent(),
119+
new MultiplayerGameNotificationsComponent(),
120+
new MissionOptionsComponent(),
121+
new MissionScoreboardComponent(new BountyMPScoreboardData()),
122+
new MissionAgentPanicHandler(),
123+
new AgentHumanAILogic(),
124+
new EquipmentControllerLeaveLogic(),
125+
new MultiplayerPreloadHelper(),
126+
};
118127
}
119128
);
120129
}
121130

122-
From this code, you can see that `GameNetwork` has a variable that you can use in all of your code to check if the running game instance is a server or a client. In this method, you can see that it is used to separate client behaviors from server behaviors. This way we make sure that correct `MissionBehaviors` are loaded for the correct type of the game. In other methods, `GameNetwork.IsClient` and `GameNetwork.IsServer` can be used to act differently on different events.
123131

124-
This method also shows how a mission runs at an overview. All mission behaviors are loaded one by one and they all handle different aspects of the game. Depending on your game mode, you might want all of these or only some of these at your mode. Also please note that there are dependencies between some of these behaviors, meaning that if one is not present, others might not work correctly. In this example, there are two mission behaviors that you are not going to get if you have created a clean project with the steps mentioned in the first section. These two behaviors are the ones the modder creates to add their own game logic. These are `MissionMultiplayerBountyMP` and `MissionMultiplayerBountyMPClient`. The former manages the game mode from the server while the latter manages the game mode from the client side. Make sure that all shared and important data is on your server and synchronized properly.
132+
This method shows how a mission runs at an overview. All mission behaviors are loaded one by one and they all handle different aspects of the game. Depending on your game mode, you might want all of these or only some of these at your mode. Also please note that there are dependencies between some of these behaviors, meaning that if one is not present, others might not work correctly. In this example, there are two mission behaviors that you are not going to get if you have created a clean project with the steps mentioned in the first section. These two behaviors are the ones the modder creates to add their own game logic. These are `MissionMultiplayerBountyMP` and `MissionMultiplayerBountyMPClient`. The former manages the game mode from the server while the latter manages the game mode from the client side. Make sure that all shared and important data is on your server and synchronized properly.
125133

126134
#### Mission Behaviors
127135
For all native game modes, the server side game mode logic class, `MissionMultiplayerBountyMP` in this example, inherits `MissionMultiplayerGameModeBase`. This class defines basic spawning and synchronization systems. Also for all native game modes, the client side game mode message handling logic class, `MissionMultiplayerBountyMPClient` in this example, inherits `MissionMultiplayerGameModeBaseClient`. There are several overrides available for this class that makes sure the registering and deregistering from message handlers happen at the correct time.

docs/content/schinese/Multiplayer/custom_game_mode.md

Lines changed: 58 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ weight = 10
88
#### 前提条件
99
要制作一个多人游戏模式,你首先需要在你游戏安装目录的 `Modules` 目录下创建你的模组文件夹。在你的模组目录下,你需要创建一个 `bin` 文件夹来放置 DLL 文件,还要创建一个 `SubModule.xml` 文件来存放你的模组定义和额外数据。
1010

11-
对于程序开发,你需要有 .NET Framework 开发工具。配置开发环境的话,下载 Visual Studio 2017 社区版并安装 .NET Framework 4.7.2 支持。完成这些步骤后,新建一个 Class Library 项目。对于客户端而言,添加位于你的 Mount & Blade II: Bannerlord 安装目录的 `Win64_Shipping_Client` 目录下的所有的 DLL 引用。对于服务端而言,添加位于你的 Mount & Blade II: Dedicated Server 安装目录的 `Win64_Shipping_Server` 目录下的所有的 DLL 引用。
11+
对于程序开发,你需要有 .NET Framework 开发工具。配置开发环境的话,下载 Visual Studio 2022 社区版并安装 .NET 6 支持。完成这些步骤后,新建一个 Class Library 项目。\\
12+
13+
对于客户端而言,添加位于你的 Mount & Blade II: Bannerlord 安装目录的 `Win64_Shipping_Client` 目录下的所有的 DLL 引用。\\
14+
对于服务端而言,添加位于你的 Mount & Blade II: Dedicated Server 安装目录的 `Win64_Shipping_Server` 目录下的所有的 DLL 引用。
1215

1316
请保证你项目的输出路径是:
1417

@@ -66,61 +69,68 @@ weight = 10
6669
确保 ID 与你在代码和模组定义文件中所定义的 ID 一致。
6770

6871
#### GameMode 类
69-
要让服务器用你的游戏模式开始一场行动(mission),你需要新建一个类继承自 `MissionBasedMultiplayerGameMode`。在该类中,重写 `StartMultiplayerGame` 方法如下:
72+
要让服务器用你的游戏模式开始一场行动(mission),你需要新建一个类继承自 `MissionBasedMultiplayerGameMode`。在该类中,重写 `StartMultiplayerGame` 方法如下 **for your client module**
7073

7174
public override void StartMultiplayerGame(string scene) {
7275
MissionState.OpenNew("BountyMP", new MissionInitializerRecord(scene),
7376
missionController => {
74-
if (GameNetwork.IsServer) {
75-
return new MissionBehavior[] {
76-
MissionLobbyComponent.CreateBehavior(),
77-
new MissionMultiplayerBountyMP(),
78-
new MissionMultiplayerBountyMPClient(),
79-
new MultiplayerTimerComponent(),
80-
new MultiplayerMissionAgentVisualSpawnComponent(),
81-
new SpawnComponent(new BountyMPSpawnFrameBehavior(), new BountyMPSpawningBehavior()),
82-
new MissionLobbyEquipmentNetworkComponent(),
83-
new MultiplayerTeamSelectComponent(),
84-
new MissionHardBorderPlacer(),
85-
new MissionBoundaryPlacer(),
86-
new MissionBoundaryCrossingHandler(),
87-
new MultiplayerPollComponent(),
88-
new MultiplayerAdminComponent(),
89-
new MultiplayerGameNotificationsComponent(),
90-
new MissionOptionsComponent(),
91-
new MissionScoreboardComponent(new BountyMPScoreboardData()),
92-
new MissionAgentPanicHandler(),
93-
new AgentHumanAILogic(),
94-
new EquipmentControllerLeaveLogic(),
95-
new MultiplayerPreloadHelper(),
96-
};
97-
} else {
98-
return new MissionBehavior[] {
99-
MissionLobbyComponent.CreateBehavior(),
100-
new MissionMultiplayerBountyMPClient(),
101-
new MultiplayerAchievementComponent(),
102-
new MultiplayerTimerComponent(),
103-
new MultiplayerMissionAgentVisualSpawnComponent(),
104-
new MissionLobbyEquipmentNetworkComponent(),
105-
new MultiplayerTeamSelectComponent(),
106-
new MissionHardBorderPlacer(),
107-
new MissionBoundaryPlacer(),
108-
new MissionBoundaryCrossingHandler(),
109-
new MultiplayerPollComponent(),
110-
new MultiplayerGameNotificationsComponent(),
111-
new MissionOptionsComponent(),
112-
new MissionScoreboardComponent(new BountyMPScoreboardData()),
113-
new MissionMatchHistoryComponent(),
114-
new EquipmentControllerLeaveLogic(),
115-
new MissionRecentPlayersComponent(),
116-
new MultiplayerPreloadHelper(),
117-
};
118-
}
77+
return new MissionBehavior[] {
78+
MissionLobbyComponent.CreateBehavior(),
79+
new MissionMultiplayerBountyMPClient(),
80+
new MultiplayerAchievementComponent(),
81+
new MultiplayerTimerComponent(),
82+
new MultiplayerMissionAgentVisualSpawnComponent(),
83+
new MissionLobbyEquipmentNetworkComponent(),
84+
new MultiplayerTeamSelectComponent(),
85+
new MissionHardBorderPlacer(),
86+
new MissionBoundaryPlacer(),
87+
new MissionBoundaryCrossingHandler(),
88+
new MultiplayerPollComponent(),
89+
new MultiplayerAdminComponent(),
90+
new MultiplayerGameNotificationsComponent(),
91+
new MissionOptionsComponent(),
92+
new MissionScoreboardComponent(new BountyMPScoreboardData()),
93+
new MissionMatchHistoryComponent(),
94+
new EquipmentControllerLeaveLogic(),
95+
new MissionRecentPlayersComponent(),
96+
new MultiplayerPreloadHelper(),
97+
};
11998
}
12099
);
121100
}
122101

123-
通过这段代码,你可以看见 `GameNetwork` 有一个变量,可以用在你的代码里,用于检查运行的游戏实例是服务端还是客户端。在该方法中,你可以看到它用来分隔客户端行为和服务器行为。这能确保正确的 `MissionBehaviors` 被加载到正确类型的游戏。其他方法中, `GameNetwork.IsClient``GameNetwork.IsServer` 可用于对不同事件采取不同处理。
102+
In this class, override StartMultiplayerGame method like this for your server module:
103+
104+
public override void StartMultiplayerGame(string scene) {
105+
MissionState.OpenNew("BountyMP", new MissionInitializerRecord(scene),
106+
missionController => {
107+
return new MissionBehavior[] {
108+
MissionLobbyComponent.CreateBehavior(),
109+
new MissionMultiplayerBountyMP(),
110+
new MissionMultiplayerBountyMPClient(),
111+
new MultiplayerTimerComponent(),
112+
new SpawnComponent(new BountyMPSpawnFrameBehavior(), new BountyMPSpawningBehavior()),
113+
new MissionLobbyEquipmentNetworkComponent(),
114+
new MultiplayerTeamSelectComponent(),
115+
new MissionHardBorderPlacer(),
116+
new MissionBoundaryPlacer(),
117+
new MissionBoundaryCrossingHandler(),
118+
new MultiplayerPollComponent(),
119+
new MultiplayerAdminComponent(),
120+
new MultiplayerGameNotificationsComponent(),
121+
new MissionOptionsComponent(),
122+
new MissionScoreboardComponent(new BountyMPScoreboardData()),
123+
new MissionAgentPanicHandler(),
124+
new AgentHumanAILogic(),
125+
new EquipmentControllerLeaveLogic(),
126+
new MultiplayerPreloadHelper(),
127+
};
128+
}
129+
);
130+
}
131+
132+
133+
124134

125135
该方法也大概展示了一场行动是如何进行的。所有行动行为(mission behaviors)都是一个接一个加载的,它们分别处理游戏的不同方面。根据你的游戏模式,你可能希望在你的模式中使用全部这些行为,又或者是只使用一部分。另外请注意,其中一些行为之间存在依赖关系,这意味着如果一个行为不存在,其他行为可能无法正确工作。在本例中,如果你按照第一部分中提到的步骤创建了一个空项目,那么有两个任务行为是无法实现的。开发者创建这两个行为来添加自己的游戏逻辑,它们是 `MissionMultiplayerBountyMP``MissionMultiplayerBountyMPClient`。前者从服务端管理游戏模式,后者从客户端管理游戏模式,确保所有重要的共享数据都在你的服务器上并正确同步。
126136

0 commit comments

Comments
 (0)