栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 游戏开发 > 其他

记一次Unity最新多人联网同步框架Mirror

其他 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

记一次Unity最新多人联网同步框架Mirror

偶尔发现一个宝藏插件Mirror

 

由于最近在做一些多人同步的Demo

由于习惯性思维,先百度

能搜索到的,无非是什么unet 或者photon,

先不管要不要收费,或者收费如何

首先这些网上的一般项目,配置就是一个大问题

-Photon其实是好用的(不要问哥怎么知道的)只要你公司钱给够

配置难其实也就是收费的原罪,一是要验证,二是源码不公开

本来我也想用用Unet等

自己试了一遍后发现,service 没有, package manager没用,安装了 xxxx mlai也是安装了寂寞

所以:

直接安装 Mirror,还免费的
 

可能会碰到2个问题吧

1.是 Horizantal 按键没设置

只需要在Editor -> PlayerSettings , Input Manager设置上即可

2.BuildSettings缺subScene

(本身要放弃Mirror了,觉得和其他框架一样)哥也是在全局搜索tank才发现这个场景( .unity);

其实只要在File -》 BuildSettings设置上即可

以上都是基本设置了,有些Unity经验就都能搞定

搞定后居然发现,他喵的,Mirror居然是开源的

居然是开源的

居然是开源的!

也估计从旧版本Tank二次开发而来,但这不重要了

重点是:居然是开源的!

(需要研究代码)

不是一般的项目,或联网例子,这是多人平滑移动必须,懂得就懂了

(代码如下,是研究多人移动的宝藏项目啊)

  void UpdateClient()
        {
            // client authority, and local player (= allowed to move myself)?
            if (IsClientWithAuthority)
            {
                // send to server each 'sendInterval'
                // NetworkTime.localTime for double precision until Unity has it too
                //
                // IMPORTANT:
                // snapshot interpolation requires constant sending.
                // DO NOT only send if position changed. for example:
                // ---
                // * client sends first position at t=0
                // * ... 10s later ...
                // * client moves again, sends second position at t=10
                // ---
                // * server gets first position at t=0
                // * server gets second position at t=10
                // * server moves from first to second within a time of 10s
                //   => would be a super slow move, instead of a wait & move.

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/906602.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号