当前位置: 首页 > news >正文

Blaster - Multiplayer P117-PXXX: 匹配状态

P118_ Game Timer

  • 本局赛还剩多长时间.

P118_1 Formet And Set Time Text

  • ABlasterPlayerController::SetHUDMatchCountdown().

P118_2 计算剩余时间

  • 我们目前在 PlayerController 做的倒计时逻辑, 之后会把其放到 Game Mode 中 , 这也许就是问题所在.

P118_3 问题

  • 各端的时间都不是同步的.
  • GetWorld()->GetTimeSeconds() 每台机器都不一样.

P119_Syncing Client and Server Time

  • 由于本地测试联网功能各个端没什么延迟 , 所以我们在 ABlasterPlayerController::ReceivedPlayer() 初始化的同步对局时间会失效 , 在5秒后才会同步时间.
  • 整体上逻辑代码很复杂 , 其实就是通过获取 Client=>Server=>Client 的网络传输时间预估一下服务器当前时间.整体的传输时间保存在局部变量 RoundTripTime 中.
  • 通过估计的服务器当前时间 = 服务端调用 ClientRPC 的时间 + RoundTripTime / 2.0f;
  • 然后估算 服务端和客户端的延迟.作为参考的差值 Δ.
  • 当每次设置HUD时 , 预估的当前服务器事件 = 当前时间 + Δ.
  • 这个和我们手动写附加逻辑差不多 , 都是计算初始的向量插值Δ , 再每帧加上这个Δ.

P119_1 override PC::ReceivedPlayer()

  • i'd like to sync up as early as we possibly can.
  • Now Received player is the earliest we can possibly get the time from the server.
  • So that's where we can send our request On Initializtion.

P119_2 PC::Tick()

  • But I'd like to also do this periodically , just in case we get some drift the server time and the client time.
  • That way we can update our client server delta ,  so we can make a float to determin how often we can sync the server.

P119_3 PC::CheckTimeSync()

  • 固定频率执行.

P119_4 PC::ServerRequestServerTime

P120_5 PC::ClientReportServerTime

P120_6 PC::GetServerTime

P120_7 Set HUD

  • 将原本减去当前客户端时间的逻辑,变为减预估的服务器时间.

P120 Match State 

P121 On Match State Set

P122 Warmup Timer

P123 Updateing Warmup Time

P124 Custom Match States

P125 Cooldown Announcement

P126 Restart Game

P127 Blaster Game State

相关文章:

  • 怒更一波免费声音克隆和AI配音功能
  • qlora
  • MTK平台-- 如何在屏幕关闭时过滤组播和广播的数据包
  • Java开发经验——阿里巴巴编码规范实践解析7
  • 【stm32开发板】原理图设计(电源部分)附:设计PCB流程
  • sql查询中in不生效的问题
  • 【SQL Server Management Studio 连接时遇到的一个错误】
  • 额度年审领域知识讲解
  • 中间表/中转表笔记
  • ⚽【足球数据全维度解析】从基础统计到高阶分析,数据如何重塑现代足球?
  • 用 Python 模拟下雨效果
  • [智能算法]蚁群算法原理与TSP问题示例
  • 软考-系统架构设计师-第二章 嵌入式基础知识
  • 计算机总线技术深度解析:从系统架构到前沿演进
  • 软考-系统架构设计师-第七章 软件工程基础知识
  • MySQL 8.0中的mysql.ibd文件
  • 6个月Python学习计划 Day 8 - Python 函数基础
  • PCIe走线注意事项
  • [250529] CrateDB 5.10.7 发布:一系列重要修复与升级注意事项
  • 红 黑 树
  • 网站结构怎么做适合优化/西安百度公司官网
  • 网站 建设标准/百度导航下载2021最新版
  • 做网站得叫什么/百度关键词搜索量查询
  • 合肥有多少做网站的/用广州seo推广获精准访问量
  • 湘潭免费网站建设/关键词调词平台费用
  • 陕西省建设造价协会网站/快速排名优化