Merged
Conversation
Contributor
|
Preview URLs Flaws (12)URL:
External URLs (2)URL:
(comment last updated: 2024-11-24 15:23:17) |
Co-authored-by: A1lo <yin199909@aliyun.com>
Contributor
Author
|
Member
|
类似 35f4c34 的不止一处,请继续更正。 |
yin1999
approved these changes
Nov 24, 2024
Member
yin1999
left a comment
There was a problem hiding this comment.
感谢贡献,但请始终注意贡献的质量,也不要迷信以前翻译的正确性(MDN 中文翻译的很多内容都来自曾经那个没有内容审核的 Wiki 时代)。这次我照旧对你的 PR 所涉及的文档进行全文的检查和更正。下次我可能就不会花那么多时间了(请重视贡献的过程)。
files/zh-cn/games/anatomy/index.md
Outdated
| 4. 睡眠(除非事件打断了浏览器的小睡),直到显示器准备好你的图像([VSync](https://www.techopedia.com/definition/92/vertical-sync-vsync))并重复。 | ||
|
|
||
| 你可以考虑开发实时应用程序,因为有时间做工作。所有上述步骤都必须在每 16 毫秒内进行一次,以保持 60 赫兹的显示效果。浏览器会尽可能早地调用你的代码,从而给它最大的计算时间。你的主线程通常会启动一些甚至不在主线程上的工作负载(如 WebGL 的中的光栅化或着色器)。在浏览器使用其主线程管理垃圾收集,其他任务或处理异步事件时,可以在 Web Worker 或 GPU 上执行长时间的计算。 | ||
| 你可以考虑开发实时应用程序,因为有时间做工作。所有上述步骤都必须在每 16 毫秒内进行一次,以保持 60Hz 的显示效果。浏览器会尽可能早地调用你的代码,从而给它最大的计算时间。你的主线程通常会启动一些甚至不在主线程上的工作负载(如 WebGL 的中的光栅化或着色器)。在浏览器使用其主线程管理垃圾收集,其他任务或处理异步事件时,可以在 Web Worker 或 GPU 上执行长时间的计算。 |
files/zh-cn/games/anatomy/index.md
Outdated
| 你可以考虑开发实时应用程序,因为有时间做工作。所有上述步骤都必须在每 16 毫秒内进行一次,以保持 60Hz 的显示效果。浏览器会尽可能早地调用你的代码,从而给它最大的计算时间。你的主线程通常会启动一些甚至不在主线程上的工作负载(如 WebGL 的中的光栅化或着色器)。在浏览器使用其主线程管理垃圾收集,其他任务或处理异步事件时,可以在 Web Worker 或 GPU 上执行长时间的计算。 | ||
|
|
||
| 当我们讨论预算时,许多网络浏览器都有一个称为高分辨率时间的工具。{{jsxref("Date")}} 对象不再是计时事件的识别方法,因为它非常不精确,可以由系统时钟进行修改。另一方面,高分辨率的时间计算自 `navigationStart`(当上一个文档被卸载时)的毫秒数。这个值以小数的精度返回,精确到千分之一毫秒。它被称为{{ domxref("DOMHighResTimeStamp") }},但是,无论出于什么目的和目的,都认为它是一个浮点数。 | ||
| 当我们讨论预算时,许多 Web 浏览器都有一个称为*高分辨率时间*的工具。{{jsxref("Date")}} 对象不再是计时事件的识别方法,因为它非常不精确,可以由系统时钟进行修改。另一方面,高分辨率的时间计算自 `navigationStart`(当上一个文档被卸载时)的毫秒数。这个值以小数的精度返回,精确到千分之一毫秒。它被称为{{ domxref("DOMHighResTimeStamp") }},但是,无论出于什么目的和目的,都认为它是一个浮点数。 |
Member
There was a problem hiding this comment.
files/zh-cn/games/anatomy/index.md
Outdated
|
|
||
| > [!NOTE] | ||
| > 系统(硬件或软件)不能达到微秒精度,可以提供毫秒精度的最小值然而,如果他们能够做到这一点,他们就应该提供 0.001 毫秒的准确性。 | ||
| > 系统(硬件或软件)不能达到微秒精度,可以提供毫秒精度作为一个最小的要求。不过,如果他们能够达到微妙的精度,那就应该提供这一精度。 |
files/zh-cn/games/anatomy/index.md
Outdated
| const tNow = window.performance.now(); | ||
| ``` | ||
|
|
||
| 回到主循环的主题。你将经常想知道何时调用主函数。因为这是常见的,`window.requestAnimationFrame()` 总是提供一个 `DOMHighResTimeStamp` 执行时回调函数作为参数。这将导致我们之前的主循环的另一个增强。 |
files/zh-cn/games/anatomy/index.md
Outdated
|
|
||
| - 用户可以跳过渲染帧或根据其性能内插额外的帧。 | ||
| - 你可以指望所有用户以相同的恒定频率更改打嗝的更新非美容变量。 | ||
| - 你可以指望所有用户以相同的固定频率更新非图形变量,而不会卡顿。 |
files/zh-cn/games/anatomy/index.md
Outdated
| - 强制性内插具有性能损失。 | ||
|
|
||
| 单独的更新和绘图方法可能如下面的示例。为了演示,该示例基于第三个项目符号,只是不使用 Web Workers 进行可读性(而且我们诚实地说可写性)。 | ||
| 单独的更新和绘图方法可能类似于下面的示例。为了演示,该示例基于第三个项目符号,只是不使用 Web Worker 进行可读性(而且我们诚实地说可写性)。 |
files/zh-cn/games/anatomy/index.md
Outdated
| @@ -267,13 +269,13 @@ var tNow = window.performance.now(); | |||
| ;(function(){ | |||
files/zh-cn/games/anatomy/index.md
Outdated
| ## 概要 | ||
| ## 总结 | ||
|
|
||
| 我知道上述的任何一种,或许没有适合你的游戏。正确的决定完全取决于你愿意(和不愿意)做出的权衡。主要关心的是切换到另一个选项。幸运的是,我没有任何经验,但我听说这是一个令人难以置信的游戏的 Whack-a-Mole。 |
Member
There was a problem hiding this comment.
“excruciating game”,不是“exciting game”
Contributor
Author
好的,辛苦了!以后会更认真全文给认真过几次! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
minor improvements on missing styles and grammars