Prince of Persia... A very interesting feature...

Started by
5 comments, last by Vexorian 18 years, 5 months ago
Hi, maybe some of you have played prince of persia in the PS2. If not... You may have at least seen it or heard about it... Well in Prince of Persia (I dunno which subtitle). There is a feature that lets you travel back throough time (Time Slip?). Like when you die... You can use the hour glass to undo everything and have a step back through time. I could somehow figure out the technique used if this was in 2D. But in 3D! Magnificent! How do you think did they come up with that idea? And how did they do that? Could anyone please explain the logic behind? Thanks!
We should never stop learning...
Advertisement
I've never played the game and don't know how they actually implemented that feature but here's a few thoughts:

- identify what are the relevant 'events' that can happen in your game.

- at runtime, maintain a list of these events. An event would be a data structure containing things such as player input and object's state.

- (maybe) have some kind of 'keyframes' that would just be a dump of all entity positions, AI state etc. Such keyframes are a safety net in case things go out of sync (due to timing, floating point errors,..).

Which sounds just like a replay system actually. Possibly the hard part of implementing this is to have all those checks so things are synchronized properly. Also there could be a problem to store all that data in memory.

or you could just store that kind of information [say from 1 in 3 frames to save memory, and interpolate it back...] in a buffer going back a fixed amount of time

you can only rewind like 5 seconds, this would keep the buffer from having to be too large [there's only 32Mb of ram on the ps2 for textures, models, sound, everyhing [except some io buffers and the screen buffer]]
Quote:Original post by sit
or you could just store that kind of information [say from 1 in 3 frames to save memory, and interpolate it back...] in a buffer going back a fixed amount of time

you can only rewind like 5 seconds, this would keep the buffer from having to be too large [there's only 32Mb of ram on the ps2 for textures, models, sound, everyhing [except some io buffers and the screen buffer]]

It sounds like you're talking about saving a "video" of the last few seconds. If this is what you mean, then I can't foresee this working since game's aren't just graphical. There is also data such as enemy health and player health that must be restored.
That happens in the Sands of Time version.
It is a genius at play there, because most parts of the mechanism
involve not much more than a simple replay/demo mechanism.

It means dealing with safe state-machines on all the characters
and all the environment's attributes. Bassically, I think that it logs the last few seconds from the current point, saving all the meaningfull data such as x,y,z position for a certain chr, its orientation, its life points, etc.

From that point, you can freely (or should be able to, at least) go freely in time, either by "backtracking towards past" or by replaying the last seconds in a replay mode.
It's all saving game states each frames in ring buffers, probably similar to saving the level at anytime, but with extra optimisations, since it is an integral part of the game, and it has to be extra-robust. That stuff has to be designed carefully and early on (can;t be stapled to the game, it's too complex), analysing the memory requirements, and what-not (like not saving the ENTIRE level, but rather, what's close by...).

It's a cool feature, but will be restricted, here, with a limited time. There is another methiod used for replays, which is to save the state of the level at the very start, and recording 'inputs' of the game every frames, taking advantage of the predicatble behaviours and reproduceability of events, but you can't arbitrary ask for a game state at any time as easily, like you would do by saving the game state every frames. This is used generally for non-interractive replays, like to see a replay of a race, and so on.

Everything is better with Metal.

I don't see any relationship between that an the number of dimensions the game simulates.

It is all about saving states as the other replies said.

Is it a good feature? may be, I think it depends on the kind of game
------ XYE - A new edition of the classic Kye

This topic is closed to new replies.

Advertisement