《忍者龙剑传 黑之章》(含飓风版中文汉化 vb-zh-x2.1)与《忍者龙剑传》(2004)的非官方 Windows 原生移植。2.2.35。
2.2.35:120 Hz 屏幕画面更均匀,修好偶发几秒的“顿”,低延迟呈现重做(仍默认关闭)
先看这里:这次更新对你有什么影响
| 你的情况 | 更新后 |
|---|---|
| 60 Hz 屏幕,默认设置 | 画面和按键延迟与 2.2.34 相同。偶发的“连续几秒重复一帧、跳一帧”修好了(显卡很忙时更常见,旧版本也有)。 |
| 120 Hz(或 180、240 Hz)屏幕,窗口 / 无边框全屏 | 明显更顺:以前约 45% 的帧显示时长不对(一帧 1 次刷新、一帧 3 次刷新交替出现),现在约 1% 以内。 |
| 144、165 Hz 屏幕,窗口 / 无边框全屏 | 没有变化(60 帧在这些刷新率上本来就无法均匀显示,见“注意事项”)。 |
| 独占全屏 + 垂直同步 | 和 2.2.34 一样默认切到 60 Hz。屏幕开着可变刷新(G-SYNC / FreeSync)时,不再被拖慢(以前 120 Hz 下游戏只有每秒 51–52 帧)。 |
| 打开了“低延迟呈现” | 重做了:集成显卡上不再明显不顺;独显直接连着屏幕时推荐开启。详见下文。 |
低延迟呈现关闭时(默认),按键延迟和画面送出方式都与 2.2.34 完全相同;本版只改了游戏节拍怎样对齐屏幕,影响的是画面是否均匀。
玩家会注意到的变化
- 120 Hz 屏幕的窗口模式画面更均匀。 游戏每秒 60 帧,120 Hz 时每帧应该正好显示 2 次刷新。以前在 59–61 Hz 以外的屏幕上,游戏的节拍用 59.94 Hz 的计时器,和屏幕对不齐,约 45% 的帧显示了 1 次或 3 次刷新,画面一顿一顿。现在节拍跟着屏幕每 2 次刷新走一拍(180 Hz 每 3 次、240 Hz 每 4 次)。
- 偶发的“连续 5–10 秒重复一帧、跳一帧”修好了。 原因:偶尔有一拍醒得晚,下一次屏幕刷新就显得“太早”,程序把它当成没有同步、改用计时器;计时器又把下一拍对在刷新之前,于是连着几秒都对不上,直到两边的频率差把它错开。旧版本也有,显卡很忙时(高渲染倍数)更常见。现在刷新来得太早时就再等下一次刷新。
- 可变刷新屏幕上,独占全屏不再变慢。 屏幕开着 G-SYNC / FreeSync 时,独占全屏下屏幕的刷新跟着游戏的画面走,不再是固定的时钟,游戏的节拍跟着它就越走越慢。现在程序检查节拍间隔是不是整数个刷新周期,600 拍里有 60 拍以上不是,就改用 59.94 Hz 计时器(实测 11–13 秒内识别),游戏速度恢复正常。只在独占全屏下判断;显示模式或全屏状态变了会重新判断。
- 低延迟呈现重做(仍默认关闭)。 见下一节。
低延迟呈现:现在怎么工作、效果如何、该不该开
它做什么:游戏按主机的节拍每秒 60 帧,每帧开头读手柄,算好、画好,再等下一个节拍才送去显示。开启后,画得快的帧画完立刻送出,从读手柄到画面送出约 16 ms → 1–5 ms;来不及的帧照旧等节拍。游戏本身的节奏完全不变。
2.2.33 的问题:画完就送,较重的帧赶不上桌面合成的截止时刻,屏幕上就“一帧多显示一次、紧接着一帧没显示”,有玩家在 60 Hz 显示器、集成显卡上感觉不顺,所以 2.2.34 改回默认关闭。当时没有量屏幕上实际显示的帧,这次补上了:用桌面抓屏读出每一帧画在角落里的帧号,逐帧核对。
本版的做法:
- 窗口模式改用翻页呈现(FLIPEX),程序从系统读取每一帧实际在哪次刷新显示出来,自己学出“节拍后多少毫秒内送出还来得及”(从 10 ms 起,最多 14 ms),有帧没赶上就收紧。
- 拿不到这些统计的电脑(例如笔记本混合输出时用独显)和独占全屏,用固定的“节拍后 10 ms 内”。
- 送出得很早却仍然没赶上的帧(问题在显卡或桌面合成,不在送出时刻),不会让截止时间一下降到底;截止时间降低后,一分钟没出错会慢慢回升。修好之前,集成显卡上 3 局有 2 局截止时间掉到 4 ms 后再也回不来,低延迟等于失效。
- 在“提前”和“等节拍”之间来回切换的保护:每切换一次屏幕上必然多一次重复。刚切回提前、很快又退回的,下次切回前要连续更多帧来得及(120 帧起翻倍,最多约 2 分钟)。4 倍渲染的集成显卡上,修好之前每 10 秒切换 2–5 次。
实测(60 Hz 窗口,每局 150 秒,屏幕抓取逐帧数“重复一帧 + 跳一帧”的次数):
| 显卡 | 关闭 | 2.2.33 的做法 | 本版开启 | 提前送出的帧 |
|---|---|---|---|---|
| RTX 3060 直接连着屏幕(显卡直连) | 0–7(4 局) | — | 0(3 局) | 约 40–84% |
| RTX 3060,笔记本混合输出 | 0(1 局) | 64 | 0、7 | 约 40% |
| Iris Xe 集成显卡 | 约 4(3 局) | 约 136 | 约 6(3 局) | 约 21% |
| Iris Xe,4 倍渲染 | 约 35–42 | — | 约 45 | 几乎没有 |
游戏速度和迟到帧在所有情况下都相同(93.7%,开头加载的部分)。
该不该开:
- 独显直接连着屏幕(台式机,或笔记本切到“显卡直连 / 独显模式”):推荐开启,延迟明显更低,画面一样顺。
- 集成显卡:收益小(约两成帧提前),每分钟大约多一次重复,按自己的感受决定。
- 120 Hz 屏幕:一帧只有约 5 ms 可以提前,实测几乎没有帧来得及,开了基本等于关闭;144、165 Hz 的窗口模式不起作用。
注意事项(与之前的不同)
- 低延迟呈现仍默认关闭,设置名仍是
black.ini的low_latency_present;之前自己打开过的玩家,本版会继续开着,用的是新做法。 - 开启低延迟后窗口模式改用翻页呈现:拖动改变窗口大小时,画面先被拉伸显示,停下约 20 帧(三分之一秒)后按新大小重建。
- 低延迟只在一台笔记本(Iris Xe + RTX 3060)上测过。AMD 显卡、Steam Deck / Proton 没测过;如果开启后黑屏、画面不动或更不顺,请关掉,并把
logs\black.log发给作者。 - 144、165 Hz 屏幕的窗口模式:60 帧在这些刷新率上只能按 3、3、2… 次刷新交替显示,程序无法改变。想要均匀:用独占全屏 + 垂直同步(默认自动切到 60 Hz),或把桌面刷新率设成 120 Hz 或 60 Hz(Windows“高级显示设置”里可以选“列出所有模式”)。
- 120 Hz 窗口下显卡很忙时(例如 8 倍渲染),偶尔有一帧晚一次刷新(约 8 ms)显示:8 倍渲染约 320 帧 / 150 秒(以前约 3,500)。要消除它只能让每帧都晚 8 ms 送出,相当于游戏每帧可用的时间减半,所以不做。
- 120 Hz 下桌面合成更敏感:浏览器播放视频等占用显卡的程序在后台运行时,画面不均匀会变多(同一时段新旧版本都从约 100 变成约 800 帧 / 150 秒)。玩的时候最好关掉或最小化这些窗口。
- 判断为可变刷新后,节拍用计时器:屏幕若其实是固定刷新,每约 16 秒会有一帧重复(59.94 与 60 Hz 之差),与 2.2.34 以前在非 60 Hz 屏幕上一样。本机的屏幕支持 FreeSync,在 165 Hz 桌面下进独占全屏(切到 60 Hz)时也判断为可变刷新。
日志里新增的内容(反馈问题时有用)
- 开头一行写出屏幕刷新率和节拍来源:
[d3d] vblank: the display at 120 Hz: follows every n-th composition (DwmFlush)。 - 每分钟一行:来自屏幕的节拍数和“刷新太早、再等一次”的次数(
refreshes too soon waited past)。 - 判断为可变刷新:
... not whole refreshes apart (a variable refresh?): the 59.94 Hz timer instead。 - 开启低延迟时:
host: Direct3D 9 renders on '...'、host: the window presents by flip;加--hitch-detail时每 10 秒写出[flip]和[lat] present_early gate两行(提前了多少帧、截止时间、切换次数)。
测试
- 发布包:Windows Defender 扫描三个程序,无威胁。
- 核显后台跑黑之章 150 秒:版本号 2.2.35,绘制状态 8,493 全部回放、0 条失败,没有一帧超过 50 ms,没有在种子以外现编着色器,
low_latency_present 0, exclusive_60hz 1;2004 更新补丁版同样全部回放、没有一帧超过 50 ms。 - 发布包本身在核显、60 Hz 窗口前台跑,屏幕抓取逐帧核对:低延迟开 6 次(约 28% 的帧提前)、关 7 次,游戏速度 93.7%。
- 共约 100 局 150 秒的屏幕抓取:60 / 120 / 165 Hz,显卡直连与混合输出,RTX 3060 与 Iris Xe,1 / 4 / 8 倍渲染,窗口与独占全屏;拖动改窗口大小、无边框全屏、Alt+Enter 进出独占全屏后画面完整、持续刷新。
- 165 Hz 窗口:每帧显示 2 / 3 / 4 / 5 / 6 次刷新的帧数,新旧版本相同(2286 / 5371 / 114 / 297 / 308 对 2292 / 5360 / 109 / 297 / 309)。
源码
本版提交:e76b5b0(低延迟呈现只让赶得上桌面合成截止时刻的帧提前)、407583b(翻页呈现与从屏幕学出的截止时间)、44cf9b3(n × 60 Hz 屏幕的节拍、刷新太早再等一次、可变刷新判断)、78cffc5(截止时间的保护与切换保护)、c03e9c8、1b78911(版本号、启动器说明)、36c4f78(源码 README 新增 “2.2.35” 一节)。
致谢
低延迟呈现的思路来自 ngbrecomp 0.9.70 的低延迟呈现;本版的屏幕抓取核对、翻页呈现统计、学出截止时间和节拍对齐是本项目自己的实现。
发布包
ngb-hurricane-pc-2.2.35-win32.zip- 大小:3,406,126 字节
- SHA-256:
ddabf75d11f5ddfc9cb6ad4d8ea84e78200a39102c0858fadbf2ec3303f693e9 - 符号包
ngb-hurricane-pc-2.2.35-win32-symbols.zip:31,763,843 字节 - SHA-256:
988dcd4ad967be7f15dd350eae2520c82ac08450ef3aaceb41cb78264ac55dcf
作者:b站 哈雅布撒(QQ:2682557218)
English
An unofficial native Windows port of Ninja Gaiden Black (including the Hurricane Chinese translation vb-zh-x2.1) and Ninja Gaiden (2004). 2.2.35.
2.2.35: an even picture on 120 Hz screens, the occasional few seconds of stutter fixed, the low-latency present redone (still off by default)
Start here: what this update means for you
| Your setup | After the update |
|---|---|
| 60 Hz screen, default settings | Picture and input lag as in 2.2.34. The occasional "a few seconds of repeated and skipped frames" is fixed (more common with a busy GPU; older versions had it too). |
| 120 Hz (or 180, 240 Hz) screen, windowed / borderless | Clearly smoother: about 45% of the frames used to stay on screen for the wrong time (one refresh, then three, alternating); now under about 1%. |
| 144 or 165 Hz screen, windowed / borderless | No change (60 frames a second cannot be shown evenly at these rates; see "Things to know"). |
| Exclusive fullscreen with V-Sync | As in 2.2.34 it switches to 60 Hz by default. With a variable refresh (G-SYNC / FreeSync) the game no longer slows down (it ran at 51-52 frames a second at 120 Hz). |
| You turned on "Low-latency present" | Redone: no longer visibly less smooth on integrated graphics; recommended when a dedicated GPU drives the screen. See below. |
With the low-latency present off (the default), input lag and the way frames go out are exactly as in 2.2.34; this release only changes how the game's beat lines up with the screen, which affects how even the picture is.
What players will notice
- Windowed on a 120 Hz screen, the picture is even. The game makes 60 frames a second, so at 120 Hz each frame should stay exactly 2 refreshes. Outside 59-61 Hz the game's beat used to come from a 59.94 Hz timer that did not line up with the screen: about 45% of the frames stayed 1 or 3 refreshes, and the picture judders. Now the beat follows every 2nd refresh of the screen (every 3rd at 180 Hz, every 4th at 240 Hz).
- The occasional 5-10 seconds of repeated and skipped frames is fixed. Cause: now and then a beat woke late, so the next refresh looked "too soon"; the program took that as lost sync and fell back to its timer, which set the next beat just before a refresh, so the next one came too soon as well - for seconds, until the small difference in rate let go. Older versions had it too, more often with a busy GPU (high render scale). Now a refresh that comes too soon is simply waited past.
- Exclusive fullscreen no longer slows down on a variable-refresh screen. With G-SYNC / FreeSync on, the screen's refresh in exclusive fullscreen follows the game's pictures instead of a fixed clock, and a beat that follows it drifts slower and slower. Now the program checks that beats are a whole number of refreshes apart; when 60 of 600 are not, it switches to the 59.94 Hz timer (found within 11-13 s in the tests) and the game runs at full speed. This is judged in exclusive fullscreen only, and afresh when the display mode or the fullscreen state changes.
- The low-latency present is redone (still off by default). See the next section.
Low-latency present: how it works now, what it does, should you turn it on
What it does: the game runs on the console's beat, 60 frames a second: each frame reads the pad at its start, is worked out and drawn, then waits for the next beat before it goes to the screen. On, a frame drawn quickly goes out at once: from the pad read to the picture going out about 16 ms -> 1-5 ms; a frame that is not in time waits for the beat as before. The game's own timing is unchanged.
The 2.2.33 problem: every frame went out as soon as drawn; heavier ones missed the desktop compositor's deadline and the screen showed a picture twice and then skipped one. A player on a 60 Hz screen with integrated graphics felt it as less smooth, so 2.2.34 turned it off by default. What reached the screen had not been measured then; it is now: a desktop capture reads the frame number each frame draws in a corner, frame by frame.
How it works now:
- Windowed, frames go out by flip (FLIPEX) and the program reads from the system which refresh showed each frame, learning by itself how many milliseconds after the beat a frame may still go out (from 10 ms, at most 14 ms), and tightening when one is late.
- Where these statistics are not available (for example a laptop's dedicated GPU under hybrid graphics) and in exclusive fullscreen, a fixed "within 10 ms of the beat" is used.
- A frame that went out early and was still late (the GPU's or the compositor's doing, not its timing) no longer drops the deadline to the bottom, and a lowered deadline climbs back after a minute without misses. Before this fix, on integrated graphics 2 runs of 3 lost the deadline to 4 ms for good, which turned the feature off in effect.
- Against switching back and forth between "early" and "on the beat" - each switch necessarily shows one frame twice: a return that soon falls back makes the next return wait for more frames in time (from 120, doubling, up to about 2 minutes). On integrated graphics at 4x render scale it had switched 2-5 times every 10 seconds.
Measured (60 Hz, windowed, 150 s a run, "shown twice + skipped" counted frame by frame from a screen capture):
| GPU | Off | as in 2.2.33 | This release, on | Frames early |
|---|---|---|---|---|
| RTX 3060 driving the screen (MUX / dGPU mode) | 0-7 (4 runs) | - | 0 (3 runs) | about 40-84% |
| RTX 3060, laptop hybrid graphics | 0 (1 run) | 64 | 0, 7 | about 40% |
| Iris Xe integrated | about 4 (3 runs) | about 136 | about 6 (3 runs) | about 21% |
| Iris Xe, 4x render scale | about 35-42 | - | about 45 | hardly any |
Game speed and late frames were the same in every case (93.7%, the loading at the start).
Should you turn it on:
- A dedicated GPU driving the screen (a desktop PC, or a laptop switched to "MUX / dGPU only"): recommended, clearly lower lag and just as smooth.
- Integrated graphics: a small gain (about a fifth of the frames early) and about one extra repeat a minute; go by how it feels.
- A 120 Hz screen: a frame has only about 5 ms to go early and hardly any made it in the tests, so it is about the same as off; windowed at 144 or 165 Hz it does nothing.
Things to know (what is different)
- The low-latency present is still off by default, still under
low_latency_presentinblack.ini; players who turned it on keep it on, now with the new method. - On, windowed frames go out by flip: while you drag the window to a new size the picture is stretched, and about 20 frames (a third of a second) after you stop it is rebuilt at the new size.
- The low-latency present was tested on one laptop only (Iris Xe + RTX 3060). AMD GPUs and Steam Deck / Proton are untested; if it shows a black screen, a still picture or less smoothness, turn it off and send
logs\black.logto the author. - Windowed on a 144 or 165 Hz screen, 60 frames a second can only alternate 3, 3, 2... refreshes; the program cannot change that. For an even picture use exclusive fullscreen with V-Sync (switches to 60 Hz by default) or set the desktop to 120 or 60 Hz (Windows "Advanced display" can "List all modes").
- Windowed at 120 Hz with a busy GPU (8x render scale, say), now and then a frame shows one refresh (about 8 ms) late: about 320 frames in 150 s at 8x (about 3,500 before). Removing that would mean sending every frame 8 ms later, halving the game's time for each frame, so it is not done.
- At 120 Hz the desktop compositor is more sensitive: GPU-using programs in the background (a browser playing video) make the picture less even (in the same hour old and new versions both went from about 100 to about 800 frames in 150 s). Close or minimise them while playing.
- After a variable refresh is detected the beat uses the timer: if the screen is in fact at a fixed refresh, one frame repeats about every 16 s (59.94 against 60 Hz), as it did before 2.2.34 on screens other than 60 Hz. This laptop's screen supports FreeSync; entering exclusive fullscreen from a 165 Hz desktop (switched to 60 Hz) was also judged a variable refresh.
New in the log (useful when reporting)
- The first lines give the refresh rate and where the beat comes from:
[d3d] vblank: the display at 120 Hz: follows every n-th composition (DwmFlush). - A line a minute: beats from the screen and how often a refresh came too soon and was waited past (
refreshes too soon waited past). - A variable refresh detected:
... not whole refreshes apart (a variable refresh?): the 59.94 Hz timer instead. - With the low-latency present on:
host: Direct3D 9 renders on '...',host: the window presents by flip; with--hitch-detail,[flip]and[lat] present_early gatelines every 10 s (frames early, the deadline, switches).
Tests
- The package: Windows Defender scan of the three programs, no threats.
- Iris Xe in the background, Black for 150 s: version 2.2.35, all 8,493 draw states replayed, none left out, no frame over 50 ms, no shader compiled beyond the seed,
low_latency_present 0, exclusive_60hz 1; the NG2004 title update likewise all replayed, no frame over 50 ms. - The package itself on the Iris Xe, 60 Hz windowed in the foreground, checked frame by frame from a screen capture: low-latency present on 6 (about 28% of the frames early), off 7; game speed 93.7%.
- About 100 screen-captured runs of 150 s: 60 / 120 / 165 Hz, MUX and hybrid graphics, RTX 3060 and Iris Xe, 1x / 4x / 8x render scale, windowed and exclusive; after dragging the window to a new size, borderless fullscreen, and Alt+Enter in and out of exclusive fullscreen the picture was whole and kept updating.
- Windowed at 165 Hz: frames staying 2 / 3 / 4 / 5 / 6 refreshes, new against old: 2286 / 5371 / 114 / 297 / 308 vs 2292 / 5360 / 109 / 297 / 309.
Source
This release's commits: e76b5b0 (low-latency present only for frames that make the compositor's deadline), 407583b (flip presentation and the deadline learned from the screen), 44cf9b3 (the beat on n x 60 Hz screens, a refresh too soon waited past, the variable-refresh check), 78cffc5 (deadline and switching safeguards), c03e9c8, 1b78911 (version, launcher help), 36c4f78 (a new "2.2.35" section in the source README).
Thanks
The idea of the low-latency present comes from ngbrecomp 0.9.70's low-latency present; this release's screen-capture checks, flip statistics, learned deadline and beat alignment are this project's own.
Package
ngb-hurricane-pc-2.2.35-win32.zip- Size: 3,406,126 bytes
- SHA-256:
ddabf75d11f5ddfc9cb6ad4d8ea84e78200a39102c0858fadbf2ec3303f693e9 - Symbols
ngb-hurricane-pc-2.2.35-win32-symbols.zip: 31,763,843 bytes - SHA-256:
988dcd4ad967be7f15dd350eae2520c82ac08450ef3aaceb41cb78264ac55dcf
Author: 哈雅布撒 on Bilibili (QQ: 2682557218)