【UNET自学日志】Part19 第一次尝试匹配系统

写在开头,需要说清楚的是,这个匹配系统是指一个玩家,可以创建一个自己随意命名的房间,然后其他玩家可以通过联网去搜索房间,然后加入房间一起游戏


我先讲讲怎么使用这个匹配系统:

在运行游戏后,因为添加了Network Manager HUD组件,所以有系统自带的UI界面,如何进行匹配呢?

点击最下方的Enable Match Maker按钮,有一个可以输入的文本框,前面的laber写着"Room Name:",所以在这文本框中输入的即是房间的名称,然后点击上面的Create Internet Match 即可创建房间。

在 "Room Name:"下方有一个Find Internet Match即可寻找房间,找到自己想加入的房间,点击即可加入房间进行游戏。


接下来让我们进入正题,这种东西还是得看用户手册:

Setting up the Multiplayer service

Before you can use the Matchmaker or the internet services you need to register the project first. See the Services Window (cloud icon in upper right corner, or go to Window->Unity Services in the application menu) where the Multiplayer panel should appear. In there you’ll find a link to the cloud Multiplayer website (you can also visit https://multiplayer.unity3d.com directly). Find your project name there and set up the Multiplayer configuration.

Note about Unity 5.1.x: The project ID is set up manually in this version of Unity, you can find the field for it in the Player settings (Edit -> Project Settings -> Player). Visit https://multiplayer.unity3d.com and set up your project manually and create a Multiplayer configuration for it. When viewing the configuration you’ll be able to see the ID (it’s called UPID right now in a 12345678–1234–1234–1234–123456789ABC format).

这是unity5.3的用户手册,可以发现5.3和5.1的操作是不一样的,其他的版本会不会也不一样我就不大清楚了,还请各位观众老爷自行查查手册

在这我就简单说说5.3和5.1的设置方法,具体的详见上面的英文版。

5.3版本:第一步需要先注册你的项目,在unity的菜单栏上找到Windows->Services,在弹出的面板中可以找到多人玩家的网址(或者直接访问 https://multiplayer.unity3d.com),找到你的项目,并设置多人游戏的配置(主要就是设置下每个房间最多的玩家数量)

5.1版本:同5.3,访问 https://multiplayer.unity3d.com,找到你的项目然后设置其配置,然后在配置中你可以看到你项目的ID(一个类似于12345678–1234–1234–1234–123456789ABC这样的格式的叫做UPID的东西),复制这一ID,在Edit -> Project Settings -> Player中填入此ID即可。


至此就可以使用简单的匹配功能了,目前的问题就是延迟和丢包率,后续看看能不能有好的解决方法。

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值