Wednesday, December 25, 2024
spot_img

What components decide the body fee in sport programming?


I learn that body fee will depend on the monitor’s refresh fee, as described within the following Japanese article:
https://siv3d.github.io/ja-jp/tutorial2/movement/#181-%E7percentB5percent8CpercentE9percent81percent8EpercentE6percent99percent82percentE9percent96percent93percentE3percent82percent92percentE4percentBDpercentBFpercentE3percent81percentA3percentE3percent81percent9FpercentE3percent83percentA2percentE3percent83percentBCpercentE3percent82percentB7percentE3percent83percentA7percentE3percent83percentB3

Scene::Time() や Scene::DeltaTime() を使わなくても、フレームごとに固定の値を足していけばモーションを作れそうですが、それは大きな間違いです。

なぜなら、プログラムが実行されるパソコンのモニタのリフレッシュレートによって、メインループが毎秒何回実行されるかが異なるためです。一般的なモニタのリフレッシュレートは 60Hz で、毎秒 60 回メインループが実行されますが、近年は 120Hz や 144Hz, 240Hz など、より高頻度のリフレッシュレートを持つモニタが増えています。

Google Translate

It looks like you’ll be able to create movement by including a hard and fast worth for every body with out utilizing Scene::Time() or Scene::DeltaTime(), however that could be a large mistake.

It is because the variety of instances the principle loop is executed per second varies relying on the refresh fee of the pc monitor on which this system is executed. The refresh fee of a typical monitor is 60Hz, that means that the principle loop is executed 60 instances per second, however in recent times, screens with larger refresh charges, comparable to 120Hz, 144Hz, and 240Hz, have been rising in quantity.

Is that this conduct particular to Siv3D, or is it a common precept in sport programming?

Earlier than studying this, I assumed that body fee would depend upon CPU or GPU processing pace. Does this imply that the CPU or GPU doesn’t affect the body fee, and it solely will depend on the monitor? Or does it depend upon each?

If each are components, how does the dependency work? Is that this dealt with by the OS, or is it the accountability of the sport engine?

For instance, Unity and Pygame have a hard and fast body fee function.
However, Siv3D and Flutter Flame wouldn’t have a hard and fast body fee function. In Lua, you’ll be able to casually toggle the vsync flag, however another methods are designed in a approach that does not make you conscious of vsync’s existence.

As an apart, I’ve typically come throughout the time period vsync in sport programming however by no means absolutely understood it. If the body fee will depend on the monitor, this idea now begins to make a bit extra sense.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement -spot_img

Latest Articles