从概念上讲,游戏中的重播如何工作? [英] Conceptually, how does replay work in a game?

查看:92
本文介绍了从概念上讲,游戏中的重播如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于如何在游戏中实现重播,我很好奇。



最初,我以为只会在游戏中采取的每个玩家/ ai动作的命令列表,然后重播游戏并让引擎像往常一样渲染。然而,我看过FPS / RTS游戏中的重播,仔细检查后,即使像粒子和图形/听觉上的毛刺一样(一致的那些毛刺通常)。

那么这是怎么回事。在固定的摄像机角度游戏中,虽然它可能会将整个场景的每一帧写入一个被存储的流,然后只是重新播放流,但这似乎不足以让你暂停和移动相机周围。您必须在所有时间点存储场景中的所有位置(否?)。所以对于像粒子这样的东西来说,这是一个很大的数据推动,这似乎是玩游戏表现的一个重要的一面。

解决方案

我认为你的初步想法是正确的。要创建重播,您将存储从用户接收的所有输入(以及接收到的帧号)以及任意随机数生成器的初始种子。要重播游戏,您可以使用保存的种子重置您的PRNG,并为游戏引擎提供相同的输入序列(与帧号同步)。由于许多游戏会根据帧间通过的时间量来更新游戏状态,所以您可能还需要存储每个帧的长度。


I was kind of curious as to how replay might be implemented in a game.

Initially, I thought that there would be just a command list of every player/ai action that was taken in the game, and it then 're-plays' the game and lets the engine render as usual. However, I have looked at replays in FPS/RTS games, and upon careful inspection even things like the particles and graphical/audible glitches are consistent (and those glitches are generally inconsistent).

So How does this happen. In fixed camera angle games I though it might just write every frame of the whole scene to a stream that gets stored and then just replays the stream back, but that doesn't seem like enough for games that allow you to pause and move the camera around. You'd have to store the locations of everything in the scene at all points in time (No?). So for things like particles, that's a lot of data to push which seems like a significant draw on the game's performance whilst playing.

解决方案

I think your initial thought was correct. To create a replay, you store all input received from the user (along with the frame number at which it was received) along with the initial seeds of any random number generators. To replay the game, you reset your PRNGs using the saved seeds and feed the game engine the same sequence of input (synchronized to the frame numbers). Since many games will update the game state based on the amount of time that passes between frames, you may also need to store the length of each frame.

这篇关于从概念上讲,游戏中的重播如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆