Project Training--Unity Multiplayer Game Development--Part Nine

review

The game development of our group mainly uses the PUN2 framework, through PUN to realize the online connection of multiplayer games, realize information synchronization and message processing. The following mainly introduces pun.

Introduction

Photon Unity Networking (acronym PUN) is a plugin package for Unity multiplayer games. It offers authentication options, matchmaking, and fast, reliable in-game communication through our Photon backend, and it also offers free small servers for up to 20 simultaneous online games.

The official website evaluates it like this

Fusion 的开发是为了发展和替换 Unity 的两种现有 Photon 状态转移产品(Bolt 和 PUN);它包括所有支持的架构等等!
单人游戏:本地使用相同的代码,无需连接。
专用服务器:部署具有完整服务器权限的 Unity 无头实例。
客户端托管:播放器托管 _server + _client,内置穿透、中继作为后备和完整主机迁移(由 Photon Cloud 提供支持)。
共享模式:光子云上的客户端权限,使用数据驱动的服务器管理快照,使用Eventual Consistency(EC)和兴趣管理(AoI:兴趣区域),可扩展到高玩家数量。
与自定义服务器共享模式:即使没有 Unity,Fusion 的 Photon Server 插件也可以完全访问游戏状态。编写轻量级服务器游戏逻辑很容易实现。

quick start

Apply for PUN server

https://dashboard.photonengine.com/zh-CN/Official website
and then register,
insert image description here

insert image description here
For the type, it needs to be selected according to the requirements, and different types support different functions. For example, pun realizes multi-personality, and chat realizes multi-person chat.

Apply for China

Because foreign servers are unstable, it is necessary to apply for the pun server in China, so that delays can be reduced and the synchronization function can be better realized.

The pun official website in China https://vibrantlink.com/, apply here.
insert image description here
insert image description here
insert image description here
After filling in the relevant information, you can apply. After the application is successful, a notification will be sent by email.

Guide package PUN

First, you need to import the Photon package in your project, mainly by downloading the latest installation package from the assert store, and then importing it into the local project.
insert image description here
Click on this setting to configure it.

Then you need to configure the AppId, which is used to connect to your pun server, insert image description here
fill in the corresponding box with the pun server id you applied for, and fill in the chat server id in the chat box.

The following countries are filled in with cn, because foreign servers are unstable, you need to apply for the pun server in the China region, so as to reduce delays and achieve better synchronization functions.
At the same time, NameServerHost needs to be modified in this file.
insert image description here

In this way, we have basically completed the configuration of pun.

Summarize

For the multiplayer of the game, it is mainly realized through the PUN framework, and we will continue to introduce PUN later.

Guess you like

Origin blog.csdn.net/qq_53259920/article/details/125242113
Recommended