独立于帧速率的基于时间的仿真
您如何解释在这个时间非常重要的事件?大多数游戏都使用帧,并且模拟按时间步长进行。如果发生的事件需要特定时间发生怎么办?
例如,在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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道你的游戏架构是如何设计的,但是如果你能够获取事件的时间戳,你可以轻松地将它们放入另一个
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.