本文介绍了我可以使用 Unity 网络 HLAPI 而无需支付 Unity Multiplayer 服务费用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到了 Unity 的多人服务页面​​,我完全糊涂了:

I saw Unity's Multiplayer service page, and I'm completely confused:

我可以在一个应用程序中使用 Unity 的高级网络 API (NetworkManager/NetworkManagerHUD)无需为 Unity Matchmaker 和中继服务器(无论是什么)付费即可发布游戏?

Can I use Unity's high-level networking API (NetworkManager / NetworkManagerHUD) in a published game without paying for Unity Matchmaker and the Relay servers (whatever those are)?

我有自己的基于云的 VM,我想在其上运行专用服务器.我的项目只是一个我会和朋友一起玩的小游戏(非商业或大型游戏).我想在我的 VM 上以专用服务器模式运行该游戏的已发布副本,并让我的朋友运行他们已发布的客户端副本并通过 NetworkManager 连接到服务器.

I have my own cloud-based VM that I want to run a dedicated server on. My project is just a small game I would play with my friends (nothing commercial or large-scale). I want to run a published copy of that game in dedicated server mode on my VM, and have my friends run their published client copy and connect to the server via the NetworkManager.

我可以免费做吗?我不介意我的朋友是否必须使用 NetworkManagerHUD 在他们的游戏副本中手动输入服务器的 IP 和端口.他们这样做会算作CCU"吗(Unity Personal 限制为 20)?这会使用 Unity Matchmaker 带宽(0.49 美元/GB,甚至不适用于 Unity Personal)?

Can I do that for free? I don't mind if my friends have to manually enter the server's IP and port in their game copy using the NetworkManagerHUD. Would them doing so count as a "CCU" (limit of 20 for Unity Personal)? Would that use Unity Matchmaker bandwidth ($0.49 / GB, not even available for Unity Personal)?

任何澄清将不胜感激!:)

Any clarification would be appreciated! :)

推荐答案

无需付费即可使用 Unity HLAPI.只是不要使用 Unity 匹配 API,然后您就不需要支付任何费用.

You can use Unity HLAPI without paying. Just don't use the Unity match making API, then you won't need to pay for anything.

您可以让另一个播放器直接连接到不在同一本地网络上的另一个播放器,但您需要在每台计算机上执行端口转发.玩家可以通过他们的路由器设置执行端口转发,但你不希望你的玩家通过这个.您可以从 C# 脚本进行端口转发,但如果您对网络一无所知,这会很复杂.有许多 C# 库可以做到这一点,因此您必须重新发明轮子.

You can get another player to directly connect to another player that is not on the same local network but you need to perform port forwarding on each computer. Players can perform port forwarding through their router settings but you don't want your player to go through this. You can do port-forwarding from C# script but it is complicated if you don't know anything about networking.There are many C# libraries that can do this so that you have to re-invent a wheel.

一旦端口转发正常工作,您就可以使用 Unity 标准 API 直接连接到另一个网络中的另一个播放器.

Once you get port forwarding working, you can then use the Unity standard API to directly connect to another player in another network.

如果您想更进一步,您可以编写一个脚本,将播放器的 IP 地址和端口号发送到您的服务器,以便播放器可以自动相互连接,而无需手动输入 IP 地址和每台计算机的端口号.

If you want to take this further, you can have a script that sends the IP Address and the port number of the players to your server so that players can connect to each other automatically without having to manually type in the IP Address and the Port number of each computer.

编辑:

Unity 匹配 API = UnityEngine.Networking.Match 中的所有类,例如 NetworkMatch

Unity match making API = All classes inside UnityEngine.Networking.Match, such as NetworkMatch

Unity 标准 API = NetworkServerNetworkClient

你不应该使用NetworkManager,因为它的大部分功能都依赖于Unity match Making API.

You should NOT use NetworkManager because most of its function depends on Unity match making API.

要创建一个没有 Unity 匹配 API 的网络游戏,您只需要 NetworkServerNetworkClient 类.

To create a network game that is free from Unity match making API, you just need the NetworkServer and the NetworkClient class.

创建服务器:

NetworkServer.Listen

它有重载方法如

public static bool Listen(string ipAddress, int serverPort);
public static bool Listen(int serverPort);

创建客户端(连接到服务器):

NetworkClient.Connect
public void Connect(string serverIp, int serverPort);

如果您不想使用 Unity 匹配 API,您将失去创建和加入游戏等功能.您可以使用我上面提到的NetworkServerNetworkClient 来创建一个完整的网络游戏.只需创建一个服务器,连接到它并开始发送和接收信息.这是值得的,因为当 Unity 的服务器出现故障或开始变慢时,您的游戏仍然可以与其他游戏不同地运行.

You will lose functions such as creating and joining games if you don't want to use Unity match making API. You can use the NetworkServer and the NetworkClient I mentioned above to create a complete network game. Just create a server, connect to it and start sending and receiving information. It is worth it because when Unity's server goes down or begins to get slow your game would still be working unlike others.

注意:Unity 正在开发可让您托管自己的游戏的应用程序.这还没有出来,但是当他们发布它时,您将能够通过在您的服务器上运行该应用程序,在没有 Unity 服务器的情况下托管您自己的游戏.现在,他们希望您付费使用他们的一些网络代码,但真正的编码人员不必这样做.

NOTE: Unity is working on Application that lets you host your own game. This is NOT out yet but when they release it, you will be able to host your own game without Unity's Server by running that Application on your server. Right now, they want you to pay to use their some of their network codes but real coders won't have to do this.

这篇关于我可以使用 Unity 网络 HLAPI 而无需支付 Unity Multiplayer 服务费用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-19 06:50