我可以在不付费使用Unity Multiplayer服务的情况下使用Unity网络HLAPI吗? [英] Can I use the Unity networking HLAPI without paying for the Unity Multiplayer service?

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

问题描述

我看到Unity的多人游戏服务页面,我完全感到困惑:

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

我可以在其中使用 Unity的高级联网API (NetworkManager/NetworkManagerHUD)已发布的游戏而无需支付Unity Matchmaker和Relay服务器(无论是什么)?

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 Match Match 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.

编辑:

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

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

统一标准API = NetworkServer NetworkClient

Unity standard API = NetworkServer and NetworkClient

您不应使用NetworkManager,因为其大部分功能取决于 Unity Matching API .

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

要创建不包含Unity Match Match 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

它具有重载的方法,例如

It has overloaded methods such as

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

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

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

如果您不想使用Unity Match Match 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 Multiplayer服务的情况下使用Unity网络HLAPI吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆