独立于帧速率的基于时间的仿真

发布于 2024-12-28 06:36:45 字数 315 浏览 4 评论 0原文

您如何解释在这个时间非常重要的事件?大多数游戏都使用帧,并且模拟按时间步长进行。如果发生的事件需要特定时间发生怎么办?

例如,在DOTA这样的游戏中,攻击速度非常重要。现在,假设这个游戏的时间步长是 50 毫秒。两个英雄正在战斗。 HeroA 攻击 HeroB,并在时间步长 14 毫秒时给予“致命一击”。 HeroB 攻击 HeroA 并给予“致命一击”,但这只发生在时间步长 40 毫秒时。然而,直到 50 毫秒时间步长之前,这些打击都不会被模拟。因此,在 50 毫秒时,两个英雄都会被杀死,而实际上只有 HeroA 应该留下来,因为他成功地先攻击了。

有什么办法可以解释这个吗?

How would you account for an event during which time is very important? Most games use frames and the simulations take place in time steps. What if an event occurred that needed a specific time to take place on?

For example, in a game like DOTA, attack speed is very important. Now, let's say the time-step for this game is 50ms. Two heroes are fighting. HeroA attacks HeroB and lands a "killing blow" at 14ms into the time-step. HeroB attacks HeroA and also lands a "killing blow", only this occurs at 40ms into the time-step. However, neither one of these blows will be simulated until the 50ms time-step. Therefore, at 50ms, both heroes will be killed when really only HeroA should be left standing because he managed to attack first.

Is there some way to account for this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

固执像三岁 2025-01-04 06:36:45

我不知道你的游戏架构是如何设计的,但是如果你能够获取事件的时间戳,你可以轻松地将它们放入另一个 Thread 的缓冲区中,并在特定的时间处理它们每 50 毫秒订购一次。

I don't know how your game architecture is designed, but if you are able to get the timestamps of your events, you can easily put them into a buffer with another Thread and process them in the time specific order every 50ms.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文